mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
120 lines
443 KiB
JavaScript
120 lines
443 KiB
JavaScript
(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))r(f);new MutationObserver(f=>{for(const d of f)if(d.type==="childList")for(const y of d.addedNodes)y.tagName==="LINK"&&y.rel==="modulepreload"&&r(y)}).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 $v(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Fo={exports:{}},As={};var pp;function Kv(){if(pp)return As;pp=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function i(r,f,d){var y=null;if(d!==void 0&&(y=""+d),f.key!==void 0&&(y=""+f.key),"key"in f){d={};for(var p in f)p!=="key"&&(d[p]=f[p])}else d=f;return f=d.ref,{$$typeof:a,type:r,key:y,ref:f!==void 0?f:null,props:d}}return As.Fragment=l,As.jsx=i,As.jsxs=i,As}var gp;function Zv(){return gp||(gp=1,Fo.exports=Kv()),Fo.exports}var o=Zv(),Jo={exports:{}},me={};var yp;function Fv(){if(yp)return me;yp=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"),y=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),w=Symbol.iterator;function C(q){return q===null||typeof q!="object"?null:(q=w&&q[w]||q["@@iterator"],typeof q=="function"?q:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,A={};function E(q,z,k){this.props=q,this.context=z,this.refs=A,this.updater=k||j}E.prototype.isReactComponent={},E.prototype.setState=function(q,z){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,z,"setState")},E.prototype.forceUpdate=function(q){this.updater.enqueueForceUpdate(this,q,"forceUpdate")};function N(){}N.prototype=E.prototype;function D(q,z,k){this.props=q,this.context=z,this.refs=A,this.updater=k||j}var J=D.prototype=new N;J.constructor=D,R(J,E.prototype),J.isPureReactComponent=!0;var G=Array.isArray;function K(){}var V={H:null,A:null,T:null,S:null},ne=Object.prototype.hasOwnProperty;function I(q,z,k){var _=k.ref;return{$$typeof:a,type:q,key:z,ref:_!==void 0?_:null,props:k}}function ae(q,z){return I(q.type,z,q.props)}function Z(q){return typeof q=="object"&&q!==null&&q.$$typeof===a}function P(q){var z={"=":"=0",":":"=2"};return"$"+q.replace(/[=:]/g,function(k){return z[k]})}var ce=/\/+/g;function ue(q,z){return typeof q=="object"&&q!==null&&q.key!=null?P(""+q.key):z.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(K,K):(q.status="pending",q.then(function(z){q.status==="pending"&&(q.status="fulfilled",q.value=z)},function(z){q.status==="pending"&&(q.status="rejected",q.reason=z)})),q.status){case"fulfilled":return q.value;case"rejected":throw q.reason}}throw q}function B(q,z,k,_,X){var te=typeof q;(te==="undefined"||te==="boolean")&&(q=null);var fe=!1;if(q===null)fe=!0;else switch(te){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(q.$$typeof){case a:case l:fe=!0;break;case b:return fe=q._init,B(fe(q._payload),z,k,_,X)}}if(fe)return X=X(q),fe=_===""?"."+ue(q,0):_,G(X)?(k="",fe!=null&&(k=fe.replace(ce,"$&/")+"/"),B(X,z,k,"",function(mt){return mt})):X!=null&&(Z(X)&&(X=ae(X,k+(X.key==null||q&&q.key===X.key?"":(""+X.key).replace(ce,"$&/")+"/")+fe)),z.push(X)),1;fe=0;var Ne=_===""?".":_+":";if(G(q))for(var pe=0;pe<q.length;pe++)_=q[pe],te=Ne+ue(_,pe),fe+=B(_,z,k,te,X);else if(pe=C(q),typeof pe=="function")for(q=pe.call(q),pe=0;!(_=q.next()).done;)_=_.value,te=Ne+ue(_,pe++),fe+=B(_,z,k,te,X);else if(te==="object"){if(typeof q.then=="function")return B(se(q),z,k,_,X);throw z=String(q),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(q).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return fe}function W(q,z,k){if(q==null)return q;var _=[],X=0;return B(q,_,"","",function(te){return z.call(k,te,X++)}),_}function le(q){if(q._status===-1){var z=q._result;z=z(),z.then(function(k){(q._status===0||q._status===-1)&&(q._status=1,q._result=k)},function(k){(q._status===0||q._status===-1)&&(q._status=2,q._result=k)}),q._status===-1&&(q._status=0,q._result=z)}if(q._status===1)return q._result.default;throw q._result}var ie=typeof reportError=="function"?reportError:function(q){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var z=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(z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",q);return}console.error(q)},ee={map:W,forEach:function(q,z,k){W(q,function(){z.apply(this,arguments)},k)},count:function(q){var z=0;return W(q,function(){z++}),z},toArray:function(q){return W(q,function(z){return z})||[]},only:function(q){if(!Z(q))throw Error("React.Children.only expected to receive a single React element child.");return q}};return me.Activity=S,me.Children=ee,me.Component=E,me.Fragment=i,me.Profiler=f,me.PureComponent=D,me.StrictMode=r,me.Suspense=g,me.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,me.__COMPILER_RUNTIME={__proto__:null,c:function(q){return V.H.useMemoCache(q)}},me.cache=function(q){return function(){return q.apply(null,arguments)}},me.cacheSignal=function(){return null},me.cloneElement=function(q,z,k){if(q==null)throw Error("The argument must be a React element, but you passed "+q+".");var _=R({},q.props),X=q.key;if(z!=null)for(te in z.key!==void 0&&(X=""+z.key),z)!ne.call(z,te)||te==="key"||te==="__self"||te==="__source"||te==="ref"&&z.ref===void 0||(_[te]=z[te]);var te=arguments.length-2;if(te===1)_.children=k;else if(1<te){for(var fe=Array(te),Ne=0;Ne<te;Ne++)fe[Ne]=arguments[Ne+2];_.children=fe}return I(q.type,X,_)},me.createContext=function(q){return q={$$typeof:y,_currentValue:q,_currentValue2:q,_threadCount:0,Provider:null,Consumer:null},q.Provider=q,q.Consumer={$$typeof:d,_context:q},q},me.createElement=function(q,z,k){var _,X={},te=null;if(z!=null)for(_ in z.key!==void 0&&(te=""+z.key),z)ne.call(z,_)&&_!=="key"&&_!=="__self"&&_!=="__source"&&(X[_]=z[_]);var fe=arguments.length-2;if(fe===1)X.children=k;else if(1<fe){for(var Ne=Array(fe),pe=0;pe<fe;pe++)Ne[pe]=arguments[pe+2];X.children=Ne}if(q&&q.defaultProps)for(_ in fe=q.defaultProps,fe)X[_]===void 0&&(X[_]=fe[_]);return I(q,te,X)},me.createRef=function(){return{current:null}},me.forwardRef=function(q){return{$$typeof:p,render:q}},me.isValidElement=Z,me.lazy=function(q){return{$$typeof:b,_payload:{_status:-1,_result:q},_init:le}},me.memo=function(q,z){return{$$typeof:v,type:q,compare:z===void 0?null:z}},me.startTransition=function(q){var z=V.T,k={};V.T=k;try{var _=q(),X=V.S;X!==null&&X(k,_),typeof _=="object"&&_!==null&&typeof _.then=="function"&&_.then(K,ie)}catch(te){ie(te)}finally{z!==null&&k.types!==null&&(z.types=k.types),V.T=z}},me.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},me.use=function(q){return V.H.use(q)},me.useActionState=function(q,z,k){return V.H.useActionState(q,z,k)},me.useCallback=function(q,z){return V.H.useCallback(q,z)},me.useContext=function(q){return V.H.useContext(q)},me.useDebugValue=function(){},me.useDeferredValue=function(q,z){return V.H.useDeferredValue(q,z)},me.useEffect=function(q,z){return V.H.useEffect(q,z)},me.useEffectEvent=function(q){return V.H.useEffectEvent(q)},me.useId=function(){return V.H.useId()},me.useImperativeHandle=function(q,z,k){return V.H.useImperativeHandle(q,z,k)},me.useInsertionEffect=function(q,z){return V.H.useInsertionEffect(q,z)},me.useLayoutEffect=function(q,z){return V.H.useLayoutEffect(q,z)},me.useMemo=function(q,z){return V.H.useMemo(q,z)},me.useOptimistic=function(q,z){return V.H.useOptimistic(q,z)},me.useReducer=function(q,z,k){return V.H.useReducer(q,z,k)},me.useRef=function(q){return V.H.useRef(q)},me.useState=function(q){return V.H.useState(q)},me.useSyncExternalStore=function(q,z,k){return V.H.useSyncExternalStore(q,z,k)},me.useTransition=function(){return V.H.useTransition()},me.version="19.2.0",me}var vp;function Ou(){return vp||(vp=1,Jo.exports=Fv()),Jo.exports}var m=Ou();const Ta=$v(m);var Io={exports:{}},js={},Wo={exports:{}},Po={};var xp;function Jv(){return xp||(xp=1,(function(a){function l(B,W){var le=B.length;B.push(W);e:for(;0<le;){var ie=le-1>>>1,ee=B[ie];if(0<f(ee,W))B[ie]=W,B[le]=ee,le=ie;else break e}}function i(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var W=B[0],le=B.pop();if(le!==W){B[0]=le;e:for(var ie=0,ee=B.length,q=ee>>>1;ie<q;){var z=2*(ie+1)-1,k=B[z],_=z+1,X=B[_];if(0>f(k,le))_<ee&&0>f(X,k)?(B[ie]=X,B[_]=le,ie=_):(B[ie]=k,B[z]=le,ie=z);else if(_<ee&&0>f(X,le))B[ie]=X,B[_]=le,ie=_;else break e}}return W}function f(B,W){var le=B.sortIndex-W.sortIndex;return le!==0?le:B.id-W.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 y=Date,p=y.now();a.unstable_now=function(){return y.now()-p}}var g=[],v=[],b=1,S=null,w=3,C=!1,j=!1,R=!1,A=!1,E=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function J(B){for(var W=i(v);W!==null;){if(W.callback===null)r(v);else if(W.startTime<=B)r(v),W.sortIndex=W.expirationTime,l(g,W);else break;W=i(v)}}function G(B){if(R=!1,J(B),!j)if(i(g)!==null)j=!0,K||(K=!0,P());else{var W=i(v);W!==null&&se(G,W.startTime-B)}}var K=!1,V=-1,ne=5,I=-1;function ae(){return A?!0:!(a.unstable_now()-I<ne)}function Z(){if(A=!1,K){var B=a.unstable_now();I=B;var W=!0;try{e:{j=!1,R&&(R=!1,N(V),V=-1),C=!0;var le=w;try{t:{for(J(B),S=i(g);S!==null&&!(S.expirationTime>B&&ae());){var ie=S.callback;if(typeof ie=="function"){S.callback=null,w=S.priorityLevel;var ee=ie(S.expirationTime<=B);if(B=a.unstable_now(),typeof ee=="function"){S.callback=ee,J(B),W=!0;break t}S===i(g)&&r(g),J(B)}else r(g);S=i(g)}if(S!==null)W=!0;else{var q=i(v);q!==null&&se(G,q.startTime-B),W=!1}}break e}finally{S=null,w=le,C=!1}W=void 0}}finally{W?P():K=!1}}}var P;if(typeof D=="function")P=function(){D(Z)};else if(typeof MessageChannel<"u"){var ce=new MessageChannel,ue=ce.port2;ce.port1.onmessage=Z,P=function(){ue.postMessage(null)}}else P=function(){E(Z,0)};function se(B,W){V=E(function(){B(a.unstable_now())},W)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(B){B.callback=null},a.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ne=0<B?Math.floor(1e3/B):5},a.unstable_getCurrentPriorityLevel=function(){return w},a.unstable_next=function(B){switch(w){case 1:case 2:case 3:var W=3;break;default:W=w}var le=w;w=W;try{return B()}finally{w=le}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(B,W){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var le=w;w=B;try{return W()}finally{w=le}},a.unstable_scheduleCallback=function(B,W,le){var ie=a.unstable_now();switch(typeof le=="object"&&le!==null?(le=le.delay,le=typeof le=="number"&&0<le?ie+le:ie):le=ie,B){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=le+ee,B={id:b++,callback:W,priorityLevel:B,startTime:le,expirationTime:ee,sortIndex:-1},le>ie?(B.sortIndex=le,l(v,B),i(g)===null&&B===i(v)&&(R?(N(V),V=-1):R=!0,se(G,le-ie))):(B.sortIndex=ee,l(g,B),j||C||(j=!0,K||(K=!0,P()))),B},a.unstable_shouldYield=ae,a.unstable_wrapCallback=function(B){var W=w;return function(){var le=w;w=W;try{return B.apply(this,arguments)}finally{w=le}}}})(Po)),Po}var bp;function Iv(){return bp||(bp=1,Wo.exports=Jv()),Wo.exports}var eu={exports:{}},ht={};var Sp;function Wv(){if(Sp)return ht;Sp=1;var a=Ou();function l(g){var v="https://react.dev/errors/"+g;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)v+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+g+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(l(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},f=Symbol.for("react.portal");function d(g,v,b){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:S==null?null:""+S,children:g,containerInfo:v,implementation:b}}var y=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(g,v){if(g==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return ht.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ht.createPortal=function(g,v){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!v||v.nodeType!==1&&v.nodeType!==9&&v.nodeType!==11)throw Error(l(299));return d(g,v,null,b)},ht.flushSync=function(g){var v=y.T,b=r.p;try{if(y.T=null,r.p=2,g)return g()}finally{y.T=v,r.p=b,r.d.f()}},ht.preconnect=function(g,v){typeof g=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,r.d.C(g,v))},ht.prefetchDNS=function(g){typeof g=="string"&&r.d.D(g)},ht.preinit=function(g,v){if(typeof g=="string"&&v&&typeof v.as=="string"){var b=v.as,S=p(b,v.crossOrigin),w=typeof v.integrity=="string"?v.integrity:void 0,C=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;b==="style"?r.d.S(g,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:S,integrity:w,fetchPriority:C}):b==="script"&&r.d.X(g,{crossOrigin:S,integrity:w,fetchPriority:C,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},ht.preinitModule=function(g,v){if(typeof g=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var b=p(v.as,v.crossOrigin);r.d.M(g,{crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0})}}else v==null&&r.d.M(g)},ht.preload=function(g,v){if(typeof g=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var b=v.as,S=p(b,v.crossOrigin);r.d.L(g,b,{crossOrigin:S,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0,type:typeof v.type=="string"?v.type:void 0,fetchPriority:typeof v.fetchPriority=="string"?v.fetchPriority:void 0,referrerPolicy:typeof v.referrerPolicy=="string"?v.referrerPolicy:void 0,imageSrcSet:typeof v.imageSrcSet=="string"?v.imageSrcSet:void 0,imageSizes:typeof v.imageSizes=="string"?v.imageSizes:void 0,media:typeof v.media=="string"?v.media:void 0})}},ht.preloadModule=function(g,v){if(typeof g=="string")if(v){var b=p(v.as,v.crossOrigin);r.d.m(g,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:b,integrity:typeof v.integrity=="string"?v.integrity:void 0})}else r.d.m(g)},ht.requestFormReset=function(g){r.d.r(g)},ht.unstable_batchedUpdates=function(g,v){return g(v)},ht.useFormState=function(g,v,b){return y.H.useFormState(g,v,b)},ht.useFormStatus=function(){return y.H.useHostTransitionStatus()},ht.version="19.2.0",ht}var Ap;function Pv(){if(Ap)return eu.exports;Ap=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(),eu.exports=Wv(),eu.exports}var jp;function ex(){if(jp)return js;jp=1;var a=Iv(),l=Ou(),i=Pv();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 y(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function p(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(d(e)!==e)throw Error(r(188))}function v(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(r(188));return t!==e?null:e}for(var n=e,s=t;;){var c=n.return;if(c===null)break;var u=c.alternate;if(u===null){if(s=c.return,s!==null){n=s;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===n)return g(c),e;if(u===s)return g(c),t;u=u.sibling}throw Error(r(188))}if(n.return!==s.return)n=c,s=u;else{for(var h=!1,x=c.child;x;){if(x===n){h=!0,n=c,s=u;break}if(x===s){h=!0,s=c,n=u;break}x=x.sibling}if(!h){for(x=u.child;x;){if(x===n){h=!0,n=u,s=c;break}if(x===s){h=!0,s=u,n=c;break}x=x.sibling}if(!h)throw Error(r(189))}}if(n.alternate!==s)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var S=Object.assign,w=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),D=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),ne=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),ae=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function P(e){return e===null||typeof e!="object"?null:(e=Z&&e[Z]||e["@@iterator"],typeof e=="function"?e:null)}var ce=Symbol.for("react.client.reference");function ue(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ce?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case R:return"Fragment";case E:return"Profiler";case A:return"StrictMode";case G:return"Suspense";case K:return"SuspenseList";case I:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case j:return"Portal";case D:return e.displayName||"Context";case N:return(e._context.displayName||"Context")+".Consumer";case J:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case V:return t=e.displayName||null,t!==null?t:ue(e.type)||"Memo";case ne:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var se=Array.isArray,B=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le={pending:!1,data:null,method:null,action:null},ie=[],ee=-1;function q(e){return{current:e}}function z(e){0>ee||(e.current=ie[ee],ie[ee]=null,ee--)}function k(e,t){ee++,ie[ee]=e.current,e.current=t}var _=q(null),X=q(null),te=q(null),fe=q(null);function Ne(e,t){switch(k(te,t),k(X,e),k(_,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Lm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Lm(t),e=Um(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}z(_),k(_,e)}function pe(){z(_),z(X),z(te)}function mt(e){e.memoizedState!==null&&k(fe,e);var t=_.current,n=Um(t,e.type);t!==n&&(k(X,e),k(_,n))}function _n(e){X.current===e&&(z(_),z(X)),fe.current===e&&(z(fe),vs._currentValue=le)}var Dn,rn;function yt(e){if(Dn===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Dn=t&&t[1]||"",rn=-1<n.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+Dn+e+rn}var kt=!1;function dt(e,t){if(!e||kt)return"";kt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(Y){var H=Y}Reflect.construct(e,[],F)}else{try{F.call()}catch(Y){H=Y}e.call(F.prototype)}}else{try{throw Error()}catch(Y){H=Y}(F=e())&&typeof F.catch=="function"&&F.catch(function(){})}}catch(Y){if(Y&&H&&typeof Y.stack=="string")return[Y.stack,H.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(),h=u[0],x=u[1];if(h&&x){var T=h.split(`
|
||
`),U=x.split(`
|
||
`);for(c=s=0;s<T.length&&!T[s].includes("DetermineComponentFrameRoot");)s++;for(;c<U.length&&!U[c].includes("DetermineComponentFrameRoot");)c++;if(s===T.length||c===U.length)for(s=T.length-1,c=U.length-1;1<=s&&0<=c&&T[s]!==U[c];)c--;for(;1<=s&&0<=c;s--,c--)if(T[s]!==U[c]){if(s!==1||c!==1)do if(s--,c--,0>c||T[s]!==U[c]){var Q=`
|
||
`+T[s].replace(" at new "," at ");return e.displayName&&Q.includes("<anonymous>")&&(Q=Q.replace("<anonymous>",e.displayName)),Q}while(1<=s&&0<=c);break}}}finally{kt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?yt(n):""}function ca(e,t){switch(e.tag){case 26:case 27:case 5:return yt(e.type);case 16:return yt("Lazy");case 13:return e.child!==t&&t!==null?yt("Suspense Fallback"):yt("Suspense");case 19:return yt("SuspenseList");case 0:case 15:return dt(e.type,!1);case 11:return dt(e.type.render,!1);case 1:return dt(e.type,!0);case 31:return yt("Activity");default:return""}}function Ma(e){try{var t="",n=null;do t+=ca(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
|
||
Error generating stack: `+s.message+`
|
||
`+s.stack}}var ql=Object.prototype.hasOwnProperty,oa=a.unstable_scheduleCallback,cn=a.unstable_cancelCallback,ka=a.unstable_shouldYield,Cl=a.unstable_requestPaint,tt=a.unstable_now,Tl=a.unstable_getCurrentPriorityLevel,ua=a.unstable_ImmediatePriority,Rl=a.unstable_UserBlockingPriority,_a=a.unstable_NormalPriority,Dr=a.unstable_LowPriority,Vs=a.unstable_IdlePriority,Ys=a.log,we=a.unstable_setDisableYieldValue,$e=null,Le=null;function Ee(e){if(typeof Ys=="function"&&we(e),Le&&typeof Le.setStrictMode=="function")try{Le.setStrictMode($e,e)}catch{}}var qe=Math.clz32?Math.clz32:kg,Ue=Math.log,Or=Math.LN2;function kg(e){return e>>>=0,e===0?32:31-(Ue(e)/Or|0)|0}var Gs=256,Qs=262144,Xs=4194304;function fa(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 $s(e,t,n){var s=e.pendingLanes;if(s===0)return 0;var c=0,u=e.suspendedLanes,h=e.pingedLanes;e=e.warmLanes;var x=s&134217727;return x!==0?(s=x&~u,s!==0?c=fa(s):(h&=x,h!==0?c=fa(h):n||(n=x&~e,n!==0&&(c=fa(n))))):(x=s&~u,x!==0?c=fa(x):h!==0?c=fa(h):n||(n=s&~e,n!==0&&(c=fa(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 Ml(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function _g(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 xf(){var e=Xs;return Xs<<=1,(Xs&62914560)===0&&(Xs=4194304),e}function Br(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function kl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Dg(e,t,n,s,c,u){var h=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 x=e.entanglements,T=e.expirationTimes,U=e.hiddenUpdates;for(n=h&~n;0<n;){var Q=31-qe(n),F=1<<Q;x[Q]=0,T[Q]=-1;var H=U[Q];if(H!==null)for(U[Q]=null,Q=0;Q<H.length;Q++){var Y=H[Q];Y!==null&&(Y.lane&=-536870913)}n&=~F}s!==0&&bf(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(h&~t))}function bf(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-qe(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function Sf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-qe(n),c=1<<s;c&t|e[s]&t&&(e[s]|=t),n&=~c}}function Af(e,t){var n=t&-t;return n=(n&42)!==0?1:zr(n),(n&(e.suspendedLanes|t))!==0?0:n}function zr(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 Lr(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function jf(){var e=W.p;return e!==0?e:(e=window.event,e===void 0?32:cp(e.type))}function Nf(e,t){var n=W.p;try{return W.p=e,t()}finally{W.p=n}}var On=Math.random().toString(36).slice(2),st="__reactFiber$"+On,vt="__reactProps$"+On,Da="__reactContainer$"+On,Ur="__reactEvents$"+On,Og="__reactListeners$"+On,Bg="__reactHandles$"+On,wf="__reactResources$"+On,_l="__reactMarker$"+On;function Hr(e){delete e[st],delete e[vt],delete e[Ur],delete e[Og],delete e[Bg]}function Oa(e){var t=e[st];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Da]||n[st]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=$m(e);e!==null;){if(n=e[st])return n;e=$m(e)}return t}e=n,n=e.parentNode}return null}function Ba(e){if(e=e[st]||e[Da]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Dl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function za(e){var t=e[wf];return t||(t=e[wf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function at(e){e[_l]=!0}var Ef=new Set,qf={};function da(e,t){La(e,t),La(e+"Capture",t)}function La(e,t){for(qf[e]=t,e=0;e<t.length;e++)Ef.add(t[e])}var zg=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]*$"),Cf={},Tf={};function Lg(e){return ql.call(Tf,e)?!0:ql.call(Cf,e)?!1:zg.test(e)?Tf[e]=!0:(Cf[e]=!0,!1)}function Ks(e,t,n){if(Lg(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 Zs(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 on(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 _t(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Rf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ug(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(h){n=""+h,u.call(this,h)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return n},setValue:function(h){n=""+h},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Vr(e){if(!e._valueTracker){var t=Rf(e)?"checked":"value";e._valueTracker=Ug(e,t,""+e[t])}}function Mf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=Rf(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Fs(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 Hg=/[\n"\\]/g;function Dt(e){return e.replace(Hg,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Yr(e,t,n,s,c,u,h,x){e.name="",h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"?e.type=h:e.removeAttribute("type"),t!=null?h==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+_t(t)):e.value!==""+_t(t)&&(e.value=""+_t(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?Gr(e,h,_t(t)):n!=null?Gr(e,h,_t(n)):s!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.name=""+_t(x):e.removeAttribute("name")}function kf(e,t,n,s,c,u,h,x){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)){Vr(e);return}n=n!=null?""+_t(n):"",t=t!=null?""+_t(t):n,x||t===e.value||(e.value=t),e.defaultValue=t}s=s??c,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=x?e.checked:!!s,e.defaultChecked=!!s,h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.name=h),Vr(e)}function Gr(e,t,n){t==="number"&&Fs(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Ua(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=""+_t(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 _f(e,t,n){if(t!=null&&(t=""+_t(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+_t(n):""}function Df(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=_t(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),Vr(e)}function Ha(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Vg=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 Of(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||Vg.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Bf(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&&Of(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&Of(e,u,t[u])}function Qr(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 Yg=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"]]),Gg=/^[\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 Js(e){return Gg.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function un(){}var Xr=null;function $r(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Va=null,Ya=null;function zf(e){var t=Ba(e);if(t&&(e=t.stateNode)){var n=e[vt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Yr(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="'+Dt(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var c=s[vt]||null;if(!c)throw Error(r(90));Yr(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&&Mf(s)}break e;case"textarea":_f(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Ua(e,!!n.multiple,t,!1)}}}var Kr=!1;function Lf(e,t,n){if(Kr)return e(t,n);Kr=!0;try{var s=e(t);return s}finally{if(Kr=!1,(Va!==null||Ya!==null)&&(zi(),Va&&(t=Va,e=Ya,Ya=Va=null,zf(t),e)))for(t=0;t<e.length;t++)zf(e[t])}}function Ol(e,t){var n=e.stateNode;if(n===null)return null;var s=n[vt]||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 fn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Zr=!1;if(fn)try{var Bl={};Object.defineProperty(Bl,"passive",{get:function(){Zr=!0}}),window.addEventListener("test",Bl,Bl),window.removeEventListener("test",Bl,Bl)}catch{Zr=!1}var Bn=null,Fr=null,Is=null;function Uf(){if(Is)return Is;var e,t=Fr,n=t.length,s,c="value"in Bn?Bn.value:Bn.textContent,u=c.length;for(e=0;e<n&&t[e]===c[e];e++);var h=n-e;for(s=1;s<=h&&t[n-s]===c[u-s];s++);return Is=c.slice(e,1<s?1-s:void 0)}function Ws(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 Ps(){return!0}function Hf(){return!1}function xt(e){function t(n,s,c,u,h){this._reactName=n,this._targetInst=c,this.type=s,this.nativeEvent=u,this.target=h,this.currentTarget=null;for(var x in e)e.hasOwnProperty(x)&&(n=e[x],this[x]=n?n(u):u[x]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Ps:Hf,this.isPropagationStopped=Hf,this}return S(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ps)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ps)},persist:function(){},isPersistent:Ps}),t}var ha={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ei=xt(ha),zl=S({},ha,{view:0,detail:0}),Qg=xt(zl),Jr,Ir,Ll,ti=S({},zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pr,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!==Ll&&(Ll&&e.type==="mousemove"?(Jr=e.screenX-Ll.screenX,Ir=e.screenY-Ll.screenY):Ir=Jr=0,Ll=e),Jr)},movementY:function(e){return"movementY"in e?e.movementY:Ir}}),Vf=xt(ti),Xg=S({},ti,{dataTransfer:0}),$g=xt(Xg),Kg=S({},zl,{relatedTarget:0}),Wr=xt(Kg),Zg=S({},ha,{animationName:0,elapsedTime:0,pseudoElement:0}),Fg=xt(Zg),Jg=S({},ha,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Ig=xt(Jg),Wg=S({},ha,{data:0}),Yf=xt(Wg),Pg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ey={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"},ty={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ny(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ty[e])?!!t[e]:!1}function Pr(){return ny}var ay=S({},zl,{key:function(e){if(e.key){var t=Pg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ws(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ey[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pr,charCode:function(e){return e.type==="keypress"?Ws(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ws(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ly=xt(ay),sy=S({},ti,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gf=xt(sy),iy=S({},zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pr}),ry=xt(iy),cy=S({},ha,{propertyName:0,elapsedTime:0,pseudoElement:0}),oy=xt(cy),uy=S({},ti,{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}),fy=xt(uy),dy=S({},ha,{newState:0,oldState:0}),hy=xt(dy),my=[9,13,27,32],ec=fn&&"CompositionEvent"in window,Ul=null;fn&&"documentMode"in document&&(Ul=document.documentMode);var py=fn&&"TextEvent"in window&&!Ul,Qf=fn&&(!ec||Ul&&8<Ul&&11>=Ul),Xf=" ",$f=!1;function Kf(e,t){switch(e){case"keyup":return my.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ga=!1;function gy(e,t){switch(e){case"compositionend":return Zf(t);case"keypress":return t.which!==32?null:($f=!0,Xf);case"textInput":return e=t.data,e===Xf&&$f?null:e;default:return null}}function yy(e,t){if(Ga)return e==="compositionend"||!ec&&Kf(e,t)?(e=Uf(),Is=Fr=Bn=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 Qf&&t.locale!=="ko"?null:t.data;default:return null}}var vy={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 Ff(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!vy[e.type]:t==="textarea"}function Jf(e,t,n,s){Va?Ya?Ya.push(s):Ya=[s]:Va=s,t=Qi(t,"onChange"),0<t.length&&(n=new ei("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Hl=null,Vl=null;function xy(e){km(e,0)}function ni(e){var t=Dl(e);if(Mf(t))return e}function If(e,t){if(e==="change")return t}var Wf=!1;if(fn){var tc;if(fn){var nc="oninput"in document;if(!nc){var Pf=document.createElement("div");Pf.setAttribute("oninput","return;"),nc=typeof Pf.oninput=="function"}tc=nc}else tc=!1;Wf=tc&&(!document.documentMode||9<document.documentMode)}function ed(){Hl&&(Hl.detachEvent("onpropertychange",td),Vl=Hl=null)}function td(e){if(e.propertyName==="value"&&ni(Vl)){var t=[];Jf(t,Vl,e,$r(e)),Lf(xy,t)}}function by(e,t,n){e==="focusin"?(ed(),Hl=t,Vl=n,Hl.attachEvent("onpropertychange",td)):e==="focusout"&&ed()}function Sy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ni(Vl)}function Ay(e,t){if(e==="click")return ni(t)}function jy(e,t){if(e==="input"||e==="change")return ni(t)}function Ny(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wt=typeof Object.is=="function"?Object.is:Ny;function Yl(e,t){if(wt(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(!ql.call(t,c)||!wt(e[c],t[c]))return!1}return!0}function nd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ad(e,t){var n=nd(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=nd(n)}}function ld(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ld(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Fs(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=Fs(e.document)}return t}function ac(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 wy=fn&&"documentMode"in document&&11>=document.documentMode,Qa=null,lc=null,Gl=null,sc=!1;function id(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;sc||Qa==null||Qa!==Fs(s)||(s=Qa,"selectionStart"in s&&ac(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}),Gl&&Yl(Gl,s)||(Gl=s,s=Qi(lc,"onSelect"),0<s.length&&(t=new ei("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=Qa)))}function ma(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Xa={animationend:ma("Animation","AnimationEnd"),animationiteration:ma("Animation","AnimationIteration"),animationstart:ma("Animation","AnimationStart"),transitionrun:ma("Transition","TransitionRun"),transitionstart:ma("Transition","TransitionStart"),transitioncancel:ma("Transition","TransitionCancel"),transitionend:ma("Transition","TransitionEnd")},ic={},rd={};fn&&(rd=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 pa(e){if(ic[e])return ic[e];if(!Xa[e])return e;var t=Xa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in rd)return ic[e]=t[n];return e}var cd=pa("animationend"),od=pa("animationiteration"),ud=pa("animationstart"),Ey=pa("transitionrun"),qy=pa("transitionstart"),Cy=pa("transitioncancel"),fd=pa("transitionend"),dd=new Map,rc="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(" ");rc.push("scrollEnd");function Xt(e,t){dd.set(e,t),da(t,[e])}var ai=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ot=[],$a=0,cc=0;function li(){for(var e=$a,t=cc=$a=0;t<e;){var n=Ot[t];Ot[t++]=null;var s=Ot[t];Ot[t++]=null;var c=Ot[t];Ot[t++]=null;var u=Ot[t];if(Ot[t++]=null,s!==null&&c!==null){var h=s.pending;h===null?c.next=c:(c.next=h.next,h.next=c),s.pending=c}u!==0&&hd(n,c,u)}}function si(e,t,n,s){Ot[$a++]=e,Ot[$a++]=t,Ot[$a++]=n,Ot[$a++]=s,cc|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function oc(e,t,n,s){return si(e,t,n,s),ii(e)}function ga(e,t){return si(e,null,null,t),ii(e)}function hd(e,t,n){e.lanes|=n;var s=e.alternate;s!==null&&(s.lanes|=n);for(var c=!1,u=e.return;u!==null;)u.childLanes|=n,s=u.alternate,s!==null&&(s.childLanes|=n),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(c=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,c&&t!==null&&(c=31-qe(n),e=u.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=n|536870912),u):null}function ii(e){if(50<fs)throw fs=0,xo=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ka={};function Ty(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 Et(e,t,n,s){return new Ty(e,t,n,s)}function uc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dn(e,t){var n=e.alternate;return n===null?(n=Et(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 md(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 ri(e,t,n,s,c,u){var h=0;if(s=e,typeof e=="function")uc(e)&&(h=1);else if(typeof e=="string")h=Dv(e,n,_.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case I:return e=Et(31,n,t,c),e.elementType=I,e.lanes=u,e;case R:return ya(n.children,c,u,t);case A:h=8,c|=24;break;case E:return e=Et(12,n,t,c|2),e.elementType=E,e.lanes=u,e;case G:return e=Et(13,n,t,c),e.elementType=G,e.lanes=u,e;case K:return e=Et(19,n,t,c),e.elementType=K,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:h=10;break e;case N:h=9;break e;case J:h=11;break e;case V:h=14;break e;case ne:h=16,s=null;break e}h=29,n=Error(r(130,e===null?"null":typeof e,"")),s=null}return t=Et(h,n,t,c),t.elementType=e,t.type=s,t.lanes=u,t}function ya(e,t,n,s){return e=Et(7,e,s,t),e.lanes=n,e}function fc(e,t,n){return e=Et(6,e,null,t),e.lanes=n,e}function pd(e){var t=Et(18,null,null,0);return t.stateNode=e,t}function dc(e,t,n){return t=Et(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var gd=new WeakMap;function Bt(e,t){if(typeof e=="object"&&e!==null){var n=gd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Ma(t)},gd.set(e,t),t)}return{value:e,source:t,stack:Ma(t)}}var Za=[],Fa=0,ci=null,Ql=0,zt=[],Lt=0,zn=null,Wt=1,Pt="";function hn(e,t){Za[Fa++]=Ql,Za[Fa++]=ci,ci=e,Ql=t}function yd(e,t,n){zt[Lt++]=Wt,zt[Lt++]=Pt,zt[Lt++]=zn,zn=e;var s=Wt;e=Pt;var c=32-qe(s)-1;s&=~(1<<c),n+=1;var u=32-qe(t)+c;if(30<u){var h=c-c%5;u=(s&(1<<h)-1).toString(32),s>>=h,c-=h,Wt=1<<32-qe(t)+c|n<<c|s,Pt=u+e}else Wt=1<<u|n<<c|s,Pt=e}function hc(e){e.return!==null&&(hn(e,1),yd(e,1,0))}function mc(e){for(;e===ci;)ci=Za[--Fa],Za[Fa]=null,Ql=Za[--Fa],Za[Fa]=null;for(;e===zn;)zn=zt[--Lt],zt[Lt]=null,Pt=zt[--Lt],zt[Lt]=null,Wt=zt[--Lt],zt[Lt]=null}function vd(e,t){zt[Lt++]=Wt,zt[Lt++]=Pt,zt[Lt++]=zn,Wt=t.id,Pt=t.overflow,zn=e}var it=null,He=null,Ae=!1,Ln=null,Ut=!1,pc=Error(r(519));function Un(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Xl(Bt(t,e)),pc}function xd(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[st]=e,t[vt]=s,n){case"dialog":xe("cancel",t),xe("close",t);break;case"iframe":case"object":case"embed":xe("load",t);break;case"video":case"audio":for(n=0;n<hs.length;n++)xe(hs[n],t);break;case"source":xe("error",t);break;case"img":case"image":case"link":xe("error",t),xe("load",t);break;case"details":xe("toggle",t);break;case"input":xe("invalid",t),kf(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":xe("invalid",t);break;case"textarea":xe("invalid",t),Df(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||Bm(t.textContent,n)?(s.popover!=null&&(xe("beforetoggle",t),xe("toggle",t)),s.onScroll!=null&&xe("scroll",t),s.onScrollEnd!=null&&xe("scrollend",t),s.onClick!=null&&(t.onclick=un),t=!0):t=!1,t||Un(e,!0)}function bd(e){for(it=e.return;it;)switch(it.tag){case 5:case 31:case 13:Ut=!1;return;case 27:case 3:Ut=!0;return;default:it=it.return}}function Ja(e){if(e!==it)return!1;if(!Ae)return bd(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")||Do(e.type,e.memoizedProps)),n=!n),n&&He&&Un(e),bd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));He=Xm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));He=Xm(e)}else t===27?(t=He,Pn(e.type)?(e=Uo,Uo=null,He=e):He=t):He=it?Vt(e.stateNode.nextSibling):null;return!0}function va(){He=it=null,Ae=!1}function gc(){var e=Ln;return e!==null&&(jt===null?jt=e:jt.push.apply(jt,e),Ln=null),e}function Xl(e){Ln===null?Ln=[e]:Ln.push(e)}var yc=q(null),xa=null,mn=null;function Hn(e,t,n){k(yc,t._currentValue),t._currentValue=n}function pn(e){e._currentValue=yc.current,z(yc)}function vc(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 xc(e,t,n,s){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var u=c.dependencies;if(u!==null){var h=c.child;u=u.firstContext;e:for(;u!==null;){var x=u;u=c;for(var T=0;T<t.length;T++)if(x.context===t[T]){u.lanes|=n,x=u.alternate,x!==null&&(x.lanes|=n),vc(u.return,n,e),s||(h=null);break e}u=x.next}}else if(c.tag===18){if(h=c.return,h===null)throw Error(r(341));h.lanes|=n,u=h.alternate,u!==null&&(u.lanes|=n),vc(h,n,e),h=null}else h=c.child;if(h!==null)h.return=c;else for(h=c;h!==null;){if(h===e){h=null;break}if(c=h.sibling,c!==null){c.return=h.return,h=c;break}h=h.return}c=h}}function Ia(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 h=c.alternate;if(h===null)throw Error(r(387));if(h=h.memoizedProps,h!==null){var x=c.type;wt(c.pendingProps.value,h.value)||(e!==null?e.push(x):e=[x])}}else if(c===fe.current){if(h=c.alternate,h===null)throw Error(r(387));h.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(vs):e=[vs])}c=c.return}e!==null&&xc(t,e,n,s),t.flags|=262144}function oi(e){for(e=e.firstContext;e!==null;){if(!wt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ba(e){xa=e,mn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function rt(e){return Sd(xa,e)}function ui(e,t){return xa===null&&ba(e),Sd(e,t)}function Sd(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},mn===null){if(e===null)throw Error(r(308));mn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else mn=mn.next=t;return n}var Ry=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()})}},My=a.unstable_scheduleCallback,ky=a.unstable_NormalPriority,Fe={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bc(){return{controller:new Ry,data:new Map,refCount:0}}function $l(e){e.refCount--,e.refCount===0&&My(ky,function(){e.controller.abort()})}var Kl=null,Sc=0,Wa=0,Pa=null;function _y(e,t){if(Kl===null){var n=Kl=[];Sc=0,Wa=wo(),Pa={status:"pending",value:void 0,then:function(s){n.push(s)}}}return Sc++,t.then(Ad,Ad),t}function Ad(){if(--Sc===0&&Kl!==null){Pa!==null&&(Pa.status="fulfilled");var e=Kl;Kl=null,Wa=0,Pa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Dy(e,t){var n=[],s={status:"pending",value:null,reason:null,then:function(c){n.push(c)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var c=0;c<n.length;c++)(0,n[c])(t)},function(c){for(s.status="rejected",s.reason=c,c=0;c<n.length;c++)(0,n[c])(void 0)}),s}var jd=B.S;B.S=function(e,t){im=tt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&_y(e,t),jd!==null&&jd(e,t)};var Sa=q(null);function Ac(){var e=Sa.current;return e!==null?e:ze.pooledCache}function fi(e,t){t===null?k(Sa,Sa.current):k(Sa,t.pool)}function Nd(){var e=Ac();return e===null?null:{parent:Fe._currentValue,pool:e}}var el=Error(r(460)),jc=Error(r(474)),di=Error(r(542)),hi={then:function(){}};function wd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Ed(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(un,un),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Cd(e),e;default:if(typeof t.status=="string")t.then(un,un);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,Cd(e),e}throw ja=t,el}}function Aa(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(ja=n,el):n}}var ja=null;function qd(){if(ja===null)throw Error(r(459));var e=ja;return ja=null,e}function Cd(e){if(e===el||e===di)throw Error(r(483))}var tl=null,Zl=0;function mi(e){var t=Zl;return Zl+=1,tl===null&&(tl=[]),Ed(tl,e,t)}function Fl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function pi(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 Td(e){function t(O,M){if(e){var L=O.deletions;L===null?(O.deletions=[M],O.flags|=16):L.push(M)}}function n(O,M){if(!e)return null;for(;M!==null;)t(O,M),M=M.sibling;return null}function s(O){for(var M=new Map;O!==null;)O.key!==null?M.set(O.key,O):M.set(O.index,O),O=O.sibling;return M}function c(O,M){return O=dn(O,M),O.index=0,O.sibling=null,O}function u(O,M,L){return O.index=L,e?(L=O.alternate,L!==null?(L=L.index,L<M?(O.flags|=67108866,M):L):(O.flags|=67108866,M)):(O.flags|=1048576,M)}function h(O){return e&&O.alternate===null&&(O.flags|=67108866),O}function x(O,M,L,$){return M===null||M.tag!==6?(M=fc(L,O.mode,$),M.return=O,M):(M=c(M,L),M.return=O,M)}function T(O,M,L,$){var de=L.type;return de===R?Q(O,M,L.props.children,$,L.key):M!==null&&(M.elementType===de||typeof de=="object"&&de!==null&&de.$$typeof===ne&&Aa(de)===M.type)?(M=c(M,L.props),Fl(M,L),M.return=O,M):(M=ri(L.type,L.key,L.props,null,O.mode,$),Fl(M,L),M.return=O,M)}function U(O,M,L,$){return M===null||M.tag!==4||M.stateNode.containerInfo!==L.containerInfo||M.stateNode.implementation!==L.implementation?(M=dc(L,O.mode,$),M.return=O,M):(M=c(M,L.children||[]),M.return=O,M)}function Q(O,M,L,$,de){return M===null||M.tag!==7?(M=ya(L,O.mode,$,de),M.return=O,M):(M=c(M,L),M.return=O,M)}function F(O,M,L){if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return M=fc(""+M,O.mode,L),M.return=O,M;if(typeof M=="object"&&M!==null){switch(M.$$typeof){case C:return L=ri(M.type,M.key,M.props,null,O.mode,L),Fl(L,M),L.return=O,L;case j:return M=dc(M,O.mode,L),M.return=O,M;case ne:return M=Aa(M),F(O,M,L)}if(se(M)||P(M))return M=ya(M,O.mode,L,null),M.return=O,M;if(typeof M.then=="function")return F(O,mi(M),L);if(M.$$typeof===D)return F(O,ui(O,M),L);pi(O,M)}return null}function H(O,M,L,$){var de=M!==null?M.key:null;if(typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint")return de!==null?null:x(O,M,""+L,$);if(typeof L=="object"&&L!==null){switch(L.$$typeof){case C:return L.key===de?T(O,M,L,$):null;case j:return L.key===de?U(O,M,L,$):null;case ne:return L=Aa(L),H(O,M,L,$)}if(se(L)||P(L))return de!==null?null:Q(O,M,L,$,null);if(typeof L.then=="function")return H(O,M,mi(L),$);if(L.$$typeof===D)return H(O,M,ui(O,L),$);pi(O,L)}return null}function Y(O,M,L,$,de){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return O=O.get(L)||null,x(M,O,""+$,de);if(typeof $=="object"&&$!==null){switch($.$$typeof){case C:return O=O.get($.key===null?L:$.key)||null,T(M,O,$,de);case j:return O=O.get($.key===null?L:$.key)||null,U(M,O,$,de);case ne:return $=Aa($),Y(O,M,L,$,de)}if(se($)||P($))return O=O.get(L)||null,Q(M,O,$,de,null);if(typeof $.then=="function")return Y(O,M,L,mi($),de);if($.$$typeof===D)return Y(O,M,L,ui(M,$),de);pi(M,$)}return null}function re(O,M,L,$){for(var de=null,Ce=null,oe=M,ye=M=0,Se=null;oe!==null&&ye<L.length;ye++){oe.index>ye?(Se=oe,oe=null):Se=oe.sibling;var Te=H(O,oe,L[ye],$);if(Te===null){oe===null&&(oe=Se);break}e&&oe&&Te.alternate===null&&t(O,oe),M=u(Te,M,ye),Ce===null?de=Te:Ce.sibling=Te,Ce=Te,oe=Se}if(ye===L.length)return n(O,oe),Ae&&hn(O,ye),de;if(oe===null){for(;ye<L.length;ye++)oe=F(O,L[ye],$),oe!==null&&(M=u(oe,M,ye),Ce===null?de=oe:Ce.sibling=oe,Ce=oe);return Ae&&hn(O,ye),de}for(oe=s(oe);ye<L.length;ye++)Se=Y(oe,O,ye,L[ye],$),Se!==null&&(e&&Se.alternate!==null&&oe.delete(Se.key===null?ye:Se.key),M=u(Se,M,ye),Ce===null?de=Se:Ce.sibling=Se,Ce=Se);return e&&oe.forEach(function(la){return t(O,la)}),Ae&&hn(O,ye),de}function he(O,M,L,$){if(L==null)throw Error(r(151));for(var de=null,Ce=null,oe=M,ye=M=0,Se=null,Te=L.next();oe!==null&&!Te.done;ye++,Te=L.next()){oe.index>ye?(Se=oe,oe=null):Se=oe.sibling;var la=H(O,oe,Te.value,$);if(la===null){oe===null&&(oe=Se);break}e&&oe&&la.alternate===null&&t(O,oe),M=u(la,M,ye),Ce===null?de=la:Ce.sibling=la,Ce=la,oe=Se}if(Te.done)return n(O,oe),Ae&&hn(O,ye),de;if(oe===null){for(;!Te.done;ye++,Te=L.next())Te=F(O,Te.value,$),Te!==null&&(M=u(Te,M,ye),Ce===null?de=Te:Ce.sibling=Te,Ce=Te);return Ae&&hn(O,ye),de}for(oe=s(oe);!Te.done;ye++,Te=L.next())Te=Y(oe,O,ye,Te.value,$),Te!==null&&(e&&Te.alternate!==null&&oe.delete(Te.key===null?ye:Te.key),M=u(Te,M,ye),Ce===null?de=Te:Ce.sibling=Te,Ce=Te);return e&&oe.forEach(function(Xv){return t(O,Xv)}),Ae&&hn(O,ye),de}function Be(O,M,L,$){if(typeof L=="object"&&L!==null&&L.type===R&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case C:e:{for(var de=L.key;M!==null;){if(M.key===de){if(de=L.type,de===R){if(M.tag===7){n(O,M.sibling),$=c(M,L.props.children),$.return=O,O=$;break e}}else if(M.elementType===de||typeof de=="object"&&de!==null&&de.$$typeof===ne&&Aa(de)===M.type){n(O,M.sibling),$=c(M,L.props),Fl($,L),$.return=O,O=$;break e}n(O,M);break}else t(O,M);M=M.sibling}L.type===R?($=ya(L.props.children,O.mode,$,L.key),$.return=O,O=$):($=ri(L.type,L.key,L.props,null,O.mode,$),Fl($,L),$.return=O,O=$)}return h(O);case j:e:{for(de=L.key;M!==null;){if(M.key===de)if(M.tag===4&&M.stateNode.containerInfo===L.containerInfo&&M.stateNode.implementation===L.implementation){n(O,M.sibling),$=c(M,L.children||[]),$.return=O,O=$;break e}else{n(O,M);break}else t(O,M);M=M.sibling}$=dc(L,O.mode,$),$.return=O,O=$}return h(O);case ne:return L=Aa(L),Be(O,M,L,$)}if(se(L))return re(O,M,L,$);if(P(L)){if(de=P(L),typeof de!="function")throw Error(r(150));return L=de.call(L),he(O,M,L,$)}if(typeof L.then=="function")return Be(O,M,mi(L),$);if(L.$$typeof===D)return Be(O,M,ui(O,L),$);pi(O,L)}return typeof L=="string"&&L!==""||typeof L=="number"||typeof L=="bigint"?(L=""+L,M!==null&&M.tag===6?(n(O,M.sibling),$=c(M,L),$.return=O,O=$):(n(O,M),$=fc(L,O.mode,$),$.return=O,O=$),h(O)):n(O,M)}return function(O,M,L,$){try{Zl=0;var de=Be(O,M,L,$);return tl=null,de}catch(oe){if(oe===el||oe===di)throw oe;var Ce=Et(29,oe,null,O.mode);return Ce.lanes=$,Ce.return=O,Ce}finally{}}}var Na=Td(!0),Rd=Td(!1),Vn=!1;function Nc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wc(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 Yn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Gn(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Re&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=ii(e),hd(e,null,n),t}return si(e,s,t,n),ii(e)}function Jl(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,Sf(e,n)}}function Ec(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 h={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};u===null?c=u=h:u=u.next=h,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 qc=!1;function Il(){if(qc){var e=Pa;if(e!==null)throw e}}function Wl(e,t,n,s){qc=!1;var c=e.updateQueue;Vn=!1;var u=c.firstBaseUpdate,h=c.lastBaseUpdate,x=c.shared.pending;if(x!==null){c.shared.pending=null;var T=x,U=T.next;T.next=null,h===null?u=U:h.next=U,h=T;var Q=e.alternate;Q!==null&&(Q=Q.updateQueue,x=Q.lastBaseUpdate,x!==h&&(x===null?Q.firstBaseUpdate=U:x.next=U,Q.lastBaseUpdate=T))}if(u!==null){var F=c.baseState;h=0,Q=U=T=null,x=u;do{var H=x.lane&-536870913,Y=H!==x.lane;if(Y?(be&H)===H:(s&H)===H){H!==0&&H===Wa&&(qc=!0),Q!==null&&(Q=Q.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var re=e,he=x;H=t;var Be=n;switch(he.tag){case 1:if(re=he.payload,typeof re=="function"){F=re.call(Be,F,H);break e}F=re;break e;case 3:re.flags=re.flags&-65537|128;case 0:if(re=he.payload,H=typeof re=="function"?re.call(Be,F,H):re,H==null)break e;F=S({},F,H);break e;case 2:Vn=!0}}H=x.callback,H!==null&&(e.flags|=64,Y&&(e.flags|=8192),Y=c.callbacks,Y===null?c.callbacks=[H]:Y.push(H))}else Y={lane:H,tag:x.tag,payload:x.payload,callback:x.callback,next:null},Q===null?(U=Q=Y,T=F):Q=Q.next=Y,h|=H;if(x=x.next,x===null){if(x=c.shared.pending,x===null)break;Y=x,x=Y.next,Y.next=null,c.lastBaseUpdate=Y,c.shared.pending=null}}while(!0);Q===null&&(T=F),c.baseState=T,c.firstBaseUpdate=U,c.lastBaseUpdate=Q,u===null&&(c.shared.lanes=0),Zn|=h,e.lanes=h,e.memoizedState=F}}function Md(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function kd(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Md(n[e],t)}var nl=q(null),gi=q(0);function _d(e,t){e=Nn,k(gi,e),k(nl,t),Nn=e|t.baseLanes}function Cc(){k(gi,Nn),k(nl,nl.current)}function Tc(){Nn=gi.current,z(nl),z(gi)}var qt=q(null),Ht=null;function Qn(e){var t=e.alternate;k(Ke,Ke.current&1),k(qt,e),Ht===null&&(t===null||nl.current!==null||t.memoizedState!==null)&&(Ht=e)}function Rc(e){k(Ke,Ke.current),k(qt,e),Ht===null&&(Ht=e)}function Dd(e){e.tag===22?(k(Ke,Ke.current),k(qt,e),Ht===null&&(Ht=e)):Xn()}function Xn(){k(Ke,Ke.current),k(qt,qt.current)}function Ct(e){z(qt),Ht===e&&(Ht=null),z(Ke)}var Ke=q(0);function yi(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||zo(n)||Lo(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 gn=0,ge=null,De=null,Je=null,vi=!1,al=!1,wa=!1,xi=0,Pl=0,ll=null,Oy=0;function Qe(){throw Error(r(321))}function Mc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wt(e[n],t[n]))return!1;return!0}function kc(e,t,n,s,c,u){return gn=u,ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,B.H=e===null||e.memoizedState===null?yh:Kc,wa=!1,u=n(s,c),wa=!1,al&&(u=Bd(t,n,s,c)),Od(e),u}function Od(e){B.H=ns;var t=De!==null&&De.next!==null;if(gn=0,Je=De=ge=null,vi=!1,Pl=0,ll=null,t)throw Error(r(300));e===null||Ie||(e=e.dependencies,e!==null&&oi(e)&&(Ie=!0))}function Bd(e,t,n,s){ge=e;var c=0;do{if(al&&(ll=null),Pl=0,al=!1,25<=c)throw Error(r(301));if(c+=1,Je=De=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}B.H=vh,u=t(n,s)}while(al);return u}function By(){var e=B.H,t=e.useState()[0];return t=typeof t.then=="function"?es(t):t,e=e.useState()[0],(De!==null?De.memoizedState:null)!==e&&(ge.flags|=1024),t}function _c(){var e=xi!==0;return xi=0,e}function Dc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Oc(e){if(vi){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}vi=!1}gn=0,Je=De=ge=null,al=!1,Pl=xi=0,ll=null}function pt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Je===null?ge.memoizedState=Je=e:Je=Je.next=e,Je}function Ze(){if(De===null){var e=ge.alternate;e=e!==null?e.memoizedState:null}else e=De.next;var t=Je===null?ge.memoizedState:Je.next;if(t!==null)Je=t,De=e;else{if(e===null)throw ge.alternate===null?Error(r(467)):Error(r(310));De=e,e={memoizedState:De.memoizedState,baseState:De.baseState,baseQueue:De.baseQueue,queue:De.queue,next:null},Je===null?ge.memoizedState=Je=e:Je=Je.next=e}return Je}function bi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function es(e){var t=Pl;return Pl+=1,ll===null&&(ll=[]),e=Ed(ll,e,t),t=ge,(Je===null?t.memoizedState:Je.next)===null&&(t=t.alternate,B.H=t===null||t.memoizedState===null?yh:Kc),e}function Si(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return es(e);if(e.$$typeof===D)return rt(e)}throw Error(r(438,String(e)))}function Bc(e){var t=null,n=ge.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=ge.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=bi(),ge.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=ae;return t.index++,n}function yn(e,t){return typeof t=="function"?t(e):t}function Ai(e){var t=Ze();return zc(t,De,e)}function zc(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 h=c.next;c.next=u.next,u.next=h}t.baseQueue=c=u,s.pending=null}if(u=e.baseState,c===null)e.memoizedState=u;else{t=c.next;var x=h=null,T=null,U=t,Q=!1;do{var F=U.lane&-536870913;if(F!==U.lane?(be&F)===F:(gn&F)===F){var H=U.revertLane;if(H===0)T!==null&&(T=T.next={lane:0,revertLane:0,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null}),F===Wa&&(Q=!0);else if((gn&H)===H){U=U.next,H===Wa&&(Q=!0);continue}else F={lane:0,revertLane:U.revertLane,gesture:null,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},T===null?(x=T=F,h=u):T=T.next=F,ge.lanes|=H,Zn|=H;F=U.action,wa&&n(u,F),u=U.hasEagerState?U.eagerState:n(u,F)}else H={lane:F,revertLane:U.revertLane,gesture:U.gesture,action:U.action,hasEagerState:U.hasEagerState,eagerState:U.eagerState,next:null},T===null?(x=T=H,h=u):T=T.next=H,ge.lanes|=F,Zn|=F;U=U.next}while(U!==null&&U!==t);if(T===null?h=u:T.next=x,!wt(u,e.memoizedState)&&(Ie=!0,Q&&(n=Pa,n!==null)))throw n;e.memoizedState=u,e.baseState=h,e.baseQueue=T,s.lastRenderedState=u}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Lc(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 h=c=c.next;do u=e(u,h.action),h=h.next;while(h!==c);wt(u,t.memoizedState)||(Ie=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,s]}function zd(e,t,n){var s=ge,c=Ze(),u=Ae;if(u){if(n===void 0)throw Error(r(407));n=n()}else n=t();var h=!wt((De||c).memoizedState,n);if(h&&(c.memoizedState=n,Ie=!0),c=c.queue,Vc(Hd.bind(null,s,c,e),[e]),c.getSnapshot!==t||h||Je!==null&&Je.memoizedState.tag&1){if(s.flags|=2048,sl(9,{destroy:void 0},Ud.bind(null,s,c,n,t),null),ze===null)throw Error(r(349));u||(gn&127)!==0||Ld(s,t,n)}return n}function Ld(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ge.updateQueue,t===null?(t=bi(),ge.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ud(e,t,n,s){t.value=n,t.getSnapshot=s,Vd(t)&&Yd(e)}function Hd(e,t,n){return n(function(){Vd(t)&&Yd(e)})}function Vd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wt(e,n)}catch{return!0}}function Yd(e){var t=ga(e,2);t!==null&&Nt(t,e,2)}function Uc(e){var t=pt();if(typeof e=="function"){var n=e;if(e=n(),wa){Ee(!0);try{n()}finally{Ee(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yn,lastRenderedState:e},t}function Gd(e,t,n,s){return e.baseState=n,zc(e,De,typeof s=="function"?s:yn)}function zy(e,t,n,s,c){if(wi(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(h){u.listeners.push(h)}};B.T!==null?n(!0):u.isTransition=!1,s(u),n=t.pending,n===null?(u.next=t.pending=u,Qd(t,u)):(u.next=n.next,t.pending=n.next=u)}}function Qd(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=B.T,h={};B.T=h;try{var x=n(c,s),T=B.S;T!==null&&T(h,x),Xd(e,t,x)}catch(U){Hc(e,t,U)}finally{u!==null&&h.types!==null&&(u.types=h.types),B.T=u}}else try{u=n(c,s),Xd(e,t,u)}catch(U){Hc(e,t,U)}}function Xd(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){$d(e,t,s)},function(s){return Hc(e,t,s)}):$d(e,t,n)}function $d(e,t,n){t.status="fulfilled",t.value=n,Kd(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Qd(e,n)))}function Hc(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,Kd(t),t=t.next;while(t!==s)}e.action=null}function Kd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Zd(e,t){return t}function Fd(e,t){if(Ae){var n=ze.formState;if(n!==null){e:{var s=ge;if(Ae){if(He){t:{for(var c=He,u=Ut;c.nodeType!==8;){if(!u){c=null;break t}if(c=Vt(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){He=Vt(c.nextSibling),s=c.data==="F!";break e}}Un(s)}s=!1}s&&(t=n[0])}}return n=pt(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zd,lastRenderedState:t},n.queue=s,n=mh.bind(null,ge,s),s.dispatch=n,s=Uc(!1),u=$c.bind(null,ge,!1,s.queue),s=pt(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=zy.bind(null,ge,c,u,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function Jd(e){var t=Ze();return Id(t,De,e)}function Id(e,t,n){if(t=zc(e,t,Zd)[0],e=Ai(yn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=es(t)}catch(h){throw h===el?di:h}else s=t;t=Ze();var c=t.queue,u=c.dispatch;return n!==t.memoizedState&&(ge.flags|=2048,sl(9,{destroy:void 0},Ly.bind(null,c,n),null)),[s,u,e]}function Ly(e,t){e.action=t}function Wd(e){var t=Ze(),n=De;if(n!==null)return Id(t,n,e);Ze(),t=t.memoizedState,n=Ze();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function sl(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=ge.updateQueue,t===null&&(t=bi(),ge.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(s=n.next,n.next=e,e.next=s,t.lastEffect=e),e}function Pd(){return Ze().memoizedState}function ji(e,t,n,s){var c=pt();ge.flags|=e,c.memoizedState=sl(1|t,{destroy:void 0},n,s===void 0?null:s)}function Ni(e,t,n,s){var c=Ze();s=s===void 0?null:s;var u=c.memoizedState.inst;De!==null&&s!==null&&Mc(s,De.memoizedState.deps)?c.memoizedState=sl(t,u,n,s):(ge.flags|=e,c.memoizedState=sl(1|t,u,n,s))}function eh(e,t){ji(8390656,8,e,t)}function Vc(e,t){Ni(2048,8,e,t)}function Uy(e){ge.flags|=4;var t=ge.updateQueue;if(t===null)t=bi(),ge.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function th(e){var t=Ze().memoizedState;return Uy({ref:t,nextImpl:e}),function(){if((Re&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function nh(e,t){return Ni(4,2,e,t)}function ah(e,t){return Ni(4,4,e,t)}function lh(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 sh(e,t,n){n=n!=null?n.concat([e]):null,Ni(4,4,lh.bind(null,t,e),n)}function Yc(){}function ih(e,t){var n=Ze();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&Mc(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function rh(e,t){var n=Ze();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&Mc(t,s[1]))return s[0];if(s=e(),wa){Ee(!0);try{e()}finally{Ee(!1)}}return n.memoizedState=[s,t],s}function Gc(e,t,n){return n===void 0||(gn&1073741824)!==0&&(be&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=cm(),ge.lanes|=e,Zn|=e,n)}function ch(e,t,n,s){return wt(n,t)?n:nl.current!==null?(e=Gc(e,n,s),wt(e,t)||(Ie=!0),e):(gn&42)===0||(gn&1073741824)!==0&&(be&261930)===0?(Ie=!0,e.memoizedState=n):(e=cm(),ge.lanes|=e,Zn|=e,t)}function oh(e,t,n,s,c){var u=W.p;W.p=u!==0&&8>u?u:8;var h=B.T,x={};B.T=x,$c(e,!1,t,n);try{var T=c(),U=B.S;if(U!==null&&U(x,T),T!==null&&typeof T=="object"&&typeof T.then=="function"){var Q=Dy(T,s);ts(e,t,Q,Mt(e))}else ts(e,t,s,Mt(e))}catch(F){ts(e,t,{then:function(){},status:"rejected",reason:F},Mt())}finally{W.p=u,h!==null&&x.types!==null&&(h.types=x.types),B.T=h}}function Hy(){}function Qc(e,t,n,s){if(e.tag!==5)throw Error(r(476));var c=uh(e).queue;oh(e,c,t,le,n===null?Hy:function(){return fh(e),n(s)})}function uh(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:yn,lastRenderedState:le},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function fh(e){var t=uh(e);t.next===null&&(t=e.alternate.memoizedState),ts(e,t.next.queue,{},Mt())}function Xc(){return rt(vs)}function dh(){return Ze().memoizedState}function hh(){return Ze().memoizedState}function Vy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Mt();e=Yn(n);var s=Gn(t,e,n);s!==null&&(Nt(s,t,n),Jl(s,t,n)),t={cache:bc()},e.payload=t;return}t=t.return}}function Yy(e,t,n){var s=Mt();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},wi(e)?ph(t,n):(n=oc(e,t,n,s),n!==null&&(Nt(n,e,s),gh(n,t,s)))}function mh(e,t,n){var s=Mt();ts(e,t,n,s)}function ts(e,t,n,s){var c={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(wi(e))ph(t,c);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var h=t.lastRenderedState,x=u(h,n);if(c.hasEagerState=!0,c.eagerState=x,wt(x,h))return si(e,t,c,0),ze===null&&li(),!1}catch{}finally{}if(n=oc(e,t,c,s),n!==null)return Nt(n,e,s),gh(n,t,s),!0}return!1}function $c(e,t,n,s){if(s={lane:2,revertLane:wo(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},wi(e)){if(t)throw Error(r(479))}else t=oc(e,n,s,2),t!==null&&Nt(t,e,2)}function wi(e){var t=e.alternate;return e===ge||t!==null&&t===ge}function ph(e,t){al=vi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gh(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,Sf(e,n)}}var ns={readContext:rt,use:Si,useCallback:Qe,useContext:Qe,useEffect:Qe,useImperativeHandle:Qe,useLayoutEffect:Qe,useInsertionEffect:Qe,useMemo:Qe,useReducer:Qe,useRef:Qe,useState:Qe,useDebugValue:Qe,useDeferredValue:Qe,useTransition:Qe,useSyncExternalStore:Qe,useId:Qe,useHostTransitionStatus:Qe,useFormState:Qe,useActionState:Qe,useOptimistic:Qe,useMemoCache:Qe,useCacheRefresh:Qe};ns.useEffectEvent=Qe;var yh={readContext:rt,use:Si,useCallback:function(e,t){return pt().memoizedState=[e,t===void 0?null:t],e},useContext:rt,useEffect:eh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,ji(4194308,4,lh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ji(4194308,4,e,t)},useInsertionEffect:function(e,t){ji(4,2,e,t)},useMemo:function(e,t){var n=pt();t=t===void 0?null:t;var s=e();if(wa){Ee(!0);try{e()}finally{Ee(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=pt();if(n!==void 0){var c=n(t);if(wa){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=Yy.bind(null,ge,e),[s.memoizedState,e]},useRef:function(e){var t=pt();return e={current:e},t.memoizedState=e},useState:function(e){e=Uc(e);var t=e.queue,n=mh.bind(null,ge,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Yc,useDeferredValue:function(e,t){var n=pt();return Gc(n,e,t)},useTransition:function(){var e=Uc(!1);return e=oh.bind(null,ge,e.queue,!0,!1),pt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=ge,c=pt();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||Ld(s,t,n)}c.memoizedState=n;var u={value:n,getSnapshot:t};return c.queue=u,eh(Hd.bind(null,s,u,e),[e]),s.flags|=2048,sl(9,{destroy:void 0},Ud.bind(null,s,u,n,t),null),n},useId:function(){var e=pt(),t=ze.identifierPrefix;if(Ae){var n=Pt,s=Wt;n=(s&~(1<<32-qe(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=xi++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Oy++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Xc,useFormState:Fd,useActionState:Fd,useOptimistic:function(e){var t=pt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=$c.bind(null,ge,!0,n),n.dispatch=t,[e,t]},useMemoCache:Bc,useCacheRefresh:function(){return pt().memoizedState=Vy.bind(null,ge)},useEffectEvent:function(e){var t=pt(),n={impl:e};return t.memoizedState=n,function(){if((Re&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},Kc={readContext:rt,use:Si,useCallback:ih,useContext:rt,useEffect:Vc,useImperativeHandle:sh,useInsertionEffect:nh,useLayoutEffect:ah,useMemo:rh,useReducer:Ai,useRef:Pd,useState:function(){return Ai(yn)},useDebugValue:Yc,useDeferredValue:function(e,t){var n=Ze();return ch(n,De.memoizedState,e,t)},useTransition:function(){var e=Ai(yn)[0],t=Ze().memoizedState;return[typeof e=="boolean"?e:es(e),t]},useSyncExternalStore:zd,useId:dh,useHostTransitionStatus:Xc,useFormState:Jd,useActionState:Jd,useOptimistic:function(e,t){var n=Ze();return Gd(n,De,e,t)},useMemoCache:Bc,useCacheRefresh:hh};Kc.useEffectEvent=th;var vh={readContext:rt,use:Si,useCallback:ih,useContext:rt,useEffect:Vc,useImperativeHandle:sh,useInsertionEffect:nh,useLayoutEffect:ah,useMemo:rh,useReducer:Lc,useRef:Pd,useState:function(){return Lc(yn)},useDebugValue:Yc,useDeferredValue:function(e,t){var n=Ze();return De===null?Gc(n,e,t):ch(n,De.memoizedState,e,t)},useTransition:function(){var e=Lc(yn)[0],t=Ze().memoizedState;return[typeof e=="boolean"?e:es(e),t]},useSyncExternalStore:zd,useId:dh,useHostTransitionStatus:Xc,useFormState:Wd,useActionState:Wd,useOptimistic:function(e,t){var n=Ze();return De!==null?Gd(n,De,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:Bc,useCacheRefresh:hh};vh.useEffectEvent=th;function Zc(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:S({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Fc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Mt(),c=Yn(s);c.payload=t,n!=null&&(c.callback=n),t=Gn(e,c,s),t!==null&&(Nt(t,e,s),Jl(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Mt(),c=Yn(s);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=Gn(e,c,s),t!==null&&(Nt(t,e,s),Jl(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Mt(),s=Yn(n);s.tag=2,t!=null&&(s.callback=t),t=Gn(e,s,n),t!==null&&(Nt(t,e,n),Jl(t,e,n))}};function xh(e,t,n,s,c,u,h){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,h):t.prototype&&t.prototype.isPureReactComponent?!Yl(n,s)||!Yl(c,u):!0}function bh(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&&Fc.enqueueReplaceState(t,t.state,null)}function Ea(e,t){var n=t;if("ref"in t){n={};for(var s in t)s!=="ref"&&(n[s]=t[s])}if(e=e.defaultProps){n===t&&(n=S({},n));for(var c in e)n[c]===void 0&&(n[c]=e[c])}return n}function Sh(e){ai(e)}function Ah(e){console.error(e)}function jh(e){ai(e)}function Ei(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Nh(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 Jc(e,t,n){return n=Yn(n),n.tag=3,n.payload={element:null},n.callback=function(){Ei(e,t)},n}function wh(e){return e=Yn(e),e.tag=3,e}function Eh(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(){Nh(t,n,s)}}var h=n.stateNode;h!==null&&typeof h.componentDidCatch=="function"&&(e.callback=function(){Nh(t,n,s),typeof c!="function"&&(Fn===null?Fn=new Set([this]):Fn.add(this));var x=s.stack;this.componentDidCatch(s.value,{componentStack:x!==null?x:""})})}function Gy(e,t,n,s,c){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&Ia(t,n,c,!0),n=qt.current,n!==null){switch(n.tag){case 31:case 13:return Ht===null?Li():n.alternate===null&&Xe===0&&(Xe=3),n.flags&=-257,n.flags|=65536,n.lanes=c,s===hi?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),Ao(e,s,c)),!1;case 22:return n.flags|=65536,s===hi?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)),Ao(e,s,c)),!1}throw Error(r(435,n.tag))}return Ao(e,s,c),Li(),!1}if(Ae)return t=qt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==pc&&(e=Error(r(422),{cause:s}),Xl(Bt(e,n)))):(s!==pc&&(t=Error(r(423),{cause:s}),Xl(Bt(t,n))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Bt(s,n),c=Jc(e.stateNode,s,c),Ec(e,c),Xe!==4&&(Xe=2)),!1;var u=Error(r(520),{cause:s});if(u=Bt(u,n),us===null?us=[u]:us.push(u),Xe!==4&&(Xe=2),t===null)return!0;s=Bt(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=c&-c,n.lanes|=e,e=Jc(n.stateNode,s,e),Ec(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"&&(Fn===null||!Fn.has(u))))return n.flags|=65536,c&=-c,n.lanes|=c,c=wh(c),Eh(c,e,n,s),Ec(n,c),!1}n=n.return}while(n!==null);return!1}var Ic=Error(r(461)),Ie=!1;function ct(e,t,n,s){t.child=e===null?Rd(t,null,n,s):Na(t,e.child,n,s)}function qh(e,t,n,s,c){n=n.render;var u=t.ref;if("ref"in s){var h={};for(var x in s)x!=="ref"&&(h[x]=s[x])}else h=s;return ba(t),s=kc(e,t,n,h,u,c),x=_c(),e!==null&&!Ie?(Dc(e,t,c),vn(e,t,c)):(Ae&&x&&hc(t),t.flags|=1,ct(e,t,s,c),t.child)}function Ch(e,t,n,s,c){if(e===null){var u=n.type;return typeof u=="function"&&!uc(u)&&u.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=u,Th(e,t,u,s,c)):(e=ri(n.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!so(e,c)){var h=u.memoizedProps;if(n=n.compare,n=n!==null?n:Yl,n(h,s)&&e.ref===t.ref)return vn(e,t,c)}return t.flags|=1,e=dn(u,s),e.ref=t.ref,e.return=t,t.child=e}function Th(e,t,n,s,c){if(e!==null){var u=e.memoizedProps;if(Yl(u,s)&&e.ref===t.ref)if(Ie=!1,t.pendingProps=s=u,so(e,c))(e.flags&131072)!==0&&(Ie=!0);else return t.lanes=e.lanes,vn(e,t,c)}return Wc(e,t,n,s,c)}function Rh(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 Mh(e,t,u,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&fi(t,u!==null?u.cachePool:null),u!==null?_d(t,u):Cc(),Dd(t);else return s=t.lanes=536870912,Mh(e,t,u!==null?u.baseLanes|n:n,n,s)}else u!==null?(fi(t,u.cachePool),_d(t,u),Xn(),t.memoizedState=null):(e!==null&&fi(t,null),Cc(),Xn());return ct(e,t,c,n),t.child}function as(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Mh(e,t,n,s,c){var u=Ac();return u=u===null?null:{parent:Fe._currentValue,pool:u},t.memoizedState={baseLanes:n,cachePool:u},e!==null&&fi(t,null),Cc(),Dd(t),e!==null&&Ia(e,t,s,!0),t.childLanes=c,null}function qi(e,t){return t=Ti({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function kh(e,t,n){return Na(t,e.child,null,n),e=qi(t,t.pendingProps),e.flags|=2,Ct(t),t.memoizedState=null,e}function Qy(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=qi(t,s),t.lanes=536870912,as(null,e);if(Rc(t),(e=He)?(e=Qm(e,Ut),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:zn!==null?{id:Wt,overflow:Pt}:null,retryLane:536870912,hydrationErrors:null},n=pd(e),n.return=t,t.child=n,it=t,He=null)):e=null,e===null)throw Un(t);return t.lanes=536870912,null}return qi(t,s)}var u=e.memoizedState;if(u!==null){var h=u.dehydrated;if(Rc(t),c)if(t.flags&256)t.flags&=-257,t=kh(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||Ia(e,t,n,!1),c=(n&e.childLanes)!==0,Ie||c){if(s=ze,s!==null&&(h=Af(s,n),h!==0&&h!==u.retryLane))throw u.retryLane=h,ga(e,h),Nt(s,e,h),Ic;Li(),t=kh(e,t,n)}else e=u.treeContext,He=Vt(h.nextSibling),it=t,Ae=!0,Ln=null,Ut=!1,e!==null&&vd(t,e),t=qi(t,s),t.flags|=4096;return t}return e=dn(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ci(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 Wc(e,t,n,s,c){return ba(t),n=kc(e,t,n,s,void 0,c),s=_c(),e!==null&&!Ie?(Dc(e,t,c),vn(e,t,c)):(Ae&&s&&hc(t),t.flags|=1,ct(e,t,n,c),t.child)}function _h(e,t,n,s,c,u){return ba(t),t.updateQueue=null,n=Bd(t,s,n,c),Od(e),s=_c(),e!==null&&!Ie?(Dc(e,t,u),vn(e,t,u)):(Ae&&s&&hc(t),t.flags|=1,ct(e,t,n,u),t.child)}function Dh(e,t,n,s,c){if(ba(t),t.stateNode===null){var u=Ka,h=n.contextType;typeof h=="object"&&h!==null&&(u=rt(h)),u=new n(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Fc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},Nc(t),h=n.contextType,u.context=typeof h=="object"&&h!==null?rt(h):Ka,u.state=t.memoizedState,h=n.getDerivedStateFromProps,typeof h=="function"&&(Zc(t,n,h,s),u.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(h=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),h!==u.state&&Fc.enqueueReplaceState(u,u.state,null),Wl(t,s,u,c),Il(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var x=t.memoizedProps,T=Ea(n,x);u.props=T;var U=u.context,Q=n.contextType;h=Ka,typeof Q=="object"&&Q!==null&&(h=rt(Q));var F=n.getDerivedStateFromProps;Q=typeof F=="function"||typeof u.getSnapshotBeforeUpdate=="function",x=t.pendingProps!==x,Q||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(x||U!==h)&&bh(t,u,s,h),Vn=!1;var H=t.memoizedState;u.state=H,Wl(t,s,u,c),Il(),U=t.memoizedState,x||H!==U||Vn?(typeof F=="function"&&(Zc(t,n,F,s),U=t.memoizedState),(T=Vn||xh(t,n,T,s,H,U,h))?(Q||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=h,s=T):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,wc(e,t),h=t.memoizedProps,Q=Ea(n,h),u.props=Q,F=t.pendingProps,H=u.context,U=n.contextType,T=Ka,typeof U=="object"&&U!==null&&(T=rt(U)),x=n.getDerivedStateFromProps,(U=typeof x=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(h!==F||H!==T)&&bh(t,u,s,T),Vn=!1,H=t.memoizedState,u.state=H,Wl(t,s,u,c),Il();var Y=t.memoizedState;h!==F||H!==Y||Vn||e!==null&&e.dependencies!==null&&oi(e.dependencies)?(typeof x=="function"&&(Zc(t,n,x,s),Y=t.memoizedState),(Q=Vn||xh(t,n,Q,s,H,Y,T)||e!==null&&e.dependencies!==null&&oi(e.dependencies))?(U||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,Y,T),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,Y,T)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||h===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=Y),u.props=s,u.state=Y,u.context=T,s=Q):(typeof u.componentDidUpdate!="function"||h===e.memoizedProps&&H===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||h===e.memoizedProps&&H===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,Ci(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=Na(t,e.child,null,c),t.child=Na(t,null,n,c)):ct(e,t,n,c),t.memoizedState=u.state,e=t.child):e=vn(e,t,c),e}function Oh(e,t,n,s){return va(),t.flags|=256,ct(e,t,n,s),t.child}var Pc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function eo(e){return{baseLanes:e,cachePool:Nd()}}function to(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Rt),e}function Bh(e,t,n){var s=t.pendingProps,c=!1,u=(t.flags&128)!==0,h;if((h=u)||(h=e!==null&&e.memoizedState===null?!1:(Ke.current&2)!==0),h&&(c=!0,t.flags&=-129),h=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ae){if(c?Qn(t):Xn(),(e=He)?(e=Qm(e,Ut),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:zn!==null?{id:Wt,overflow:Pt}:null,retryLane:536870912,hydrationErrors:null},n=pd(e),n.return=t,t.child=n,it=t,He=null)):e=null,e===null)throw Un(t);return Lo(e)?t.lanes=32:t.lanes=536870912,null}var x=s.children;return s=s.fallback,c?(Xn(),c=t.mode,x=Ti({mode:"hidden",children:x},c),s=ya(s,c,n,null),x.return=t,s.return=t,x.sibling=s,t.child=x,s=t.child,s.memoizedState=eo(n),s.childLanes=to(e,h,n),t.memoizedState=Pc,as(null,s)):(Qn(t),no(t,x))}var T=e.memoizedState;if(T!==null&&(x=T.dehydrated,x!==null)){if(u)t.flags&256?(Qn(t),t.flags&=-257,t=ao(e,t,n)):t.memoizedState!==null?(Xn(),t.child=e.child,t.flags|=128,t=null):(Xn(),x=s.fallback,c=t.mode,s=Ti({mode:"visible",children:s.children},c),x=ya(x,c,n,null),x.flags|=2,s.return=t,x.return=t,s.sibling=x,t.child=s,Na(t,e.child,null,n),s=t.child,s.memoizedState=eo(n),s.childLanes=to(e,h,n),t.memoizedState=Pc,t=as(null,s));else if(Qn(t),Lo(x)){if(h=x.nextSibling&&x.nextSibling.dataset,h)var U=h.dgst;h=U,s=Error(r(419)),s.stack="",s.digest=h,Xl({value:s,source:null,stack:null}),t=ao(e,t,n)}else if(Ie||Ia(e,t,n,!1),h=(n&e.childLanes)!==0,Ie||h){if(h=ze,h!==null&&(s=Af(h,n),s!==0&&s!==T.retryLane))throw T.retryLane=s,ga(e,s),Nt(h,e,s),Ic;zo(x)||Li(),t=ao(e,t,n)}else zo(x)?(t.flags|=192,t.child=e.child,t=null):(e=T.treeContext,He=Vt(x.nextSibling),it=t,Ae=!0,Ln=null,Ut=!1,e!==null&&vd(t,e),t=no(t,s.children),t.flags|=4096);return t}return c?(Xn(),x=s.fallback,c=t.mode,T=e.child,U=T.sibling,s=dn(T,{mode:"hidden",children:s.children}),s.subtreeFlags=T.subtreeFlags&65011712,U!==null?x=dn(U,x):(x=ya(x,c,n,null),x.flags|=2),x.return=t,s.return=t,s.sibling=x,t.child=s,as(null,s),s=t.child,x=e.child.memoizedState,x===null?x=eo(n):(c=x.cachePool,c!==null?(T=Fe._currentValue,c=c.parent!==T?{parent:T,pool:T}:c):c=Nd(),x={baseLanes:x.baseLanes|n,cachePool:c}),s.memoizedState=x,s.childLanes=to(e,h,n),t.memoizedState=Pc,as(e.child,s)):(Qn(t),n=e.child,e=n.sibling,n=dn(n,{mode:"visible",children:s.children}),n.return=t,n.sibling=null,e!==null&&(h=t.deletions,h===null?(t.deletions=[e],t.flags|=16):h.push(e)),t.child=n,t.memoizedState=null,n)}function no(e,t){return t=Ti({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ti(e,t){return e=Et(22,e,null,t),e.lanes=0,e}function ao(e,t,n){return Na(t,e.child,null,n),e=no(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function zh(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),vc(e.return,t,n)}function lo(e,t,n,s,c,u){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:n,tailMode:c,treeForkCount:u}:(h.isBackwards=t,h.rendering=null,h.renderingStartTime=0,h.last=s,h.tail=n,h.tailMode=c,h.treeForkCount=u)}function Lh(e,t,n){var s=t.pendingProps,c=s.revealOrder,u=s.tail;s=s.children;var h=Ke.current,x=(h&2)!==0;if(x?(h=h&1|2,t.flags|=128):h&=1,k(Ke,h),ct(e,t,s,n),s=Ae?Ql:0,!x&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&zh(e,n,t);else if(e.tag===19)zh(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&&yi(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),lo(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&&yi(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}lo(t,!0,n,null,u,s);break;case"together":lo(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function vn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Zn|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ia(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=dn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=dn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function so(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&oi(e)))}function Xy(e,t,n){switch(t.tag){case 3:Ne(t,t.stateNode.containerInfo),Hn(t,Fe,e.memoizedState.cache),va();break;case 27:case 5:mt(t);break;case 4:Ne(t,t.stateNode.containerInfo);break;case 10:Hn(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Rc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Qn(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Bh(e,t,n):(Qn(t),e=vn(e,t,n),e!==null?e.sibling:null);Qn(t);break;case 19:var c=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(Ia(e,t,n,!1),s=(n&t.childLanes)!==0),c){if(s)return Lh(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),k(Ke,Ke.current),s)break;return null;case 22:return t.lanes=0,Rh(e,t,n,t.pendingProps);case 24:Hn(t,Fe,e.memoizedState.cache)}return vn(e,t,n)}function Uh(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Ie=!0;else{if(!so(e,n)&&(t.flags&128)===0)return Ie=!1,Xy(e,t,n);Ie=(e.flags&131072)!==0}else Ie=!1,Ae&&(t.flags&1048576)!==0&&yd(t,Ql,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Aa(t.elementType),t.type=e,typeof e=="function")uc(e)?(s=Ea(e,s),t.tag=1,t=Dh(null,t,e,s,n)):(t.tag=0,t=Wc(null,t,e,s,n));else{if(e!=null){var c=e.$$typeof;if(c===J){t.tag=11,t=qh(null,t,e,s,n);break e}else if(c===V){t.tag=14,t=Ch(null,t,e,s,n);break e}}throw t=ue(e)||e,Error(r(306,t,""))}}return t;case 0:return Wc(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,c=Ea(s,t.pendingProps),Dh(e,t,s,c,n);case 3:e:{if(Ne(t,t.stateNode.containerInfo),e===null)throw Error(r(387));s=t.pendingProps;var u=t.memoizedState;c=u.element,wc(e,t),Wl(t,s,null,n);var h=t.memoizedState;if(s=h.cache,Hn(t,Fe,s),s!==u.cache&&xc(t,[Fe],n,!0),Il(),s=h.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:h.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=Oh(e,t,s,n);break e}else if(s!==c){c=Bt(Error(r(424)),t),Xl(c),t=Oh(e,t,s,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(He=Vt(e.firstChild),it=t,Ae=!0,Ln=null,Ut=!0,n=Rd(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(va(),s===c){t=vn(e,t,n);break e}ct(e,t,s,n)}t=t.child}return t;case 26:return Ci(e,t),e===null?(n=Jm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ae||(n=t.type,e=t.pendingProps,s=Xi(te.current).createElement(n),s[st]=t,s[vt]=e,ot(s,n,e),at(s),t.stateNode=s):t.memoizedState=Jm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return mt(t),e===null&&Ae&&(s=t.stateNode=Km(t.type,t.pendingProps,te.current),it=t,Ut=!0,c=He,Pn(t.type)?(Uo=c,He=Vt(s.firstChild)):He=c),ct(e,t,t.pendingProps.children,n),Ci(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ae&&((c=s=He)&&(s=Sv(s,t.type,t.pendingProps,Ut),s!==null?(t.stateNode=s,it=t,He=Vt(s.firstChild),Ut=!1,c=!0):c=!1),c||Un(t)),mt(t),c=t.type,u=t.pendingProps,h=e!==null?e.memoizedProps:null,s=u.children,Do(c,u)?s=null:h!==null&&Do(c,h)&&(t.flags|=32),t.memoizedState!==null&&(c=kc(e,t,By,null,null,n),vs._currentValue=c),Ci(e,t),ct(e,t,s,n),t.child;case 6:return e===null&&Ae&&((e=n=He)&&(n=Av(n,t.pendingProps,Ut),n!==null?(t.stateNode=n,it=t,He=null,e=!0):e=!1),e||Un(t)),null;case 13:return Bh(e,t,n);case 4:return Ne(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Na(t,null,s,n):ct(e,t,s,n),t.child;case 11:return qh(e,t,t.type,t.pendingProps,n);case 7:return ct(e,t,t.pendingProps,n),t.child;case 8:return ct(e,t,t.pendingProps.children,n),t.child;case 12:return ct(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,Hn(t,t.type,s.value),ct(e,t,s.children,n),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,ba(t),c=rt(c),s=s(c),t.flags|=1,ct(e,t,s,n),t.child;case 14:return Ch(e,t,t.type,t.pendingProps,n);case 15:return Th(e,t,t.type,t.pendingProps,n);case 19:return Lh(e,t,n);case 31:return Qy(e,t,n);case 22:return Rh(e,t,n,t.pendingProps);case 24:return ba(t),s=rt(Fe),e===null?(c=Ac(),c===null&&(c=ze,u=bc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=n),c=u),t.memoizedState={parent:s,cache:c},Nc(t),Hn(t,Fe,c)):((e.lanes&n)!==0&&(wc(e,t),Wl(t,null,null,n),Il()),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),Hn(t,Fe,s)):(s=u.cache,Hn(t,Fe,s),s!==c.cache&&xc(t,[Fe],n,!0))),ct(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 io(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(dm())e.flags|=8192;else throw ja=hi,jc}else e.flags&=-16777217}function Hh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!tp(t))if(dm())e.flags|=8192;else throw ja=hi,jc}function Ri(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?xf():536870912,e.lanes|=t,ol|=t)}function ls(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 $y(e,t,n){var s=t.pendingProps;switch(mc(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),pn(Fe),pe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Ja(t)?xn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,gc())),Ve(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(xn(t),u!==null?(Ve(t),Hh(t,u)):(Ve(t),io(t,c,null,s,n))):u?u!==e.memoizedState?(xn(t),Ve(t),Hh(t,u)):(Ve(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&xn(t),Ve(t),io(t,c,e,s,n)),null;case 27:if(_n(t),n=te.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&xn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Ve(t),null}e=_.current,Ja(t)?xd(t):(e=Km(c,s,n),t.stateNode=e,xn(t))}return Ve(t),null;case 5:if(_n(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&xn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return Ve(t),null}if(u=_.current,Ja(t))xd(t);else{var h=Xi(te.current);switch(u){case 1:u=h.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=h.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=h.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=h.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=h.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?h.createElement("select",{is:s.is}):h.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?h.createElement(c,{is:s.is}):h.createElement(c)}}u[st]=t,u[vt]=s;e:for(h=t.child;h!==null;){if(h.tag===5||h.tag===6)u.appendChild(h.stateNode);else if(h.tag!==4&&h.tag!==27&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;h=h.return}h.sibling.return=h.return,h=h.sibling}t.stateNode=u;e:switch(ot(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),io(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&xn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(r(166));if(e=te.current,Ja(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||Bm(e.nodeValue,n)),e||Un(t,!0)}else e=Xi(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=Ja(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 va(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ve(t),e=!1}else n=gc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ct(t),t):(Ct(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=Ja(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 va(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ve(t),c=!1}else c=gc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Ct(t),t):(Ct(t),null)}return Ct(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),Ri(t,t.updateQueue),Ve(t),null);case 4:return pe(),e===null&&To(t.stateNode.containerInfo),Ve(t),null;case 10:return pn(t.type),Ve(t),null;case 19:if(z(Ke),s=t.memoizedState,s===null)return Ve(t),null;if(c=(t.flags&128)!==0,u=s.rendering,u===null)if(c)ls(s,!1);else{if(Xe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=yi(e),u!==null){for(t.flags|=128,ls(s,!1),e=u.updateQueue,t.updateQueue=e,Ri(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)md(n,e),n=n.sibling;return k(Ke,Ke.current&1|2),Ae&&hn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&tt()>Oi&&(t.flags|=128,c=!0,ls(s,!1),t.lanes=4194304)}else{if(!c)if(e=yi(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,Ri(t,e),ls(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!Ae)return Ve(t),null}else 2*tt()-s.renderingStartTime>Oi&&n!==536870912&&(t.flags|=128,c=!0,ls(s,!1),t.lanes=4194304);s.isBackwards?(u.sibling=t.child,t.child=u):(e=s.last,e!==null?e.sibling=u:t.child=u,s.last=u)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=tt(),e.sibling=null,n=Ke.current,k(Ke,c?n&1|2:n&1),Ae&&hn(t,s.treeForkCount),e):(Ve(t),null);case 22:case 23:return Ct(t),Tc(),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&&Ri(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&&z(Sa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),pn(Fe),Ve(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Ky(e,t){switch(mc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return pn(Fe),pe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return _n(t),null;case 31:if(t.memoizedState!==null){if(Ct(t),t.alternate===null)throw Error(r(340));va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ct(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(Ke),null;case 4:return pe(),null;case 10:return pn(t.type),null;case 22:case 23:return Ct(t),Tc(),e!==null&&z(Sa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return pn(Fe),null;case 25:return null;default:return null}}function Vh(e,t){switch(mc(t),t.tag){case 3:pn(Fe),pe();break;case 26:case 27:case 5:_n(t);break;case 4:pe();break;case 31:t.memoizedState!==null&&Ct(t);break;case 13:Ct(t);break;case 19:z(Ke);break;case 10:pn(t.type);break;case 22:case 23:Ct(t),Tc(),e!==null&&z(Sa);break;case 24:pn(Fe)}}function ss(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,h=n.inst;s=u(),h.destroy=s}n=n.next}while(n!==c)}}catch(x){ke(t,t.return,x)}}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 h=s.inst,x=h.destroy;if(x!==void 0){h.destroy=void 0,c=t;var T=n,U=x;try{U()}catch(Q){ke(c,T,Q)}}}s=s.next}while(s!==u)}}catch(Q){ke(t,t.return,Q)}}function Yh(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{kd(t,n)}catch(s){ke(e,e.return,s)}}}function Gh(e,t,n){n.props=Ea(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){ke(e,t,s)}}function is(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 en(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 Qh(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 ro(e,t,n){try{var s=e.stateNode;pv(s,e.type,n,t),s[vt]=t}catch(c){ke(e,e.return,c)}}function Xh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Pn(e.type)||e.tag===4}function co(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Xh(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&&Pn(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 oo(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=un));else if(s!==4&&(s===27&&Pn(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(oo(e,t,n),e=e.sibling;e!==null;)oo(e,t,n),e=e.sibling}function Mi(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&&Pn(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Mi(e,t,n),e=e.sibling;e!==null;)Mi(e,t,n),e=e.sibling}function $h(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);ot(t,s,n),t[st]=e,t[vt]=n}catch(u){ke(e,e.return,u)}}var bn=!1,We=!1,uo=!1,Kh=typeof WeakSet=="function"?WeakSet:Set,lt=null;function Zy(e,t){if(e=e.containerInfo,ko=Wi,e=sd(e),ac(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 h=0,x=-1,T=-1,U=0,Q=0,F=e,H=null;t:for(;;){for(var Y;F!==n||c!==0&&F.nodeType!==3||(x=h+c),F!==u||s!==0&&F.nodeType!==3||(T=h+s),F.nodeType===3&&(h+=F.nodeValue.length),(Y=F.firstChild)!==null;)H=F,F=Y;for(;;){if(F===e)break t;if(H===n&&++U===c&&(x=h),H===u&&++Q===s&&(T=h),(Y=F.nextSibling)!==null)break;F=H,H=F.parentNode}F=Y}n=x===-1||T===-1?null:{start:x,end:T}}else n=null}n=n||{start:0,end:0}}else n=null;for(_o={focusedElem:e,selectionRange:n},Wi=!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=Ea(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)Bo(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Bo(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 Zh(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:An(e,n),s&4&&ss(5,n);break;case 1:if(An(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(h){ke(n,n.return,h)}else{var c=Ea(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(h){ke(n,n.return,h)}}s&64&&Yh(n),s&512&&is(n,n.return);break;case 3:if(An(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{kd(e,t)}catch(h){ke(n,n.return,h)}}break;case 27:t===null&&s&4&&$h(n);case 26:case 5:An(e,n),t===null&&s&4&&Qh(n),s&512&&is(n,n.return);break;case 12:An(e,n);break;case 31:An(e,n),s&4&&Ih(e,n);break;case 13:An(e,n),s&4&&Wh(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=av.bind(null,n),jv(e,n))));break;case 22:if(s=n.memoizedState!==null||bn,!s){t=t!==null&&t.memoizedState!==null||We,c=bn;var u=We;bn=s,(We=t)&&!u?jn(e,n,(n.subtreeFlags&8772)!==0):An(e,n),bn=c,We=u}break;case 30:break;default:An(e,n)}}function Fh(e){var t=e.alternate;t!==null&&(e.alternate=null,Fh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Hr(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,bt=!1;function Sn(e,t,n){for(n=n.child;n!==null;)Jh(e,t,n),n=n.sibling}function Jh(e,t,n){if(Le&&typeof Le.onCommitFiberUnmount=="function")try{Le.onCommitFiberUnmount($e,n)}catch{}switch(n.tag){case 26:We||en(n,t),Sn(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:We||en(n,t);var s=Ye,c=bt;Pn(n.type)&&(Ye=n.stateNode,bt=!1),Sn(e,t,n),ps(n.stateNode),Ye=s,bt=c;break;case 5:We||en(n,t);case 6:if(s=Ye,c=bt,Ye=null,Sn(e,t,n),Ye=s,bt=c,Ye!==null)if(bt)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&&(bt?(e=Ye,Ym(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),yl(e)):Ym(Ye,n.stateNode));break;case 4:s=Ye,c=bt,Ye=n.stateNode.containerInfo,bt=!0,Sn(e,t,n),Ye=s,bt=c;break;case 0:case 11:case 14:case 15:$n(2,n,t),We||$n(4,n,t),Sn(e,t,n);break;case 1:We||(en(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&Gh(n,t,s)),Sn(e,t,n);break;case 21:Sn(e,t,n);break;case 22:We=(s=We)||n.memoizedState!==null,Sn(e,t,n),We=s;break;default:Sn(e,t,n)}}function Ih(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 Wh(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 Fy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Kh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Kh),t;default:throw Error(r(435,e.tag))}}function ki(e,t){var n=Fy(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=lv.bind(null,e,s);s.then(c,c)}})}function St(e,t){var n=t.deletions;if(n!==null)for(var s=0;s<n.length;s++){var c=n[s],u=e,h=t,x=h;e:for(;x!==null;){switch(x.tag){case 27:if(Pn(x.type)){Ye=x.stateNode,bt=!1;break e}break;case 5:Ye=x.stateNode,bt=!1;break e;case 3:case 4:Ye=x.stateNode.containerInfo,bt=!0;break e}x=x.return}if(Ye===null)throw Error(r(160));Jh(u,h,c),Ye=null,bt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Ph(t,e),t=t.sibling}var $t=null;function Ph(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:St(t,e),At(e),s&4&&($n(3,e,e.return),ss(3,e),$n(5,e,e.return));break;case 1:St(t,e),At(e),s&512&&(We||n===null||en(n,n.return)),s&64&&bn&&(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=$t;if(St(t,e),At(e),s&512&&(We||n===null||en(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[_l]||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"))),ot(u,s,n),u[st]=e,at(u),s=u;break e;case"link":var h=Pm("link","href",c).get(s+(n.href||""));if(h){for(var x=0;x<h.length;x++)if(u=h[x],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)){h.splice(x,1);break t}}u=c.createElement(s),ot(u,s,n),c.head.appendChild(u);break;case"meta":if(h=Pm("meta","content",c).get(s+(n.content||""))){for(x=0;x<h.length;x++)if(u=h[x],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)){h.splice(x,1);break t}}u=c.createElement(s),ot(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 ep(c,e.type,e.stateNode);else e.stateNode=Wm(c,s,e.memoizedProps);else u!==s?(u===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):u.count--,s===null?ep(c,e.type,e.stateNode):Wm(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&ro(e,e.memoizedProps,n.memoizedProps)}break;case 27:St(t,e),At(e),s&512&&(We||n===null||en(n,n.return)),n!==null&&s&4&&ro(e,e.memoizedProps,n.memoizedProps);break;case 5:if(St(t,e),At(e),s&512&&(We||n===null||en(n,n.return)),e.flags&32){c=e.stateNode;try{Ha(c,"")}catch(re){ke(e,e.return,re)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,ro(e,c,n!==null?n.memoizedProps:c)),s&1024&&(uo=!0);break;case 6:if(St(t,e),At(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(Zi=null,c=$t,$t=$i(t.containerInfo),St(t,e),$t=c,At(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{yl(t.containerInfo)}catch(re){ke(e,e.return,re)}uo&&(uo=!1,em(e));break;case 4:s=$t,$t=$i(e.stateNode.containerInfo),St(t,e),At(e),$t=s;break;case 12:St(t,e),At(e);break;case 31:St(t,e),At(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ki(e,s)));break;case 13:St(t,e),At(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Di=tt()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ki(e,s)));break;case 22:c=e.memoizedState!==null;var T=n!==null&&n.memoizedState!==null,U=bn,Q=We;if(bn=U||c,We=Q||T,St(t,e),We=Q,bn=U,At(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||T||bn||We||qa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){T=n=t;try{if(u=T.stateNode,c)h=u.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none";else{x=T.stateNode;var F=T.memoizedProps.style,H=F!=null&&F.hasOwnProperty("display")?F.display:null;x.style.display=H==null||typeof H=="boolean"?"":(""+H).trim()}}catch(re){ke(T,T.return,re)}}}else if(t.tag===6){if(n===null){T=t;try{T.stateNode.nodeValue=c?"":T.memoizedProps}catch(re){ke(T,T.return,re)}}}else if(t.tag===18){if(n===null){T=t;try{var Y=T.stateNode;c?Gm(Y,!0):Gm(T.stateNode,!1)}catch(re){ke(T,T.return,re)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(n=s.retryQueue,n!==null&&(s.retryQueue=null,ki(e,n))));break;case 19:St(t,e),At(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,ki(e,s)));break;case 30:break;case 21:break;default:St(t,e),At(e)}}function At(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(Xh(s)){n=s;break}s=s.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var c=n.stateNode,u=co(e);Mi(e,u,c);break;case 5:var h=n.stateNode;n.flags&32&&(Ha(h,""),n.flags&=-33);var x=co(e);Mi(e,x,h);break;case 3:case 4:var T=n.stateNode.containerInfo,U=co(e);oo(e,U,T);break;default:throw Error(r(161))}}catch(Q){ke(e,e.return,Q)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function em(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;em(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function An(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Zh(e,t.alternate,t),t=t.sibling}function qa(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),qa(t);break;case 1:en(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Gh(t,t.return,n),qa(t);break;case 27:ps(t.stateNode);case 26:case 5:en(t,t.return),qa(t);break;case 22:t.memoizedState===null&&qa(t);break;case 30:qa(t);break;default:qa(t)}e=e.sibling}}function jn(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,c=e,u=t,h=u.flags;switch(u.tag){case 0:case 11:case 15:jn(c,u,n),ss(4,u);break;case 1:if(jn(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 x=s.stateNode;try{var T=c.shared.hiddenCallbacks;if(T!==null)for(c.shared.hiddenCallbacks=null,c=0;c<T.length;c++)Md(T[c],x)}catch(U){ke(s,s.return,U)}}n&&h&64&&Yh(u),is(u,u.return);break;case 27:$h(u);case 26:case 5:jn(c,u,n),n&&s===null&&h&4&&Qh(u),is(u,u.return);break;case 12:jn(c,u,n);break;case 31:jn(c,u,n),n&&h&4&&Ih(c,u);break;case 13:jn(c,u,n),n&&h&4&&Wh(c,u);break;case 22:u.memoizedState===null&&jn(c,u,n),is(u,u.return);break;case 30:break;default:jn(c,u,n)}t=t.sibling}}function fo(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&&$l(n))}function ho(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&$l(e))}function Kt(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)tm(e,t,n,s),t=t.sibling}function tm(e,t,n,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Kt(e,t,n,s),c&2048&&ss(9,t);break;case 1:Kt(e,t,n,s);break;case 3:Kt(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&&$l(e)));break;case 12:if(c&2048){Kt(e,t,n,s),e=t.stateNode;try{var u=t.memoizedProps,h=u.id,x=u.onPostCommit;typeof x=="function"&&x(h,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(T){ke(t,t.return,T)}}else Kt(e,t,n,s);break;case 31:Kt(e,t,n,s);break;case 13:Kt(e,t,n,s);break;case 23:break;case 22:u=t.stateNode,h=t.alternate,t.memoizedState!==null?u._visibility&2?Kt(e,t,n,s):rs(e,t):u._visibility&2?Kt(e,t,n,s):(u._visibility|=2,il(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&fo(h,t);break;case 24:Kt(e,t,n,s),c&2048&&ho(t.alternate,t);break;default:Kt(e,t,n,s)}}function il(e,t,n,s,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,h=t,x=n,T=s,U=h.flags;switch(h.tag){case 0:case 11:case 15:il(u,h,x,T,c),ss(8,h);break;case 23:break;case 22:var Q=h.stateNode;h.memoizedState!==null?Q._visibility&2?il(u,h,x,T,c):rs(u,h):(Q._visibility|=2,il(u,h,x,T,c)),c&&U&2048&&fo(h.alternate,h);break;case 24:il(u,h,x,T,c),c&&U&2048&&ho(h.alternate,h);break;default:il(u,h,x,T,c)}t=t.sibling}}function rs(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:rs(n,s),c&2048&&fo(s.alternate,s);break;case 24:rs(n,s),c&2048&&ho(s.alternate,s);break;default:rs(n,s)}t=t.sibling}}var cs=8192;function rl(e,t,n){if(e.subtreeFlags&cs)for(e=e.child;e!==null;)nm(e,t,n),e=e.sibling}function nm(e,t,n){switch(e.tag){case 26:rl(e,t,n),e.flags&cs&&e.memoizedState!==null&&Ov(n,$t,e.memoizedState,e.memoizedProps);break;case 5:rl(e,t,n);break;case 3:case 4:var s=$t;$t=$i(e.stateNode.containerInfo),rl(e,t,n),$t=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=cs,cs=16777216,rl(e,t,n),cs=s):rl(e,t,n));break;default:rl(e,t,n)}}function am(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 os(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,sm(s,e)}am(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)lm(e),e=e.sibling}function lm(e){switch(e.tag){case 0:case 11:case 15:os(e),e.flags&2048&&$n(9,e,e.return);break;case 3:os(e);break;case 12:os(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,_i(e)):os(e);break;default:os(e)}}function _i(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var s=t[n];lt=s,sm(s,e)}am(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:$n(8,t,t.return),_i(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,_i(t));break;default:_i(t)}e=e.sibling}}function sm(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:$l(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(Fh(s),s===n){lt=null;break e}if(c!==null){c.return=u,lt=c;break e}lt=u}}}var Jy={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}},Iy=typeof WeakMap=="function"?WeakMap:Map,Re=0,ze=null,ve=null,be=0,Me=0,Tt=null,Kn=!1,cl=!1,mo=!1,Nn=0,Xe=0,Zn=0,Ca=0,po=0,Rt=0,ol=0,us=null,jt=null,go=!1,Di=0,im=0,Oi=1/0,Bi=null,Fn=null,nt=0,Jn=null,ul=null,wn=0,yo=0,vo=null,rm=null,fs=0,xo=null;function Mt(){return(Re&2)!==0&&be!==0?be&-be:B.T!==null?wo():jf()}function cm(){if(Rt===0)if((be&536870912)===0||Ae){var e=Qs;Qs<<=1,(Qs&3932160)===0&&(Qs=262144),Rt=e}else Rt=536870912;return e=qt.current,e!==null&&(e.flags|=32),Rt}function Nt(e,t,n){(e===ze&&(Me===2||Me===9)||e.cancelPendingCommit!==null)&&(fl(e,0),In(e,be,Rt,!1)),kl(e,n),((Re&2)===0||e!==ze)&&(e===ze&&((Re&2)===0&&(Ca|=n),Xe===4&&In(e,be,Rt,!1)),tn(e))}function om(e,t,n){if((Re&6)!==0)throw Error(r(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Ml(e,t),c=s?ev(e,t):So(e,t,!0),u=s;do{if(c===0){cl&&!s&&In(e,t,0,!1);break}else{if(n=e.current.alternate,u&&!Wy(n)){c=So(e,t,!1),u=!1;continue}if(c===2){if(u=t,e.errorRecoveryDisabledLanes&u)var h=0;else h=e.pendingLanes&-536870913,h=h!==0?h:h&536870912?536870912:0;if(h!==0){t=h;e:{var x=e;c=us;var T=x.current.memoizedState.isDehydrated;if(T&&(fl(x,h).flags|=256),h=So(x,h,!1),h!==2){if(mo&&!T){x.errorRecoveryDisabledLanes|=u,Ca|=u,c=4;break e}u=jt,jt=c,u!==null&&(jt===null?jt=u:jt.push.apply(jt,u))}c=h}if(u=!1,c!==2)continue}}if(c===1){fl(e,0),In(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:In(s,t,Rt,!Kn);break e;case 2:jt=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(c=Di+300-tt(),10<c)){if(In(s,t,Rt,!Kn),$s(s,0,!0)!==0)break e;wn=t,s.timeoutHandle=Hm(um.bind(null,s,n,jt,Bi,go,t,Rt,Ca,ol,Kn,u,"Throttled",-0,0),c);break e}um(s,n,jt,Bi,go,t,Rt,Ca,ol,Kn,u,null,-0,0)}}break}while(!0);tn(e)}function um(e,t,n,s,c,u,h,x,T,U,Q,F,H,Y){if(e.timeoutHandle=-1,F=t.subtreeFlags,F&8192||(F&16785408)===16785408){F={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:un},nm(t,u,F);var re=(u&62914560)===u?Di-tt():(u&4194048)===u?im-tt():0;if(re=Bv(F,re),re!==null){wn=u,e.cancelPendingCommit=re(vm.bind(null,e,t,u,n,s,c,h,x,T,Q,F,null,H,Y)),In(e,u,h,!U);return}}vm(e,t,u,n,s,c,h,x,T)}function Wy(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(!wt(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 In(e,t,n,s){t&=~po,t&=~Ca,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var u=31-qe(c),h=1<<u;s[u]=-1,c&=~h}n!==0&&bf(e,n,t)}function zi(){return(Re&6)===0?(ds(0),!1):!0}function bo(){if(ve!==null){if(Me===0)var e=ve.return;else e=ve,mn=xa=null,Oc(e),tl=null,Zl=0,e=ve;for(;e!==null;)Vh(e.alternate,e),e=e.return;ve=null}}function fl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,vv(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),wn=0,bo(),ze=e,ve=n=dn(e.current,null),be=t,Me=0,Tt=null,Kn=!1,cl=Ml(e,t),mo=!1,ol=Rt=po=Ca=Zn=Xe=0,jt=us=null,go=!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-qe(s),u=1<<c;t|=e[c],s&=~u}return Nn=t,li(),n}function fm(e,t){ge=null,B.H=ns,t===el||t===di?(t=qd(),Me=3):t===jc?(t=qd(),Me=4):Me=t===Ic?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Tt=t,ve===null&&(Xe=1,Ei(e,Bt(t,e.current)))}function dm(){var e=qt.current;return e===null?!0:(be&4194048)===be?Ht===null:(be&62914560)===be||(be&536870912)!==0?e===Ht:!1}function hm(){var e=B.H;return B.H=ns,e===null?ns:e}function mm(){var e=B.A;return B.A=Jy,e}function Li(){Xe=4,Kn||(be&4194048)!==be&&qt.current!==null||(cl=!0),(Zn&134217727)===0&&(Ca&134217727)===0||ze===null||In(ze,be,Rt,!1)}function So(e,t,n){var s=Re;Re|=2;var c=hm(),u=mm();(ze!==e||be!==t)&&(Bi=null,fl(e,t)),t=!1;var h=Xe;e:do try{if(Me!==0&&ve!==null){var x=ve,T=Tt;switch(Me){case 8:bo(),h=6;break e;case 3:case 2:case 9:case 6:qt.current===null&&(t=!0);var U=Me;if(Me=0,Tt=null,dl(e,x,T,U),n&&cl){h=0;break e}break;default:U=Me,Me=0,Tt=null,dl(e,x,T,U)}}Py(),h=Xe;break}catch(Q){fm(e,Q)}while(!0);return t&&e.shellSuspendCounter++,mn=xa=null,Re=s,B.H=c,B.A=u,ve===null&&(ze=null,be=0,li()),h}function Py(){for(;ve!==null;)pm(ve)}function ev(e,t){var n=Re;Re|=2;var s=hm(),c=mm();ze!==e||be!==t?(Bi=null,Oi=tt()+500,fl(e,t)):cl=Ml(e,t);e:do try{if(Me!==0&&ve!==null){t=ve;var u=Tt;t:switch(Me){case 1:Me=0,Tt=null,dl(e,t,u,1);break;case 2:case 9:if(wd(u)){Me=0,Tt=null,gm(t);break}t=function(){Me!==2&&Me!==9||ze!==e||(Me=7),tn(e)},u.then(t,t);break e;case 3:Me=7;break e;case 4:Me=5;break e;case 7:wd(u)?(Me=0,Tt=null,gm(t)):(Me=0,Tt=null,dl(e,t,u,7));break;case 5:var h=null;switch(ve.tag){case 26:h=ve.memoizedState;case 5:case 27:var x=ve;if(h?tp(h):x.stateNode.complete){Me=0,Tt=null;var T=x.sibling;if(T!==null)ve=T;else{var U=x.return;U!==null?(ve=U,Ui(U)):ve=null}break t}}Me=0,Tt=null,dl(e,t,u,5);break;case 6:Me=0,Tt=null,dl(e,t,u,6);break;case 8:bo(),Xe=6;break e;default:throw Error(r(462))}}tv();break}catch(Q){fm(e,Q)}while(!0);return mn=xa=null,B.H=s,B.A=c,Re=n,ve!==null?0:(ze=null,be=0,li(),Xe)}function tv(){for(;ve!==null&&!ka();)pm(ve)}function pm(e){var t=Uh(e.alternate,e,Nn);e.memoizedProps=e.pendingProps,t===null?Ui(e):ve=t}function gm(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=_h(n,t,t.pendingProps,t.type,void 0,be);break;case 11:t=_h(n,t,t.pendingProps,t.type.render,t.ref,be);break;case 5:Oc(t);default:Vh(n,t),t=ve=md(t,Nn),t=Uh(n,t,Nn)}e.memoizedProps=e.pendingProps,t===null?Ui(e):ve=t}function dl(e,t,n,s){mn=xa=null,Oc(t),tl=null,Zl=0;var c=t.return;try{if(Gy(e,c,t,n,be)){Xe=1,Ei(e,Bt(n,e.current)),ve=null;return}}catch(u){if(c!==null)throw ve=c,u;Xe=1,Ei(e,Bt(n,e.current)),ve=null;return}t.flags&32768?(Ae||s===1?e=!0:cl||(be&536870912)!==0?e=!1:(Kn=e=!0,(s===2||s===9||s===3||s===6)&&(s=qt.current,s!==null&&s.tag===13&&(s.flags|=16384))),ym(t,e)):Ui(t)}function Ui(e){var t=e;do{if((t.flags&32768)!==0){ym(t,Kn);return}e=t.return;var n=$y(t.alternate,t,Nn);if(n!==null){ve=n;return}if(t=t.sibling,t!==null){ve=t;return}ve=t=e}while(t!==null);Xe===0&&(Xe=5)}function ym(e,t){do{var n=Ky(e.alternate,e);if(n!==null){n.flags&=32767,ve=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ve=e;return}ve=e=n}while(e!==null);Xe=6,ve=null}function vm(e,t,n,s,c,u,h,x,T){e.cancelPendingCommit=null;do Hi();while(nt!==0);if((Re&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(u=t.lanes|t.childLanes,u|=cc,Dg(e,n,u,h,x,T),e===ze&&(ve=ze=null,be=0),ul=t,Jn=e,wn=n,yo=u,vo=c,rm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,sv(_a,function(){return jm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=B.T,B.T=null,c=W.p,W.p=2,h=Re,Re|=4;try{Zy(e,t,n)}finally{Re=h,W.p=c,B.T=s}}nt=1,xm(),bm(),Sm()}}function xm(){if(nt===1){nt=0;var e=Jn,t=ul,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=B.T,B.T=null;var s=W.p;W.p=2;var c=Re;Re|=4;try{Ph(t,e);var u=_o,h=sd(e.containerInfo),x=u.focusedElem,T=u.selectionRange;if(h!==x&&x&&x.ownerDocument&&ld(x.ownerDocument.documentElement,x)){if(T!==null&&ac(x)){var U=T.start,Q=T.end;if(Q===void 0&&(Q=U),"selectionStart"in x)x.selectionStart=U,x.selectionEnd=Math.min(Q,x.value.length);else{var F=x.ownerDocument||document,H=F&&F.defaultView||window;if(H.getSelection){var Y=H.getSelection(),re=x.textContent.length,he=Math.min(T.start,re),Be=T.end===void 0?he:Math.min(T.end,re);!Y.extend&&he>Be&&(h=Be,Be=he,he=h);var O=ad(x,he),M=ad(x,Be);if(O&&M&&(Y.rangeCount!==1||Y.anchorNode!==O.node||Y.anchorOffset!==O.offset||Y.focusNode!==M.node||Y.focusOffset!==M.offset)){var L=F.createRange();L.setStart(O.node,O.offset),Y.removeAllRanges(),he>Be?(Y.addRange(L),Y.extend(M.node,M.offset)):(L.setEnd(M.node,M.offset),Y.addRange(L))}}}}for(F=[],Y=x;Y=Y.parentNode;)Y.nodeType===1&&F.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<F.length;x++){var $=F[x];$.element.scrollLeft=$.left,$.element.scrollTop=$.top}}Wi=!!ko,_o=ko=null}finally{Re=c,W.p=s,B.T=n}}e.current=t,nt=2}}function bm(){if(nt===2){nt=0;var e=Jn,t=ul,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=B.T,B.T=null;var s=W.p;W.p=2;var c=Re;Re|=4;try{Zh(e,t.alternate,t)}finally{Re=c,W.p=s,B.T=n}}nt=3}}function Sm(){if(nt===4||nt===3){nt=0,Cl();var e=Jn,t=ul,n=wn,s=rm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?nt=5:(nt=0,ul=Jn=null,Am(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Fn=null),Lr(n),t=t.stateNode,Le&&typeof Le.onCommitFiberRoot=="function")try{Le.onCommitFiberRoot($e,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=B.T,c=W.p,W.p=2,B.T=null;try{for(var u=e.onRecoverableError,h=0;h<s.length;h++){var x=s[h];u(x.value,{componentStack:x.stack})}}finally{B.T=t,W.p=c}}(wn&3)!==0&&Hi(),tn(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===xo?fs++:(fs=0,xo=e):fs=0,ds(0)}}function Am(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,$l(t)))}function Hi(){return xm(),bm(),Sm(),jm()}function jm(){if(nt!==5)return!1;var e=Jn,t=yo;yo=0;var n=Lr(wn),s=B.T,c=W.p;try{W.p=32>n?32:n,B.T=null,n=vo,vo=null;var u=Jn,h=wn;if(nt=0,ul=Jn=null,wn=0,(Re&6)!==0)throw Error(r(331));var x=Re;if(Re|=4,lm(u.current),tm(u,u.current,h,n),Re=x,ds(0,!1),Le&&typeof Le.onPostCommitFiberRoot=="function")try{Le.onPostCommitFiberRoot($e,u)}catch{}return!0}finally{W.p=c,B.T=s,Am(e,t)}}function Nm(e,t,n){t=Bt(n,t),t=Jc(e.stateNode,t,2),e=Gn(e,t,2),e!==null&&(kl(e,2),tn(e))}function ke(e,t,n){if(e.tag===3)Nm(e,e,n);else for(;t!==null;){if(t.tag===3){Nm(t,e,n);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Fn===null||!Fn.has(s))){e=Bt(n,e),n=wh(2),s=Gn(t,n,2),s!==null&&(Eh(n,s,t,e),kl(s,2),tn(s));break}}t=t.return}}function Ao(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Iy;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)||(mo=!0,c.add(n),e=nv.bind(null,e,t,n),t.then(e,e))}function nv(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ze===e&&(be&n)===n&&(Xe===4||Xe===3&&(be&62914560)===be&&300>tt()-Di?(Re&2)===0&&fl(e,0):po|=n,ol===be&&(ol=0)),tn(e)}function wm(e,t){t===0&&(t=xf()),e=ga(e,t),e!==null&&(kl(e,t),tn(e))}function av(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),wm(e,n)}function lv(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),wm(e,n)}function sv(e,t){return oa(e,t)}var Vi=null,hl=null,jo=!1,Yi=!1,No=!1,Wn=0;function tn(e){e!==hl&&e.next===null&&(hl===null?Vi=hl=e:hl=hl.next=e),Yi=!0,jo||(jo=!0,rv())}function ds(e,t){if(!No&&Yi){No=!0;do for(var n=!1,s=Vi;s!==null;){if(e!==0){var c=s.pendingLanes;if(c===0)var u=0;else{var h=s.suspendedLanes,x=s.pingedLanes;u=(1<<31-qe(42|e)+1)-1,u&=c&~(h&~x),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,Tm(s,u))}else u=be,u=$s(s,s===ze?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||Ml(s,u)||(n=!0,Tm(s,u));s=s.next}while(n);No=!1}}function iv(){Em()}function Em(){Yi=jo=!1;var e=0;Wn!==0&&yv()&&(e=Wn);for(var t=tt(),n=null,s=Vi;s!==null;){var c=s.next,u=qm(s,t);u===0?(s.next=null,n===null?Vi=c:n.next=c,c===null&&(hl=n)):(n=s,(e!==0||(u&3)!==0)&&(Yi=!0)),s=c}nt!==0&&nt!==5||ds(e),Wn!==0&&(Wn=0)}function qm(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var h=31-qe(u),x=1<<h,T=c[h];T===-1?((x&n)===0||(x&s)!==0)&&(c[h]=_g(x,t)):T<=t&&(e.expiredLanes|=x),u&=~x}if(t=ze,n=be,n=$s(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(Me===2||Me===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&cn(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Ml(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&cn(s),Lr(n)){case 2:case 8:n=Rl;break;case 32:n=_a;break;case 268435456:n=Vs;break;default:n=_a}return s=Cm.bind(null,e),n=oa(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&cn(s),e.callbackPriority=2,e.callbackNode=null,2}function Cm(e,t){if(nt!==0&&nt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Hi()&&e.callbackNode!==n)return null;var s=be;return s=$s(e,e===ze?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(om(e,s,t),qm(e,tt()),e.callbackNode!=null&&e.callbackNode===n?Cm.bind(null,e):null)}function Tm(e,t){if(Hi())return null;om(e,t,!0)}function rv(){xv(function(){(Re&6)!==0?oa(ua,iv):Em()})}function wo(){if(Wn===0){var e=Wa;e===0&&(e=Gs,Gs<<=1,(Gs&261888)===0&&(Gs=256)),Wn=e}return Wn}function Rm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Js(""+e)}function Mm(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 cv(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var u=Rm((c[vt]||null).action),h=s.submitter;h&&(t=(t=h[vt]||null)?Rm(t.formAction):h.getAttribute("formAction"),t!==null&&(u=t,h=null));var x=new ei("action","action",null,s,c);e.push({event:x,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Wn!==0){var T=h?Mm(c,h):new FormData(c);Qc(n,{pending:!0,data:T,method:c.method,action:u},null,T)}}else typeof u=="function"&&(x.preventDefault(),T=h?Mm(c,h):new FormData(c),Qc(n,{pending:!0,data:T,method:c.method,action:u},u,T))},currentTarget:c}]})}}for(var Eo=0;Eo<rc.length;Eo++){var qo=rc[Eo],ov=qo.toLowerCase(),uv=qo[0].toUpperCase()+qo.slice(1);Xt(ov,"on"+uv)}Xt(cd,"onAnimationEnd"),Xt(od,"onAnimationIteration"),Xt(ud,"onAnimationStart"),Xt("dblclick","onDoubleClick"),Xt("focusin","onFocus"),Xt("focusout","onBlur"),Xt(Ey,"onTransitionRun"),Xt(qy,"onTransitionStart"),Xt(Cy,"onTransitionCancel"),Xt(fd,"onTransitionEnd"),La("onMouseEnter",["mouseout","mouseover"]),La("onMouseLeave",["mouseout","mouseover"]),La("onPointerEnter",["pointerout","pointerover"]),La("onPointerLeave",["pointerout","pointerover"]),da("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),da("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),da("onBeforeInput",["compositionend","keypress","textInput","paste"]),da("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),da("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),da("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),fv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(hs));function km(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 h=s.length-1;0<=h;h--){var x=s[h],T=x.instance,U=x.currentTarget;if(x=x.listener,T!==u&&c.isPropagationStopped())break e;u=x,c.currentTarget=U;try{u(c)}catch(Q){ai(Q)}c.currentTarget=null,u=T}else for(h=0;h<s.length;h++){if(x=s[h],T=x.instance,U=x.currentTarget,x=x.listener,T!==u&&c.isPropagationStopped())break e;u=x,c.currentTarget=U;try{u(c)}catch(Q){ai(Q)}c.currentTarget=null,u=T}}}}function xe(e,t){var n=t[Ur];n===void 0&&(n=t[Ur]=new Set);var s=e+"__bubble";n.has(s)||(_m(t,e,2,!1),n.add(s))}function Co(e,t,n){var s=0;t&&(s|=4),_m(n,e,s,t)}var Gi="_reactListening"+Math.random().toString(36).slice(2);function To(e){if(!e[Gi]){e[Gi]=!0,Ef.forEach(function(n){n!=="selectionchange"&&(fv.has(n)||Co(n,!1,e),Co(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Gi]||(t[Gi]=!0,Co("selectionchange",!1,t))}}function _m(e,t,n,s){switch(cp(t)){case 2:var c=Uv;break;case 8:c=Hv;break;default:c=Qo}n=c.bind(null,t,n,e),c=void 0,!Zr||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 Ro(e,t,n,s,c){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var h=s.tag;if(h===3||h===4){var x=s.stateNode.containerInfo;if(x===c)break;if(h===4)for(h=s.return;h!==null;){var T=h.tag;if((T===3||T===4)&&h.stateNode.containerInfo===c)return;h=h.return}for(;x!==null;){if(h=Oa(x),h===null)return;if(T=h.tag,T===5||T===6||T===26||T===27){s=u=h;continue e}x=x.parentNode}}s=s.return}Lf(function(){var U=u,Q=$r(n),F=[];e:{var H=dd.get(e);if(H!==void 0){var Y=ei,re=e;switch(e){case"keypress":if(Ws(n)===0)break e;case"keydown":case"keyup":Y=ly;break;case"focusin":re="focus",Y=Wr;break;case"focusout":re="blur",Y=Wr;break;case"beforeblur":case"afterblur":Y=Wr;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":Y=Vf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=$g;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=ry;break;case cd:case od:case ud:Y=Fg;break;case fd:Y=oy;break;case"scroll":case"scrollend":Y=Qg;break;case"wheel":Y=fy;break;case"copy":case"cut":case"paste":Y=Ig;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=Gf;break;case"toggle":case"beforetoggle":Y=hy}var he=(t&4)!==0,Be=!he&&(e==="scroll"||e==="scrollend"),O=he?H!==null?H+"Capture":null:H;he=[];for(var M=U,L;M!==null;){var $=M;if(L=$.stateNode,$=$.tag,$!==5&&$!==26&&$!==27||L===null||O===null||($=Ol(M,O),$!=null&&he.push(ms(M,$,L))),Be)break;M=M.return}0<he.length&&(H=new Y(H,re,null,n,Q),F.push({event:H,listeners:he}))}}if((t&7)===0){e:{if(H=e==="mouseover"||e==="pointerover",Y=e==="mouseout"||e==="pointerout",H&&n!==Xr&&(re=n.relatedTarget||n.fromElement)&&(Oa(re)||re[Da]))break e;if((Y||H)&&(H=Q.window===Q?Q:(H=Q.ownerDocument)?H.defaultView||H.parentWindow:window,Y?(re=n.relatedTarget||n.toElement,Y=U,re=re?Oa(re):null,re!==null&&(Be=d(re),he=re.tag,re!==Be||he!==5&&he!==27&&he!==6)&&(re=null)):(Y=null,re=U),Y!==re)){if(he=Vf,$="onMouseLeave",O="onMouseEnter",M="mouse",(e==="pointerout"||e==="pointerover")&&(he=Gf,$="onPointerLeave",O="onPointerEnter",M="pointer"),Be=Y==null?H:Dl(Y),L=re==null?H:Dl(re),H=new he($,M+"leave",Y,n,Q),H.target=Be,H.relatedTarget=L,$=null,Oa(Q)===U&&(he=new he(O,M+"enter",re,n,Q),he.target=L,he.relatedTarget=Be,$=he),Be=$,Y&&re)t:{for(he=dv,O=Y,M=re,L=0,$=O;$;$=he($))L++;$=0;for(var de=M;de;de=he(de))$++;for(;0<L-$;)O=he(O),L--;for(;0<$-L;)M=he(M),$--;for(;L--;){if(O===M||M!==null&&O===M.alternate){he=O;break t}O=he(O),M=he(M)}he=null}else he=null;Y!==null&&Dm(F,H,Y,he,!1),re!==null&&Be!==null&&Dm(F,Be,re,he,!0)}}e:{if(H=U?Dl(U):window,Y=H.nodeName&&H.nodeName.toLowerCase(),Y==="select"||Y==="input"&&H.type==="file")var Ce=If;else if(Ff(H))if(Wf)Ce=jy;else{Ce=Sy;var oe=by}else Y=H.nodeName,!Y||Y.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?U&&Qr(U.elementType)&&(Ce=If):Ce=Ay;if(Ce&&(Ce=Ce(e,U))){Jf(F,Ce,n,Q);break e}oe&&oe(e,H,U),e==="focusout"&&U&&H.type==="number"&&U.memoizedProps.value!=null&&Gr(H,"number",H.value)}switch(oe=U?Dl(U):window,e){case"focusin":(Ff(oe)||oe.contentEditable==="true")&&(Qa=oe,lc=U,Gl=null);break;case"focusout":Gl=lc=Qa=null;break;case"mousedown":sc=!0;break;case"contextmenu":case"mouseup":case"dragend":sc=!1,id(F,n,Q);break;case"selectionchange":if(wy)break;case"keydown":case"keyup":id(F,n,Q)}var ye;if(ec)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?Kf(e,n)&&(Se="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Se="onCompositionStart");Se&&(Qf&&n.locale!=="ko"&&(Ga||Se!=="onCompositionStart"?Se==="onCompositionEnd"&&Ga&&(ye=Uf()):(Bn=Q,Fr="value"in Bn?Bn.value:Bn.textContent,Ga=!0)),oe=Qi(U,Se),0<oe.length&&(Se=new Yf(Se,e,null,n,Q),F.push({event:Se,listeners:oe}),ye?Se.data=ye:(ye=Zf(n),ye!==null&&(Se.data=ye)))),(ye=py?gy(e,n):yy(e,n))&&(Se=Qi(U,"onBeforeInput"),0<Se.length&&(oe=new Yf("onBeforeInput","beforeinput",null,n,Q),F.push({event:oe,listeners:Se}),oe.data=ye)),cv(F,e,U,n,Q)}km(F,t)})}function ms(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Qi(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=Ol(e,n),c!=null&&s.unshift(ms(e,c,u)),c=Ol(e,t),c!=null&&s.push(ms(e,c,u))),e.tag===3)return s;e=e.return}return[]}function dv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dm(e,t,n,s,c){for(var u=t._reactName,h=[];n!==null&&n!==s;){var x=n,T=x.alternate,U=x.stateNode;if(x=x.tag,T!==null&&T===s)break;x!==5&&x!==26&&x!==27||U===null||(T=U,c?(U=Ol(n,u),U!=null&&h.unshift(ms(n,U,T))):c||(U=Ol(n,u),U!=null&&h.push(ms(n,U,T)))),n=n.return}h.length!==0&&e.push({event:t,listeners:h})}var hv=/\r\n?/g,mv=/\u0000|\uFFFD/g;function Om(e){return(typeof e=="string"?e:""+e).replace(hv,`
|
||
`).replace(mv,"")}function Bm(e,t){return t=Om(t),Om(e)===t}function Oe(e,t,n,s,c,u){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Ha(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Ha(e,""+s);break;case"className":Zs(e,"class",s);break;case"tabIndex":Zs(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Zs(e,n,s);break;case"style":Bf(e,s,u);break;case"data":if(t!=="object"){Zs(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=Js(""+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=Js(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=un);break;case"onScroll":s!=null&&xe("scroll",e);break;case"onScrollEnd":s!=null&&xe("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=Js(""+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":xe("beforetoggle",e),xe("toggle",e),Ks(e,"popover",s);break;case"xlinkActuate":on(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":on(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":on(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":on(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":on(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":on(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":on(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":on(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":on(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Ks(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=Yg.get(n)||n,Ks(e,n,s))}}function Mo(e,t,n,s,c,u){switch(n){case"style":Bf(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"?Ha(e,s):(typeof s=="number"||typeof s=="bigint")&&Ha(e,""+s);break;case"onScroll":s!=null&&xe("scroll",e);break;case"onScrollEnd":s!=null&&xe("scrollend",e);break;case"onClick":s!=null&&(e.onclick=un);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!qf.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[vt]||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,""):Ks(e,n,s)}}}function ot(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":xe("error",e),xe("load",e);var s=!1,c=!1,u;for(u in n)if(n.hasOwnProperty(u)){var h=n[u];if(h!=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,h,n,null)}}c&&Oe(e,t,"srcSet",n.srcSet,n,null),s&&Oe(e,t,"src",n.src,n,null);return;case"input":xe("invalid",e);var x=u=h=c=null,T=null,U=null;for(s in n)if(n.hasOwnProperty(s)){var Q=n[s];if(Q!=null)switch(s){case"name":c=Q;break;case"type":h=Q;break;case"checked":T=Q;break;case"defaultChecked":U=Q;break;case"value":u=Q;break;case"defaultValue":x=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(r(137,t));break;default:Oe(e,t,s,Q,n,null)}}kf(e,u,x,T,U,h,c,!1);return;case"select":xe("invalid",e),s=h=u=null;for(c in n)if(n.hasOwnProperty(c)&&(x=n[c],x!=null))switch(c){case"value":u=x;break;case"defaultValue":h=x;break;case"multiple":s=x;default:Oe(e,t,c,x,n,null)}t=u,n=h,e.multiple=!!s,t!=null?Ua(e,!!s,t,!1):n!=null&&Ua(e,!!s,n,!0);return;case"textarea":xe("invalid",e),u=c=s=null;for(h in n)if(n.hasOwnProperty(h)&&(x=n[h],x!=null))switch(h){case"value":s=x;break;case"defaultValue":c=x;break;case"children":u=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:Oe(e,t,h,x,n,null)}Df(e,s,c,u);return;case"option":for(T in n)if(n.hasOwnProperty(T)&&(s=n[T],s!=null))switch(T){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Oe(e,t,T,s,n,null)}return;case"dialog":xe("beforetoggle",e),xe("toggle",e),xe("cancel",e),xe("close",e);break;case"iframe":case"object":xe("load",e);break;case"video":case"audio":for(s=0;s<hs.length;s++)xe(hs[s],e);break;case"image":xe("error",e),xe("load",e);break;case"details":xe("toggle",e);break;case"embed":case"source":case"link":xe("error",e),xe("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(Qr(t)){for(Q in n)n.hasOwnProperty(Q)&&(s=n[Q],s!==void 0&&Mo(e,t,Q,s,n,void 0));return}}for(x in n)n.hasOwnProperty(x)&&(s=n[x],s!=null&&Oe(e,t,x,s,n,null))}function pv(e,t,n,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,h=null,x=null,T=null,U=null,Q=null;for(Y in n){var F=n[Y];if(n.hasOwnProperty(Y)&&F!=null)switch(Y){case"checked":break;case"value":break;case"defaultValue":T=F;default:s.hasOwnProperty(Y)||Oe(e,t,Y,null,s,F)}}for(var H in s){var Y=s[H];if(F=n[H],s.hasOwnProperty(H)&&(Y!=null||F!=null))switch(H){case"type":u=Y;break;case"name":c=Y;break;case"checked":U=Y;break;case"defaultChecked":Q=Y;break;case"value":h=Y;break;case"defaultValue":x=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(137,t));break;default:Y!==F&&Oe(e,t,H,Y,s,F)}}Yr(e,h,x,T,U,Q,u,c);return;case"select":Y=h=x=H=null;for(u in n)if(T=n[u],n.hasOwnProperty(u)&&T!=null)switch(u){case"value":break;case"multiple":Y=T;default:s.hasOwnProperty(u)||Oe(e,t,u,null,s,T)}for(c in s)if(u=s[c],T=n[c],s.hasOwnProperty(c)&&(u!=null||T!=null))switch(c){case"value":H=u;break;case"defaultValue":x=u;break;case"multiple":h=u;default:u!==T&&Oe(e,t,c,u,s,T)}t=x,n=h,s=Y,H!=null?Ua(e,!!n,H,!1):!!s!=!!n&&(t!=null?Ua(e,!!n,t,!0):Ua(e,!!n,n?[]:"",!1));return;case"textarea":Y=H=null;for(x in n)if(c=n[x],n.hasOwnProperty(x)&&c!=null&&!s.hasOwnProperty(x))switch(x){case"value":break;case"children":break;default:Oe(e,t,x,null,s,c)}for(h in s)if(c=s[h],u=n[h],s.hasOwnProperty(h)&&(c!=null||u!=null))switch(h){case"value":H=c;break;case"defaultValue":Y=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(r(91));break;default:c!==u&&Oe(e,t,h,c,s,u)}_f(e,H,Y);return;case"option":for(var re in n)if(H=n[re],n.hasOwnProperty(re)&&H!=null&&!s.hasOwnProperty(re))switch(re){case"selected":e.selected=!1;break;default:Oe(e,t,re,null,s,H)}for(T in s)if(H=s[T],Y=n[T],s.hasOwnProperty(T)&&H!==Y&&(H!=null||Y!=null))switch(T){case"selected":e.selected=H&&typeof H!="function"&&typeof H!="symbol";break;default:Oe(e,t,T,H,s,Y)}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)H=n[he],n.hasOwnProperty(he)&&H!=null&&!s.hasOwnProperty(he)&&Oe(e,t,he,null,s,H);for(U in s)if(H=s[U],Y=n[U],s.hasOwnProperty(U)&&H!==Y&&(H!=null||Y!=null))switch(U){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(r(137,t));break;default:Oe(e,t,U,H,s,Y)}return;default:if(Qr(t)){for(var Be in n)H=n[Be],n.hasOwnProperty(Be)&&H!==void 0&&!s.hasOwnProperty(Be)&&Mo(e,t,Be,void 0,s,H);for(Q in s)H=s[Q],Y=n[Q],!s.hasOwnProperty(Q)||H===Y||H===void 0&&Y===void 0||Mo(e,t,Q,H,s,Y);return}}for(var O in n)H=n[O],n.hasOwnProperty(O)&&H!=null&&!s.hasOwnProperty(O)&&Oe(e,t,O,null,s,H);for(F in s)H=s[F],Y=n[F],!s.hasOwnProperty(F)||H===Y||H==null&&Y==null||Oe(e,t,F,H,s,Y)}function zm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function gv(){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,h=c.initiatorType,x=c.duration;if(u&&x&&zm(h)){for(h=0,x=c.responseEnd,s+=1;s<n.length;s++){var T=n[s],U=T.startTime;if(U>x)break;var Q=T.transferSize,F=T.initiatorType;Q&&zm(F)&&(T=T.responseEnd,h+=Q*(T<x?1:(x-U)/(T-U)))}if(--s,t+=8*(u+h)/(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 ko=null,_o=null;function Xi(e){return e.nodeType===9?e:e.ownerDocument}function Lm(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 Um(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 Do(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 Oo=null;function yv(){var e=window.event;return e&&e.type==="popstate"?e===Oo?!1:(Oo=e,!0):(Oo=null,!1)}var Hm=typeof setTimeout=="function"?setTimeout:void 0,vv=typeof clearTimeout=="function"?clearTimeout:void 0,Vm=typeof Promise=="function"?Promise:void 0,xv=typeof queueMicrotask=="function"?queueMicrotask:typeof Vm<"u"?function(e){return Vm.resolve(null).then(e).catch(bv)}:Hm;function bv(e){setTimeout(function(){throw e})}function Pn(e){return e==="head"}function Ym(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")ps(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,ps(n);for(var u=n.firstChild;u;){var h=u.nextSibling,x=u.nodeName;u[_l]||x==="SCRIPT"||x==="STYLE"||x==="LINK"&&u.rel.toLowerCase()==="stylesheet"||n.removeChild(u),u=h}}else n==="body"&&ps(e.ownerDocument.body);n=c}while(n);yl(t)}function Gm(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 Bo(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":Bo(n),Hr(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Sv(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[_l])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=Vt(e.nextSibling),e===null)break}return null}function Av(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Vt(e.nextSibling),e===null))return null;return e}function Qm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Vt(e.nextSibling),e===null))return null;return e}function zo(e){return e.data==="$?"||e.data==="$~"}function Lo(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function jv(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 Vt(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 Uo=null;function Xm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Vt(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function $m(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 Km(e,t,n){switch(t=Xi(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 ps(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Hr(e)}var Yt=new Map,Zm=new Set;function $i(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var En=W.d;W.d={f:Nv,r:wv,D:Ev,C:qv,L:Cv,m:Tv,X:Mv,S:Rv,M:kv};function Nv(){var e=En.f(),t=zi();return e||t}function wv(e){var t=Ba(e);t!==null&&t.tag===5&&t.type==="form"?fh(t):En.r(e)}var ml=typeof document>"u"?null:document;function Fm(e,t,n){var s=ml;if(s&&typeof t=="string"&&t){var c=Dt(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),Zm.has(c)||(Zm.add(c),e={rel:e,crossOrigin:n,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),ot(t,"link",e),at(t),s.head.appendChild(t)))}}function Ev(e){En.D(e),Fm("dns-prefetch",e,null)}function qv(e,t){En.C(e,t),Fm("preconnect",e,t)}function Cv(e,t,n){En.L(e,t,n);var s=ml;if(s&&e&&t){var c='link[rel="preload"][as="'+Dt(t)+'"]';t==="image"&&n&&n.imageSrcSet?(c+='[imagesrcset="'+Dt(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(c+='[imagesizes="'+Dt(n.imageSizes)+'"]')):c+='[href="'+Dt(e)+'"]';var u=c;switch(t){case"style":u=pl(e);break;case"script":u=gl(e)}Yt.has(u)||(e=S({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Yt.set(u,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(gs(u))||t==="script"&&s.querySelector(ys(u))||(t=s.createElement("link"),ot(t,"link",e),at(t),s.head.appendChild(t)))}}function Tv(e,t){En.m(e,t);var n=ml;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+Dt(s)+'"][href="'+Dt(e)+'"]',u=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=gl(e)}if(!Yt.has(u)&&(e=S({rel:"modulepreload",href:e},t),Yt.set(u,e),n.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ys(u)))return}s=n.createElement("link"),ot(s,"link",e),at(s),n.head.appendChild(s)}}}function Rv(e,t,n){En.S(e,t,n);var s=ml;if(s&&e){var c=za(s).hoistableStyles,u=pl(e);t=t||"default";var h=c.get(u);if(!h){var x={loading:0,preload:null};if(h=s.querySelector(gs(u)))x.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Yt.get(u))&&Ho(e,n);var T=h=s.createElement("link");at(T),ot(T,"link",e),T._p=new Promise(function(U,Q){T.onload=U,T.onerror=Q}),T.addEventListener("load",function(){x.loading|=1}),T.addEventListener("error",function(){x.loading|=2}),x.loading|=4,Ki(h,t,s)}h={type:"stylesheet",instance:h,count:1,state:x},c.set(u,h)}}}function Mv(e,t){En.X(e,t);var n=ml;if(n&&e){var s=za(n).hoistableScripts,c=gl(e),u=s.get(c);u||(u=n.querySelector(ys(c)),u||(e=S({src:e,async:!0},t),(t=Yt.get(c))&&Vo(e,t),u=n.createElement("script"),at(u),ot(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function kv(e,t){En.M(e,t);var n=ml;if(n&&e){var s=za(n).hoistableScripts,c=gl(e),u=s.get(c);u||(u=n.querySelector(ys(c)),u||(e=S({src:e,async:!0,type:"module"},t),(t=Yt.get(c))&&Vo(e,t),u=n.createElement("script"),at(u),ot(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function Jm(e,t,n,s){var c=(c=te.current)?$i(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=pl(n.href),n=za(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=pl(n.href);var u=za(c).hoistableStyles,h=u.get(e);if(h||(c=c.ownerDocument||c,h={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,h),(u=c.querySelector(gs(e)))&&!u._p&&(h.instance=u,h.state.loading=5),Yt.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},Yt.set(e,n),u||_v(c,e,n,h.state))),t&&s===null)throw Error(r(528,""));return h}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=gl(n),n=za(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 pl(e){return'href="'+Dt(e)+'"'}function gs(e){return'link[rel="stylesheet"]['+e+"]"}function Im(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function _v(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}),ot(t,"link",n),at(t),e.head.appendChild(t))}function gl(e){return'[src="'+Dt(e)+'"]'}function ys(e){return"script[async]"+e}function Wm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Dt(n.href)+'"]');if(s)return t.instance=s,at(s),s;var c=S({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),at(s),ot(s,"style",c),Ki(s,n.precedence,e),t.instance=s;case"stylesheet":c=pl(n.href);var u=e.querySelector(gs(c));if(u)return t.state.loading|=4,t.instance=u,at(u),u;s=Im(n),(c=Yt.get(c))&&Ho(s,c),u=(e.ownerDocument||e).createElement("link"),at(u);var h=u;return h._p=new Promise(function(x,T){h.onload=x,h.onerror=T}),ot(u,"link",s),t.state.loading|=4,Ki(u,n.precedence,e),t.instance=u;case"script":return u=gl(n.src),(c=e.querySelector(ys(u)))?(t.instance=c,at(c),c):(s=n,(c=Yt.get(u))&&(s=S({},n),Vo(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),at(c),ot(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,Ki(s,n.precedence,e));return t.instance}function Ki(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,h=0;h<s.length;h++){var x=s[h];if(x.dataset.precedence===t)u=x;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 Ho(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Vo(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Zi=null;function Pm(e,t,n){if(Zi===null){var s=new Map,c=Zi=new Map;c.set(n,s)}else c=Zi,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[_l]||u[st]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var h=u.getAttribute(t)||"";h=e+h;var x=s.get(h);x?x.push(u):s.set(h,[u])}}return s}function ep(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Dv(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 tp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Ov(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=pl(s.href),u=t.querySelector(gs(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Fi.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,at(u);return}u=t.ownerDocument||t,s=Im(s),(c=Yt.get(c))&&Ho(s,c),u=u.createElement("link"),at(u);var h=u;h._p=new Promise(function(x,T){h.onload=x,h.onerror=T}),ot(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=Fi.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Yo=0;function Bv(e,t){return e.stylesheets&&e.count===0&&Ii(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&Ii(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Yo===0&&(Yo=62500*gv());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ii(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Yo?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Fi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ii(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Ji=null;function Ii(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Ji=new Map,t.forEach(zv,e),Ji=null,Fi.call(e))}function zv(e,t){if(!(t.state.loading&4)){var n=Ji.get(e);if(n)var s=n.get(null);else{n=new Map,Ji.set(e,n);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var h=c[u];(h.nodeName==="LINK"||h.getAttribute("media")!=="not all")&&(n.set(h.dataset.precedence,h),s=h)}s&&n.set(null,s)}c=t.instance,h=c.getAttribute("data-precedence"),u=n.get(h)||s,u===s&&n.set(null,c),n.set(h,c),this.count++,s=Fi.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 vs={$$typeof:D,Provider:null,Consumer:null,_currentValue:le,_currentValue2:le,_threadCount:0};function Lv(e,t,n,s,c,u,h,x,T){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Br(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Br(0),this.hiddenUpdates=Br(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=h,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.incompleteTransitions=new Map}function np(e,t,n,s,c,u,h,x,T,U,Q,F){return e=new Lv(e,t,n,h,T,U,Q,F,x),t=1,u===!0&&(t|=24),u=Et(3,null,null,t),e.current=u,u.stateNode=e,t=bc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:n,cache:t},Nc(u),e}function ap(e){return e?(e=Ka,e):Ka}function lp(e,t,n,s,c,u){c=ap(c),s.context===null?s.context=c:s.pendingContext=c,s=Yn(t),s.payload={element:n},u=u===void 0?null:u,u!==null&&(s.callback=u),n=Gn(e,s,t),n!==null&&(Nt(n,e,t),Jl(n,e,t))}function sp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Go(e,t){sp(e,t),(e=e.alternate)&&sp(e,t)}function ip(e){if(e.tag===13||e.tag===31){var t=ga(e,67108864);t!==null&&Nt(t,e,67108864),Go(e,67108864)}}function rp(e){if(e.tag===13||e.tag===31){var t=Mt();t=zr(t);var n=ga(e,t);n!==null&&Nt(n,e,t),Go(e,t)}}var Wi=!0;function Uv(e,t,n,s){var c=B.T;B.T=null;var u=W.p;try{W.p=2,Qo(e,t,n,s)}finally{W.p=u,B.T=c}}function Hv(e,t,n,s){var c=B.T;B.T=null;var u=W.p;try{W.p=8,Qo(e,t,n,s)}finally{W.p=u,B.T=c}}function Qo(e,t,n,s){if(Wi){var c=Xo(s);if(c===null)Ro(e,t,s,Pi,n),op(e,s);else if(Yv(c,e,t,n,s))s.stopPropagation();else if(op(e,s),t&4&&-1<Vv.indexOf(e)){for(;c!==null;){var u=Ba(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var h=fa(u.pendingLanes);if(h!==0){var x=u;for(x.pendingLanes|=2,x.entangledLanes|=2;h;){var T=1<<31-qe(h);x.entanglements[1]|=T,h&=~T}tn(u),(Re&6)===0&&(Oi=tt()+500,ds(0))}}break;case 31:case 13:x=ga(u,2),x!==null&&Nt(x,u,2),zi(),Go(u,2)}if(u=Xo(s),u===null&&Ro(e,t,s,Pi,n),u===c)break;c=u}c!==null&&s.stopPropagation()}else Ro(e,t,s,null,n)}}function Xo(e){return e=$r(e),$o(e)}var Pi=null;function $o(e){if(Pi=null,e=Oa(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=y(t),e!==null)return e;e=null}else if(n===31){if(e=p(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Pi=e,null}function cp(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(Tl()){case ua:return 2;case Rl:return 8;case _a:case Dr:return 32;case Vs:return 268435456;default:return 32}default:return 32}}var Ko=!1,ea=null,ta=null,na=null,xs=new Map,bs=new Map,aa=[],Vv="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 op(e,t){switch(e){case"focusin":case"focusout":ea=null;break;case"dragenter":case"dragleave":ta=null;break;case"mouseover":case"mouseout":na=null;break;case"pointerover":case"pointerout":xs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":bs.delete(t.pointerId)}}function Ss(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=Ba(t),t!==null&&ip(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Yv(e,t,n,s,c){switch(t){case"focusin":return ea=Ss(ea,e,t,n,s,c),!0;case"dragenter":return ta=Ss(ta,e,t,n,s,c),!0;case"mouseover":return na=Ss(na,e,t,n,s,c),!0;case"pointerover":var u=c.pointerId;return xs.set(u,Ss(xs.get(u)||null,e,t,n,s,c)),!0;case"gotpointercapture":return u=c.pointerId,bs.set(u,Ss(bs.get(u)||null,e,t,n,s,c)),!0}return!1}function up(e){var t=Oa(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=y(n),t!==null){e.blockedOn=t,Nf(e.priority,function(){rp(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,Nf(e.priority,function(){rp(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 er(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Xo(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Xr=s,n.target.dispatchEvent(s),Xr=null}else return t=Ba(n),t!==null&&ip(t),e.blockedOn=n,!1;t.shift()}return!0}function fp(e,t,n){er(e)&&n.delete(t)}function Gv(){Ko=!1,ea!==null&&er(ea)&&(ea=null),ta!==null&&er(ta)&&(ta=null),na!==null&&er(na)&&(na=null),xs.forEach(fp),bs.forEach(fp)}function tr(e,t){e.blockedOn===t&&(e.blockedOn=null,Ko||(Ko=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Gv)))}var nr=null;function dp(e){nr!==e&&(nr=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){nr===e&&(nr=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($o(s||n)===null)continue;break}var u=Ba(n);u!==null&&(e.splice(t,3),t-=3,Qc(u,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function yl(e){function t(T){return tr(T,e)}ea!==null&&tr(ea,e),ta!==null&&tr(ta,e),na!==null&&tr(na,e),xs.forEach(t),bs.forEach(t);for(var n=0;n<aa.length;n++){var s=aa[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<aa.length&&(n=aa[0],n.blockedOn===null);)up(n),n.blockedOn===null&&aa.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],h=c[vt]||null;if(typeof u=="function")h||dp(n);else if(h){var x=null;if(u&&u.hasAttribute("formAction")){if(c=u,h=u[vt]||null)x=h.formAction;else if($o(c)!==null)continue}else x=h.action;typeof x=="function"?n[s+1]=x:(n.splice(s,3),s-=3),dp(n)}}}function hp(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(h){return c=h})},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 Zo(e){this._internalRoot=e}ar.prototype.render=Zo.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,s=Mt();lp(n,s,e,t,null,null)},ar.prototype.unmount=Zo.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;lp(e.current,2,null,e,null,null),zi(),t[Da]=null}};function ar(e){this._internalRoot=e}ar.prototype.unstable_scheduleHydration=function(e){if(e){var t=jf();e={blockedOn:null,target:e,priority:t};for(var n=0;n<aa.length&&t!==0&&t<aa[n].priority;n++);aa.splice(n,0,e),n===0&&up(e)}};var mp=l.version;if(mp!=="19.2.0")throw Error(r(527,mp,"19.2.0"));W.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=v(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var Qv={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lr.isDisabled&&lr.supportsFiber)try{$e=lr.inject(Qv),Le=lr}catch{}}return js.createRoot=function(e,t){if(!f(e))throw Error(r(299));var n=!1,s="",c=Sh,u=Ah,h=jh;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&&(h=t.onRecoverableError)),t=np(e,1,!1,null,null,n,s,null,c,u,h,hp),e[Da]=t.current,To(e),new Zo(t)},js.hydrateRoot=function(e,t,n){if(!f(e))throw Error(r(299));var s=!1,c="",u=Sh,h=Ah,x=jh,T=null;return n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(h=n.onCaughtError),n.onRecoverableError!==void 0&&(x=n.onRecoverableError),n.formState!==void 0&&(T=n.formState)),t=np(e,1,!0,t,n??null,s,c,T,u,h,x,hp),t.context=ap(null),n=t.current,s=Mt(),s=zr(s),c=Yn(s),c.callback=null,Gn(n,c,s),n=s,t.current.lanes=n,kl(t,n),tn(t),e[Da]=t.current,To(e),new ar(t)},js.version="19.2.0",js}var Np;function tx(){if(Np)return Io.exports;Np=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(),Io.exports=ex(),Io.exports}var nx=tx();var wp="popstate";function ax(a={}){function l(r,f){let{pathname:d,search:y,hash:p}=r.location;return bu("",{pathname:d,search:y,hash:p},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function i(r,f){return typeof f=="string"?f:Ms(f)}return sx(l,i,null,a)}function Ge(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function It(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function lx(){return Math.random().toString(36).substring(2,10)}function Ep(a,l){return{usr:a.state,key:a.key,idx:l}}function bu(a,l,i=null,r){return{pathname:typeof a=="string"?a:a.pathname,search:"",hash:"",...typeof l=="string"?jl(l):l,state:i,key:l&&l.key||r||lx()}}function Ms({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 jl(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 sx(a,l,i,r={}){let{window:f=document.defaultView,v5Compat:d=!1}=r,y=f.history,p="POP",g=null,v=b();v==null&&(v=0,y.replaceState({...y.state,idx:v},""));function b(){return(y.state||{idx:null}).idx}function S(){p="POP";let A=b(),E=A==null?null:A-v;v=A,g&&g({action:p,location:R.location,delta:E})}function w(A,E){p="PUSH";let N=bu(R.location,A,E);v=b()+1;let D=Ep(N,v),J=R.createHref(N);try{y.pushState(D,"",J)}catch(G){if(G instanceof DOMException&&G.name==="DataCloneError")throw G;f.location.assign(J)}d&&g&&g({action:p,location:R.location,delta:1})}function C(A,E){p="REPLACE";let N=bu(R.location,A,E);v=b();let D=Ep(N,v),J=R.createHref(N);y.replaceState(D,"",J),d&&g&&g({action:p,location:R.location,delta:0})}function j(A){return ix(A)}let R={get action(){return p},get location(){return a(f,y)},listen(A){if(g)throw new Error("A history only accepts one active listener");return f.addEventListener(wp,S),g=A,()=>{f.removeEventListener(wp,S),g=null}},createHref(A){return l(f,A)},createURL:j,encodeLocation(A){let E=j(A);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:w,replace:C,go(A){return y.go(A)}};return R}function ix(a,l=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),Ge(i,"No window.location.(origin|href) available to create URL");let r=typeof a=="string"?a:Ms(a);return r=r.replace(/ $/,"%20"),!l&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function m0(a,l,i="/"){return rx(a,l,i,!1)}function rx(a,l,i,r){let f=typeof l=="string"?jl(l):l,d=Mn(f.pathname||"/",i);if(d==null)return null;let y=p0(a);cx(y);let p=null;for(let g=0;p==null&&g<y.length;++g){let v=xx(d);p=yx(y[g],v,r)}return p}function p0(a,l=[],i=[],r="",f=!1){let d=(y,p,g=f,v)=>{let b={relativePath:v===void 0?y.path||"":v,caseSensitive:y.caseSensitive===!0,childrenIndex:p,route:y};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(r)&&g)return;Ge(b.relativePath.startsWith(r),`Absolute route path "${b.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(r.length)}let S=Tn([r,b.relativePath]),w=i.concat(b);y.children&&y.children.length>0&&(Ge(y.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${S}".`),p0(y.children,l,w,S,g)),!(y.path==null&&!y.index)&&l.push({path:S,score:px(S,y.index),routesMeta:w})};return a.forEach((y,p)=>{if(y.path===""||!y.path?.includes("?"))d(y,p);else for(let g of g0(y.path))d(y,p,!0,g)}),l}function g0(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 y=g0(r.join("/")),p=[];return p.push(...y.map(g=>g===""?d:[d,g].join("/"))),f&&p.push(...y),p.map(g=>a.startsWith("/")&&g===""?"/":g)}function cx(a){a.sort((l,i)=>l.score!==i.score?i.score-l.score:gx(l.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var ox=/^:[\w-]+$/,ux=3,fx=2,dx=1,hx=10,mx=-2,qp=a=>a==="*";function px(a,l){let i=a.split("/"),r=i.length;return i.some(qp)&&(r+=mx),l&&(r+=fx),i.filter(f=>!qp(f)).reduce((f,d)=>f+(ox.test(d)?ux:d===""?dx:hx),r)}function gx(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 yx(a,l,i=!1){let{routesMeta:r}=a,f={},d="/",y=[];for(let p=0;p<r.length;++p){let g=r[p],v=p===r.length-1,b=d==="/"?l:l.slice(d.length)||"/",S=Ar({path:g.relativePath,caseSensitive:g.caseSensitive,end:v},b),w=g.route;if(!S&&v&&i&&!r[r.length-1].route.index&&(S=Ar({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},b)),!S)return null;Object.assign(f,S.params),y.push({params:f,pathname:Tn([d,S.pathname]),pathnameBase:Nx(Tn([d,S.pathnameBase])),route:w}),S.pathnameBase!=="/"&&(d=Tn([d,S.pathnameBase]))}return y}function Ar(a,l){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[i,r]=vx(a.path,a.caseSensitive,a.end),f=l.match(i);if(!f)return null;let d=f[0],y=d.replace(/(.)\/+$/,"$1"),p=f.slice(1);return{params:r.reduce((v,{paramName:b,isOptional:S},w)=>{if(b==="*"){let j=p[w]||"";y=d.slice(0,d.length-j.length).replace(/(.)\/+$/,"$1")}const C=p[w];return S&&!C?v[b]=void 0:v[b]=(C||"").replace(/%2F/g,"/"),v},{}),pathname:d,pathnameBase:y,pattern:a}}function vx(a,l=!1,i=!0){It(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,(y,p,g)=>(r.push({paramName:p,isOptional:g!=null}),g?"/?([^\\/]+)?":"/([^\\/]+)")).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 xx(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return It(!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 Mn(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 bx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Sx=a=>bx.test(a);function Ax(a,l="/"){let{pathname:i,search:r="",hash:f=""}=typeof a=="string"?jl(a):a,d;if(i)if(Sx(i))d=i;else{if(i.includes("//")){let y=i;i=i.replace(/\/\/+/g,"/"),It(!1,`Pathnames cannot have embedded double slashes - normalizing ${y} -> ${i}`)}i.startsWith("/")?d=Cp(i.substring(1),"/"):d=Cp(i,l)}else d=l;return{pathname:d,search:wx(r),hash:Ex(f)}}function Cp(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 tu(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 jx(a){return a.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function y0(a){let l=jx(a);return l.map((i,r)=>r===l.length-1?i.pathname:i.pathnameBase)}function v0(a,l,i,r=!1){let f;typeof a=="string"?f=jl(a):(f={...a},Ge(!f.pathname||!f.pathname.includes("?"),tu("?","pathname","search",f)),Ge(!f.pathname||!f.pathname.includes("#"),tu("#","pathname","hash",f)),Ge(!f.search||!f.search.includes("#"),tu("#","search","hash",f)));let d=a===""||f.pathname==="",y=d?"/":f.pathname,p;if(y==null)p=i;else{let S=l.length-1;if(!r&&y.startsWith("..")){let w=y.split("/");for(;w[0]==="..";)w.shift(),S-=1;f.pathname=w.join("/")}p=S>=0?l[S]:"/"}let g=Ax(f,p),v=y&&y!=="/"&&y.endsWith("/"),b=(d||y===".")&&i.endsWith("/");return!g.pathname.endsWith("/")&&(v||b)&&(g.pathname+="/"),g}var Tn=a=>a.join("/").replace(/\/\/+/g,"/"),Nx=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),wx=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,Ex=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function qx(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var x0=["POST","PUT","PATCH","DELETE"];new Set(x0);var Cx=["GET",...x0];new Set(Cx);var Nl=m.createContext(null);Nl.displayName="DataRouter";var Er=m.createContext(null);Er.displayName="DataRouterState";m.createContext(!1);var b0=m.createContext({isTransitioning:!1});b0.displayName="ViewTransition";var Tx=m.createContext(new Map);Tx.displayName="Fetchers";var Rx=m.createContext(null);Rx.displayName="Await";var ln=m.createContext(null);ln.displayName="Navigation";var Bs=m.createContext(null);Bs.displayName="Location";var kn=m.createContext({outlet:null,matches:[],isDataRoute:!1});kn.displayName="Route";var Bu=m.createContext(null);Bu.displayName="RouteError";function Mx(a,{relative:l}={}){Ge(zs(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:r}=m.useContext(ln),{hash:f,pathname:d,search:y}=Ls(a,{relative:l}),p=d;return i!=="/"&&(p=d==="/"?i:Tn([i,d])),r.createHref({pathname:p,search:y,hash:f})}function zs(){return m.useContext(Bs)!=null}function Ra(){return Ge(zs(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(Bs).location}var S0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function A0(a){m.useContext(ln).static||m.useLayoutEffect(a)}function kx(){let{isDataRoute:a}=m.useContext(kn);return a?Xx():_x()}function _x(){Ge(zs(),"useNavigate() may be used only in the context of a <Router> component.");let a=m.useContext(Nl),{basename:l,navigator:i}=m.useContext(ln),{matches:r}=m.useContext(kn),{pathname:f}=Ra(),d=JSON.stringify(y0(r)),y=m.useRef(!1);return A0(()=>{y.current=!0}),m.useCallback((g,v={})=>{if(It(y.current,S0),!y.current)return;if(typeof g=="number"){i.go(g);return}let b=v0(g,JSON.parse(d),f,v.relative==="path");a==null&&l!=="/"&&(b.pathname=b.pathname==="/"?l:Tn([l,b.pathname])),(v.replace?i.replace:i.push)(b,v.state,v)},[l,i,d,f,a])}m.createContext(null);function Ls(a,{relative:l}={}){let{matches:i}=m.useContext(kn),{pathname:r}=Ra(),f=JSON.stringify(y0(i));return m.useMemo(()=>v0(a,JSON.parse(f),r,l==="path"),[a,f,r,l])}function Dx(a,l){return j0(a,l)}function j0(a,l,i,r,f){Ge(zs(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:d}=m.useContext(ln),{matches:y}=m.useContext(kn),p=y[y.length-1],g=p?p.params:{},v=p?p.pathname:"/",b=p?p.pathnameBase:"/",S=p&&p.route;{let N=S&&S.path||"";N0(v,!S||N.endsWith("*")||N.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${v}" (under <Route path="${N}">) 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="${N}"> to <Route path="${N==="/"?"*":`${N}/*`}">.`)}let w=Ra(),C;if(l){let N=typeof l=="string"?jl(l):l;Ge(b==="/"||N.pathname?.startsWith(b),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${b}" but pathname "${N.pathname}" was given in the \`location\` prop.`),C=N}else C=w;let j=C.pathname||"/",R=j;if(b!=="/"){let N=b.replace(/^\//,"").split("/");R="/"+j.replace(/^\//,"").split("/").slice(N.length).join("/")}let A=m0(a,{pathname:R});It(S||A!=null,`No routes matched location "${C.pathname}${C.search}${C.hash}" `),It(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 "${C.pathname}${C.search}${C.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=Ux(A&&A.map(N=>Object.assign({},N,{params:Object.assign({},g,N.params),pathname:Tn([b,d.encodeLocation?d.encodeLocation(N.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?b:Tn([b,d.encodeLocation?d.encodeLocation(N.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathnameBase])})),y,i,r,f);return l&&E?m.createElement(Bs.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...C},navigationType:"POP"}},E):E}function Ox(){let a=Qx(),l=qx(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},y=null;return console.error("Error handled by React Router default ErrorBoundary:",a),y=m.createElement(m.Fragment,null,m.createElement("p",null,"💿 Hey developer 👋"),m.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",m.createElement("code",{style:d},"ErrorBoundary")," or"," ",m.createElement("code",{style:d},"errorElement")," prop on your route.")),m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},l),i?m.createElement("pre",{style:f},i):null,y)}var Bx=m.createElement(Ox,null),zx=class extends m.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,l){return l.location!==a.location||l.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:l.error,location:l.location,revalidation:a.revalidation||l.revalidation}}componentDidCatch(a,l){this.props.onError?this.props.onError(a,l):console.error("React Router caught the following error during render",a)}render(){return this.state.error!==void 0?m.createElement(kn.Provider,{value:this.props.routeContext},m.createElement(Bu.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Lx({routeContext:a,match:l,children:i}){let r=m.useContext(Nl);return r&&r.static&&r.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=l.route.id),m.createElement(kn.Provider,{value:a},i)}function Ux(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,y=i?.errors;if(y!=null){let b=d.findIndex(S=>S.route.id&&y?.[S.route.id]!==void 0);Ge(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(y).join(",")}`),d=d.slice(0,Math.min(d.length,b+1))}let p=!1,g=-1;if(i)for(let b=0;b<d.length;b++){let S=d[b];if((S.route.HydrateFallback||S.route.hydrateFallbackElement)&&(g=b),S.route.id){let{loaderData:w,errors:C}=i,j=S.route.loader&&!w.hasOwnProperty(S.route.id)&&(!C||C[S.route.id]===void 0);if(S.route.lazy||j){p=!0,g>=0?d=d.slice(0,g+1):d=[d[0]];break}}}let v=i&&r?(b,S)=>{r(b,{location:i.location,params:i.matches?.[0]?.params??{},errorInfo:S})}:void 0;return d.reduceRight((b,S,w)=>{let C,j=!1,R=null,A=null;i&&(C=y&&S.route.id?y[S.route.id]:void 0,R=S.route.errorElement||Bx,p&&(g<0&&w===0?(N0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,A=null):g===w&&(j=!0,A=S.route.hydrateFallbackElement||null)));let E=l.concat(d.slice(0,w+1)),N=()=>{let D;return C?D=R:j?D=A:S.route.Component?D=m.createElement(S.route.Component,null):S.route.element?D=S.route.element:D=b,m.createElement(Lx,{match:S,routeContext:{outlet:b,matches:E,isDataRoute:i!=null},children:D})};return i&&(S.route.ErrorBoundary||S.route.errorElement||w===0)?m.createElement(zx,{location:i.location,revalidation:i.revalidation,component:R,error:C,children:N(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:v}):N()},null)}function zu(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Hx(a){let l=m.useContext(Nl);return Ge(l,zu(a)),l}function Vx(a){let l=m.useContext(Er);return Ge(l,zu(a)),l}function Yx(a){let l=m.useContext(kn);return Ge(l,zu(a)),l}function Lu(a){let l=Yx(a),i=l.matches[l.matches.length-1];return Ge(i.route.id,`${a} can only be used on routes that contain a unique "id"`),i.route.id}function Gx(){return Lu("useRouteId")}function Qx(){let a=m.useContext(Bu),l=Vx("useRouteError"),i=Lu("useRouteError");return a!==void 0?a:l.errors?.[i]}function Xx(){let{router:a}=Hx("useNavigate"),l=Lu("useNavigate"),i=m.useRef(!1);return A0(()=>{i.current=!0}),m.useCallback(async(f,d={})=>{It(i.current,S0),i.current&&(typeof f=="number"?a.navigate(f):await a.navigate(f,{fromRouteId:l,...d}))},[a,l])}var Tp={};function N0(a,l,i){!l&&!Tp[a]&&(Tp[a]=!0,It(!1,i))}m.memo($x);function $x({routes:a,future:l,state:i,unstable_onError:r}){return j0(a,void 0,i,r,l)}function hr(a){Ge(!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 Kx({basename:a="/",children:l=null,location:i,navigationType:r="POP",navigator:f,static:d=!1}){Ge(!zs(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let y=a.replace(/^\/*/,"/"),p=m.useMemo(()=>({basename:y,navigator:f,static:d,future:{}}),[y,f,d]);typeof i=="string"&&(i=jl(i));let{pathname:g="/",search:v="",hash:b="",state:S=null,key:w="default"}=i,C=m.useMemo(()=>{let j=Mn(g,y);return j==null?null:{location:{pathname:j,search:v,hash:b,state:S,key:w},navigationType:r}},[y,g,v,b,S,w,r]);return It(C!=null,`<Router basename="${y}"> is not able to match the URL "${g}${v}${b}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:m.createElement(ln.Provider,{value:p},m.createElement(Bs.Provider,{children:l,value:C}))}function Zx({children:a,location:l}){return Dx(Su(a),l)}function Su(a,l=[]){let i=[];return m.Children.forEach(a,(r,f)=>{if(!m.isValidElement(r))return;let d=[...l,f];if(r.type===m.Fragment){i.push.apply(i,Su(r.props.children,d));return}Ge(r.type===hr,`[${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>`),Ge(!r.props.index||!r.props.children,"An index route cannot have child routes.");let y={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&&(y.children=Su(r.props.children,d)),i.push(y)}),i}var mr="get",pr="application/x-www-form-urlencoded";function qr(a){return a!=null&&typeof a.tagName=="string"}function Fx(a){return qr(a)&&a.tagName.toLowerCase()==="button"}function Jx(a){return qr(a)&&a.tagName.toLowerCase()==="form"}function Ix(a){return qr(a)&&a.tagName.toLowerCase()==="input"}function Wx(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function Px(a,l){return a.button===0&&(!l||l==="_self")&&!Wx(a)}var sr=null;function eb(){if(sr===null)try{new FormData(document.createElement("form"),0),sr=!1}catch{sr=!0}return sr}var tb=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function nu(a){return a!=null&&!tb.has(a)?(It(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${pr}"`),null):a}function nb(a,l){let i,r,f,d,y;if(Jx(a)){let p=a.getAttribute("action");r=p?Mn(p,l):null,i=a.getAttribute("method")||mr,f=nu(a.getAttribute("enctype"))||pr,d=new FormData(a)}else if(Fx(a)||Ix(a)&&(a.type==="submit"||a.type==="image")){let p=a.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=a.getAttribute("formaction")||p.getAttribute("action");if(r=g?Mn(g,l):null,i=a.getAttribute("formmethod")||p.getAttribute("method")||mr,f=nu(a.getAttribute("formenctype"))||nu(p.getAttribute("enctype"))||pr,d=new FormData(p,a),!eb()){let{name:v,type:b,value:S}=a;if(b==="image"){let w=v?`${v}.`:"";d.append(`${w}x`,"0"),d.append(`${w}y`,"0")}else v&&d.append(v,S)}}else{if(qr(a))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=mr,r=null,f=pr,y=a}return d&&f==="text/plain"&&(y=d,d=void 0),{action:r,method:i.toLowerCase(),encType:f,formData:d,body:y}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Uu(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&&Mn(r.pathname,l)==="/"?r.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function lb(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 sb(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 ib(a,l,i){let r=await Promise.all(a.map(async f=>{let d=l.routes[f.route.id];if(d){let y=await lb(d,i);return y.links?y.links():[]}return[]}));return ub(r.flat(1).filter(sb).filter(f=>f.rel==="stylesheet"||f.rel==="preload").map(f=>f.rel==="stylesheet"?{...f,rel:"prefetch",as:"style"}:{...f,rel:"prefetch"}))}function Rp(a,l,i,r,f,d){let y=(g,v)=>i[v]?g.route.id!==i[v].route.id:!0,p=(g,v)=>i[v].pathname!==g.pathname||i[v].route.path?.endsWith("*")&&i[v].params["*"]!==g.params["*"];return d==="assets"?l.filter((g,v)=>y(g,v)||p(g,v)):d==="data"?l.filter((g,v)=>{let b=r.routes[g.route.id];if(!b||!b.hasLoader)return!1;if(y(g,v)||p(g,v))return!0;if(g.route.shouldRevalidate){let S=g.route.shouldRevalidate({currentUrl:new URL(f.pathname+f.search+f.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(a,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof S=="boolean")return S}return!0}):[]}function rb(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 ob(a){let l={},i=Object.keys(a).sort();for(let r of i)l[r]=a[r];return l}function ub(a,l){let i=new Set;return new Set(l),a.reduce((r,f)=>{let d=JSON.stringify(ob(f));return i.has(d)||(i.add(d),r.push({key:d,link:f})),r},[])}function w0(){let a=m.useContext(Nl);return Uu(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function fb(){let a=m.useContext(Er);return Uu(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var Hu=m.createContext(void 0);Hu.displayName="FrameworkContext";function E0(){let a=m.useContext(Hu);return Uu(a,"You must render this element inside a <HydratedRouter> element"),a}function db(a,l){let i=m.useContext(Hu),[r,f]=m.useState(!1),[d,y]=m.useState(!1),{onFocus:p,onBlur:g,onMouseEnter:v,onMouseLeave:b,onTouchStart:S}=l,w=m.useRef(null);m.useEffect(()=>{if(a==="render"&&y(!0),a==="viewport"){let R=E=>{E.forEach(N=>{y(N.isIntersecting)})},A=new IntersectionObserver(R,{threshold:.5});return w.current&&A.observe(w.current),()=>{A.disconnect()}}},[a]),m.useEffect(()=>{if(r){let R=setTimeout(()=>{y(!0)},100);return()=>{clearTimeout(R)}}},[r]);let C=()=>{f(!0)},j=()=>{f(!1),y(!1)};return i?a!=="intent"?[d,w,{}]:[d,w,{onFocus:Ns(p,C),onBlur:Ns(g,j),onMouseEnter:Ns(v,C),onMouseLeave:Ns(b,j),onTouchStart:Ns(S,C)}]:[!1,w,{}]}function Ns(a,l){return i=>{a&&a(i),i.defaultPrevented||l(i)}}function hb({page:a,...l}){let{router:i}=w0(),r=m.useMemo(()=>m0(i.routes,a,i.basename),[i.routes,a,i.basename]);return r?m.createElement(pb,{page:a,matches:r,...l}):null}function mb(a){let{manifest:l,routeModules:i}=E0(),[r,f]=m.useState([]);return m.useEffect(()=>{let d=!1;return ib(a,l,i).then(y=>{d||f(y)}),()=>{d=!0}},[a,l,i]),r}function pb({page:a,matches:l,...i}){let r=Ra(),{manifest:f,routeModules:d}=E0(),{basename:y}=w0(),{loaderData:p,matches:g}=fb(),v=m.useMemo(()=>Rp(a,l,g,f,r,"data"),[a,l,g,f,r]),b=m.useMemo(()=>Rp(a,l,g,f,r,"assets"),[a,l,g,f,r]),S=m.useMemo(()=>{if(a===r.pathname+r.search+r.hash)return[];let j=new Set,R=!1;if(l.forEach(E=>{let N=f.routes[E.route.id];!N||!N.hasLoader||(!v.some(D=>D.route.id===E.route.id)&&E.route.id in p&&d[E.route.id]?.shouldRevalidate||N.hasClientLoader?R=!0:j.add(E.route.id))}),j.size===0)return[];let A=ab(a,y,"data");return R&&j.size>0&&A.searchParams.set("_routes",l.filter(E=>j.has(E.route.id)).map(E=>E.route.id).join(",")),[A.pathname+A.search]},[y,p,r,f,v,l,a,d]),w=m.useMemo(()=>rb(b,f),[b,f]),C=mb(b);return m.createElement(m.Fragment,null,S.map(j=>m.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...i})),w.map(j=>m.createElement("link",{key:j,rel:"modulepreload",href:j,...i})),C.map(({key:j,link:R})=>m.createElement("link",{key:j,nonce:i.nonce,...R})))}function gb(...a){return l=>{a.forEach(i=>{typeof i=="function"?i(l):i!=null&&(i.current=l)})}}var q0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{q0&&(window.__reactRouterVersion="7.9.6")}catch{}function yb({basename:a,children:l,window:i}){let r=m.useRef();r.current==null&&(r.current=ax({window:i,v5Compat:!0}));let f=r.current,[d,y]=m.useState({action:f.action,location:f.location}),p=m.useCallback(g=>{m.startTransition(()=>y(g))},[y]);return m.useLayoutEffect(()=>f.listen(p),[f,p]),m.createElement(Kx,{basename:a,children:l,location:d.location,navigationType:d.action,navigator:f})}var C0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,T0=m.forwardRef(function({onClick:l,discover:i="render",prefetch:r="none",relative:f,reloadDocument:d,replace:y,state:p,target:g,to:v,preventScrollReset:b,viewTransition:S,...w},C){let{basename:j}=m.useContext(ln),R=typeof v=="string"&&C0.test(v),A,E=!1;if(typeof v=="string"&&R&&(A=v,q0))try{let I=new URL(window.location.href),ae=v.startsWith("//")?new URL(I.protocol+v):new URL(v),Z=Mn(ae.pathname,j);ae.origin===I.origin&&Z!=null?v=Z+ae.search+ae.hash:E=!0}catch{It(!1,`<Link to="${v}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let N=Mx(v,{relative:f}),[D,J,G]=db(r,w),K=Sb(v,{replace:y,state:p,target:g,preventScrollReset:b,relative:f,viewTransition:S});function V(I){l&&l(I),I.defaultPrevented||K(I)}let ne=m.createElement("a",{...w,...G,href:A||N,onClick:E||d?l:V,ref:gb(C,J),target:g,"data-discover":!R&&i==="render"?"true":void 0});return D&&!R?m.createElement(m.Fragment,null,ne,m.createElement(hb,{page:N})):ne});T0.displayName="Link";var vb=m.forwardRef(function({"aria-current":l="page",caseSensitive:i=!1,className:r="",end:f=!1,style:d,to:y,viewTransition:p,children:g,...v},b){let S=Ls(y,{relative:v.relative}),w=Ra(),C=m.useContext(Er),{navigator:j,basename:R}=m.useContext(ln),A=C!=null&&Eb(S)&&p===!0,E=j.encodeLocation?j.encodeLocation(S).pathname:S.pathname,N=w.pathname,D=C&&C.navigation&&C.navigation.location?C.navigation.location.pathname:null;i||(N=N.toLowerCase(),D=D?D.toLowerCase():null,E=E.toLowerCase()),D&&R&&(D=Mn(D,R)||D);const J=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let G=N===E||!f&&N.startsWith(E)&&N.charAt(J)==="/",K=D!=null&&(D===E||!f&&D.startsWith(E)&&D.charAt(E.length)==="/"),V={isActive:G,isPending:K,isTransitioning:A},ne=G?l:void 0,I;typeof r=="function"?I=r(V):I=[r,G?"active":null,K?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let ae=typeof d=="function"?d(V):d;return m.createElement(T0,{...v,"aria-current":ne,className:I,ref:b,style:ae,to:y,viewTransition:p},typeof g=="function"?g(V):g)});vb.displayName="NavLink";var xb=m.forwardRef(({discover:a="render",fetcherKey:l,navigate:i,reloadDocument:r,replace:f,state:d,method:y=mr,action:p,onSubmit:g,relative:v,preventScrollReset:b,viewTransition:S,...w},C)=>{let j=Nb(),R=wb(p,{relative:v}),A=y.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&C0.test(p),N=D=>{if(g&&g(D),D.defaultPrevented)return;D.preventDefault();let J=D.nativeEvent.submitter,G=J?.getAttribute("formmethod")||y;j(J||D.currentTarget,{fetcherKey:l,method:G,navigate:i,replace:f,state:d,relative:v,preventScrollReset:b,viewTransition:S})};return m.createElement("form",{ref:C,method:A,action:R,onSubmit:r?g:N,...w,"data-discover":!E&&a==="render"?"true":void 0})});xb.displayName="Form";function bb(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function R0(a){let l=m.useContext(Nl);return Ge(l,bb(a)),l}function Sb(a,{target:l,replace:i,state:r,preventScrollReset:f,relative:d,viewTransition:y}={}){let p=kx(),g=Ra(),v=Ls(a,{relative:d});return m.useCallback(b=>{if(Px(b,l)){b.preventDefault();let S=i!==void 0?i:Ms(g)===Ms(v);p(a,{replace:S,state:r,preventScrollReset:f,relative:d,viewTransition:y})}},[g,p,v,i,r,l,a,f,d,y])}var Ab=0,jb=()=>`__${String(++Ab)}__`;function Nb(){let{router:a}=R0("useSubmit"),{basename:l}=m.useContext(ln),i=Gx();return m.useCallback(async(r,f={})=>{let{action:d,method:y,encType:p,formData:g,body:v}=nb(r,l);if(f.navigate===!1){let b=f.fetcherKey||jb();await a.fetch(b,i,f.action||d,{preventScrollReset:f.preventScrollReset,formData:g,body:v,formMethod:f.method||y,formEncType:f.encType||p,flushSync:f.flushSync})}else await a.navigate(f.action||d,{preventScrollReset:f.preventScrollReset,formData:g,body:v,formMethod:f.method||y,formEncType:f.encType||p,replace:f.replace,state:f.state,fromRouteId:i,flushSync:f.flushSync,viewTransition:f.viewTransition})},[a,l,i])}function wb(a,{relative:l}={}){let{basename:i}=m.useContext(ln),r=m.useContext(kn);Ge(r,"useFormAction must be used inside a RouteContext");let[f]=r.matches.slice(-1),d={...Ls(a||".",{relative:l})},y=Ra();if(a==null){d.search=y.search;let p=new URLSearchParams(d.search),g=p.getAll("index");if(g.some(b=>b==="")){p.delete("index"),g.filter(S=>S).forEach(S=>p.append("index",S));let b=p.toString();d.search=b?`?${b}`:""}}return(!a||a===".")&&f.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(d.pathname=d.pathname==="/"?i:Tn([i,d.pathname])),Ms(d)}function Eb(a,{relative:l}={}){let i=m.useContext(b0);Ge(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=R0("useViewTransitionState"),f=Ls(a,{relative:l});if(!i.isTransitioning)return!1;let d=Mn(i.currentLocation.pathname,r)||i.currentLocation.pathname,y=Mn(i.nextLocation.pathname,r)||i.nextLocation.pathname;return Ar(f.pathname,y)!=null||Ar(f.pathname,d)!=null}const an=Object.create(null);an.open="0";an.close="1";an.ping="2";an.pong="3";an.message="4";an.upgrade="5";an.noop="6";const gr=Object.create(null);Object.keys(an).forEach(a=>{gr[an[a]]=a});const Au={type:"error",data:"parser error"},M0=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",k0=typeof ArrayBuffer=="function",_0=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer,Vu=({type:a,data:l},i,r)=>M0&&l instanceof Blob?i?r(l):Mp(l,r):k0&&(l instanceof ArrayBuffer||_0(l))?i?r(l):Mp(new Blob([l]),r):r(an[a]+(l||"")),Mp=(a,l)=>{const i=new FileReader;return i.onload=function(){const r=i.result.split(",")[1];l("b"+(r||""))},i.readAsDataURL(a)};function kp(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}let au;function qb(a,l){if(M0&&a.data instanceof Blob)return a.data.arrayBuffer().then(kp).then(l);if(k0&&(a.data instanceof ArrayBuffer||_0(a.data)))return l(kp(a.data));Vu(a,!1,i=>{au||(au=new TextEncoder),l(au.encode(i))})}const _p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cs=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let a=0;a<_p.length;a++)Cs[_p.charCodeAt(a)]=a;const Cb=a=>{let l=a.length*.75,i=a.length,r,f=0,d,y,p,g;a[a.length-1]==="="&&(l--,a[a.length-2]==="="&&l--);const v=new ArrayBuffer(l),b=new Uint8Array(v);for(r=0;r<i;r+=4)d=Cs[a.charCodeAt(r)],y=Cs[a.charCodeAt(r+1)],p=Cs[a.charCodeAt(r+2)],g=Cs[a.charCodeAt(r+3)],b[f++]=d<<2|y>>4,b[f++]=(y&15)<<4|p>>2,b[f++]=(p&3)<<6|g&63;return v},Tb=typeof ArrayBuffer=="function",Yu=(a,l)=>{if(typeof a!="string")return{type:"message",data:D0(a,l)};const i=a.charAt(0);return i==="b"?{type:"message",data:Rb(a.substring(1),l)}:gr[i]?a.length>1?{type:gr[i],data:a.substring(1)}:{type:gr[i]}:Au},Rb=(a,l)=>{if(Tb){const i=Cb(a);return D0(i,l)}else return{base64:!0,data:a}},D0=(a,l)=>{switch(l){case"blob":return a instanceof Blob?a:new Blob([a]);case"arraybuffer":default:return a instanceof ArrayBuffer?a:a.buffer}},O0="",Mb=(a,l)=>{const i=a.length,r=new Array(i);let f=0;a.forEach((d,y)=>{Vu(d,!1,p=>{r[y]=p,++f===i&&l(r.join(O0))})})},kb=(a,l)=>{const i=a.split(O0),r=[];for(let f=0;f<i.length;f++){const d=Yu(i[f],l);if(r.push(d),d.type==="error")break}return r};function _b(){return new TransformStream({transform(a,l){qb(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 lu;function ir(a){return a.reduce((l,i)=>l+i.length,0)}function rr(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 Db(a,l){lu||(lu=new TextDecoder);const i=[];let r=0,f=-1,d=!1;return new TransformStream({transform(y,p){for(i.push(y);;){if(r===0){if(ir(i)<1)break;const g=rr(i,1);d=(g[0]&128)===128,f=g[0]&127,f<126?r=3:f===126?r=1:r=2}else if(r===1){if(ir(i)<2)break;const g=rr(i,2);f=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),r=3}else if(r===2){if(ir(i)<8)break;const g=rr(i,8),v=new DataView(g.buffer,g.byteOffset,g.length),b=v.getUint32(0);if(b>Math.pow(2,21)-1){p.enqueue(Au);break}f=b*Math.pow(2,32)+v.getUint32(4),r=3}else{if(ir(i)<f)break;const g=rr(i,f);p.enqueue(Yu(d?g:lu.decode(g),l)),r=0}if(f===0||f>a){p.enqueue(Au);break}}}})}const B0=4;function et(a){if(a)return Ob(a)}function Ob(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 Cr=typeof Promise=="function"&&typeof Promise.resolve=="function"?l=>Promise.resolve().then(l):(l,i)=>i(l,0),Qt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Bb="arraybuffer";function z0(a,...l){return l.reduce((i,r)=>(a.hasOwnProperty(r)&&(i[r]=a[r]),i),{})}const zb=Qt.setTimeout,Lb=Qt.clearTimeout;function Tr(a,l){l.useNativeTimers?(a.setTimeoutFn=zb.bind(Qt),a.clearTimeoutFn=Lb.bind(Qt)):(a.setTimeoutFn=Qt.setTimeout.bind(Qt),a.clearTimeoutFn=Qt.clearTimeout.bind(Qt))}const Ub=1.33;function Hb(a){return typeof a=="string"?Vb(a):Math.ceil((a.byteLength||a.size)*Ub)}function Vb(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 L0(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Yb(a){let l="";for(let i in a)a.hasOwnProperty(i)&&(l.length&&(l+="&"),l+=encodeURIComponent(i)+"="+encodeURIComponent(a[i]));return l}function Gb(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 Qb extends Error{constructor(l,i,r){super(l),this.description=i,this.context=r,this.type="TransportError"}}class Gu extends et{constructor(l){super(),this.writable=!1,Tr(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 Qb(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=Yu(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=Yb(l);return i.length?"?"+i:""}}class Xb extends Gu{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)};kb(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,Mb(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]=L0()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(l,i)}}let U0=!1;try{U0=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const $b=U0;function Kb(){}class Zb extends Xb{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 nn extends et{constructor(l,i,r){super(),this.createRequest=l,Tr(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=z0(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=nn.requestsCount++,nn.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=Kb,l)try{this._xhr.abort()}catch{}typeof document<"u"&&delete nn.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()}}nn.requestsCount=0;nn.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Dp);else if(typeof addEventListener=="function"){const a="onpagehide"in Qt?"pagehide":"unload";addEventListener(a,Dp,!1)}}function Dp(){for(let a in nn.requests)nn.requests.hasOwnProperty(a)&&nn.requests[a].abort()}const Fb=(function(){const a=H0({xdomain:!1});return a&&a.responseType!==null})();class Jb extends Zb{constructor(l){super(l);const i=l&&l.forceBase64;this.supportsBinary=Fb&&!i}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new nn(H0,this.uri(),l)}}function H0(a){const l=a.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||$b))return new XMLHttpRequest}catch{}if(!l)try{return new Qt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const V0=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Ib extends Gu{get name(){return"websocket"}doOpen(){const l=this.uri(),i=this.opts.protocols,r=V0?{}:z0(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;Vu(r,this.supportsBinary,d=>{try{this.doWrite(r,d)}catch{}f&&Cr(()=>{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]=L0()),this.supportsBinary||(i.b64=1),this.createUri(l,i)}}const su=Qt.WebSocket||Qt.MozWebSocket;class Wb extends Ib{createSocket(l,i,r){return V0?new su(l,i,r):i?new su(l,i):new su(l)}doWrite(l,i){this.ws.send(i)}}class Pb extends Gu{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=Db(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=l.readable.pipeThrough(i).getReader(),f=_b();f.readable.pipeTo(l.writable),this._writer=f.writable.getWriter();const d=()=>{r.read().then(({done:p,value:g})=>{p||(this.onPacket(g),d())}).catch(p=>{})};d();const y={type:"open"};this.query.sid&&(y.data=`{"sid":"${this.query.sid}"}`),this._writer.write(y).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&&Cr(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var l;(l=this._transport)===null||l===void 0||l.close()}}const e1={websocket:Wb,webtransport:Pb,polling:Jb},t1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n1=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ju(a){if(a.length>8e3)throw"URI too long";const l=a,i=a.indexOf("["),r=a.indexOf("]");i!=-1&&r!=-1&&(a=a.substring(0,i)+a.substring(i,r).replace(/:/g,";")+a.substring(r,a.length));let f=t1.exec(a||""),d={},y=14;for(;y--;)d[n1[y]]=f[y]||"";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=l1(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 l1(a,l){const i={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,f,d){f&&(i[f]=d)}),i}const Nu=typeof addEventListener=="function"&&typeof removeEventListener=="function",yr=[];Nu&&addEventListener("offline",()=>{yr.forEach(a=>a())},!1);class ia extends et{constructor(l,i){if(super(),this.binaryType=Bb,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,l&&typeof l=="object"&&(i=l,l=null),l){const r=ju(l);i.hostname=r.host,i.secure=r.protocol==="https"||r.protocol==="wss",i.port=r.port,r.query&&(i.query=r.query)}else i.host&&(i.hostname=ju(i.host).host);Tr(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=Gb(this.opts.query)),Nu&&(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"})},yr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(l){const i=Object.assign({},this.opts.query);i.EIO=B0,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&&ia.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",ia.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+=Hb(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,Cr(()=>{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(ia.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(),Nu&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=yr.indexOf(this._offlineEventListener);r!==-1&&yr.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",l,i),this.writeBuffer=[],this._prevBufferLen=0}}}ia.protocol=B0;class s1 extends ia{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;ia.priorWebsocketSuccess=!1;const f=()=>{r||(i.send([{type:"ping",data:"probe"}]),i.once("packet",S=>{if(!r)if(S.type==="pong"&&S.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;ia.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(b(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{const w=new Error("probe error");w.transport=i.name,this.emitReserved("upgradeError",w)}}))};function d(){r||(r=!0,b(),i.close(),i=null)}const y=S=>{const w=new Error("probe error: "+S);w.transport=i.name,d(),this.emitReserved("upgradeError",w)};function p(){y("transport closed")}function g(){y("socket closed")}function v(S){i&&S.name!==i.name&&d()}const b=()=>{i.removeListener("open",f),i.removeListener("error",y),i.removeListener("close",p),this.off("close",g),this.off("upgrading",v)};i.once("open",f),i.once("error",y),i.once("close",p),this.once("close",g),this.once("upgrading",v),this._upgrades.indexOf("webtransport")!==-1&&l!=="webtransport"?this.setTimeoutFn(()=>{r||i.open()},200):i.open()}onHandshake(l){this._upgrades=this._filterUpgrades(l.upgrades),super.onHandshake(l)}_filterUpgrades(l){const i=[];for(let r=0;r<l.length;r++)~this.transports.indexOf(l[r])&&i.push(l[r]);return i}}let i1=class extends s1{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=>e1[f]).filter(f=>!!f)),super(l,r)}};function r1(a,l="",i){let r=a;i=i||typeof location<"u"&&location,a==null&&(a=i.protocol+"//"+i.host),typeof a=="string"&&(a.charAt(0)==="/"&&(a.charAt(1)==="/"?a=i.protocol+a:a=i.host+a),/^(https?|wss?):\/\//.test(a)||(typeof i<"u"?a=i.protocol+"//"+a:a="https://"+a),r=ju(a)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const d=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+d+":"+r.port+l,r.href=r.protocol+"://"+d+(i&&i.port===r.port?"":":"+r.port),r}const c1=typeof ArrayBuffer=="function",o1=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,Y0=Object.prototype.toString,u1=typeof Blob=="function"||typeof Blob<"u"&&Y0.call(Blob)==="[object BlobConstructor]",f1=typeof File=="function"||typeof File<"u"&&Y0.call(File)==="[object FileConstructor]";function Qu(a){return c1&&(a instanceof ArrayBuffer||o1(a))||u1&&a instanceof Blob||f1&&a instanceof File}function vr(a,l){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let i=0,r=a.length;i<r;i++)if(vr(a[i]))return!0;return!1}if(Qu(a))return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return vr(a.toJSON(),!0);for(const i in a)if(Object.prototype.hasOwnProperty.call(a,i)&&vr(a[i]))return!0;return!1}function d1(a){const l=[],i=a.data,r=a;return r.data=wu(i,l),r.attachments=l.length,{packet:r,buffers:l}}function wu(a,l){if(!a)return a;if(Qu(a)){const i={_placeholder:!0,num:l.length};return l.push(a),i}else if(Array.isArray(a)){const i=new Array(a.length);for(let r=0;r<a.length;r++)i[r]=wu(a[r],l);return i}else if(typeof a=="object"&&!(a instanceof Date)){const i={};for(const r in a)Object.prototype.hasOwnProperty.call(a,r)&&(i[r]=wu(a[r],l));return i}return a}function h1(a,l){return a.data=Eu(a.data,l),delete a.attachments,a}function Eu(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]=Eu(a[i],l);else if(typeof a=="object")for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&(a[i]=Eu(a[i],l));return a}const m1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],p1=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 g1{constructor(l){this.replacer=l}encode(l){return(l.type===je.EVENT||l.type===je.ACK)&&vr(l)?this.encodeAsBinary({type:l.type===je.EVENT?je.BINARY_EVENT:je.BINARY_ACK,nsp:l.nsp,data:l.data,id:l.id}):[this.encodeAsString(l)]}encodeAsString(l){let i=""+l.type;return(l.type===je.BINARY_EVENT||l.type===je.BINARY_ACK)&&(i+=l.attachments+"-"),l.nsp&&l.nsp!=="/"&&(i+=l.nsp+","),l.id!=null&&(i+=l.id),l.data!=null&&(i+=JSON.stringify(l.data,this.replacer)),i}encodeAsBinary(l){const i=d1(l),r=this.encodeAsString(i.packet),f=i.buffers;return f.unshift(r),f}}function Op(a){return Object.prototype.toString.call(a)==="[object Object]"}class Xu extends et{constructor(l){super(),this.reviver=l}add(l){let i;if(typeof l=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");i=this.decodeString(l);const r=i.type===je.BINARY_EVENT;r||i.type===je.BINARY_ACK?(i.type=r?je.EVENT:je.ACK,this.reconstructor=new y1(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(Qu(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 y=l.substring(d,i);if(y!=Number(y)||l.charAt(i)!=="-")throw new Error("Illegal attachments");r.attachments=Number(y)}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 y=l.charAt(i);if(y==null||Number(y)!=y){--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(Xu.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 Op(i);case je.DISCONNECT:return i===void 0;case je.CONNECT_ERROR:return typeof i=="string"||Op(i);case je.EVENT:case je.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&m1.indexOf(i[0])===-1);case je.ACK:case je.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class y1{constructor(l){this.packet=l,this.buffers=[],this.reconPack=l}takeBinaryData(l){if(this.buffers.push(l),this.buffers.length===this.reconPack.attachments){const i=h1(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const v1=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Xu,Encoder:g1,get PacketType(){return je},protocol:p1},Symbol.toStringTag,{value:"Module"}));function Zt(a,l,i){return a.on(l,i),function(){a.off(l,i)}}const x1=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class G0 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=[Zt(l,"open",this.onopen.bind(this)),Zt(l,"packet",this.onpacket.bind(this)),Zt(l,"error",this.onerror.bind(this)),Zt(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(x1.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 y={type:je.EVENT,data:i};if(y.options={},y.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const b=this.ids++,S=i.pop();this._registerAckCallback(b,S),y.id=b}const p=(f=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||f===void 0?void 0:f.writable,g=this.connected&&!(!((d=this.io.engine)===null||d===void 0)&&d._hasPingExpired());return this.flags.volatile&&!p||(g?(this.notifyOutgoingListeners(y),this.packet(y)):this.sendBuffer.push(y)),this.flags={},this}_registerAckCallback(l,i){var r;const f=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(f===void 0){this.acks[l]=i;return}const d=this.io.setTimeoutFn(()=>{delete this.acks[l];for(let p=0;p<this.sendBuffer.length;p++)this.sendBuffer[p].id===l&&this.sendBuffer.splice(p,1);i.call(this,new Error("operation has timed out"))},f),y=(...p)=>{this.io.clearTimeoutFn(d),i.apply(this,p)};y.withError=!0,this.acks[l]=y}emitWithAck(l,...i){return new Promise((r,f)=>{const d=(y,p)=>y?f(y):r(p);d.withError=!0,i.push(d),this.emit(l,...i)})}_addToQueue(l){let i;typeof l[l.length-1]=="function"&&(i=l.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:l,flags:Object.assign({fromQueue:!0},this.flags)};l.push((f,...d)=>r!==this._queue[0]?void 0:(f!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(f)):(this._queue.shift(),i&&i(null,...d)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(l=!1){if(!this.connected||this._queue.length===0)return;const i=this._queue[0];i.pending&&!l||(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.args))}packet(l){l.nsp=this.nsp,this.io._packet(l)}onopen(){typeof this.auth=="function"?this.auth(l=>{this._sendConnectPacket(l)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(l){this.packet({type: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 wl(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}wl.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};wl.prototype.reset=function(){this.attempts=0};wl.prototype.setMin=function(a){this.ms=a};wl.prototype.setMax=function(a){this.max=a};wl.prototype.setJitter=function(a){this.jitter=a};class qu 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,Tr(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 wl({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||v1;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 i1(this.uri,this.opts);const i=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const f=Zt(i,"open",function(){r.onopen(),l&&l()}),d=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),l?l(p):this.maybeReconnectOnOpen()},y=Zt(i,"error",d);if(this._timeout!==!1){const p=this._timeout,g=this.setTimeoutFn(()=>{f(),d(new Error("timeout")),i.close()},p);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(f),this.subs.push(y),this}connect(l){return this.open(l)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const l=this.engine;this.subs.push(Zt(l,"ping",this.onping.bind(this)),Zt(l,"data",this.ondata.bind(this)),Zt(l,"error",this.onerror.bind(this)),Zt(l,"close",this.onclose.bind(this)),Zt(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){Cr(()=>{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 G0(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 ws={};function xr(a,l){typeof a=="object"&&(l=a,a=void 0),l=l||{};const i=r1(a,l.path||"/socket.io"),r=i.source,f=i.id,d=i.path,y=ws[f]&&d in ws[f].nsps,p=l.forceNew||l["force new connection"]||l.multiplex===!1||y;let g;return p?g=new qu(r,l):(ws[f]||(ws[f]=new qu(r,l)),g=ws[f]),i.query&&!l.query&&(l.query=i.queryKey),g.socket(i.path,l)}Object.assign(xr,{Manager:qu,Socket:G0,io:xr,connect:xr});const Q0="roverSettings",b1=3600*24*365;function S1(a){try{const l=decodeURIComponent(a??"");return JSON.parse(l)}catch(l){return console.warn("Failed to parse settings cookie",l),null}}function Cu(){if(typeof document>"u")return{};const a=`${Q0}=`,l=document.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(a));if(!l)return{};const i=l.substring(a.length);return S1(i)??{}}function Bp(a){if(typeof document>"u")return!1;try{const l=encodeURIComponent(JSON.stringify(a??{})),i=`${Q0}=${l}; path=/; max-age=${b1}; samesite=strict`;return document.cookie=i,!0}catch(l){return console.warn("Failed to write settings cookie",l),!1}}const X0=window.location.origin;console.info("[socket] connecting to",X0);const A1=Cu(),j1=A1?.page?.connectionTransport||"websocket",N1=j1==="polling"?["polling"]:["websocket","polling"],$u=xr(X0,{transports:N1,timeout:15e3});$u.on("connect_error",a=>console.error("connect_error",a.code,a.message,a.data));const $0=m.createContext($u),w1=({children:a})=>o.jsx($0.Provider,{value:$u,children:a}),sn=()=>m.useContext($0),K0=m.createContext({connected:!1,session:null,logs:[],login:async()=>{},setRole:async()=>{},requestControl:async()=>{},releaseControl:async()=>{},subscribeAll:async()=>{},homeAssistantToggle:async()=>{},homeAssistantSetState:async()=>{},setNickname:async()=>{},triggerReplay:async()=>{},setCommunityGoal:async()=>{}});function E1(a){return m.useCallback((l,i={})=>new Promise((r,f)=>{a.emit(l,i,(d={})=>{d.error?f(new Error(d.error)):r(d)})}),[a])}function q1({children:a}){const l=sn(),i=E1(l),[r,f]=m.useState(null),[d,y]=m.useState([]),[p,g]=m.useState([]),[v,b]=m.useState(l.connected);m.useEffect(()=>{const C=()=>b(!0),j=()=>b(!1);return l.on("connect",C),l.on("disconnect",j),()=>{l.off("connect",C),l.off("disconnect",j)}},[l]),m.useEffect(()=>{function C(A){f(A)}function j(A=[]){y(A)}function R(A){y(E=>[...E.slice(-199),A])}return l.on("session:sync",C),l.on("log:init",j),l.on("log:entry",R),l.on("alert:new",(A={})=>{g(E=>[...E.slice(-49),{...A,receivedAt:Date.now()}])}),()=>{l.off("session:sync",C),l.off("log:init",j),l.off("log:entry",R),l.off("alert:new")}},[l]);const S=m.useMemo(()=>({login:(C,j)=>i("auth:login",{username:C,password:j}),setRole:C=>i("session:setRole",{role:C}),requestControl:(C,j={})=>i("session:requestControl",{roverId:C,...j}),releaseControl:C=>i("session:releaseControl",{roverId:C}),subscribeAll:()=>i("session:subscribeAll"),lockRover:(C,j)=>i("session:lockRover",{roverId:C,locked:j}),setMode:C=>i("setMode",{mode:C}),homeAssistantToggle:C=>i("homeAssistant:toggle",{entityId:C}),homeAssistantSetState:(C,j)=>i("homeAssistant:setState",{entityId:C,state:j}),setNickname:C=>i("nickname:set",{nickname:C}),triggerReplay:(C=[])=>i("replay:trigger",{sources:C}),setCommunityGoal:C=>i("communityGoal:set",{text:C}),pushAlert:C=>g(j=>[...j.slice(-49),{...C,receivedAt:Date.now(),id:C.id||Math.random().toString(36).slice(2)}])}),[i]),w=m.useMemo(()=>({connected:v,session:r,logs:d,alerts:p,...S}),[S,p,v,d,r]);return o.jsx(K0.Provider,{value:w,children:a})}function _e(){return m.useContext(K0)}const Z0=m.createContext({frames:{}});function C1({children:a}){const l=sn(),[i,r]=m.useState({});m.useEffect(()=>{function d({roverId:y,sensors:p={},frame:g={}}){y&&r(v=>({...v,[y]:{roverId:y,sensors:p,raw:g?.data||null,receivedAt:Date.now()}}))}return l.on("sensorFrame",d),()=>{l.off("sensorFrame",d)}},[l]);const f=m.useMemo(()=>({frames:i}),[i]);return o.jsx(Z0.Provider,{value:f,children:a})}function Ku(){return m.useContext(Z0).frames}function El(a){const l=Ku();return a?l[a]??null:null}const T1=650,R1={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 iu(a){if(typeof a!="number"||a<=0)return null;const l=R1[a];return l?{code:a,...l}:null}function M1(a,l={}){const i=l.holdMs||T1,[r,f]=m.useState({left:null,right:null,omni:null}),[d,y]=m.useState(0);return m.useEffect(()=>{const p=setInterval(()=>y(Date.now()),Math.max(i/2,100));return()=>clearInterval(p)},[i]),m.useEffect(()=>{const p=Date.now(),g=iu(a?.infraredCharacterLeft),v=iu(a?.infraredCharacterRight),b=iu(a?.infraredCharacterOmni);!g&&!v&&!b||f(S=>({left:g?{...g,ts:p}:S.left,right:v?{...v,ts:p}:S.right,omni:b?{...b,ts:p}:S.omni}))},[a?.infraredCharacterLeft,a?.infraredCharacterRight,a?.infraredCharacterOmni]),m.useEffect(()=>{const{left:p,right:g,omni:v}=r;if(!(p?.ts||g?.ts||v?.ts))return;const S=new Date().toISOString();console.debug("[DockIR]",S,{left:p?.code??0,omni:v?.code??0,right:g?.code??0})},[r.left?.code,r.right?.code,r.omni?.code]),m.useMemo(()=>{const p=Date.now(),g=A=>{if(!A)return{active:!1,red:!1,green:!1,force:!1,age:null,code:null};const E=p-A.ts,N=E<=i;return{active:N,age:E,code:A.code,red:!!(A.red&&N),green:!!(A.green&&N),force:!!(A.force&&N)}},v=g(r.left),b=g(r.right),S=g(r.omni),w=v.force||b.force||S.force,C=v.active||b.active||S.active,j=v.active&&!b.active?"right":b.active&&!v.active?"left":"center",R=(b.active?1:0)-(v.active?1:0);return{visible:C,forceDetected:w,left:v,right:b,omni:S,bias:j,balance:Math.max(-1,Math.min(1,R))}},[r.left,r.right,r.omni,i,d])}function k1(){const{connected:a,session:l}=_e(),i=l?.assignment?.roverId,r=El(i),f=r?.sensors||{},d=M1(f),y=f.voltageMv!=null?`${(f.voltageMv/1e3).toFixed(2)} V`:null,p=f.currentMa!=null?`${f.currentMa} mA`:null,g=f.batteryTemperatureC!=null?`${f.batteryTemperatureC} °C`:null,v=f.batteryChargeMah,b=f.batteryCapacityMah;r?.receivedAt&&new Date(r.receivedAt).toLocaleTimeString();const S=r?.raw?r.raw:null,w=i?l?.activeDrivers?.[i]:null;return m.useMemo(()=>i?w?w===l?.socketId?"You":(l?.users||[]).find(j=>j.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(_1,{sensors:f,voltage:y,current:p,batteryTemp:g,charge:v,capacity:b}),o.jsx(D1,{sensors:f,dockState:d})]}):o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for sensor frames…"}):o.jsx("p",{className:"text-sm text-slate-500",children:"Assign a rover to view sensors."}),S&&o.jsx("pre",{className:"surface whitespace-pre-wrap break-words text-xs text-lime-300",children:S})]})}function _1({sensors:a,voltage:l,current:i,batteryTemp:r,charge:f,capacity:d}){const y=f!=null&&d?`${Math.round(f/d*100)}`:"--",p=a?.oiMode?.label||"--",g=a?.chargingSources?.homeBase?"Yes":"No",v=a?.chargingState?.label||"--";return o.jsxs("div",{className:"grid grid-cols-2 gap-0.5 md:grid-cols-3",children:[o.jsx(qn,{label:"Voltage",value:l??"--"}),o.jsx(qn,{label:"Current",value:i??"--"}),o.jsx(qn,{label:"Battery temp",value:r??"--"}),o.jsx(qn,{label:"Charge",value:f!=null?`${f} mAh`:"--"}),o.jsx(qn,{label:"Capacity",value:d!=null?`${d} mAh`:"--"}),o.jsx(qn,{label:"Charge",value:y}),o.jsx(qn,{label:"OI mode",value:p}),o.jsx(qn,{label:"Docked",value:g}),o.jsx(qn,{label:"Charging state",value:v})]})}function qn({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 D1({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}],y=[{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(O1,{sensors:a}),o.jsx(B1,{state:l})]}),o.jsxs(vl,{title:"Bumps & drops",children:[o.jsx(Cn,{label:"Bump L",value:o.jsx(Es,{active:i.bumpLeft})}),o.jsx(Cn,{label:"Bump R",value:o.jsx(Es,{active:i.bumpRight})}),o.jsx(Cn,{label:"Wheel drop L",value:o.jsx(Es,{active:i.wheelDropLeft,tone:"amber"})}),o.jsx(Cn,{label:"Wheel drop R",value:o.jsx(Es,{active:i.wheelDropRight,tone:"amber"})})]}),o.jsx(vl,{title:"Light bumps (raw)",children:f.map(p=>o.jsx(Cn,{label:p.label,value:qs(p.value)},p.label))}),o.jsx(vl,{title:"Cliff sensors",children:d.map(p=>o.jsx(Cn,{label:p.label,value:`${qs(p.value)} · ${p.active?"bool: true":"bool: false"}`},p.label))}),o.jsx(vl,{title:"Currents",children:y.map(p=>o.jsx(Cn,{label:p.label,value:o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:qs(p.value,"mA")}),p.over?o.jsx(Es,{active:!0,tone:"red",label:"over"}):null]})},p.label))}),o.jsxs(vl,{title:"Dirt detect",children:[o.jsx(Cn,{label:"Left",value:qs(a?.dirtDetectLeft)}),o.jsx(Cn,{label:"Right",value:qs(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 Cn({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 Es({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 qs(a,l){return a==null||Number.isNaN(a)?"--":l?`${a} ${l}`:a}function O1({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 B1({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 F0=m.createContext(null);function Zu({children:a}){const[l,i]=m.useState(()=>({status:"loading",data:{}}));m.useEffect(()=>{const p=Cu();i({status:"ready",data:p??{}})},[]);const r=m.useCallback(()=>{const p=Cu();i({status:"ready",data:p??{}})},[]),f=m.useCallback(p=>{const g=Bp(p??{});return i(g?{status:"ready",data:p??{}}:v=>({...v,status:"error"})),g},[]),d=m.useCallback((p,g)=>{i(v=>{const b=v.data[p]||{},S=typeof g=="function"?g(b):{...b,...g??{}},w={...v.data,[p]:S};return Bp(w)?{status:"ready",data:w}:{...v,status:"error"}})},[]),y=m.useMemo(()=>({data:l.data,status:l.status,reload:r,saveAll:f,setNamespace:d}),[l,r,f,d]);return o.jsx(F0.Provider,{value:y,children:a})}function z1(){const a=m.useContext(F0);if(!a)throw new Error("useSettings must be used within SettingsProvider");return a}function ft(a,l={}){const{data:i,status:r,setNamespace:f}=z1(),d=i[a]??l??{},y=m.useCallback(v=>{f(a,b=>{const S=b??{};return typeof v=="function"?v(S):{...S,...v??{}}})},[a,f]),p=m.useCallback(v=>{f(a,()=>v??{})},[a,f]),g=m.useCallback(()=>{const v=typeof l=="object"?{...l}:l;f(a,()=>v??{})},[l,a,f]);return{value:d,status:r,save:y,replace:p,reset:g}}function L1(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 Fu({panelId:a="replay-sources",fillHeight:l=!1}){const{session:i,triggerReplay:r}=_e(),f=L1(i?.replaySources||[]),{value:d,save:y}=ft("replaySources",{}),[p,g]=m.useState([]),[v,b]=m.useState(!1),[S,w]=m.useState(null),[C,j]=m.useState(null),R=i?.replay||null,[A,E]=m.useState(0),N=m.useMemo(()=>{const I=i?.assignment?.roverId;return I?[`rover:${I}`]:[]},[i?.assignment?.roverId]);m.useEffect(()=>{const I=d?.[a];if(Array.isArray(I)&&I.length){g(I);return}g(N)},[d?.[a],N,a]),m.useEffect(()=>{const I=new Set(f.map(ae=>ae.key));g(ae=>ae.filter(Z=>I.has(Z)))},[f]);const D=m.useMemo(()=>({rovers:f.filter(I=>I.type==="rover"),rooms:f.filter(I=>I.type==="room")}),[f]);m.useEffect(()=>{if(!R?.lastTriggeredAt||!R?.cooldownMs){E(0);return}const I=()=>{const Z=R.lastTriggeredAt+R.cooldownMs-Date.now();E(Math.max(0,Z))};I();const ae=setInterval(I,250);return()=>clearInterval(ae)},[R?.lastTriggeredAt,R?.cooldownMs,R?.remainingMs]);const J=v||i?.mode==="lockdown"||A>0||!p.length,G=I=>{g(ae=>{const Z=ae.includes(I)?ae.filter(P=>P!==I):[...ae,I];return y(P=>({...P||{},[a]:Z})),Z}),j(null)},K=async()=>{if(!J){b(!0),w(null),j(null);try{const I=p.map(ae=>{const[Z,P]=ae.split(":");return{type:Z,id:P}});await r(I),j("Replay sent. Check the Discord replay channel.")}catch(I){w(I.message)}finally{b(!1)}}},V=l?"h-full flex flex-col":"",ne=l?"flex-1 min-h-0 overflow-y-auto":"";return o.jsxs("section",{className:`panel-section p-0.75 text-sm ${V}`,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 ${ne}`,children:[o.jsx(zp,{title:"Rovers",items:D.rovers,selected:p,onToggle:G}),o.jsx(zp,{title:"Room Cams",items:D.rooms,selected:p,onToggle:G})]}),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:K,disabled:J,children:A>0?`Replay (${Math.ceil(A/1e3)}s)`:v?"Replay…":"Replay"}),S?o.jsx("div",{className:"text-xs text-amber-400",children:S}):null,C?o.jsx("div",{className:"text-xs text-emerald-300",children:C}):null]})]})}function zp({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 J0={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Lp=Ta.createContext&&Ta.createContext(J0),U1=["attr","size","title"];function H1(a,l){if(a==null)return{};var i=V1(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 V1(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 jr(){return jr=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},jr.apply(this,arguments)}function Up(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 Nr(a){for(var l=1;l<arguments.length;l++){var i=arguments[l]!=null?arguments[l]:{};l%2?Up(Object(i),!0).forEach(function(r){Y1(a,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):Up(Object(i)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(i,r))})}return a}function Y1(a,l,i){return l=G1(l),l in a?Object.defineProperty(a,l,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[l]=i,a}function G1(a){var l=Q1(a,"string");return typeof l=="symbol"?l:l+""}function Q1(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 I0(a){return a&&a.map((l,i)=>Ta.createElement(l.tag,Nr({key:i},l.attr),I0(l.child)))}function W0(a){return l=>Ta.createElement(X1,jr({attr:Nr({},a.attr)},l),I0(a.child))}function X1(a){var l=i=>{var{attr:r,size:f,title:d}=a,y=H1(a,U1),p=f||i.size||"1em",g;return i.className&&(g=i.className),a.className&&(g=(g?g+" ":"")+a.className),Ta.createElement("svg",jr({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},i.attr,r,y,{className:g,style:Nr(Nr({color:a.color||i.color},i.style),a.style),height:p,width:p,xmlns:"http://www.w3.org/2000/svg"}),d&&Ta.createElement("title",null,d),a.children)};return Lp!==void 0?Ta.createElement(Lp.Consumer,null,i=>l(i)):l(J0)}function P0(a){return W0({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 $1(a){return W0({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 K1(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 Z1(a){const l=new Date(a);return`${l.getHours().toString().padStart(2,"0")}:${l.getMinutes().toString().padStart(2,"0")}`}function Hp(a){return a.nickname||a.socketId?.slice(0,6)||"unknown"}function F1({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 eg({message:a}){const l=a.fromDiscord?`${a.discordGuildName||"Discord"} · ${Hp(a)}`:null;return o.jsxs(o.Fragment,{children:[a.fromDiscord?o.jsxs(o.Fragment,{children:[o.jsx(P0,{className:"h-3.5 w-3.5 text-indigo-200"}),o.jsx(F1,{guildIconUrl:a.discordGuildIconUrl,userAvatarUrl:a.discordUserAvatarUrl,label:l})]}):null,o.jsx("span",{className:`font-semibold text-[0.85rem] ${K1(a.role)}`,children:Hp(a)}),a.roverId&&o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem]",children:a.roverId})]})}function tg(a){return`surface-muted relative flex flex-wrap items-start gap-0.5 text-sm ${a.role==="admin"||a.role==="lockdown"||a.role==="lockdown-admin"?"border border-amber-400/30":a.fromDiscord?"border border-indigo-400/30 bg-indigo-900/20":""}`}function ng({message:a}){return o.jsxs("div",{className:tg(a),children:[o.jsx(eg,{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:Z1(a.ts)})]})}function ag({message:a}){return o.jsxs("div",{className:`${tg(a)} italic opacity-80 border-slate-600/40 bg-slate-900/40`,children:[o.jsx(eg,{message:a}),o.jsx("span",{className:"text-slate-300",children:"typing..."})]})}const J1=3e3,I1="#2196f3";function W1(a){return a.id?a.id:a.timestamp?`${a.timestamp}-${a.message}`:`${a.title||"alert"}-${a.message}`}function Ju({scale:a=1}){const{alerts:l}=_e(),[i,r]=m.useState(()=>Date.now()),f=m.useMemo(()=>l.slice(-3).map(g=>({alert:g,key:W1(g)})),[l]);m.useEffect(()=>{if(!f.length)return;const g=setInterval(()=>r(Date.now()),200);return()=>clearInterval(g)},[f.length]);const d=f.map(g=>({...g,age:i-(g.alert.receivedAt??g.alert.timestamp??0)})).filter(g=>g.age<=J1);if(!d.length)return null;const y=a===1?void 0:{transform:`translateX(-50%) scale(${a})`,transformOrigin:"top center"},p=a===1?"pointer-events-none fixed top-0.5 left-1/2 z-50 flex -translate-x-1/2 flex-col gap-0.5":"pointer-events-none fixed top-0.5 left-1/2 z-50 flex flex-col gap-0.5";return o.jsx("div",{className:p,style:y,children:d.map(g=>o.jsx(P1,{alert:g.alert},g.key))})}function Vp(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 P1({alert:a}){if(a.kind==="chat"&&a.payload)return o.jsx(ng,{message:a.payload});if(a.kind==="chat-typing"&&a.payload)return o.jsx(ag,{message:a.payload});const l=Vp(a.color)||Vp(I1),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 xl={main:[-127,127],side:[-127,127],vacuum:[0,127]},ru={maxSpeed:500,baseSpeed:250,boostSpeed:400},Tu=100,Iu=[31,127],Sl=60,Ru=8,eS=250,tS={start:[128],safe:[131],full:[132],passive:[128],dock:[143]},Ts={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"]},lg=[{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:Tu},{type:"oi",command:"dock"},{type:"pause",duration:Tu},{type:"oi",command:"full"}]},{id:"seek-dock",label:"Dock",description:"Send the seek dock command.",steps:[{type:"oi",command:"dock"}]}];function Mu(){return{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:null,lastUpdatedAt:0}}function ku(){return{main:0,side:0,vacuum:0}}function nS(){return{enabled:!1,angle:null,config:null}}function br(){return{note:Sl}}const Yp={roverId:null,mode:"drive",drive:Mu(),aux:ku(),camera:nS(),song:br(),lastControlIntentAt:0,macros:lg,keymap:Ts,inputs:{}};function aS(a,l){switch(l.type){case"control/set-rover":return{...a,roverId:l.payload??null,drive:l.payload?a.drive:Mu(),aux:l.payload?a.aux:ku(),song:l.payload?a.song:br(),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:Mu(),aux:ku(),song:br(),lastControlIntentAt:0};case"control/record-intent":return{...a,lastControlIntentAt:Date.now()};case"control/set-song-note":return{...a,song:{...a.song||br(),note:l.payload??Sl}};default:return a}}function Al(a,l,i){return typeof a!="number"||Number.isNaN(a)?l:Math.max(l,Math.min(i,a))}function Rn(a){return typeof a!="number"||Number.isNaN(a)?0:Math.max(-1,Math.min(1,a))}function Gt(a,l){return!Array.isArray(l)||l.length!==2?a:Al(a,l[0],l[1])}function lS(a={}){const l=Rn(a.x??0),i=Rn(a.y??0);return{x:l,y:i,boost:!!a.boost}}function sS(a={},l={}){const i=lS(a),r=typeof l.maxSpeed=="number"?l.maxSpeed:ru.maxSpeed,f=typeof l.baseSpeed=="number"?l.baseSpeed:ru.baseSpeed,d=typeof l.boostSpeed=="number"?l.boostSpeed:ru.boostSpeed,y=i.boost?d:f,p=i.y*y,g=i.x*y;return{vector:i,speeds:{left:Al(Math.round(p+g),-r,r),right:Al(Math.round(p-g),-r,r)}}}function iS(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 Gp(a){return new Promise(l=>setTimeout(l,a))}function rS(a={}){const{driveTransform:l,auxTransform:i}=a,r=sn(),{session:f}=_e(),d=f?.assignment?.roverId,y=m.useMemo(()=>!d||!Array.isArray(f?.roster)?null:f.roster.find(N=>String(N.id)===String(d))||null,[d,f?.roster]),p=m.useMemo(()=>!y?.cameraServo||!y.cameraServo.enabled?null:y.cameraServo,[y]),g=m.useMemo(()=>!y?.nightVision||!y.nightVision.enabled?null:y.nightVision,[y]),v=m.useCallback((N,D)=>{d&&r.emit("command",{roverId:d,...N},D)},[r,d]),b=m.useCallback(()=>{d&&v({type:"sensorStream",data:{sensorStream:{enable:!0}}})},[v,d]),S=m.useCallback(N=>{if(!d)return null;const D={left:Gt(N?.left??0,[-500,500]),right:Gt(N?.right??0,[-500,500])},J=l?l(D):D,G={left:Gt(J?.left??0,[-500,500]),right:Gt(J?.right??0,[-500,500])};return v({type:"drive",data:{driveDirect:G}}),G},[l,v,d]),w=m.useCallback(({main:N=0,side:D=0,vacuum:J=0}={})=>{if(!d)return null;const G={main:Gt(N,xl.main),side:Gt(D,xl.side),vacuum:Gt(J,xl.vacuum)},K=i?i(G):G,V={main:Gt(K?.main??0,xl.main),side:Gt(K?.side??0,xl.side),vacuum:Gt(K?.vacuum??0,xl.vacuum)};return v({type:"motors",data:{motorPwm:V}}),V},[i,v,d]),C=m.useCallback(N=>!d||!p?null:(v({type:"servo",data:{servo:{angle:N}}}),N),[v,d,p]),j=m.useCallback(N=>{if(!d)return!1;const D=Array.isArray(N)?N:typeof N=="string"?tS[N]:null;return D?(v({type:"raw",data:{raw:iS(D)}}),b(),!0):!1},[v,b,d]),R=m.useCallback(async N=>{if(!(!N||!Array.isArray(N.steps)||!d))for(const D of N.steps){if(!d)break;switch(D.type){case"oi":j(D.command);break;case"drive":S(D.speeds??{left:0,right:0});break;case"motors":w(D.values??{});break;case"servo":C(D.angle);break;case"pause":await Gp(D.duration??Tu);break}if(D.delay||D.delayMs){const J=D.delayMs??D.delay;typeof J=="number"&&J>0&&await Gp(J)}}},[d,j,S,w,C]),A=m.useCallback((N="toggle")=>!d||!g?null:(v({type:"nightVision",data:{nightVision:{action:N}}}),N),[v,g,d]),E=m.useCallback((N=[],D={})=>{if(!d)return null;const G=(Array.isArray(N)&&N.length>0?N:[{note:Sl,duration:Ru}]).slice(0,16).map(K=>({note:Gt(Math.round(K?.note??Sl),Iu),duration:Gt(Math.round(K?.duration??Ru),[1,255])}));return v({type:"song",data:{song:{notes:G,slot:D.slot,loop:D.loop}}}),G},[v,d]);return m.useMemo(()=>({roverId:d,rosterEntry:y,servoConfig:p,nightVision:g,emitCommand:v,enableSensorStream:b,sendDriveDirect:S,sendAuxMotors:w,sendServoAngle:C,sendOiCommand:j,sendNightVision:A,sendSong:E,runMacroSteps:R}),[d,y,p,g,v,b,S,w,C,j,A,R])}const cS={"{":"[","}":"]",":":";",'"':"'","<":",",">":".","?":"/","|":"\\",_:"-","+":"="},Qp={"[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash","-":"Minus","=":"Equal","`":"Backquote"};function Us(a){if(typeof a!="string")return"";const l=a.toLowerCase();return cS[l]??l}function oS(a){const l=Us(a);if(!l)return null;if(Qp[l])return Qp[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 sg(a){const l=Us(a);return l?`key:${l}`:null}function uS(a){const l=oS(a);return l?`code:${l}`:null}function Xp(a){const l=new Set,i=sg(a?.key??"");i&&l.add(i);const r=a?.code?`code:${a.code}`:null;return r&&l.add(r),Array.from(l)}function fS(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 y=sg(String(d));y&&f.add(y);const p=uS(String(d));p&&f.add(p)}),[l,f]}))}function ra(a){const l=Us(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 bl=[{key:"drive",motors:["leftWheel","rightWheel"]},{key:"aux",motors:["mainBrush","sideBrush"]}],dS={downRatePerSec:.15,upRatePerSec:.7,releaseDelaySec:1,outputRateMs:250};function $p(){return bl.reduce((a,l)=>(a[l.key]={cap:1,clearSec:0},a),{})}function Kp(a){return Number.isFinite(a)?Math.max(0,Math.min(1,a)):0}function hS(a,l={}){const{session:i}=_e(),d=(El(a)?.sensors||{})?.wheelOvercurrents||{},y=m.useMemo(()=>({...dS,...l.config||{}}),[l.config]),[p,g]=m.useState(()=>$p()),v=m.useRef(typeof performance<"u"?performance.now():Date.now()),b=m.useRef(d);m.useEffect(()=>{b.current=d||{}},[d]),m.useEffect(()=>{g($p())},[a]),m.useEffect(()=>{const j=setInterval(()=>{const R=typeof performance<"u"?performance.now():Date.now(),A=Math.max(0,R-v.current);v.current=R;const E=A/1e3;E<=0||g(N=>{let D=!1;const J={},G=Number.isFinite(y.downRatePerSec)?Math.max(0,y.downRatePerSec):0,K=Number.isFinite(y.upRatePerSec)?Math.max(0,y.upRatePerSec):0,V=Number.isFinite(y.releaseDelaySec)?Math.max(0,y.releaseDelaySec):0;return bl.forEach(ne=>{const I=N[ne.key]||{cap:1,clearSec:0},ae=Number.isFinite(I.cap)?I.cap:1,Z=Number.isFinite(I.clearSec)?I.clearSec:0,P=ne.motors.some(B=>!!b.current?.[B]),ce=P?0:Z+E,ue=!P&&ce>=V,se=Kp(P?ae-G*E:ue?ae+K*E:ae);(Math.abs(se-ae)>1e-4||Math.abs(ce-Z)>1e-4)&&(D=!0),J[ne.key]={cap:se,clearSec:ce}}),D?J:N})},100);return()=>clearInterval(j)},[y.downRatePerSec,y.releaseDelaySec,y.upRatePerSec]);const S=m.useMemo(()=>{const j=bl.reduce((R,A)=>{const E=p?.[A.key],N=Number.isFinite(E?.cap)?E.cap:1;return R[A.key]=Kp(N),R},{});return{perGroup:j,drive:{left:j.drive??1,right:j.drive??1},aux:{main:j.aux??1,side:j.aux??1,vacuum:1}}},[p]),w=m.useMemo(()=>{const j={};bl.forEach(A=>{A.motors.forEach(E=>{j[E]=!!d?.[E]})});const R=bl.reduce((A,E)=>(A[E.key]=E.motors.some(N=>!!d?.[N]),A),{});return{motors:j,groups:R}},[d]),C=i?.role==="admin"||i?.role==="lockdown"||i?.role==="lockdown-admin";return m.useMemo(()=>({caps:p,overcurrent:w,scales:S,isActive:(S?.drive?.left??1)<1||(S?.drive?.right??1)<1||(S?.aux?.main??1)<1||(S?.aux?.side??1)<1,config:y,adminImmune:C}),[p,w,S,y,C])}function mS(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 pS(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 ig=m.createContext(null);function Zp(a){return Object.fromEntries(Object.entries(a||{}).map(([l,i])=>[l,Array.isArray(i)?[...i]:[]]))}function gS(a,l){if(!a)return l;const i=typeof a.minAngle=="number"?a.minAngle:-45,r=typeof a.maxAngle=="number"?a.maxAngle:45;return Al(l,i,r)}function yS({children:a}){const[l,i]=m.useReducer(aS,Yp),r=m.useRef(null),f=m.useRef(!1),d=m.useRef(Yp.camera.angle),{value:y,save:p}=ft("controls",{keymap:Ts,macros:lg}),{session:g,homeAssistantSetState:v}=_e(),b=g?.assignment?.roverId??null,S=hS(b),w=m.useCallback(k=>mS(k,S.scales,S.adminImmune),[S.adminImmune,S.scales]),C=m.useCallback(k=>pS(k,S.scales,S.adminImmune),[S.adminImmune,S.scales]),j=rS({driveTransform:w,auxTransform:C}),R=m.useCallback(()=>{const _=(g?.homeAssistant?.entities||[]).filter(X=>(X.type==="light"||X.type==="switch")&&X.available!==!1&&X.state!=="on");if(_.length===0){f.current=!1;return}f.current=!0,_.forEach(X=>{v(X.id,"on").catch(()=>{})}),f.current=!1},[g?.homeAssistant?.entities,v]);m.useEffect(()=>{i({type:"control/set-rover",payload:j.roverId})},[j.roverId]),m.useEffect(()=>{const k=r.current;r.current=l.mode,k!=="drive"&&l.mode==="drive"&&g?.homeAssistant?.entities?R():k!=="drive"&&l.mode==="drive"&&(f.current=!0)},[l.mode,g?.homeAssistant?.entities,R]),m.useEffect(()=>{f.current&&g?.homeAssistant?.entities&&R()},[g?.homeAssistant?.entities,R]),m.useEffect(()=>{const k={...Ts,...y?.keymap||{}};i({type:"control/set-keymap",payload:k}),y?.macros&&i({type:"control/set-macros",payload:y.macros})},[y?.keymap,y?.macros]),m.useEffect(()=>{const k=j.servoConfig;if(!k){i({type:"control/set-camera-config",payload:{config:null}}),d.current=null;return}const _=typeof k.minAngle=="number"?k.minAngle:-45,X=typeof k.maxAngle=="number"?k.maxAngle:45,te=typeof k.homeAngle=="number"?k.homeAngle:(_+X)/2,fe=typeof d.current=="number"?Al(d.current,_,X):null,Ne=fe??Al(te,_,X);i({type:"control/set-camera-config",payload:{config:k,angle:Ne}}),d.current=Ne},[j.servoConfig]),m.useEffect(()=>{d.current=typeof l.camera.angle=="number"?l.camera.angle:d.current},[l.camera.angle]),m.useEffect(()=>{j.roverId&&j.enableSensorStream()},[j.roverId,j.enableSensorStream]);const A=m.useCallback(k=>{i({type:"control/set-mode",payload:k})},[]),E=m.useCallback(()=>{i({type:"control/record-intent"})},[]),N=m.useRef(l.drive.speeds),D=m.useRef(l.aux),J=m.useMemo(()=>JSON.stringify(S.scales),[S.scales]),G=m.useRef(0),K=m.useRef(0);m.useEffect(()=>{N.current=l.drive.speeds},[l.drive.speeds]),m.useEffect(()=>{D.current=l.aux},[l.aux]),m.useEffect(()=>{if(!j.roverId||S.adminImmune||!S.isActive)return;const k=Math.max(0,Number(S?.config?.outputRateMs)||0),_=typeof performance<"u"?performance.now():Date.now(),X=N.current||{left:0,right:0},te=D.current||{main:0,side:0,vacuum:0},fe=!!(X.left||X.right),Ne=!!(te.main||te.side||te.vacuum);!fe&&!Ne||(fe&&_-G.current>=k&&(G.current=_,j.sendDriveDirect(X)),Ne&&_-K.current>=k&&(K.current=_,j.sendAuxMotors(te)))},[J,S.adminImmune,S.config,S.isActive,j]);const V=m.useCallback((k,_={})=>{const X=sS(k,_.speedOptions);i({type:"control/update-drive",payload:{...X,source:_.source??null}}),E(),j.sendDriveDirect(X.speeds)},[j,E]),ne=m.useCallback((k={})=>{const _=j.sendAuxMotors(k)??k;i({type:"control/set-aux-motors",payload:_}),E()},[j,E]),I=m.useCallback((k,_)=>{if(!k)return!1;const X=Us(_);if(!X)return!1;const te=Zp(l.keymap);return te[k]=[X],i({type:"control/set-keymap",payload:te}),p(fe=>({...fe??{},keymap:te})),!0},[l.keymap,p]),ae=m.useCallback(()=>{const k=Zp(Ts);i({type:"control/set-keymap",payload:k}),p(_=>({..._??{},keymap:k}))},[p]),Z=m.useCallback(k=>{if(!j.servoConfig)return;const _=gS(j.servoConfig,k);i({type:"control/set-camera-angle",payload:_}),j.sendServoAngle(_),d.current=_,E()},[j,E]),P=m.useCallback((k=0)=>{const _=j.servoConfig;if(!_)return;const X=typeof k=="number"&&k!==0?k:_.nudgeDegrees||1,te=typeof d.current=="number"?d.current:typeof _.homeAngle=="number"?_.homeAngle:0;Z(te+X)},[j.servoConfig,Z]),ce=m.useCallback(()=>{const k=j.servoConfig;if(!k)return;const _=typeof k.homeAngle=="number"?k.homeAngle:typeof k.minAngle=="number"&&typeof k.maxAngle=="number"?(k.minAngle+k.maxAngle)/2:0;Z(_)},[j.servoConfig,Z]),ue=m.useCallback(async k=>{const _=l.macros.find(X=>X.id===k)||null;_&&(k==="drive-sequence"?(R(),g?.homeAssistant?.entities||(f.current=!0),E()):k==="seek-dock"&&E(),await j.runMacroSteps(_))},[j,E,g?.homeAssistant?.entities,l.macros,R]),se=m.useCallback(()=>{i({type:"control/update-drive",payload:{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:"system-stop"}}),j.sendDriveDirect({left:0,right:0}),j.sendAuxMotors({main:0,side:0,vacuum:0})},[j]),B=m.useCallback(k=>{j.sendOiCommand(k)},[j]),W=m.useCallback(k=>{j.roverId&&j.emitCommand({type:"sensorStream",data:{sensorStream:{enable:k}}})},[j]),le=m.useCallback(()=>{j.sendNightVision("toggle"),E()},[j,E]),ie=m.useCallback(k=>{const _=typeof k=="number"?k:Sl;return i({type:"control/set-song-note",payload:_}),_},[]),ee=m.useCallback((k,_)=>j.sendSong(k,_),[j]),q=m.useCallback((k,_)=>{i({type:"control/register-input-state",payload:{source:k,state:_}})},[]),z=m.useMemo(()=>({state:l,dispatch:i,pipeline:j,overcurrentLimiter:S,actions:{setMode:A,setDriveVector:V,setAuxMotors:ne,setServoAngle:Z,nudgeServo:P,goServoHome:ce,runMacro:ue,stopAllMotion:se,sendOiCommand:B,setSensorStream:W,toggleNightVision:le,updateKeyBinding:I,resetKeyBindings:ae,registerInputState:q,setSongNote:ie,sendSong:ee}}),[l,j,S,A,V,ne,Z,P,ce,ue,se,B,W,le,I,ae,q,ie,ee]);return o.jsx(ig.Provider,{value:z,children:a})}function gt(){const a=m.useContext(ig);if(!a)throw new Error("useControlSystem must be used within ControlSystemProvider");return a}const vS="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=",rg=m.createContext({messages:[],typing:[],sendMessage:async()=>{},focusChat:()=>{},blurChat:()=>{},registerInputRef:()=>{},onInputFocus:()=>{},onInputBlur:()=>{},setTypingActive:()=>{},isChatFocused:!1});function xS({children:a}){const l=sn(),{session:i,pushAlert:r}=_e(),[f,d]=m.useState([]),[y,p]=m.useState([]),[g,v]=m.useState(!1),b=m.useRef(null),S=m.useRef(null),w=m.useRef(null),C=m.useRef(new Map),j=m.useRef(new Map),R=m.useRef({isTyping:!1,lastSent:0}),A=m.useCallback(()=>{const Z=Array.from(C.current.values()).sort((P,ce)=>P.lastUpdate-ce.lastUpdate).map(P=>P.payload);p(Z)},[]),E=m.useCallback(Z=>!Z||typeof Z!="object"?null:Z.typingId?Z.typingId:Z.fromDiscord?`discord:${Z.discordUserId||Z.discordUserName||Z.nickname||"unknown"}`:`socket:${Z.socketId||Z.nickname||"unknown"}`,[]);m.useEffect(()=>{w.current=new Audio(vS),w.current.load()},[]);const N=m.useCallback(()=>{const Z=w.current;Z&&(Z.currentTime=0,Z.play().catch(()=>{}))},[]);m.useEffect(()=>{function Z(P={}){d(ce=>[...ce.slice(-99),P]),!(P?.socketId&&i?.socketId&&P.socketId===i.socketId)&&(N(),r?.({kind:"chat",payload:P,id:`chat-${P.id||Math.random().toString(36).slice(2)}`,receivedAt:Date.now()}))}return l.on("chat:message",Z),()=>{l.off("chat:message",Z)}},[N,i?.socketId,l]),m.useEffect(()=>{function Z(P={}){const ce=E(P);if(!ce)return;const ue=Date.now();if(P?.socketId&&i?.socketId&&P.socketId===i.socketId){P.isTyping||(C.current.delete(ce),A());return}if(P.isTyping){C.current.set(ce,{payload:P,expiresAt:ue+6e3,lastUpdate:ue});const se=j.current.get(ce)||0;ue-se>=2500&&(j.current.set(ce,ue),r?.({kind:"chat-typing",payload:P,id:`chat-typing-${ce}-${P.id||Math.random().toString(36).slice(2)}`,receivedAt:ue}))}else C.current.delete(ce);A()}return l.on("chat:typing",Z),()=>{l.off("chat:typing",Z)}},[r,A,E,i?.socketId,l]),m.useEffect(()=>{const Z=setInterval(()=>{const P=Date.now();let ce=!1;C.current.forEach((ue,se)=>{ue.expiresAt<=P&&(C.current.delete(se),ce=!0)}),ce&&A()},2e3);return()=>clearInterval(Z)},[A]),m.useEffect(()=>{function Z(P=[]){Array.isArray(P)&&d(ce=>{if(ce.length===0)return P.slice(-100);const ue=new Set(P.map(B=>B?.id));return[...P,...ce.filter(B=>B?.id&&!ue.has(B.id))].slice(-100)})}return l.on("chat:init",Z),()=>{l.off("chat:init",Z)}},[l]);const D=m.useCallback(Z=>{const P=!!Z,ce=Date.now(),ue=R.current,se=!P&&ue.isTyping;!(P&&(!ue.isTyping||ce-ue.lastSent>=3500))&&!se||(R.current={isTyping:P,lastSent:ce},l.emit("chat:typing",{isTyping:P}))},[l]),J=m.useCallback((Z,P=null)=>new Promise((ce,ue)=>{l.emit("chat:send",{text:Z,tts:P},(se={})=>{se.error?ue(new Error(se.error)):ce(se)})}),[l]),G=m.useCallback((Z,P={})=>{(P?.target==="hud"?"hud":"panel")==="hud"?S.current=Z:b.current=Z},[]),K=m.useCallback(()=>{v(!0),(S.current||b.current)?.focus()},[]),V=m.useCallback(()=>{v(!1),S.current?.blur(),b.current?.blur()},[]),ne=m.useCallback(()=>v(!0),[]),I=m.useCallback(()=>v(!1),[]),ae=m.useMemo(()=>({messages:f,sendMessage:J,focusChat:K,blurChat:V,registerInputRef:G,onInputFocus:ne,onInputBlur:I,setTypingActive:D,typing:y,isChatFocused:g,selfSocketId:i?.socketId||null}),[V,K,g,f,I,ne,G,J,i?.socketId,D,y]);return o.jsx(rg.Provider,{value:ae,children:a})}function Wu(){const a=m.useContext(rg);if(!a)throw new Error("useChat must be used inside ChatProvider");return a}const ut={keyboard:{baseSpeed:250,turboSpeed:400,precisionSpeed:125,tiltSpeed:80,tiltIntervalMs:110},gamepad:{driveDeadzone:.2,cameraDeadzone:.25,servoStep:2,auxReverseScale:.55}},wr={drive:{horizontal:null,vertical:null},camera:{vertical:null},brushes:{mainAxis:null,sideAxis:null},buttons:{allAux:null,vacuum:null,mainReverse:null,sideReverse:null,dock:null,drive:null}},cu="keyboard",ou={x:0,y:0,boost:!1},uu={main:0,side:0,vacuum:0},Fp=Iu[0],Jp=Iu[1],Pu=5,ks=500,_s=1,ef=100;function fu(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}function bS(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Pu,Math.min(ks,i)):l}function cg(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(_s,Math.min(ef,i)):l}function SS(a){const i=(cg(a,a)-_s)/(ef-_s),r=ks-i*(ks-Pu);return Math.round(r)}function AS(a){const l=bS(a,a),i=(ks-l)/(ks-Pu),r=_s+i*(ef-_s);return Math.round(r)}function jS(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 NS(a,l){const i=Pe(l.driveForward,a),r=Pe(l.driveBackward,a),f=Pe(l.driveLeft,a),d=Pe(l.driveRight,a),y=Pe(l.boostModifier,a),p=Pe(l.slowModifier,a);let g=0;i&&!r?g=1:r&&!i&&(g=-1);let v=0;f&&!d?v=-1:d&&!f&&(v=1);const b=p?.4:1;return{x:v*b,y:g*b,boost:y&&!p}}function wS(a,l){if(Pe(l.auxAllForward,a))return{main:127,side:127,vacuum:127};const r=Pe(l.auxMainForward,a)?127:Pe(l.auxMainReverse,a)?-127:0,f=Pe(l.auxSideForward,a)?127:Pe(l.auxSideReverse,a)?-70:0,d=Pe(l.auxVacuumFast,a)?127:Pe(l.auxVacuumSlow,a)?50:0;return{main:r,side:f,vacuum:d}}function ES(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,nudgeServo:f,runMacro:d,stopAllMotion:y,registerInputState:p,toggleNightVision:g,setSongNote:v,sendSong:b}}=gt(),{session:S,homeAssistantSetState:w}=_e(),{focusChat:C,blurChat:j,isChatFocused:R}=Wu(),{value:A}=ft("inputs",ut),E=m.useMemo(()=>fS(a.keymap),[a.keymap]),N=m.useMemo(()=>{const z=new Set;return Object.values(E).forEach(k=>{k&&k.forEach(_=>z.add(_))}),z},[E]),D=m.useMemo(()=>{const z=ut.keyboard,k=A?.keyboard??{};return{baseSpeed:fu(k.baseSpeed,z.baseSpeed),turboSpeed:fu(k.turboSpeed,z.turboSpeed),precisionSpeed:fu(k.precisionSpeed,z.precisionSpeed)}},[A?.keyboard]),J=m.useMemo(()=>{const z=ut.keyboard,k=A?.keyboard??{},_=cg(typeof k.tiltSpeed=="number"?k.tiltSpeed:typeof k.tiltIntervalMs=="number"?AS(k.tiltIntervalMs):z.tiltSpeed,z.tiltSpeed);return SS(_)},[A?.keyboard]),G=m.useMemo(()=>Math.abs(a.camera?.config?.nudgeDegrees||1),[a.camera?.config?.nudgeDegrees]),K=m.useRef(new Set),V=m.useRef(ou),ne=m.useRef(uu),I=m.useRef(null),ae=m.useRef(null),Z=m.useCallback(()=>{const z=new Set(K.current);Pe(E.boostModifier,z);const _=Pe(E.slowModifier,z)?{baseSpeed:D.precisionSpeed,boostSpeed:D.precisionSpeed}:{baseSpeed:D.baseSpeed,boostSpeed:D.turboSpeed},X=NS(z,E),te=wS(z,E);(X.x!==V.current.x||X.y!==V.current.y||X.boost!==V.current.boost)&&(V.current=X,i(X,{source:cu,speedOptions:_})),(te.main!==ne.current.main||te.side!==ne.current.side||te.vacuum!==ne.current.vacuum)&&(ne.current=te,r(te)),p(cu,{keys:Array.from(z),vector:X,aux:te})},[E,D,p,r,i]),P=m.useCallback(()=>{I.current&&(clearTimeout(I.current),I.current=null)},[]),ce=m.useCallback(()=>{const z=new Set(K.current),k=Pe(E.cameraUp,z),_=Pe(E.cameraDown,z);return(k?1:0)-(_?1:0)},[E]),ue=m.useCallback(()=>{if(ce()===0){P();return}if(I.current)return;const k=()=>{const _=ce();if(_===0){P();return}f(_*G),I.current=setTimeout(k,J)};I.current=setTimeout(k,0)},[ce,f,J,G,P]),se=m.useCallback(()=>{ae.current&&(clearTimeout(ae.current),ae.current=null)},[]),B=m.useCallback(()=>{const z=new Set(K.current),k=Pe(E.songNoteUp,z),_=Pe(E.songNoteDown,z);return(k?1:0)-(_?1:0)},[E]),W=m.useCallback(z=>{if(z===0)return;let _=(typeof a.song?.note=="number"?a.song.note:Sl)+z;_>Jp?_=Fp:_<Fp&&(_=Jp);const X=v(_);b([{note:X,duration:Ru}],{slot:0})},[b,v,a.song?.note]),le=m.useCallback(()=>{if(B()===0){se();return}if(ae.current)return;const k=()=>{const _=B();if(_===0){se();return}W(_),ae.current=setTimeout(k,eS)};ae.current=setTimeout(k,0)},[B,se,W]),ie=m.useCallback(()=>{K.current.clear(),V.current=ou,ne.current=uu,P(),se(),y(),p(cu,{keys:[],vector:ou,aux:uu})},[p,y,P,se]),ee=m.useCallback(z=>{const k=S?.homeAssistant;if(!k?.enabled||!k?.connected)return;const X=(k.entities||[]).filter(te=>(te.type==="light"||te.type==="switch")&&te.available!==!1&&te.state!=="unavailable");if(X.length!==0){if(z==="on"){const te=X.find(fe=>fe.state!=="on");te&&w(te.id,"on").catch(()=>{});return}if(z==="off")for(let te=X.length-1;te>=0;te-=1){const fe=X[te];if(fe.state==="on"){w(fe.id,"off").catch(()=>{});break}}}},[w,S?.homeAssistant]);m.useEffect(()=>{function z(X){if(jS(X))return;const te=Xp(X);if(te.length===0)return;const fe=new Set(te);if(Pe(E.chatFocus,fe)){X.preventDefault(),ie(),R||C();return}te.some(pe=>N.has(pe))&&X.preventDefault();const Ne=te.filter(pe=>!K.current.has(pe));Ne.forEach(pe=>K.current.add(pe)),Ne.length>0&&(Ne.some(pe=>E.driveMacro?.has(pe))?(l("drive"),d("drive-sequence")):Ne.some(pe=>E.dockMacro?.has(pe))?(l("dock"),d("seek-dock")):Ne.some(pe=>E.nightVisionToggle?.has(pe))?g():Ne.some(pe=>E.homeAssistantOn?.has(pe))?ee("on"):Ne.some(pe=>E.homeAssistantOff?.has(pe))&&ee("off")),ue(),le(),Z()}function k(X){Xp(X).forEach(fe=>K.current.delete(fe)),ue(),le(),Z()}function _(){ie()}return window.addEventListener("keydown",z),window.addEventListener("keyup",k),window.addEventListener("blur",_),()=>{window.removeEventListener("keydown",z),window.removeEventListener("keyup",k),window.removeEventListener("blur",_)}},[N,j,Z,ue,le,C,R,E.chatFocus,E.dockMacro,E.driveMacro,ie,d,l,y,se,ee]);const q=m.useRef(ie);return m.useEffect(()=>{q.current=ie},[ie]),m.useEffect(()=>{q.current()},[a.roverId]),m.useEffect(()=>()=>{P(),se()},[P,se]),null}const cr="gamepad";function du(a,l){return Math.abs(a)<l?0:a}function Ip(a,l){return a&&l&&a.x===l.x&&a.y===l.y&&a.boost===l.boost}function Wp(a,l){return a&&l&&a.main===l.main&&a.side===l.side&&a.vacuum===l.vacuum}function qS(){const{actions:{setMode:a,setDriveVector:l,setAuxMotors:i,nudgeServo:r,runMacro:f,registerInputState:d}}=gt(),{value:y}=ft("inputs",ut),{value:p}=ft("gamepadMapping",wr),g=y.gamepad??ut.gamepad,v=Math.min(Math.max(g.driveDeadzone??.2,0),.8),b=Math.min(Math.max(g.cameraDeadzone??.25,0),.9),S=g.servoStep??ut.gamepad.servoStep,w=g.auxReverseScale??ut.gamepad.auxReverseScale,C=!!(p?.drive?.horizontal&&p?.drive?.vertical),j=!!p?.camera?.vertical,R=!!p?.brushes?.mainAxis,A=!!p?.brushes?.sideAxis,E=R||A,N=!!p?.buttons?.vacuum,D=!!p?.buttons?.allAux,J=N||D,G=!!p?.buttons?.mainReverse,K=!!p?.buttons?.sideReverse,V=G||K,ne=!!p?.buttons?.drive,I=!!p?.buttons?.dock,Z=C||j||E||J||V||(ne||I),P=m.useRef(null),ce=m.useRef({x:0,y:0,boost:!1}),ue=m.useRef({main:0,side:0,vacuum:0}),se=m.useRef(new Map),B=m.useRef(0),W=m.useRef({main:!1,side:!1}),le=m.useCallback((k,_)=>{const X=se.current.get(k)||!1;return se.current.set(k,_),_&&!X},[]),ie=m.useCallback((k,_)=>{if(!_)return 0;const X=k.axes?.[_.index]??0;return _.invert?-X:X},[]),ee=m.useCallback((k,_)=>{if(!_)return 0;const X=k.buttons?.[_.index];return X?typeof X.value=="number"?X.value:X.pressed?1:0:0},[]),q=m.useCallback((k,_)=>{if(!_)return!1;const X=k.buttons?.[_.index];return X?X.pressed||X.value>.5:!1},[]),z=m.useCallback(()=>{if(typeof navigator>"u"||!navigator.getGamepads)return;const k=navigator.getGamepads(),_=k&&Array.from(k).find(Boolean);if(!_){Ip(ce.current,{x:0,y:0,boost:!1})||(ce.current={x:0,y:0,boost:!1},l({x:0,y:0,boost:!1},{source:cr})),Wp(ue.current,{main:0,side:0,vacuum:0})||(ue.current={main:0,side:0,vacuum:0},i({main:0,side:0,vacuum:0})),d(cr,{connected:!1,mappingReady:Z});return}const X=C?Rn(du(ie(_,p.drive.horizontal),v)):0,te=C?Rn(du(-ie(_,p.drive.vertical),v)):0,fe={x:X,y:te,boost:!1};Ip(fe,ce.current)||(ce.current=fe,l(fe,{source:cr}));const Ne=R?ie(_,p.brushes.mainAxis):0,pe=Math.round(Math.min(Math.abs(Ne),1)*127),mt=W.current.main?-pe:pe,_n=A?ie(_,p.brushes.sideAxis):0,Dn=Math.round(Math.min(Math.abs(_n),1)*127),rn=W.current.side?-Math.round(Dn*w):Math.round(Dn*w),yt=N&&q(_,p.buttons.vacuum)?127:0;let kt={main:R?mt:0,side:A?rn:0,vacuum:yt};D&&q(_,p.buttons.allAux)&&(kt={main:127,side:127,vacuum:127}),Wp(kt,ue.current)||(ue.current=kt,i(kt));const dt=j?Rn(du(-ie(_,p.camera.vertical),b)):0,ca=performance.now();j&&Math.abs(dt)>.25&&ca-B.current>120&&(B.current=ca,r(dt>0?S:-S)),G&&le("toggle-main",q(_,p.buttons.mainReverse))&&(W.current.main=!W.current.main),K&&le("toggle-side",q(_,p.buttons.sideReverse))&&(W.current.side=!W.current.side),ne&&le(`macro-${p.buttons.drive.index}`,q(_,p.buttons.drive))&&(a("drive"),f("drive-sequence")),I&&le(`macro-${p.buttons.dock.index}`,q(_,p.buttons.dock))&&(a("dock"),f("seek-dock")),d(cr,{connected:!0,mappingReady:Z,id:_.id,index:_.index,axes:[X,te,dt],reverse:{...W.current},bindings:{drive:C,camera:j,brushes:E,auxButtons:{vacuum:N,allAux:D},reverseButtons:{main:G,side:K},macros:{drive:ne,dock:I}}})},[w,b,v,ie,ee,le,q,p.buttons?.allAux,p.buttons?.dock,p.buttons?.drive,p.buttons?.mainReverse,p.buttons?.sideReverse,p.buttons?.vacuum,p.camera?.vertical,p.drive?.horizontal,p.drive?.vertical,p.brushes?.mainAxis,p.brushes?.sideAxis,Z,r,d,f,S,i,l,a]);return m.useEffect(()=>{function k(){z(),P.current=requestAnimationFrame(k)}return P.current=requestAnimationFrame(k),()=>{P.current&&cancelAnimationFrame(P.current)}},[z]),null}function og(a){const l=a?.sensors||{},i=l.oiMode?.label||"Unknown",r=i.toLowerCase(),f=l.chargingState?.label||"",d=!!l.chargingSources?.homeBase,y=d&&f.toLowerCase()!=="not charging"&&f!=="";return{driving:r==="full",docked:d,charging:y,dockedNotCharging:d&&!y,dockingInProgress:!d&&!y&&r==="passive",oiLabel:i,chargingLabel:f}}function ug(a){const l=El(a);return m.useMemo(()=>og(l),[l])}function sa({label:a,active:l}){return o.jsx("span",{className:`rounded-xl px-1.5 py-0.5 text-[0.75rem] font-semibold ${l?"bg-emerald-600 text-white":"bg-red-600 text-white"}`,children:a})}function Pp({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function hu({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 CS({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(_u,{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 fg({layout:a="desktop",expand:l=!1,driveDockState:i}){const r=a==="mobile",{state:{roverId:f,keymap:d},actions:y}=gt(),p=El(f),g=i??og(p),{driving:v,docked:b,charging:S,dockedNotCharging:w,dockingInProgress:C,oiLabel:j}=g,[R,A]=m.useState(null),[E,N]=m.useState(!1),[D,J]=m.useState(!1),G=!f||R!==null,K=!f||R!==null,V=ra(d?.driveMacro?.[0]),ne=ra(d?.dockMacro?.[0]),I={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"]},ae="Click this button to initate auto-dock.",Z={summary:"You must enable driving mode before you can move the rover.",steps:["Press the keybind or tap this button to enable driving mode","Once ready (should be instant), this dialog will change, and you will be able to move"]},P=async()=>{if(!(!f||R)){A("drive");try{y.setMode("drive"),await y.runMacro("drive-sequence")}catch(X){alert(X.message)}finally{A(null)}}},ce=async()=>{if(!(!f||R)){N(!1),J(!1),A("drive");try{y.setMode("drive"),await y.runMacro("drive-sequence")}catch(X){alert(X.message)}finally{A(null)}}},ue=async()=>{if(!(!f||R)){A("dock");try{y.setMode("dock"),await y.runMacro("seek-dock")}catch(X){alert(X.message)}finally{A(null),N(!1),J(!1)}}},se=()=>{K||(J(!0),N(!0))},B="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",ie="text-center items-center justify-between",ee=r?"text-sm font-semibold":"",q="border-emerald-300/70 bg-emerald-800 text-emerald-50 hover:bg-emerald-700 focus-visible:ring-emerald-300",z="border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800 focus-visible:ring-amber-300",k="border-indigo-300/70 bg-indigo-900 text-indigo-50 hover:bg-indigo-800 focus-visible:ring-indigo-300",_=l?"h-full flex-1":"";if(!v&&!C)return o.jsxs("button",{type:"button",onClick:ce,disabled:G,className:`${B} ${_} ${ie} ${ee} ${q}`,children:[o.jsxs("div",{className:"space-y-0.5 w-full",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[o.jsx("span",{className:"text-base font-semibold text-emerald-50",children:"Start Driving"}),!r&&V?o.jsx(Pp,{label:V}):null,r?null:o.jsx(hu,{label:"Click to start",tone:"emerald"})]}),o.jsx("p",{className:"text-sm text-emerald-50/90",children:Z.summary}),o.jsx(_u,{steps:Z.steps,tone:"emerald"})]}),o.jsxs("div",{className:"flex w-full flex-col gap-0.5",children:[o.jsx(sa,{label:`OI: ${j}`,active:j.toLowerCase()==="full"}),o.jsx(sa,{label:b?"Docked!":"Not docked",active:b}),o.jsx(sa,{label:S?"Charging!":"Not charging",active:S})]})]});if(C){const X={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:G,onClick:P,className:`${B} ${_} ${ie} ${ee} ${z}`,children:[o.jsxs("div",{className:"space-y-0.5 w-full",children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5",children:[o.jsx("span",{className:"text-base font-semibold text-amber-50",children:"Docking in Progress"}),r?null:o.jsx(hu,{label:"Click to return to driving mode",tone:"amber"})]}),o.jsx("p",{className:"text-sm text-amber-50/90",children:X.summary})]}),o.jsxs("div",{className:"flex w-full flex-col gap-0.5",children:[o.jsx(sa,{label:b?"Docked":"Not docked",active:b}),o.jsx(sa,{label:S?"Charging":"Not charging",active:S})]}),o.jsx(_u,{steps:X.steps,tone:"amber"})]})}return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",disabled:K,onClick:se,className:r?`flex w-full items-center justify-center ${B} ${ie} ${ee} ${k}`:`${B} ${_} ${ie} ${ee} ${k}`,children:[o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-0.5 w-full",children:[o.jsx("span",{className:"text-base font-semibold text-indigo-50",children:"Dock and Charge"}),!r&&ne?o.jsx(Pp,{label:ne}):null,r?null:o.jsx(hu,{label:"Click to begin docking",tone:"indigo"})]}),!r&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-indigo-50/90",children:ae}),o.jsxs("div",{className:"flex w-full flex-col gap-0.5",children:[o.jsx(sa,{label:b?"Docked":"Not docked",active:b}),o.jsx(sa,{label:S?"Charging":"Not charging",active:S}),w?o.jsx(sa,{label:"Not charging yet",active:!1}):null]}),o.jsx("div",{className:"text-xs text-indigo-100/80",children:"Line up straight, about 1 foot away, before docking."})]})]}),D||!r&&E?o.jsx(CS,{instructions:I,pending:R==="dock",onCancel:()=>{J(!1),N(!1)},onConfirm:ue}):null]})}function _u({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 or="mobile-joystick",TS=80,RS=.15,MS=[{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 kS({disabled:a,layout:l,radius:i,onMove:r,onStop:f}){const d=m.useRef(null),y=m.useRef(null),p=m.useRef({x:0,y:0}),[g,v]=m.useState({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),b=m.useCallback(()=>{y.current=null,v({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),f?.()},[f]),S=m.useCallback(R=>{if(a||y.current!==null)return;R.preventDefault();const A=d.current;if(!A)return;const E=A.getBoundingClientRect(),N=R.clientX-E.left,D=R.clientY-E.top;p.current={x:N,y:D},y.current=R.pointerId,A.setPointerCapture?.(R.pointerId),v({active:!0,base:{x:N,y:D},knob:{x:0,y:0}})},[a]),w=m.useCallback(R=>{if(a||y.current!==R.pointerId)return;R.preventDefault();const A=d.current;if(!A)return;const E=A.getBoundingClientRect(),N=R.clientX-E.left,D=R.clientY-E.top,J=N-p.current.x,G=D-p.current.y,K=Math.min(Math.hypot(J,G),i),V=Math.atan2(G,J),ne=Math.cos(V)*K,I=Math.sin(V)*K,ae={x:Rn(ne/i),y:Rn(-I/i),boost:!1};v(Z=>({...Z,knob:{x:ne,y:I}})),r?.(ae)},[a,r]),C=m.useCallback(R=>{if(y.current!==R.pointerId)return;R.preventDefault(),d.current?.releasePointerCapture?.(R.pointerId),b()},[b]);m.useEffect(()=>{a&&b()},[a,b]);const j=l==="landscape"?"h-[260px]":"h-[220px]";return o.jsxs("div",{ref:d,role:"presentation",className:`relative w-full ${j} select-none overflow-hidden bg-zinc-950`,style:{touchAction:"none"},onPointerDown:S,onPointerMove:w,onPointerUp:C,onPointerLeave:C,onPointerCancel:C,onContextMenu:R=>R.preventDefault(),children:[!g.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"})]}),g.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:g.base.x,top:g.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:g.base.x+g.knob.x,top:g.base.y+g.knob.y}})]})]})}function dg({layout:a}){const{state:{roverId:l,camera:i},pipeline:r,actions:{setDriveVector:f,registerInputState:d,setServoAngle:y,toggleNightVision:p}}=gt(),g=ug(l),v=g.docked&&!g.driving,b=!l,S=i?.config,w=!!(l&&i?.enabled&&S),C=!!(l&&r?.nightVision),j=typeof S?.minAngle=="number"?S.minAngle:-45,R=typeof S?.maxAngle=="number"?S.maxAngle:45,A=typeof i?.angle=="number"?i.angle:typeof S?.homeAngle=="number"?S.homeAngle:(j+R)/2,E=TS,N=RS,D=m.useRef({x:0,y:0,boost:!1});m.useEffect(()=>{b&&(D.current={x:0,y:0,boost:!1})},[b]);const J=m.useCallback((I={})=>{if(b)return;const ae={x:Rn(I.x??0),y:Rn(I.y??0),boost:!!I.boost},Z={x:D.current.x+(ae.x-D.current.x)*(1-N),y:D.current.y+(ae.y-D.current.y)*(1-N),boost:ae.boost};D.current=Z,f(Z,{source:or}),d(or,{vector:Z,lastEvent:"move"})},[b,d,f,N]),G=m.useCallback(()=>{if(b)return;const I={x:0,y:0,boost:!1};D.current=I,f(I,{source:or}),d(or,{vector:I,lastEvent:"stop"})},[b,d,f]),K=I=>{if(!w)return;const ae=Number(I.target.value);Number.isNaN(ae)||y(ae)},ne=`flex h-full flex-col gap-0.5 text-slate-100 ${v?"max-h-screen self-start":""}`;return o.jsxs("div",{className:ne,children:[o.jsx(fg,{layout:"mobile",expand:v,driveDockState:g}),v?null:o.jsxs(o.Fragment,{children:[C&&o.jsx("button",{type:"button",onClick:()=>p(),disabled:b,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:j,max:R,step:.5,value:A,onChange:K,className:"mt-0 w-full accent-cyan-400"})]}),o.jsx(kS,{disabled:b,layout:a,radius:E,onMove:J,onStop:G})]})]})}function hg({orientation:a}){const{state:{roverId:l},actions:{setAuxMotors:i}}=gt(),r=m.useRef(null),f=!l,d=m.useCallback(g=>{if(!f){if(g.hold===!1){i(g.values),r.current=null;return}r.current=g.id,i(g.values)}},[f,i]),y=m.useCallback(g=>{f||g.hold===!1||r.current===g.id&&(r.current=null,i({main:0,side:0,vacuum:0}))},[f,i]),p=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 ${p} gap-0.5`,children:MS.map(g=>o.jsx("button",{type:"button",disabled:f,onPointerDown:v=>{v.preventDefault(),d(g)},onPointerUp:()=>y(g),onPointerLeave:()=>y(g),onPointerCancel:()=>y(g),onContextMenu:v=>v.preventDefault(),className:`px-0.5 py-0.5 text-left text-sm font-semibold text-white transition select-none no-touch-select ${g.color} hover:brightness-110 disabled:opacity-30 h-10`,children:g.label},g.id))})]})}function _S(){return o.jsx("div",{className:"flex h-full flex-col gap-0.5",children:o.jsx(hg,{orientation:"landscape"})})}function DS(){return o.jsx("div",{className:"flex h-full flex-col gap-0.5",children:o.jsx(dg,{layout:"landscape"})})}function OS(){return o.jsx("section",{className:"panel",children:o.jsxs("div",{className:"grid grid-cols-2 gap-0.5 items-stretch",children:[o.jsx(hg,{orientation:"portrait"}),o.jsx(dg,{layout:"portrait"})]})})}function BS(a=[],l={}){const i=sn(),{enabled:r=!0,version:f=null}=l,[d,y]=m.useState({}),p=m.useRef(new Map),g=m.useMemo(()=>a.map(j=>typeof j=="string"?j:j.id),[a]),v=m.useMemo(()=>{const j=g.join("|");return f?`${j}|v:${f}`:j},[g,f]),b=m.useRef([]),[S,w]=m.useState(0),C=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const j=()=>w(R=>R+1);return i.on("connect",j),()=>i.off("connect",j)},[i]),m.useEffect(()=>{b.current=g},[v,g]),m.useEffect(()=>{p.current.forEach(j=>URL.revokeObjectURL(j)),p.current.clear(),y({})},[v]),m.useEffect(()=>{if(!r){p.current.forEach(N=>URL.revokeObjectURL(N)),p.current.clear(),y({});return}if(!b.current.length||!i)return;let j=!1;const R=b.current,A=(N={},D)=>{if(j||!N.id||!D)return;const J=D.byteLength??D.length??0,G=Date.now(),K=C.current.get(N.id)||{count:0,totalBytes:0,lastLogAt:0},V={count:K.count+1,totalBytes:K.totalBytes+J,lastLogAt:K.lastLogAt};if(!V.lastLogAt||G-V.lastLogAt>=1e4){const Z=V.count?V.totalBytes/V.count:0;console.log("[roomCamera]",N.id,`frame=${J}B`,`avg=${Math.round(Z)}B`,`count=${V.count}`),V.lastLogAt=G}C.current.set(N.id,V);const ne=new Blob([D],{type:"image/jpeg"}),I=URL.createObjectURL(ne),ae=p.current.get(N.id);ae&&URL.revokeObjectURL(ae),p.current.set(N.id,I),y(Z=>({...Z,[N.id]:{status:"playing",ts:N.ts||Date.now(),error:null,objectUrl:I}}))},E=(N={})=>{j||!N.id||y(D=>({...D,[N.id]:{...D[N.id]||{},status:N.error?"error":D[N.id]?.status||"connecting",error:N.error||null,ts:N.ts||D[N.id]?.ts||null,objectUrl:D[N.id]?.objectUrl||null}}))};return i.on("roomCamera:frame",A),i.on("roomCamera:status",E),i.emit("roomCamera:subscribe",{ids:R},(N={})=>{N.error}),()=>{j=!0,i.emit("roomCamera:unsubscribe",{ids:R}),i.off("roomCamera:frame",A),i.off("roomCamera:status",E),p.current.forEach(N=>URL.revokeObjectURL(N)),p.current.clear()}},[i,v,r,S]),d}function zS({feed:a,label:l}){const[i,r]=m.useState(!1);m.useEffect(()=>{a&&(!a.ts&&!a.objectUrl||r(d=>!d))},[a?.ts,a?.objectUrl]);const f=m.useMemo(()=>a?a.error?`Error: ${a.error}`:a.status||"Connecting…":"Connecting…",[a]);return o.jsxs("div",{className:"relative w-full overflow-hidden rounded bg-black",style:{aspectRatio:"4 / 3"},children:[a?.objectUrl?o.jsx("img",{src:a.objectUrl,alt:l,className:"h-full w-full object-cover"}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-300",children:"Waiting for frame…"}),o.jsx("div",{className:"pointer-events-none absolute left-0 top-0 bg-black/70 px-0.5 py-0.5 text-xs font-semibold text-white",children:l}),o.jsxs("div",{className:"pointer-events-none absolute bottom-0 left-0 m-0 flex items-center gap-0.5 rounded bg-black/70 px-0.5 py-0.25 text-[0.7rem] text-slate-100",children:[o.jsx("span",{className:`h-2 w-2 rounded-full ${i?"bg-emerald-400":"bg-slate-500"}`}),o.jsx("span",{children:f})]})]})}function LS(){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 mg=["horizontal","vertical"];function mu(a,l){return mg.includes(a)?a:l}function tf({defaultOrientation:a="horizontal",orientation:l,hideLayoutToggle:i=!1,hideHeader:r=!1,panelId:f=null}){const{session:d}=_e(),y=d?.roomCameras||[],p=BS(y.map(A=>({id:A.id}))),{value:g,save:v}=ft("roomCameraPanels",{}),[b,S]=m.useState(()=>mu(f?g?.[f]:a,"horizontal"));m.useEffect(()=>{if(!f)return;const A=g?.[f];A&&S(mu(A,"horizontal"))},[f,g?.[f]]);const w=l?mu(l,"horizontal"):b,C=w==="vertical"?"flex flex-col gap-0.5":"grid gap-0.5 md:grid-cols-2",j=!i&&!l&&y.length>0,R=A=>{S(A),f&&v(E=>({...E||{},[f]:A}))};return y.length===0?o.jsx(LS,{}):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:y.length})]}),o.jsx("div",{className:"flex flex-wrap items-center gap-0.5 text-xs",children:j&&o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("span",{className:"text-slate-500",children:"Layout:"}),o.jsx("div",{className:"inline-flex overflow-hidden rounded border border-slate-700",children:mg.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:()=>R(A),children:A==="vertical"?"Vertical":"Grid"},A))})]})})]}),o.jsx("div",{className:C,children:y.map(A=>{const E=p[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(zS,{feed:E,label:A.name||A.id})},A.id)})})]})}function nf(){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 US(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 HS(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 af(a=[],l={}){const i=sn(),{enabled:r=!0,version:f=null}=l,[d,y]=m.useState({}),p=m.useMemo(()=>Array.isArray(a)?HS(a.map(US).filter(Boolean)):[],[a]),g=m.useMemo(()=>{const C=p.map(j=>`${j.type}:${j.id}:${j.key}`).join("|");return f?`${C}|v:${f}`:C},[p,f]),v=m.useRef([]),[b,S]=m.useState(0);return m.useEffect(()=>{if(!i)return;const C=()=>S(j=>j+1);return i.on("connect",C),()=>{i.off("connect",C)}},[i]),m.useEffect(()=>{v.current=p},[p]),m.useEffect(()=>{if(!g||!r){y({});return}const C=v.current;let j=!1;function R(A){const E=A.type==="room"?{roomCameraId:A.id}:{roverId:A.id};i.emit("video:request",E,(N={})=>{j||y(D=>({...D,[A.key]:N}))})}return C.forEach(A=>{R(A)}),()=>{j=!0}},[i,g,r,b]),m.useMemo(()=>{if(!g||!r)return{};const C={};return p.forEach(j=>{d[j.key]&&(C[j.key]=d[j.key])}),C},[g,d,p])}function lf(a=[],l={}){const i=sn(),{enabled:r=!0,version:f=null}=l,[d,y]=m.useState({}),p=m.useRef(new Map),g=m.useMemo(()=>a.map(j=>typeof j=="string"?j:j.id).filter(Boolean),[a]),v=m.useMemo(()=>{const j=g.join("|");return f?`${j}|v:${f}`:j},[g,f]),b=m.useRef([]),[S,w]=m.useState(0),C=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const j=()=>w(R=>R+1);return i.on("connect",j),()=>i.off("connect",j)},[i]),m.useEffect(()=>{b.current=g},[v,g]),m.useEffect(()=>{p.current.forEach(j=>URL.revokeObjectURL(j)),p.current.clear(),y({})},[v]),m.useEffect(()=>{if(!r){p.current.forEach(N=>URL.revokeObjectURL(N)),p.current.clear(),y({});return}if(!b.current.length||!i)return;let j=!1;const R=b.current,A=(N={},D)=>{if(j||!N.id||!D)return;const J=D.byteLength??D.length??0,G=Date.now(),K=C.current.get(N.id)||{count:0,totalBytes:0,lastLogAt:0},V={count:K.count+1,totalBytes:K.totalBytes+J,lastLogAt:K.lastLogAt};if(!V.lastLogAt||G-V.lastLogAt>=1e4){const Z=V.count?V.totalBytes/V.count:0;console.log("[roverSnapshot]",N.id,`frame=${J}B`,`avg=${Math.round(Z)}B`,`count=${V.count}`),V.lastLogAt=G}C.current.set(N.id,V);const ne=new Blob([D],{type:"image/jpeg"}),I=URL.createObjectURL(ne),ae=p.current.get(N.id);ae&&URL.revokeObjectURL(ae),p.current.set(N.id,I),y(Z=>({...Z,[N.id]:{status:"playing",ts:N.ts||Date.now(),error:null,objectUrl:I}}))},E=(N={})=>{j||!N.id||y(D=>({...D,[N.id]:{...D[N.id]||{},status:N.error?"error":D[N.id]?.status||"connecting",error:N.error||null,ts:N.ts||D[N.id]?.ts||null,objectUrl:D[N.id]?.objectUrl||null}}))};return i.on("roverSnapshot:frame",A),i.on("roverSnapshot:status",E),i.emit("roverSnapshot:subscribe",{ids:R},(N={})=>{N.error}),()=>{j=!0,i.emit("roverSnapshot:unsubscribe",{ids:R}),i.off("roverSnapshot:frame",A),i.off("roverSnapshot:status",E),p.current.forEach(N=>URL.revokeObjectURL(N)),p.current.clear()}},[i,v,r,S]),d}const VS={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"turn:your.turn.server:3478",username:"user",credential:"pass"}],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function YS(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 GS(a){if(!a)return{};const l=`${a}:${a}`;return{Authorization:`Basic ${YS(l)}`}}class e0{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(VS);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",...GS(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(y=>{"playoutDelayHint"in y&&(y.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 Du({sensors:a={},variant:l="full",size:i,overlay:r=!1}){const f=i||(l==="mini"?190:260),d=f/2,y=f*.07,p=d,g=d+y,v=d*.8,b=v-4,S=v+4,w=v-14,C=v-6,j=v*.65,R=a?.bumpsAndWheelDrops||{},A=a?.wheelOvercurrents||{},E=a?.wheelLeftCurrentMa??0,N=a?.wheelRightCurrentMa??0,D=a?.sideBrushCurrentMa??0,J=a?.mainBrushCurrentMa??0,G=6,K=R.bumpLeft?G:0,V=R.bumpRight?G:0,ne=JS({count:6,totalSpan:140,gap:6,startAngle:-70}),I=["L","FL","CL","CR","FR","R"],ae=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],Z=ne.map((se,B)=>({label:I[B],start:se.start,end:se.end,value:ae[B]})),P=[{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}],ce=ae.filter(se=>se!=null),ue=ce.length?Math.max(...ce,1200):1200;return o.jsxs("div",{className:`${r?"relative":"surface relative p-1"}`,style:r?{width:`${f}px`,height:`${f}px`}:{height:"100%",width:"100%",aspectRatio:"1 / 1"},children:[r?null:o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"absolute left-1 top-1 text-xs text-slate-400",children:"Top-down"}),o.jsxs("div",{className:"absolute right-1 top-1 text-[0.65rem] text-slate-500",children:["0–",ue]})]}),o.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${f} ${f}`,preserveAspectRatio:"xMidYMid meet",className:"mx-auto block",children:[o.jsx("circle",{cx:p,cy:g,r:v,fill:"#0f172a",stroke:"#334155",strokeWidth:"2"}),o.jsx(t0,{cx:p-j,cy:g,current:E,drop:R.wheelDropLeft,overcurrent:A.leftWheel,label:"L"}),o.jsx(t0,{cx:p+j,cy:g,current:N,drop:R.wheelDropRight,overcurrent:A.rightWheel,label:"R"}),o.jsx($S,{cx:p+v*.65,cy:g-v*.55,current:D,overcurrent:A.sideBrush}),o.jsx(KS,{cx:p,cy:g,current:J,overcurrent:A.mainBrush,variant:l,dirtLeft:a?.dirtDetectLeft,dirtRight:a?.dirtDetect}),Z.map(se=>{const B=ZS(se.value,ue),W=S+4,le=W+28;return o.jsx(QS,{cx:p,cy:g,rBase:le,rTip:W,startDeg:se.start,endDeg:se.end,color:B,value:se.value,max:ue},se.label)}),P.map(se=>{const B=FS(se.value,se.active);return o.jsx(pu,{cx:p,cy:g,rInner:w,rOuter:C,startDeg:se.start,endDeg:se.end,color:B,opacity:1,pulse:!!se.active},se.label)}),o.jsx(pu,{cx:p,cy:g,rInner:b-K,rOuter:S-K,startDeg:-70,endDeg:-6,color:R.bumpLeft?"#ef4444":"#475569",opacity:1,pulse:!!R.bumpLeft}),o.jsx(pu,{cx:p,cy:g,rInner:b-V,rOuter:S-V,startDeg:6,endDeg:70,color:R.bumpRight?"#ef4444":"#475569",opacity:1,pulse:!!R.bumpRight})]})]})}function pu({cx:a,cy:l,rInner:i,rOuter:r,startDeg:f,endDeg:d,color:y,pulse:p=!1,opacity:g=1}){const v=(i+r)/2,b=r-i,S=XS(a,l,v,f,d);return o.jsxs(o.Fragment,{children:[o.jsx("path",{d:S,stroke:y,strokeWidth:b,strokeLinecap:"round",fill:"none",opacity:g}),p?o.jsx("path",{d:S,stroke:"#ef4444",strokeWidth:b,strokeLinecap:"round",fill:"none",className:"animate-pulse",opacity:1}):null]})}function QS({cx:a,cy:l,rBase:i,rTip:r,startDeg:f,endDeg:d,color:y,value:p,max:g}){const v=(f+d)/2,b=Rs(a,l,r,v),S=Rr(p!=null?p/(g||1):0),w=Math.pow(S,.35),C=i-(i-r)*w,j=Rs(a,l,C,f),R=Rs(a,l,C,d),A=`M ${b.x} ${b.y} L ${j.x} ${j.y} L ${R.x} ${R.y} Z`;return o.jsx("path",{d:A,fill:y,opacity:1,stroke:"none"})}function XS(a,l,i,r,f){let d=r,y=f;y<=d&&(y+=360);const p=Rs(a,l,i,d),g=Rs(a,l,i,y);return["M",p.x,p.y,"A",i,i,0,0,1,g.x,g.y].join(" ")}function Rs(a,l,i,r){const f=pg(r);return{x:a+i*Math.cos(f),y:l+i*Math.sin(f)}}function pg(a){return(a-90)*Math.PI/180}function sf(a,l){if(l)return"#ef4444";const i=Math.abs(a);return i>900?"#f59e0b":i>300?"#22c55e":"#64748b"}function Rr(a){return Math.max(0,Math.min(1,a))}function t0({cx:a,cy:l,current:i,drop:r,overcurrent:f,label:d}){const y=Math.abs(i),p=Rr(y/1200),g=sf(i,f),v=56,b=14,S=9,w=3,C=v*p,j=d==="L"?-1:1,R=j*(-S/2-w/2),A=j*(b/2+w/2),E=b+S+w+2,N=v+4;return o.jsxs("g",{transform:`translate(${a},${l})`,children:[o.jsx("rect",{x:-E/2,y:-N/2,width:E,height:N,rx:"4",fill:"none",stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:R-b/2,y:-v/2,width:b,height:v,fill:"#0f172a",stroke:"#0f172a",strokeWidth:"1",rx:"2"}),o.jsx("rect",{x:R-b/2,y:v/2-C,width:b,height:C,fill:g,className:f?"animate-pulse":""}),o.jsx("rect",{x:A-S/2,y:-v/2,width:S,height:v,fill:r?"#ef4444":"#475569",className:r?"animate-pulse":"",rx:"2"}),o.jsx("text",{x:0,y:v/2+10,textAnchor:"middle",className:"fill-slate-200 text-[0.7rem]",children:d})]})}function $S({cx:a,cy:l,current:i,overcurrent:r}){const f=Math.abs(i),d=sf(i*3,r),y=42,p=f>0?.65:null;return o.jsxs("g",{style:{transformOrigin:`${a}px ${l}px`,animation:p?`spin ${p}s linear infinite`:"none"},children:[o.jsx("circle",{cx:a,cy:l,r:10,fill:"#64748b",stroke:"#64748b",strokeWidth:"1"}),[0,120,240].map(g=>{const v=pg(g),b=a+y*Math.cos(v),S=l+y*Math.sin(v);return o.jsx("line",{x1:a,y1:l,x2:b,y2:S,stroke:d,strokeWidth:"4",strokeLinecap:"round"},g)}),r?o.jsx("circle",{cx:a,cy:l,r:y+8,stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function KS({cx:a,cy:l,current:i,overcurrent:r,variant:f,dirtLeft:d,dirtRight:y}){const p=Math.abs(i),g=sf(i,r),v=1,b=96,S=12,w=`main-brush-pattern-a-${f}`,C=`main-brush-pattern-b-${f}`,j=p>0?.6:null,R=i>=0?1:-1;return o.jsxs("g",{children:[o.jsx("defs",{children:[w,C].map((A,E)=>o.jsxs("pattern",{id:A,patternUnits:"userSpaceOnUse",width:"6",height:"6",children:[o.jsx("rect",{width:"6",height:"6",fill:g,opacity:v}),o.jsx("path",{d:"M0 6 L6 0",stroke:"#0f172a",strokeWidth:"1"}),j?o.jsx("animateTransform",{attributeName:"patternTransform",type:"translate",from:"0 0",to:`0 ${R*(E===0?6:-6)}`,dur:`${j}s`,repeatCount:"indefinite"}):null]},A))}),o.jsx("rect",{x:a-b/2,y:l-14,width:b,height:S,rx:"3",fill:`url(#${w})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:a-b/2,y:l+4,width:b,height:S,rx:"3",fill:`url(#${C})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("circle",{cx:a-b/4,cy:l-8,r:3.5,fill:"#fbbf24"}),o.jsx("circle",{cx:a+b/4,cy:l+8,r:3.5,fill:"#fbbf24"}),r?o.jsx("rect",{x:a-b/2-4,y:l-16,width:b+8,height:S*2+16,rx:"6",stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function ZS(a,l){if(a==null||a<=0)return"hsl(200 60% 18%)";const r=Rr(a/(l||1));return`hsl(${(200+Math.pow(r,.45)*360)%360} 100% 60%)`}function FS(a,l){if(l)return"#ef4444";const i=Rr(a==null?0:a/4095),r=[47,55,69],f=[245,158,11],[d,y,p]=r.map((g,v)=>Math.round(g+(f[v]-g)*i));return`rgb(${d}, ${y}, ${p})`}function JS({count:a,totalSpan:l,gap:i,startAngle:r}){const d=(l-i*(a-1))/a,y=[];let p=r;for(let g=0;g<a;g+=1){const v=p+d;y.push({start:p,end:v}),p=v+i}return y}function gg(){const{value:a,save:l}=ft("page",{hudMapDesktop:!1});return[!!a?.hudMapDesktop,f=>{l({hudMapDesktop:!!f})}]}function Mr({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 ${l}`,children:[o.jsx(P0,{className:"mr-0"}),a]}):null}const n0=2e3,IS=3e3,WS=3e3;function PS(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 y=(a-r)/d,p=Math.min(1,Math.max(0,y)),g=Math.round(p*100),v=y<=0,b=f!=null&&a<=f;return{available:!0,percentDisplay:g,depleted:v,warnTriggered:b,barClass:v?"bg-red-500 animate-pulse":b?"bg-amber-400":"bg-emerald-500"}}function rf({sessionInfo:a,audioSessionInfo:l,videoMode:i="whep",snapshotFeed:r=null,qualityNotice:f=null,label:d,forceMute:y=!1,telemetryFrame:p,batteryConfig:g,layoutFormat:v="desktop",hudVariant:b="default",driverLabel:S=null,hudForceMap:w=!1,hudMapPosition:C="top-right",hudLabelScale:j=1,fitParent:R=!1,overcurrentLimiter:A=null,showTurnCue:E=!1,turnTimerText:N=null,turnSeconds:D=null,isActiveDriver:J=!1,idleSkipSeconds:G=null}){const K=m.useRef(null),V=m.useRef(null),ne=m.useRef(null),I=m.useRef(null),ae=m.useRef(null),Z=m.useRef(null),[P,ce]=m.useState("idle"),[ue,se]=m.useState(null),[B,W]=m.useState("idle"),[le,ie]=m.useState(null),[ee,q]=m.useState(0),[z,k]=m.useState(0),[_,X]=m.useState(!0),te=i==="snapshot",fe=p?.sensors,Ne=fe?.batteryChargeMah??null,pe=v==="desktop",mt=!pe,[_n]=gg(),Dn=w||mt?!0:_n,rn=PS(Ne,g),yt=fe?.wheelOvercurrents||null,kt=yt==null?[]:Object.entries(yt).filter(([,we])=>!!we).map(([we])=>we),dt=A?.caps||null,ca=A?.overcurrent?.groups||null,Ma=typeof window<"u"&&new URLSearchParams(window.location.search).has("debugHud"),ql=m.useMemo(()=>{if(!dt)return null;const we=Number.isFinite(dt?.drive?.cap)?dt.drive.cap:1,$e=Number.isFinite(dt?.aux?.cap)?dt.aux.cap:1;return Math.max(0,Math.min(1,1-Math.min(we,$e)))},[dt]),oa=!!A?.isActive,cn=kt.length?kt:oa?["limiter"]:[],ka=ql??(kt.length?1:0),Cl=!!cn.length;m.useEffect(()=>{Ma&&console.log("[OvercurrentHUD]",{overlayVisible:Cl,overlayMotors:cn,overlayFill:ka,limiterActive:oa,limiterCaps:dt,limiterGroups:ca,wheelOvercurrents:yt})},[Ma,ka,cn,Cl,oa,dt,ca,yt]);const tt=m.useCallback(()=>{clearTimeout(ne.current),ne.current=setTimeout(()=>q(Date.now()),n0)},[]),Tl=m.useCallback(()=>{clearTimeout(I.current),I.current=setTimeout(()=>k(Date.now()),n0)},[]),ua=m.useCallback(async()=>{const we=K.current;if(we)try{we.muted=!0,await we.play()}catch{}},[]),Rl=m.useCallback((we=0)=>{if(y)return;clearTimeout(Z.current);const $e=()=>{clearTimeout(Z.current),Z.current=setTimeout(()=>{y||Le()},IS)},Le=async()=>{const Ee=K.current;if(Ee)try{await ua(),Ee.muted=!1,await Ee.play(),X(!1)}catch{Ee.muted=!0,X(!0),$e()}};Z.current=setTimeout(Le,we)},[ua,y]);m.useEffect(()=>()=>{clearTimeout(ne.current),clearTimeout(I.current),clearTimeout(Z.current),clearInterval(ae.current)},[]),m.useEffect(()=>{P==="playing"&&Rl(0)},[P,Rl]),m.useEffect(()=>{te&&(ce("snapshot"),se(null))},[te]),m.useEffect(()=>{if(te||!a?.url||!K.current)return;let we=!0,$e;const Le=setTimeout(()=>X(!0),0),Ee=(qe,Ue)=>{we&&(ce(qe),se(Ue||null),qe==="playing"&&ua(),["error","failed","disconnected","closed"].includes(qe)&&tt())};return $e=new e0({url:a.url,token:a.token,video:K.current,onStatus:Ee}),$e.start().catch(qe=>{we&&(ce("error"),se(qe.message),tt())}),()=>{we=!1,clearTimeout(Le),$e?.stop()}},[te,a?.url,a?.token,ee,tt,ua]),m.useEffect(()=>{P==="stopped"&&a?.url&&tt()},[P,a?.url,tt]),m.useEffect(()=>{if(!l?.url||!V.current)return;let we=!0,$e;const Le=(Ee,qe)=>{we&&(ie(qe||(Ee==="connected"?"connected":null)),W(Ue=>Ee==="connected"&&(Ue==="playing"||Ue==="connecting")||Ee==="new"?Ue:Ee),Ee==="playing"&&V.current?.play().catch(()=>{}),["error","failed","disconnected","closed"].includes(Ee)&&Tl())};return $e=new e0({url:l.url,token:l.token,video:V.current,audioOnly:!0,onStatus:Le}),$e.start().catch(Ee=>{we&&(W("error"),ie(Ee.message),Tl())}),()=>{we=!1,$e?.stop()}},[l?.url,l?.token,z,Tl]),m.useEffect(()=>{const we=V.current;if(!l?.url||!we){clearInterval(ae.current);return}if(!["connecting","connected","playing","paused"].includes(B)){clearInterval(ae.current);return}const Le=()=>{const Ee=V.current;Ee&&(!Ee.paused&&!Ee.ended||Ee.play().then(()=>{W(qe=>qe==="connected"?"playing":qe),ie(qe=>qe==="paused"?null:qe)}).catch(qe=>{ie(Ue=>Ue||qe?.message||"autoplay blocked")}))};return Le(),ae.current=setInterval(Le,WS),()=>clearInterval(ae.current)},[l?.url,B]),m.useEffect(()=>{const we=V.current;if(!we)return;const $e=()=>{W(Ue=>Ue==="error"?Ue:"playing"),ie(null)},Le=()=>{W(Ue=>["error","failed","disconnected","closed","stopped"].includes(Ue)?Ue:"paused"),ie(Ue=>Ue||"paused")},Ee=()=>{W(Ue=>Ue==="error"?Ue:"stopped"),ie(Ue=>Ue||"ended")},qe=()=>{const{error:Ue}=we,Or=Ue?.message||"audio error";W("error"),ie(Or)};return we.addEventListener("play",$e),we.addEventListener("pause",Le),we.addEventListener("ended",Ee),we.addEventListener("error",qe),()=>{we.removeEventListener("play",$e),we.removeEventListener("pause",Le),we.removeEventListener("ended",Ee),we.removeEventListener("error",qe)}},[l?.url]);const _a=r?.error?`Error: ${r.error}`:r?.objectUrl?"snapshot":r?.status||"waiting",Dr=te?_a:a?.url?P==="error"?`Error: ${ue||"unknown"}`:ue?`${P} (${ue})`:P:"waiting",Vs=l?.error?`Error: ${l.error}`:l?.url?B==="error"?`Error: ${le||"unknown"}`:le?`${B} (${le})`:B:null,Ys=b==="spectator";return o.jsxs("div",{className:`flex flex-col gap-0.5 ${R?"h-full":""}`,children:[o.jsxs("div",{className:`relative w-full overflow-hidden bg-black ${R?"h-full flex-1":"aspect-[4/3]"}`,children:[te?r?.objectUrl?o.jsx("img",{src:r.objectUrl,alt:d,className:"h-full w-full object-contain",draggable:!1}):o.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-300",children:"Waiting for frame…"}):o.jsx("video",{ref:K,muted:y||_,playsInline:!0,autoPlay:!0,controls:!1,className:"h-full w-full object-contain"}),o.jsx("audio",{ref:V,autoPlay:!0,hidden:!0}),E?o.jsx(lA,{mobileHud:mt,turnSeconds:D,isActiveDriver:J,idleSkipSeconds:G}):null,o.jsx(aA,{frame:p,sensors:fe,label:d,status:Dr,audioStatus:Vs,desktopLayout:pe,layoutFormat:v,variant:b,driverLabel:S,battery:rn,showTopDown:Dn,mobileHud:mt,mapPosition:C,turnTimerText:N,labelScale:j}),o.jsx(cA,{compact:mt}),Ma?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:${Cl?1:0} motors:${cn.length} fill:${Math.round(ka*100)}%`}):null,o.jsx(iA,{motors:cn,fill:ka,compact:mt}),o.jsx(rA,{charge:Ne,config:g,compact:mt}),Ys&&rn.available?o.jsx(tA,{visual:rn}):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 ${mt?"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(Mr,{text:"Join our Discord server while you wait!"})})]})}):null]}),!Ys&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(nA,{sensors:fe}),o.jsx(eA,{visual:rn})]})]})}function eA({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 tA({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 nA({sensors:a}){const l=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],i=l.filter(p=>p!=null).reduce((p,g)=>Math.max(p,g),1200),r=p=>Math.pow(Math.max(0,Math.min(1,(p??0)/i)),.35),f=p=>p==null||p<=0?"hsl(200 60% 18%)":`hsl(${(200+r(p)*360)%360} 100% 60%)`,d=6,y=12;return o.jsx("div",{className:"flex w-full items-center justify-center gap-0.5",children:l.map((p,g)=>{const v=r(p),b=g<d/2?-1:1,S=`${v*100}%`,w=f(p);return o.jsx("div",{className:"relative flex-1 min-w-[0]",style:{height:`${y}px`},children:o.jsx("div",{className:"h-full w-full overflow-hidden bg-slate-800",style:{borderRadius:0},children:o.jsx("div",{className:"h-full",style:{width:S,background:w,float:b===-1?"right":"left"}})})},g)})})}function aA({frame:a,sensors:l,label:i,status:r,audioStatus:f,desktopLayout:d=!0,layoutFormat:y="desktop",variant:p="default",driverLabel:g=null,battery:v,showTopDown:b=!1,mobileHud:S=!1,mapPosition:w="top-right",turnTimerText:C=null,labelScale:j=1}){l?.bumpsAndWheelDrops;const[R,A]=m.useState(()=>Date.now());m.useEffect(()=>{const W=setInterval(()=>A(Date.now()),150);return()=>clearInterval(W)},[]),a?.receivedAt&&R-a.receivedAt<200;const E=S,N=y==="mobile-portrait",D=E?"text-[0.45rem]":"text-[0.65rem]",J=E?"px-0.25 py-0.25":"px-1 py-0.5",G=E?"px-0.25 py-0.25":"px-0.5 py-0.5",K=E?"text-[0.55rem]":"text-[0.8rem]",V=E?"left-0.5 top-0.5":"left-1 top-1",ne=E?"text-[0.5rem]":"text-[0.7rem]",I=E?"px-0.5 py-0.25":"px-1 py-0.5",ae=E?"left-0.5 top-1/2":"left-1 top-1/2",Z="bottom-0.5",P={transform:`translateX(-50%) scale(${j})`,transformOrigin:"center bottom"},ce="240px",B={width:ce,height:ce,opacity:E?.85:.7,transform:`scale(${N?.36:E?.45:.7})`,transformOrigin:w==="bottom-left"?"bottom left":"top right",...w==="bottom-left"?{left:"0.25rem",bottom:"0.25rem"}:{right:"0.25rem",top:"0.25rem"}};if(p==="spectator"){const W=[["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||"--"]];return o.jsxs("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:[o.jsx("div",{className:`absolute ${V} font-medium text-slate-100 ${D}`,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.jsxs("div",{className:`absolute ${ae} flex -translate-y-1/2 flex-col gap-0.5 bg-black/70 text-slate-100 ${D} ${J}`,children:[o.jsxs("div",{className:"space-y-0.5 leading-tight",children:[o.jsx("span",{className:`${E?"text-[0.45rem]":"text-[0.6rem]"} uppercase tracking-wide text-slate-400`,children:"Telemetry"}),W.map(([le,ie])=>o.jsxs("span",{className:"flex items-center justify-between gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:le}),o.jsx("span",{className:"font-semibold text-white",children:ie})]},le))]}),b?o.jsx("div",{className:"flex items-center justify-center pt-0.25",children:o.jsx("div",{className:"pointer-events-none rounded",style:{width:E?"110px":"130px",height:E?"110px":"130px",opacity:E?.85:.9,transform:E?"scale(0.7)":"scale(0.85)",transformOrigin:"top left"},children:o.jsx(Du,{sensors:l,size:160,overlay:!0})})}):null]}),o.jsx("div",{className:`absolute ${Z} left-1/2`,style:P,children:o.jsxs("div",{className:`flex items-center gap-0.5 bg-black/80 text-slate-100 ${G} ${K}`,children:[o.jsx("span",{className:"font-semibold text-white",children:i||"Unnamed Rover"}),g?o.jsxs("span",{className:"text-slate-300",children:["• ",g]}):null]})})]})}return o.jsxs("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:[o.jsx("div",{className:`absolute ${V} font-medium text-slate-100 ${D}`,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]})}),C?o.jsx("div",{className:`absolute left-1/2 top-0.5 -translate-x-1/2 rounded bg-black/70 text-slate-100 ${I} ${ne}`,children:C}):null,o.jsx("div",{className:`absolute ${Z} left-1/2`,style:P,children:o.jsx("div",{className:`flex gap-0.5 bg-black/80 text-slate-100 ${G} ${K}`,children:o.jsxs("span",{children:['Rover: "',i||"Unnamed Rover",'"']})})}),b&&p!=="spectator"?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...B},children:o.jsx(Du,{sensors:l,size:240,overlay:!0})}):null]})}function lA({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",y=a?"text-[0.55rem]":"text-[0.75rem]",p=a?"px-4 py-3":"px-6 py-4",g=i&&typeof r=="number";return o.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center bg-black/55",children:o.jsxs("div",{className:`flex flex-col items-center gap-0.5 rounded border border-amber-300/80 bg-black/70 ${p}`,children:[o.jsx("div",{className:`font-semibold text-amber-200 ${f}`,children:"IT IS YOUR TURN!"}),o.jsx("div",{className:`text-amber-200/80 ${d}`,children:"Start driving!"}),g?o.jsxs("div",{className:`text-red-100/90 ${y}`,children:["Idle skip in ",r,"s"]}):null]})})}const sA={leftWheel:"Left wheel",rightWheel:"Right wheel",mainBrush:"Main brush",sideBrush:"Side brush",limiter:"Overcurrent limit"};function iA({motors:a,fill:l=0,compact:i=!1}){if(!a?.length)return null;const r=a.map(b=>sA[b]||b),f=i?"w-[12rem] h-[3.5rem]":"w-[20rem] h-[7rem]",d=i?"px-2 py-1":"px-4 py-2",y=i?"text-lg":"text-4xl",p=i?"text-xs":"text-xl",g=Math.max(0,Math.min(1,l)),v=`${Math.round(g*100)}%`;return o.jsx("div",{className:`pointer-events-none absolute flex items-center justify-center bg-red-900/50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${f}`,children:o.jsxs("div",{className:"relative h-full w-full",children:[o.jsx("div",{className:"absolute inset-0 overflow-hidden",children:o.jsx("div",{className:"h-full bg-red-700/60",style:{width:v}})}),o.jsxs("div",{className:`relative z-10 flex h-full w-full flex-col items-center justify-center text-center font-semibold text-white animate-pulse ${y} ${d}`,children:[o.jsx("div",{children:"OVERCURRENT"}),o.jsx("div",{className:`mt-0 font-medium text-white ${p}`,children:r.join(", ")})]})]})})}function rA({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,y=r-f;if(y<=0)return null;const g=(a-f)/y<=0;if(!(d!=null&&a<=d)&&!g)return null;const b=g?"Battery low! please dock and charge the rover soon.":"BATTERY VERY LOW, PLEASE DOCK THE ROVER AND CHARGE IMMEDIATELY!!",S=i?"p-2 top-6":"p-4 top-10",w=i?"text-sm":"text-2xl";return o.jsx("div",{className:`pointer-events-none absolute flex items-center justify-center bg-amber-900/60 left-1/2 -translate-x-1/2 ${S}`,children:o.jsx("div",{className:`text-center font-semibold text-white animate-pulse ${w}`,children:o.jsx("div",{children:b})})})}function cA({compact:a=!1}){const{session:l}=_e(),{sendMessage:i,onInputFocus:r,onInputBlur:f,blurChat:d,registerInputRef:y,setTypingActive:p}=Wu(),{value:g}=ft("tts",{engine:"flite",voice:"rms",pitch:50}),[v,b]=m.useState(""),[S,w]=m.useState(!1),C=l?.role!=="spectator",j=l?.role==="spectator",R=l?.assignment?.roverId||null,E=!!m.useMemo(()=>l?.roster?.find(V=>String(V.id)===String(R))||null,[R,l?.roster])?.audio?.ttsEnabled,N=m.useMemo(()=>{if(!E)return null;const V=g?.engine==="espeak"?"espeak":"flite";if(V==="espeak"){let I=Number.isFinite(g?.pitch)?Math.round(g.pitch):void 0;return typeof I=="number"&&(I=Math.max(0,Math.min(99,I))),{speak:!0,engine:V,pitch:I}}const ne=typeof g?.voice=="string"?g.voice:void 0;return{speak:!0,engine:V,voice:ne}},[g?.engine,g?.pitch,g?.voice,E]),D=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",J=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",G=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 K(V){if(V.preventDefault(),!C)return;const ne=v.trim();if(ne){w(!0);try{await i(ne,N),b(""),d(),p(!1)}catch(I){alert(I.message)}finally{w(!1)}}}return j?null:o.jsxs("form",{onSubmit:K,className:D,children:[o.jsx("input",{className:J,value:v,onChange:V=>{const ne=V.target.value;b(ne),p(!!ne.trim())},onFocus:V=>{r(V),p(!!v.trim())},onBlur:V=>{f(V),p(!1)},onKeyDown:V=>{V.key==="Enter"&&!v.trim()&&(V.preventDefault(),d(),p(!1))},ref:V=>y(V,{target:"hud"}),placeholder:C?"Chat (TTS)":"Spectator",disabled:!C}),o.jsx("button",{type:"submit",disabled:!C||S,className:G,children:"Speak"})]})}function cf({layoutFormat:a="desktop"}){const{session:l}=_e(),{state:{song:i,lastControlIntentAt:r},overcurrentLimiter:f}=gt(),[d,y]=m.useState(()=>Date.now()),[p,g]=m.useState(!1),[v,b]=m.useState(null),S=m.useRef({active:!1,roverId:null});m.useEffect(()=>{if(l?.mode!=="turns")return;const _=setInterval(()=>y(Date.now()),250);return()=>clearInterval(_)},[l?.mode]);const w=l?.assignment?.roverId,j=!!(w&&l?.roster?l.roster.find(_=>String(_.id)===String(w)):null)?.media?.audioPublishUrl,R=w?l?.turnQueues?.[w]:null,A=l?.socketId||null,E=w?l?.activeDrivers?.[w]:null,N=!!(A&&E===A),D=m.useMemo(()=>{const _=R?.queue||[];if(!_.length||!R?.current||_.length<=1)return null;const X=_.findIndex(te=>te===R.current);return X===-1?_[0]||null:_[(X+1)%_.length]||null},[R?.queue,R?.current]),J=!!(A&&D===A),G=R?.deadline||null,K=R?.idleDeadline||null,V=G?G-d:null,ne=K?K-d:null,I=l?.mode==="turns"&&J&&V!=null&&V<=5e3&&V>0,ae=l?.mode!=="turns"||N||I,Z=V!=null&&Number.isFinite(V)?Math.max(0,Math.ceil(V/1e3)):null,P=ne!=null&&Number.isFinite(ne)?Math.max(0,Math.ceil(ne/1e3)):null,ce=N?Z!=null?`${Z}s left`:null:J&&Z!=null?`Your turn in ${Z}s`:null,ue=w?[...ae?[{type:"rover",id:w,key:w}]:[],...j?[{type:"rover",id:`${w}-audio`,key:`${w}-audio`}]:[]]:[],se=af(ue),B=w&&ae?se[w]:null,W=w&&j?se[`${w}-audio`]:null,le=lf(w?[w]:[],{enabled:!!w,version:l?.mode}),ie=w&&le[w]||null,ee=El(w),q=w&&l?.roster?l.roster.find(_=>String(_.id)===String(w)):null,z=q?.battery??null,k=q?.name||(w?`Rover ${w}`:"");return m.useEffect(()=>{if(l?.mode!=="turns"){g(!1),b(null),S.current={active:!1,roverId:null};return}const _=S.current,X=N&&!_.active,te=N&&w&&w!==_.roverId;X||te?(g(!0),b(Date.now())):!N&&_.active&&(g(!1),b(null)),S.current={active:N,roverId:w}},[N,w,l?.mode]),m.useEffect(()=>{!p||!v||r>v&&g(!1)},[r,v,p]),o.jsx("section",{className:"panel",children:w?o.jsx(rf,{sessionInfo:B,videoMode:ae?"whep":"snapshot",snapshotFeed:ie,audioSessionInfo:W,label:k,telemetryFrame:ee,batteryConfig:z,layoutFormat:a,overcurrentLimiter:f,songNote:i?.note,qualityNotice:ae?null:"Preview feed (low FPS) until your turn.",showTurnCue:p,turnTimerText:ce,turnSeconds:Z,isActiveDriver:N,idleSkipSeconds:P}):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 a0(...a){return a.filter(Boolean).join(" ")}function oA(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function uA(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function fA({title:a,roster:l=[],emptyText:i="No roster data.",renderActions:r=null}){return o.jsxs("div",{className:"space-y-0.5 text-sm",children:[a&&o.jsx("p",{className:"text-sm text-slate-400",children:a}),l.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:i}):o.jsx("ul",{className:"space-y-0.5 text-sm",children:l.map(f=>o.jsxs("li",{className:a0("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:a0("font-semibold",uA(f)),children:["Battery ",oA(f)]})]})]}),r?r(f):null]},f.id))})]})}function dA({keymap:a}){const{state:{roverId:l,camera:i},actions:{setServoAngle:r}}=gt(),f=i?.config,d=!!(l&&i?.enabled&&f),y=typeof f?.minAngle=="number"?f.minAngle:-30,p=typeof f?.maxAngle=="number"?f.maxAngle:30,g=typeof i?.angle=="number"?i.angle:typeof f?.homeAngle=="number"?f.homeAngle:(y+p)/2,[v,b]=m.useState(g),S=m.useRef(!1);m.useEffect(()=>{S.current||b(g)},[g]);const w=A=>{const E=Number.parseFloat(A.target.value);Number.isNaN(E)||(S.current=!0,b(E),r(E))},C=()=>{S.current=!1};if(!d)return null;const j=ra(a?.cameraUp?.[0]),R=ra(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:gu(g)})]}),o.jsxs("div",{children:[o.jsx("input",{type:"range",className:"w-full accent-emerald-400",min:y,max:p,step:.5,value:v,onChange:w,onMouseUp:C,onTouchEnd:C,onPointerUp:C}),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:[R?o.jsx(l0,{label:R}):null,gu(y)]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[gu(p),j?o.jsx(l0,{label:j}):null]})]})]})]})}function l0({label:a}){return o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a})}function gu(a){return typeof a!="number"||Number.isNaN(a)?"—":`${a>0?"+":""}${a.toFixed(1)}°`}function yg({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 hA({entity:a,connected:l,onToggle:i}){const r=a.state==="unavailable"||!a.available,f=a.state==="on",d=r?"warn":f?"success":"muted",y=r?"Unavailable":f?"On":"Off",p=!l||r,g=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:p,className:`flex min-w-[10rem] flex-1 items-center justify-between gap-0.5 rounded px-1 py-0.5 text-left transition-colors ${g} 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(yg,{label:y,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 vg(){const{state:{keymap:a}}=gt(),{session:l,homeAssistantToggle:i}=_e(),r=l?.homeAssistant,f=m.useMemo(()=>r?.entities||[],[r?.entities]),d=ra(a?.homeAssistantOn?.[0]),y=ra(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 p=!!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(s0,{label:d}):null]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:"Off"}),y?o.jsx(s0,{label:y}):null]})]})]}),o.jsx(yg,{label:p?"Connected":"Offline",tone:p?"success":"warn"})]}),o.jsx("div",{className:"flex flex-wrap gap-0.5",children:f.map(g=>o.jsx(hA,{entity:g,connected:p,onToggle:i},g.id))})]})}function s0({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function xg(){const{login:a,setRole:l}=_e(),[i,r]=m.useState(""),[f,d]=m.useState(""),[y,p]=m.useState(!1);async function g(v){v.preventDefault(),p(!0);try{await a(i,f),r(""),d("")}catch(b){alert(b.message)}finally{p(!1)}}return o.jsxs("div",{className:"panel-section space-y-0.5 text-base",children:[o.jsx("p",{className:"text-sm text-slate-400",children:"Admin login"}),o.jsxs("form",{className:"flex flex-col gap-0.5",onSubmit:g,children:[o.jsx("input",{className:"field-input",placeholder:"Username",value:i,onChange:v=>r(v.target.value)}),o.jsx("input",{className:"field-input",placeholder:"Password",type:"password",value:f,onChange:v=>d(v.target.value)}),o.jsx("button",{type:"submit",disabled:y,className:"button-dark w-full disabled:opacity-50",children:y?"Logging in…":"Login"})]})]})}const mA=[{key:"open",label:"Open"},{key:"turns",label:"Turns"},{key:"admin",label:"Admin"},{key:"lockdown",label:"Lockdown"}];function pA(){const{session:a,lockRover:l,setMode:i,requestControl:r,setCommunityGoal:f}=_e(),d=m.useMemo(()=>a?.roster??[],[a?.roster]),[y,p]=m.useState({}),g=a?.health||null,v=a?.communityGoal?.text||"",b=a?.communityGoal?.updatedAt||null,[S,w]=m.useState(v),C=a?.role==="admin"||a?.role==="lockdown"||a?.role==="lockdown-admin",j=a?.mode??"open",R=async(G,K)=>{try{await l(G,K),p(V=>({...V,[G]:K}))}catch(V){alert(V.message)}},A=async G=>{const K=G.target.value;try{await i(K)}catch(V){alert(V.message)}},E=async G=>{try{await r(G,{force:!0})}catch(K){alert(K.message)}},N=async()=>{try{await f(S)}catch(G){alert(G.message)}},D=async()=>{try{await f(null)}catch(G){alert(G.message)}};m.useEffect(()=>{w(v)},[v]);const J=m.useMemo(()=>{const G={};return d.forEach(K=>{G[K.id]=y[K.id]??K.locked}),G},[d,y]);return C?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:j,onChange:A,className:"field-input text-sm",children:mA.map(G=>o.jsx("option",{value:G.key,children:G.label},G.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:S,onChange:G=>w(G.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:N,className:"button-dark",children:"Set goal"}),o.jsx("button",{type:"button",onClick:D,className:"button-danger",children:"Clear"})]})]}),o.jsx(fA,{roster:d,renderActions:G=>o.jsxs("div",{className:"flex flex-wrap gap-0.5 text-xs",children:[o.jsx("button",{type:"button",onClick:()=>R(G.id,!J[G.id]),className:"button-dark",children:J[G.id]?"Unlock":"Lock"}),o.jsx("button",{type:"button",onClick:()=>E(G.id),className:"button-dark",children:"Force"})]})}),o.jsx(gA,{health:g})]}):null}function gA({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(y=>y.stale).length,d=i.rooms.filter(y=>y.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(y=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:y.label}),o.jsxs("span",{className:y.ready?"text-emerald-300":"text-amber-300",children:[y.recentCount,"/",y.neededCount]})]},`${y.type}:${y.id}`))}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rovers.map(y=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:y.name}),o.jsx("span",{className:y.stale?"text-amber-300":"text-emerald-300",children:y.stale?"stale":"ok"})]},`rover:${y.id}`))}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rooms.map(y=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:y.name}),o.jsx("span",{className:y.stale?"text-amber-300":"text-emerald-300",children:y.error?"error":y.stale?"stale":"ok"})]},`room:${y.id}`))})]})}const yA=[{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 vA(a){return a.reduce((l,i)=>((l[i.group]||(l[i.group]=[])).push(i),l),{})}function xA(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}const of=5,Ds=500,Os=1,uf=100;function bA(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(of,Math.min(Ds,i)):l}function Sr(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Os,Math.min(uf,i)):l}function SA(a){const i=(Sr(a,a)-Os)/(uf-Os),r=Ds-i*(Ds-of);return Math.round(r)}function AA(a){const l=bA(a,a),i=(Ds-l)/(Ds-of),r=Os+i*(uf-Os);return Math.round(r)}function jA(a){const[l,i]=m.useState(null);return m.useEffect(()=>{if(!l)return;function r(f){if(f.preventDefault(),f.key==="Escape"){i(null);return}const d=Us(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 ur({label:a,description:l,value:i,onChange:r,min:f=0,max:d=500,step:y=5}){return o.jsxs("label",{className:"surface-muted block p-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[o.jsx("span",{className:"font-semibold text-slate-100",children:a}),o.jsx("input",{type:"number",min:f,max:d,value:i,onChange:p=>r(p.target.value),className:"w-16 rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-right text-[0.75rem] font-mono text-slate-100"})]}),l&&o.jsx("p",{className:"text-[0.65rem] text-slate-500",children:l}),o.jsxs("div",{className:"mt-0 flex items-center gap-0.5",children:[o.jsx("input",{type:"range",min:f,max:d,step:y,value:i,onChange:p=>r(p.target.value),className:"h-2 flex-1 accent-emerald-400"}),o.jsx("span",{className:"w-12 text-right text-[0.75rem] font-mono text-slate-400",children:i})]})]})}function NA(){const{state:{keymap:a},actions:{updateKeyBinding:l,resetKeyBindings:i}}=gt(),{value:r,save:f}=ft("inputs",ut),d={...ut.keyboard,...r.keyboard??{}},y=m.useMemo(()=>typeof d.tiltSpeed=="number"?Sr(d.tiltSpeed,ut.keyboard.tiltSpeed):typeof d.tiltIntervalMs=="number"?Sr(AA(d.tiltIntervalMs),ut.keyboard.tiltSpeed):ut.keyboard.tiltSpeed,[d.tiltIntervalMs,d.tiltSpeed]),p=m.useMemo(()=>vA(yA),[]),{active:g,startCapture:v,cancel:b}=jA((j,R)=>{l(j,R)}),S=m.useCallback(j=>a?.[j]?.[0]||Ts[j]?.[0]||"",[a]),w=m.useCallback((j,R)=>{const A=ut.keyboard,E=xA(R,A[j]);f(N=>({...N??{},keyboard:{...N?.keyboard??A,[j]:E}}))},[f]),C=m.useCallback(j=>{const R=ut.keyboard,A=Sr(j,R.tiltSpeed),E=SA(A);f(N=>({...N??{},keyboard:{...N?.keyboard??R,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(ur,{label:"Base speed",description:"Normal driving speed",value:d.baseSpeed,onChange:j=>w("baseSpeed",j)}),o.jsx(ur,{label:"Turbo speed",description:"Used when holding the boost modifier",value:d.turboSpeed,onChange:j=>w("turboSpeed",j)}),o.jsx(ur,{label:"Precision speed",description:"Used when holding the precision modifier",value:d.precisionSpeed,onChange:j=>w("precisionSpeed",j)})]})]}),o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Camera tilt"}),o.jsx(ur,{label:"Tilt speed",description:"Higher = faster when holding tilt keys",value:y,onChange:C,min:1,max:100,step:1})]}),o.jsx("div",{className:"space-y-0.5",children:Object.entries(p).map(([j,R])=>o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.75rem] text-slate-400",children:j}),o.jsx("div",{className:"space-y-0.5",children:R.map(A=>{const E=S(A.id),N=g===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:ra(E)})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[N&&o.jsx("button",{type:"button",onClick:()=>b(),className:"button-danger text-[0.7rem]",children:"Cancel"}),o.jsx("button",{type:"button",onClick:()=>v(A.id),className:`${N?"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:N?"Press a key…":"Change"})]})]},A.id)})})]},j))})]})}function wA(){const[a,l]=m.useState(!1);return m.useEffect(()=>{function i(){const f=navigator.getGamepads?.();l(!!(f&&Array.from(f).some(Boolean)))}i(),window.addEventListener("gamepadconnected",i),window.addEventListener("gamepaddisconnected",i);const r=setInterval(i,2e3);return()=>{window.removeEventListener("gamepadconnected",i),window.removeEventListener("gamepaddisconnected",i),clearInterval(r)}},[]),a}const EA=new Intl.NumberFormat(void 0,{maximumFractionDigits:2}),qA=[{id:"driveHorizontal",label:"Drive horizontal",type:"axis",section:"Drive joystick",path:["drive","horizontal"]},{id:"driveVertical",label:"Drive vertical",type:"axis",section:"Drive joystick",path:["drive","vertical"]},{id:"cameraVertical",label:"Camera vertical",type:"axis",section:"Camera joystick",path:["camera","vertical"]},{id:"mainAxis",label:"Main brush axis",type:"axis",section:"Brush analog",path:["brushes","mainAxis"]},{id:"sideAxis",label:"Side brush axis",type:"axis",section:"Brush analog",path:["brushes","sideAxis"]},{id:"mainReverse",label:"Toggle main reverse",type:"button",section:"Brush toggles",path:["buttons","mainReverse"]},{id:"sideReverse",label:"Toggle side reverse",type:"button",section:"Brush toggles",path:["buttons","sideReverse"]},{id:"vacuum",label:"Vacuum button",type:"button",section:"Auxiliary buttons",path:["buttons","vacuum"]},{id:"allAux",label:"All aux button",type:"button",section:"Auxiliary buttons",path:["buttons","allAux"]},{id:"drive",label:"Drive macro button",type:"button",section:"Mode buttons",path:["buttons","drive"]},{id:"dock",label:"Dock macro button",type:"button",section:"Mode buttons",path:["buttons","dock"]}];function fr({label:a,description:l,min:i,max:r,step:f,value:d,onChange:y}){return o.jsxs("label",{className:"surface block",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:EA.format(d)})]}),l&&o.jsx("p",{className:"text-[0.65rem] text-slate-500",children:l}),o.jsx("input",{type:"range",min:i,max:r,step:f,value:d,onChange:p=>y(Number(p.target.value)),className:"mt-0 w-full accent-emerald-400"})]})}function CA(a){return a?`Axis ${a.index}${a.invert?" (invert)":""}`:"Unassigned"}function TA(a){return a?`Button ${a.index}`:"Unassigned"}function dr(a,l,i){const[r,f]=l,d={...a??wr};return d[r]={...d[r]??wr[r]},d[r][f]=i(d[r][f]),d}function RA(){const a=wA(),{value:l,save:i,reset:r}=ft("gamepadMapping",wr),{value:f,save:d}=ft("inputs",ut),y=f.gamepad??ut.gamepad,[p,g]=m.useState(null),v=m.useRef(null),b=A=>{d(E=>({...E,gamepad:{...E.gamepad??ut.gamepad,...A}}))};m.useEffect(()=>{v.current=null},[p]),m.useEffect(()=>{if(!p)return;let A;const E=()=>{const N=navigator.getGamepads?.(),D=N&&Array.from(N).find(Boolean);if(D){if(p.type==="axis"){v.current||(v.current=Array.from(D.axes??[]).map(J=>J??0));for(let J=0;J<D.axes.length;J+=1){const G=D.axes[J],K=v.current?.[J]??0,V=Math.abs(G-K);if(Math.abs(G)>.65&&V>.5){i(ne=>dr(ne,p.path,()=>({index:J,invert:G<0}))),g(null);return}}}else if(p.type==="button")for(let J=0;J<D.buttons.length;J+=1){const G=D.buttons[J];if(G&&(G.pressed||G.value>.6)){i(K=>dr(K,p.path,()=>({index:J}))),g(null);return}}}A=requestAnimationFrame(E)};return A=requestAnimationFrame(E),()=>{A&&cancelAnimationFrame(A)}},[p,i]);const S=m.useMemo(()=>qA.reduce((A,E)=>((A[E.section]||(A[E.section]=[])).push(E),A),{}),[]),w=A=>{const[E,N]=A.path;return l?.[E]?.[N]??null},C=A=>{const E=w(A);return A.type==="axis"?CA(E):TA(E)},j=A=>{i(E=>dr(E,A.path,()=>null))},R=A=>{w(A)&&i(N=>dr(N,A.path,D=>({...D,invert:!D?.invert})))};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:"Gamepad mapping"}),o.jsx("p",{className:"text-[0.65rem] text-slate-500",children:a?"Move sticks/axes with a big sweep or press buttons when capturing.":"Connect a controller to configure."}),p&&o.jsxs("p",{className:"mt-0 text-[0.7rem] text-emerald-400",children:["Capturing ",p.label,"…"]})]}),o.jsx("button",{type:"button",onClick:()=>r(),className:"button-dark text-xs",children:"Clear all"})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"space-y-0.5 surface",children:[o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Sensitivity & feel"}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(fr,{label:"Drive deadzone",description:"Ignore small drive stick movement",min:0,max:.6,step:.01,value:y.driveDeadzone??.2,onChange:A=>b({driveDeadzone:A})}),o.jsx(fr,{label:"Camera deadzone",description:"Tilt stick sensitivity",min:0,max:.6,step:.01,value:y.cameraDeadzone??.25,onChange:A=>b({cameraDeadzone:A})}),o.jsx(fr,{label:"Servo step (deg)",description:"Degrees per camera tick",min:.5,max:6,step:.25,value:y.servoStep??2,onChange:A=>b({servoStep:A})}),o.jsx(fr,{label:"Side reverse multiplier",description:"Scale when reversing the side brush",min:.3,max:1,step:.05,value:y.auxReverseScale??.55,onChange:A=>b({auxReverseScale:A})})]})]}),Object.entries(S).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(N=>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:N.label}),o.jsx("p",{className:"text-[0.65rem] text-slate-400",children:C(N)})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[N.type==="axis"&&o.jsx("button",{type:"button",disabled:!w(N),onClick:()=>R(N),className:`${w(N)?.invert?"px-0.5 py-0.5 bg-amber-400 text-amber-900 hover:bg-amber-300":"button-dark"} text-[0.7rem] font-medium disabled:opacity-50 disabled:cursor-not-allowed`,children:"Invert"}),o.jsx("button",{type:"button",onClick:()=>j(N),className:"button-dark text-[0.7rem]",children:"Clear"}),o.jsx("button",{type:"button",onClick:()=>g(N),className:`${p?.id===N.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:p?.id===N.id?"Waiting…":"Capture"})]})]},N.id))})]},A))]})]})}const MA={drive:"Drive wheels",aux:"Aux motors"};function i0(a){return Number.isFinite(a)?`${Math.round(a*100)}%`:"--"}function kA({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 _A(){const{state:{roverId:a},overcurrentLimiter:l}=gt(),i=m.useMemo(()=>bl.map(r=>r.key),[]);return o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[o.jsx("span",{children:"Overcurrent limiter"}),o.jsx("span",{children:l?.adminImmune?"Admin immune":"Active"})]}),a?o.jsxs("div",{className:"space-y-0.5",children:[i.map(r=>{const f=l?.caps?.[r]?.cap??0,d=l?.overcurrent?.groups?.[r]??!1,y=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:MA[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:i0(f)})]}),o.jsx(kA,{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:i0(y)})]})]})]},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 bg=m.createContext(null);function Sg(){const a=m.useContext(bg);if(!a)throw new Error("Tabs components must be used within a <Tabs> provider.");return a}const r0={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",active:"bg-sky-600 text-white",inactive:"bg-zinc-900 text-slate-300 hover:bg-sky-500 hover:text-white"}},Ag="primary";function ff(...a){return a.filter(Boolean).join(" ")}function df({children:a,defaultTab:l,currentTab:i,onTabChange:r,variant:f=Ag}){const[d,y]=m.useState(l??null),[p,g]=m.useState([]),v=m.useCallback(C=>C?(g(j=>j.includes(C)?j:[...j,C]),()=>g(j=>j.includes(C)?j.filter(R=>R!==C):j)):()=>{},[]),b=i??d??p[0]??null;m.useEffect(()=>{l&&i===void 0&&y(l)},[l,i]);const S=m.useCallback(C=>{C&&(i===void 0&&y(C),r&&r(C))},[i,r]),w=m.useMemo(()=>({activeTab:b,setActiveTab:S,registerTab:v,variant:f}),[b,S,v,f]);return o.jsx(bg.Provider,{value:w,children:a})}function hf({children:a,className:l=""}){return o.jsx("div",{className:ff("flex gap-0.5",l),children:a})}function Ft({id:a,children:l,className:i="",disabled:r=!1}){const{activeTab:f,setActiveTab:d,registerTab:y,variant:p}=Sg();m.useEffect(()=>y(a),[a,y]);const g=r0[p]??r0[Ag],v=f===a,b=ff(g.base,v?g.active:g.inactive,r?"cursor-not-allowed opacity-50":"",i);return o.jsx("button",{type:"button",className:b,onClick:()=>!r&&d(a),"aria-pressed":v,"aria-disabled":r,children:l})}function mf({children:a,className:l=""}){return o.jsx("div",{className:ff("mt-0 space-y-0.5",l),children:a})}function Jt({id:a,children:l,keepMounted:i=!1}){const{activeTab:r}=Sg(),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 DA(){const{session:a}=_e(),l=m.useMemo(()=>JSON.stringify(a??{},null,2),[a]);return o.jsxs("div",{className:"panel-section flex min-h-0 flex-col gap-0.5 text-xs",children:[o.jsx("p",{className:"text-sm text-slate-400",children:"Session snapshot"}),o.jsx("pre",{className:"surface min-h-0 flex-1 overflow-y-auto font-mono text-[0.7rem] text-lime-300",children:l})]})}const c0=300,o0=240;function OA(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 BA(a){const i=a.map(r=>OA(r)).join(" ");return i.length>o0?`${i.slice(0,o0)}…`:i}function zA(){const a=sn(),[l,i]=m.useState([]),r=m.useMemo(()=>l.reduce((f,d)=>(d.direction==="in"&&(f.in+=1),d.direction==="out"&&(f.out+=1),f),{in:0,out:0}),[l]);return m.useEffect(()=>{const f=(g,v,b)=>{i(S=>{const w=[...S,{id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,direction:g,event:v,payload:BA(b),timestamp:new Date().toLocaleTimeString()}];return w.length>c0?w.slice(-c0):w})},d=(g,...v)=>f("in",g,v),y=(g,...v)=>f("out",g,v);a.onAny(d);let p=null;if(typeof a.onAnyOutgoing=="function")a.onAnyOutgoing(y),p=()=>a.offAnyOutgoing(y);else{const g=a.emit.bind(a);a.emit=(v,...b)=>(y(v,...b),g(v,...b)),p=()=>{a.emit=g}}return()=>{a.offAny(d),p&&p()}},[a]),o.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[o.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-400",children:[o.jsx("span",{children:"Socket activity"}),o.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-slate-400",children:[o.jsxs("span",{className:"surface-muted",children:["in ",r.in]}),o.jsxs("span",{className:"surface-muted",children:["out ",r.out]}),o.jsx("button",{type:"button",className:"button-dark text-xs",onClick:()=>i([]),children:"Clear"})]})]}),o.jsx("div",{className:"surface h-64 overflow-y-auto font-mono text-xs",children:l.length===0?o.jsx("p",{children:"No socket activity yet."}):l.slice().reverse().map(f=>o.jsxs("div",{className:"surface",children:[o.jsx("span",{className:"text-slate-400",children:f.timestamp})," ",o.jsxs("span",{className:f.direction==="in"?"text-emerald-400":"text-amber-400",children:["[",f.direction.toUpperCase(),"]"]})," ",o.jsx("span",{className:"text-cyan-300",children:f.event})," ",o.jsx("span",{className:"text-slate-200",children:f.payload})]},f.id))}),o.jsx("p",{className:"text-xs text-slate-500",children:"Logs are collected only while this panel is open."})]})}const LA=[{key:"start",label:"Start OI"},{key:"safe",label:"Safe"},{key:"full",label:"Full"},{key:"passive",label:"Passive"},{key:"dock",label:"Dock"}];function jg(){const{state:{roverId:a},actions:{sendOiCommand:l,setSensorStream:i}}=gt(),r=!!a,[f,d]=gg(),y=sn(),{value:p,save:g}=ft("page",{hudMapDesktop:!1,connectionTransport:"websocket"}),v=p?.connectionTransport||"websocket",b=m.useMemo(()=>[{key:"start",label:"Enable stream",enable:!0},{key:"stop",label:"Disable stream",enable:!1}],[]),S=C=>{a&&i(C)},w=C=>{const j=C.target.value;g(R=>({...R??{},connectionTransport:j})),y?.io?.opts&&(y.io.opts.transports=j==="polling"?["polling"]:["websocket","polling"],y.disconnect(),y.connect())};return o.jsxs(df,{defaultTab:"keybindings",children:[o.jsxs(hf,{children:[o.jsx(Ft,{id:"keybindings",children:"Keybindings"}),o.jsx(Ft,{id:"controller",children:"Controller"}),o.jsx(Ft,{id:"page",children:"Page settings"}),o.jsx(Ft,{id:"admin",children:"Admin"})]}),o.jsxs(mf,{children:[o.jsx(Jt,{id:"keybindings",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(NA,{})})}),o.jsx(Jt,{id:"controller",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(RA,{})})}),o.jsx(Jt,{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:C=>d(C.target.checked)}),o.jsx("span",{children:"Show top-down map in HUD (desktop)"})]}),o.jsx("p",{className:"text-xs text-slate-500",children:"Mobile HUD keeps the map on by default."})]}),o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsx("p",{className:"text-slate-400",children:"Connection"}),o.jsxs("label",{className:"flex items-center justify-between gap-0.5 text-slate-200",children:[o.jsx("span",{children:"Transport"}),o.jsxs("select",{value:v,onChange:w,className:"field-input text-sm",children:[o.jsx("option",{value:"websocket",children:"WebSocket"}),o.jsx("option",{value:"polling",children:"Polling"})]})]}),o.jsx("p",{className:"text-xs text-slate-500",children:"Switching reconnects your session."})]})]})}),o.jsx(Jt,{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:LA.map(C=>o.jsx("button",{type:"button",onClick:()=>l(C.key),disabled:!r,className:"button-dark text-xs disabled:opacity-30",children:C.label},C.key))})]}),o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsx("p",{className:"text-slate-400",children:"Sensor stream"}),o.jsx("div",{className:"surface flex gap-0.5",children:b.map(C=>o.jsx("button",{type:"button",onClick:()=>S(C.enable),disabled:!r,className:"flex-1 button-dark text-xs disabled:opacity-30",children:C.label},C.key))}),!r&&o.jsx("p",{className:"text-xs text-slate-500",children:"Assign a rover to toggle streams."})]}),o.jsx(xg,{}),o.jsx(_A,{}),o.jsx(pA,{}),o.jsx(DA,{}),o.jsx(zA,{})]})})]})]})}const u0={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 not mapped by default, this is because of how terribly inconsistent gamepad implementations are across browsers and devices.","You can map gamepad controls in Settings → Controller.","Use at your own risk, it may not be perfect depending on your setup."]}]},"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 UA(a){return u0[a]||u0.desktop}function Ng({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:ra(i)})}function f0(a,l){return a.map((i,r)=>typeof i=="string"?o.jsx("span",{children:i},`text-${r}`):i?.action?o.jsx(Ng,{actionId:i.action,keymap:l},`pill-${i.action}-${r}`):i?.text?o.jsx("span",{children:i.text},`span-${r}`):null)}function kr(a,l,i){if(typeof a=="string")return a;if(Array.isArray(a?.segments))return f0(a.segments,l);if(a&&typeof a=="object"){if(typeof a.text=="string")return a.text;if(Array.isArray(a))return f0(a,l)}return String(a??"")}function HA({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:kr(i,l)},f)})})]}):null}function VA({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:kr(i,l)},f)})})]})}function YA({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:kr(i,{})},`callout-${r}`))})]})}function GA({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(Ng,{actionId:i.action,keymap:l})]},i.action))})]})}function QA({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(GA,{group:i,keymap:l},i.id))})]}):null}function XA({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:kr(l,{})},`gamepad-${i}`))})]}):null}function d0({block:a,keymap:l}){if(!a)return null;switch(a.type){case"list":return o.jsx(VA,{block:a,keymap:l});case"callout":return o.jsx(YA,{block:a});case"keyboard":return o.jsx(QA,{block:a,keymap:l});case"gamepad":return o.jsx(XA,{block:a});default:return null}}function wg({layout:a,keymap:l}){const i=m.useMemo(()=>UA(a),[a]),r=l||{},f=i.main||[],d=i.aside||[];return o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(HA,{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((y,p)=>o.jsx(d0,{block:y,keymap:r},y.title||p))}),o.jsx("div",{className:"space-y-0.5",children:d.map((y,p)=>o.jsx(d0,{block:y,keymap:r},y.title||p))})]})]})}function Eg({layout:a,onOpenOverlay:l}){const{state:i}=gt();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(wg,{layout:a,keymap:i?.keymap||{}})]})}const $A=["kal","rms","slt","ksp","bdl"],KA=Array.from({length:10},(a,l)=>l*10);function Hs({hideInput:a=!1,hideSpectatorNotice:l=!1,fillHeight:i=!1}){const{session:r}=_e(),{messages:f,typing:d,sendMessage:y,registerInputRef:p,onInputFocus:g,onInputBlur:v,blurChat:b,setTypingActive:S}=Wu(),{value:w,save:C}=ft("tts",{engine:"flite",voice:"rms",pitch:50}),[j,R]=m.useState(""),[A,E]=m.useState(!1),[N,D]=m.useState(!1),[J,G]=m.useState(()=>w?.engine||"flite"),[K,V]=m.useState(()=>w?.voice||"rms"),[ne,I]=m.useState(()=>Number.isFinite(w?.pitch)?w.pitch:50),ae=r?.role!=="spectator",Z=m.useRef(null),P=r?.assignment?.roverId||null,ue=!!m.useMemo(()=>r?.roster?.find(ee=>String(ee.id)===String(P))||null,[P,r?.roster])?.audio?.ttsEnabled,se=m.useMemo(()=>f.slice(-200),[f]),B=m.useMemo(()=>d||[],[d]);m.useEffect(()=>{Z.current&&(Z.current.scrollTop=Z.current.scrollHeight)},[se,B]),m.useEffect(()=>{const ee=w?.engine||"flite",q=w?.voice||"rms",z=Number.isFinite(w?.pitch)?w.pitch:50;J!==ee&&G(ee),K!==q&&V(q),ne!==z&&I(z)},[J,ne,w?.engine,w?.pitch,w?.voice,K]),m.useEffect(()=>{D(!!ue)},[ue]);const W=m.useMemo(()=>!ue||!N?null:J==="espeak"?{speak:!0,engine:J,pitch:ne}:{speak:!0,engine:J,voice:K},[J,ne,N,ue,K]);async function le(ee){if(ee.preventDefault(),!ae||a)return;const z=j.replace(/\\n/g,`
|
||
`).trim();if(z){E(!0);try{await y(z,W),R(""),b(),S(!1)}catch(k){alert(k.message)}finally{E(!1)}}}const ie=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 ${ie}`,ref:Z,children:[se.length===0&&B.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"No messages yet."}):se.map(ee=>o.jsx(ng,{message:ee},ee.id)),B.map(ee=>o.jsx(ag,{message:ee},`typing-${ee.typingId||ee.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:j,onChange:ee=>{const q=ee.target.value;R(q),S(!!q.trim())},onFocus:ee=>{g(ee),S(!!j.trim())},onBlur:ee=>{v(ee),S(!1)},onKeyDown:ee=>{ee.key==="Enter"&&!j.trim()&&(ee.preventDefault(),b(),S(!1))},ref:ee=>p(ee,{target:"panel"}),placeholder:ae?"Type a message…":l?"":"Spectators cannot chat",disabled:!ae}),ue&&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:N,onChange:ee=>D(ee.target.checked),className:"accent-cyan-500"}),o.jsx("span",{children:"Speak"})]}),o.jsxs("select",{value:J,onChange:ee=>{const q=ee.target.value;G(q),C(z=>({...z||{},engine:q}))},className:"field-input text-xs",children:[o.jsx("option",{value:"flite",children:"flite"}),o.jsx("option",{value:"espeak",children:"espeak"})]}),J==="flite"?o.jsx("select",{value:K,onChange:ee=>{const q=ee.target.value;V(q),C(z=>({...z||{},voice:q}))},className:"field-input text-xs",children:$A.map(ee=>o.jsx("option",{value:ee,children:ee},ee))}):o.jsx("select",{value:ne,onChange:ee=>{const q=Number(ee.target.value);I(q),C(z=>({...z||{},pitch:q}))},className:"field-input text-xs",children:KA.map(ee=>o.jsxs("option",{value:ee,children:["pitch ",ee]},ee))})]}),o.jsx("button",{type:"submit",disabled:!ae||A,className:"button-dark h-full disabled:opacity-50 self-stretch",children:A?"...":"Send"})]})]})}function pf({compact:a=!1}){const{session:l,setNickname:i}=_e(),{value:r,save:f}=ft("profile",{nickname:""}),[d,y]=m.useState(r.nickname||""),[p,g]=m.useState(!1),v=l?.role!=="spectator";m.useEffect(()=>{y(r.nickname||"")},[r.nickname]);async function b(S){if(S.preventDefault(),!v)return;const w=(d||"").trim().slice(0,32);if(w){g(!0);try{await i(w),f({nickname:w})}catch(C){alert(C.message)}finally{g(!1)}}}return o.jsxs("form",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-stretch gap-0.5",onSubmit:b,children:[o.jsx("input",{className:"field-input flex-1 min-w-0",value:d,onChange:S=>y(S.target.value),maxLength:32,placeholder:"Enter a nickname",disabled:!v}),o.jsx("button",{type:"submit",disabled:!v||p,className:"button-dark h-full shrink-0 whitespace-nowrap px-0.5 py-0 disabled:opacity-50",children:p?"Saving…":a?"Set":"Save"})]})}function qg({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 ${l}`,children:[o.jsx($1,{className:"mr-0"}),a]}):null}function ZA({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(pf,{compact:a})})})}function FA(){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(Mr,{className:"h-full"}),o.jsx(qg,{className:"h-full"})]})})}function yu(...a){return a.filter(Boolean).join(" ")}function JA(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function IA(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function WA(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 PA(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 _r({title:a="Rovers"}){const{session:l,requestControl:i}=_e(),[r,f]=m.useState({}),[d,y]=m.useState(()=>Date.now()),p=m.useMemo(()=>l?.role&&l.role!=="spectator",[l?.role]),g=l?.roster??[],v=l?.turnQueues??{},b=l?.users??[],S=l?.socketId||null,w=m.useMemo(()=>Object.values(v||{}).some(A=>A?.deadline||A?.idleDeadline),[v]);m.useEffect(()=>{if(!w)return;const A=setInterval(()=>{y(Date.now())},1e3);return()=>clearInterval(A)},[w]);const C=m.useMemo(()=>{const A=new Set(g.map(N=>String(N.id))),E=Object.keys(v||{}).filter(N=>!A.has(String(N))).map(N=>({id:N,name:N,locked:!1,batteryState:null}));return[...g,...E]},[g,v]);async function j(A){if(A){f(E=>({...E,[A]:!0}));try{await i(A)}catch(E){alert(E.message)}finally{f(E=>({...E,[A]:!1}))}}}const R=A=>b.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}),C.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:C.map(A=>{const E=String(A.id),N=v?.[E]||null,D=N?.queue||[],J=N?.idleDeadline||N?.deadline||null,G=J&&J>d?Math.ceil((J-d)/1e3):J?0:null,K=N?.current||null,V=K?D.findIndex(B=>B===K):-1,ne=D.length>1?V>=0?D[(V+1)%D.length]:D[0]:null,I=!!(S&&K&&K===S),ae=!!(S&&ne&&ne===S),Z=G!=null&&(I||ae),P=!!A.locked,ce=A.lockReason?`locked: ${A.lockReason}`:"locked",ue=P?ce:r[E]?"...":"request",se=p&&!P&&!r[E];return o.jsxs("li",{className:yu("surface flex flex-wrap items-start justify-between gap-0.5",se&&"cursor-pointer",P&&"bg-red-900/40"),onClick:()=>{se&&j(A.id)},children:[o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("p",{className:"text-slate-200",children:A.name}),Z?o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem] text-slate-200",children:I?`${G}s left`:`Your turn in ${G}s`}):null]}),o.jsx("span",{className:yu("text-[0.75rem] font-semibold",IA(A)),children:JA(A)})]}),D.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:D.map((B,W)=>{const le=R(B),ie=B===K,ee=!!(ne&&B===ne&&!ie),q=ie?"bg-sky-600 text-white ring-2 ring-amber-300":ee?"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:`${WA(le.role)} font-semibold`,children:PA(le,S)}),ie&&o.jsx("span",{className:"text-[0.65rem] text-slate-200",children:"now"}),ee&&o.jsx("span",{className:"text-[0.65rem] text-emerald-100",children:"next"})]},`${E}-${B}-${W}`)})})]}),p?o.jsx("button",{type:"button",onClick:B=>{B.stopPropagation(),j(A.id)},disabled:r[E]||P,className:yu("button-dark disabled:opacity-40",P&&"bg-red-600/70 text-white hover:bg-red-600"),children:ue}):null]},A.id)})})]})}function ej(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 tj(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 gf({hideNicknameForm:a=!1,hideHeader:l=!1,className:i="",fillHeight:r=!1,compact:f=!1}){const{session:d,setNickname:y}=_e(),{value:p}=ft("profile",{nickname:""}),g=m.useRef(null),v=sn(),b=d?.role!=="spectator",S=d?.users??[],w=d?.socketId||null;m.useEffect(()=>{if(!b||!d?.socketId)return;const R=p.nickname||"";if(!R||d.socketId===g.current)return;const A=d.socketId;y(R).then(()=>{g.current=A}).catch(()=>{})},[b,d?.socketId,y,p.nickname]),m.useEffect(()=>{if(!v)return;const R=()=>{if(!b)return;const A=(p.nickname||"").trim();A&&y(A).then(()=>{g.current=d?.socketId||null}).catch(()=>{})};return v.on("connect",R),()=>v.off("connect",R)},[b,y,v,p.nickname,d?.socketId]);const C=m.useMemo(()=>[...S].sort((R,A)=>R.socketId===w?-1:A.socketId===w?1:(R.nickname||"").localeCompare(A.nickname||"")),[w,S]),j=r?"flex-1 min-h-0 overflow-y-auto":f?"h-28 overflow-y-auto":"h-48 overflow-y-auto";return o.jsxs("section",{className:`panel-section space-y-0.5 text-base ${r?"flex h-full min-h-0 flex-col overflow-hidden":""} ${i}`,children:[!a&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"grid gap-0.5 md:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)]",children:[o.jsx("div",{className:"min-w-0",children:o.jsx("div",{className:"surface flex w-full items-center px-0 py-0",children:o.jsx(pf,{compact:f})})}),o.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2 md:grid-cols-1",children:[o.jsx(Mr,{}),o.jsx(qg,{})]})]}),!b&&o.jsx("p",{className:"text-xs text-slate-500",children:"Spectators cannot set nicknames."})]}),o.jsxs("div",{className:`space-y-0.5 ${r?"flex flex-1 min-h-0 flex-col":""}`,children:[!l&&o.jsxs("div",{className:`flex items-center justify-between text-sm text-slate-400 ${f?"text-xs":""}`,children:[o.jsx("span",{children:"Users"}),o.jsx("span",{className:"text-xs text-slate-500",children:C.length})]}),o.jsx("div",{className:`surface flex flex-wrap content-start items-start gap-0.5 px-0 pb-0 ${j} ${f?"text-[0.8rem]":""}`,children:C.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for users…"}):C.map(R=>o.jsx("span",{className:`rounded bg-slate-800/80 px-1 py-0.25 text-[0.7rem] ${ej(R.role)}`,children:tj(R,w)},R.socketId))})]})]})}function nj(){const{state:{roverId:a}}=gt(),i=El(a)?.sensors||{};return o.jsx("section",{className:"panel-section",children:o.jsx("div",{className:"aspect-square w-full",children:o.jsx(Du,{sensors:i})})})}function aj(){const{state:{roverId:a,keymap:l}}=gt(),i=ug(a),r=i.docked&&!i.driving;return o.jsxs("section",{className:"panel-section flex h-full flex-col gap-0.5",children:[o.jsx(fg,{layout:"desktop",expand:!0,driveDockState:i}),r?null:o.jsx(dA,{keymap:l})]})}function lj({layout:a,onOpenHelpOverlay:l}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(df,{defaultTab:"telemetry",children:[o.jsxs(hf,{children:[o.jsx(Ft,{id:"telemetry",children:"Controls"}),o.jsx(Ft,{id:"help",children:"Help"}),o.jsx(Ft,{id:"settings",children:"Settings"})]}),o.jsxs(mf,{children:[o.jsx(Jt,{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(nj,{}),o.jsx(aj,{})]}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.9fr)_minmax(0,0.75fr)]",children:[o.jsx(_r,{}),o.jsx(Fu,{panelId:"replay-sources-desktop",fillHeight:!0}),o.jsx(FA,{})]}),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(Hs,{fillHeight:!0}),o.jsxs("div",{className:"grid min-h-0 gap-0.5 grid-rows-[minmax(0,1fr)_auto]",children:[o.jsx(gf,{compact:!0,hideNicknameForm:!0,fillHeight:!0}),o.jsx(ZA,{compact:!0})]})]}),o.jsx(vg,{}),o.jsx(tf,{defaultOrientation:"horizontal",panelId:"rightpane-telemetry"})]})}),o.jsx(Jt,{id:"help",children:o.jsx(Eg,{layout:a,onOpenOverlay:l})}),o.jsx(Jt,{id:"settings",children:o.jsx(jg,{})})]})]})})}const sj=new Set(["admin","lockdown","lockdown-admin"]),ij=new Set(["admin","lockdown"]);function rj(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 cj(){const{session:a}=_e(),l=a?.mode,i=a?.role,r=ij.has(l),f=sj.has(i);if(!r||f)return null;const d=rj(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(xg,{})}),o.jsx("div",{className:"w-full justify-center items-center",children:o.jsx(Mr,{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(Hs,{}),o.jsx(pf,{})]})]})})}const oj="/assets/turn_alert-DVO8EZJa.mp3";function uj(a){const l=m.useRef(null);return m.useEffect(()=>{l.current=new Audio(a),l.current.load()},[a]),()=>{l.current&&(l.current.currentTime=0,l.current.play().catch(()=>{}))}}function fj(){const{session:a,pushAlert:l}=_e(),i=uj(oj),r=m.useRef(new Set),f=m.useMemo(()=>a?.turnQueues||{},[a?.turnQueues]),d=a?.socketId||null;return m.useEffect(()=>{if(!d)return;const y=[];Object.entries(f).forEach(([p,g])=>{!g||!g.current||g.current!==d||r.current.has(p)||(y.push(p),r.current.add(p))}),Object.keys(f).forEach(p=>{(!f[p]||f[p].current!==d)&&r.current.delete(p)}),y.length!==0&&(y.forEach(p=>{const g=a?.roster?.find(v=>String(v.id)===String(p))?.name||p;l({title:"Your turn!",message:`You now control ${g}.`,color:"#ff5722"})}),i())},[f,i,l,a?.roster,d]),null}function dj({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 Cg="fullscreenPromptDismissed",hj=new Set(["mobile-portrait","mobile-landscape"]),Tg=()=>{if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}},mj=()=>{const a=Tg();if(!a)return!1;try{return a.getItem(Cg)==="1"}catch{return!1}},h0=()=>{const a=Tg();if(a)try{a.setItem(Cg,"1")}catch{}},pj=()=>{if(typeof navigator>"u")return!1;const a=navigator.userAgent||navigator.platform||"";return/iphone|ipad|ipod/i.test(a)},gj=()=>{if(typeof document>"u")return!1;const a=document;return!!(a.fullscreenEnabled||a.webkitFullscreenEnabled||a.mozFullScreenEnabled||a.msFullscreenEnabled)};function yj(a){const l=hj.has(a),[i,r]=m.useState(!1),[f,d]=m.useState("native"),y=m.useMemo(()=>pj(),[]),p=m.useCallback(()=>{if(!l){r(!1);return}if(mj()){r(!1);return}if(y){d("pwa-hint"),r(!0);return}if(!gj()){r(!1);return}if(typeof document<"u"&&document.fullscreenElement){r(!1);return}d("native"),r(!0)},[y,l]);m.useEffect(()=>{p()},[p]),m.useEffect(()=>{if(typeof document>"u")return;const b=()=>{if(document.fullscreenElement){r(!1);return}p()};return document.addEventListener("fullscreenchange",b),document.addEventListener("webkitfullscreenchange",b),()=>{document.removeEventListener("fullscreenchange",b),document.removeEventListener("webkitfullscreenchange",b)}},[p]);const g=m.useCallback(()=>{h0(),r(!1)},[]),v=m.useCallback(async()=>{if(!l||y||typeof document>"u")return!1;const b=document.documentElement;if(!b)return!1;const S=b.requestFullscreen||b.webkitRequestFullscreen||b.mozRequestFullScreen||b.msRequestFullscreen;if(!S)return!1;try{const w=S.call(b);return w&&typeof w.then=="function"&&await w,h0(),r(!1),!0}catch(w){return console.warn("Failed to enter fullscreen",w),!1}},[y,l]);return m.useEffect(()=>{l||r(!1)},[l]),{visible:i,mode:f,enterFullscreen:v,dismiss:g}}function vj({visible:a,layout:l,onClose:i,showOnLoad:r,onToggleShowOnLoad:f}){if(!a)return null;const{state:d}=gt(),y=p=>{const g=!p.target.checked;f?.(g)};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:y,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(wg,{layout:l,keymap:d?.keymap||{}})})]})})}const xj=`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 bj(a){return a?a.charAt(0).toUpperCase()+a.slice(1):""}function Sj(){const a=String(xj).split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return a.length?(a[Math.floor(Math.random()*a.length)]||"").trim():""}function yf(){const{setNickname:a}=_e(),{value:l,status:i,save:r}=ft("profile",{nickname:""}),f=m.useRef(!1);m.useEffect(()=>{if(i!=="ready"||f.current||(l.nickname||"").trim())return;f.current=!0;const y=bj(Sj()).slice(0,32);if(!y)return;(async()=>{try{await a(y)}catch{}finally{r({nickname:y})}})()},[r,a,i,l.nickname])}const vu=1e4,xu=28,Aj=14;function vf({layout:a="desktop",className:l=""}){const{session:i}=_e(),r=i?.communityGoal?.text?String(i.communityGoal.text).trim():"",f=a==="mobile-portrait"||a==="mobile-landscape"||a==="mobile",[d,y]=m.useState(!1),[p,g]=m.useState(xu),[v,b]=m.useState(0),S=m.useRef(null),w=m.useRef(null),C=m.useRef(null);m.useEffect(()=>{if(!r){y(!1);return}if(y(!0),!f)return;const A=Date.now();b(vu);const E=setTimeout(()=>y(!1),vu),N=setInterval(()=>{const D=Date.now()-A;b(Math.max(0,vu-D))},250);return()=>{clearTimeout(E),clearInterval(N)}},[r,f]),m.useEffect(()=>{if(!r)return;g(xu);let A=0;const E=()=>{const D=C.current,J=w.current;if(!D||!J)return;const G=D.clientWidth;if(!G)return;const K=J.scrollWidth;if(!K)return;const V=Math.min(1,G/K),ne=Math.max(Aj,Math.floor(xu*V));g(ne)};A=window.requestAnimationFrame(E);const N=new ResizeObserver(()=>{window.cancelAnimationFrame(A),A=window.requestAnimationFrame(E)});return S.current&&N.observe(S.current),()=>{window.cancelAnimationFrame(A),N.disconnect()}},[r]);const j=m.useMemo(()=>["panel-section flex w-full items-center justify-center",f?"rounded-none":"rounded","px-1 py-1 text-center font-semibold tracking-tight",l].filter(Boolean).join(" "),[l,f]);if(!r||!d)return null;const R=f?Math.ceil(v/1e3):null;return o.jsx("div",{ref:S,className:j,style:{fontSize:`${p}px`,lineHeight:1.1},onClick:()=>y(!1),role:"button",tabIndex:0,children:o.jsxs("span",{className:"flex w-full items-stretch gap-0.5 whitespace-nowrap",children:[o.jsxs("span",{className:"flex flex-col justify-center border-r border-slate-700/60 px-0.5 text-[0.55em] font-semibold leading-tight text-slate-400",children:[o.jsx("span",{children:"Community"}),o.jsx("span",{children:"Goal"})]}),o.jsx("span",{ref:C,className:"flex-1 overflow-hidden text-slate-100",children:o.jsx("span",{ref:w,className:"block",children:r})}),f?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:[R,"s"]}):null]})})}function jj(){const[a,l]=m.useState(()=>typeof window>"u"||window.innerWidth>=1024?"desktop":window.innerWidth>window.innerHeight?"mobile-landscape":"mobile-portrait");return m.useEffect(()=>{function i(){if(typeof window>"u")return;const{innerWidth:r,innerHeight:f}=window;r>=1024?l("desktop"):r>f?l("mobile-landscape"):l("mobile-portrait")}return i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),a}function Nj({layout:a,onOpenHelpOverlay:l}){return o.jsxs("div",{className:"flex h-full gap-0.5 overflow-hidden",children:[o.jsxs("div",{className:"flex min-w-0 flex-[1.22] flex-col gap-0.5 overflow-y-auto pr-0",children:[o.jsx(cf,{}),o.jsx(k1,{}),o.jsx(nf,{})]}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto",children:[o.jsx(vf,{layout:a}),o.jsx(lj,{layout:a,onOpenHelpOverlay:l})]})]})}function Rg({layout:a,onOpenHelpOverlay:l,roomPanelId:i,showTelemetry:r=!0}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(df,{defaultTab:"chat",children:[o.jsxs(hf,{children:[o.jsx(Ft,{id:"chat",children:"Chat"}),o.jsx(Ft,{id:"roomcontrols",children:"Room Controls"}),o.jsx(Ft,{id:"help",children:"Help"}),o.jsx(Ft,{id:"settings",children:"Settings"})]}),o.jsxs(mf,{children:[o.jsx(Jt,{id:"chat",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Hs,{}),o.jsx(gf,{})]})}),o.jsx(Jt,{id:"roomcontrols",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(vg,{}),o.jsx(tf,{panelId:i})]})}),o.jsx(Jt,{id:"help",children:o.jsx(Eg,{layout:a,onOpenOverlay:l})}),o.jsx(Jt,{id:"settings",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(jg,{}),o.jsx(nf,{})]})})]})]})})}function wj({onOpenHelpOverlay:a}){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx(cf,{layoutFormat:"mobile-portrait"}),o.jsx(OS,{}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(Fu,{panelId:"replay-sources-mobile-portrait"}),o.jsx(_r,{})]}),o.jsx(Rg,{layout:"mobile-portrait",onOpenHelpOverlay:a,roomPanelId:"mobile-portrait-room"})]})}function Ej({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(_S,{}),o.jsxs("div",{children:[o.jsx(cf,{layoutFormat:"mobile-landscape"}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(Fu,{panelId:"replay-sources-mobile-landscape"}),o.jsx(_r,{})]})]}),o.jsx(DS,{})]}),o.jsx("div",{className:"flex flex-col gap-0.5 pb-0",children:o.jsx(Rg,{layout:"mobile-landscape",onOpenHelpOverlay:a,roomPanelId:"mobile-landscape-room",showTelemetry:!1})})]})}function qj(){const a=jj(),l=a==="desktop",i=yj(a);return o.jsx("div",{className:`bg-black text-slate-100 ${l?"h-screen overflow-hidden":"min-h-screen"}`,children:o.jsx(Zu,{children:o.jsx(Cj,{layout:a,isDesktop:l,fullscreen:i})})})}function Cj({layout:a,isDesktop:l,fullscreen:i}){yf();const{visible:r,mode:f,enterFullscreen:d,dismiss:y}=i,{value:p,status:g,save:v}=ft("help",{showOnLoad:!0}),[b,S]=m.useState(!1);m.useEffect(()=>{g==="ready"&&S(p?.showOnLoad!==!1)},[g,p?.showOnLoad]);const w=m.useCallback(()=>S(!0),[]),C=m.useCallback(()=>S(!1),[]),j=m.useCallback(A=>{const E=!!A;v(N=>({...N??{},showOnLoad:E})),E||S(!1)},[v]),R=m.useMemo(()=>l?o.jsx(Nj,{layout:a,onOpenHelpOverlay:w}):a==="mobile-landscape"?o.jsx(Ej,{onOpenHelpOverlay:w}):o.jsx(wj,{onOpenHelpOverlay:w}),[l,a,w]);return o.jsxs(yS,{children:[o.jsx(ES,{}),o.jsx(qS,{}),o.jsxs("main",{className:`flex w-full flex-col gap-0.5 text-base ${l?"h-full overflow-hidden":""}`,children:[l?null:o.jsx(vf,{layout:a}),R]}),o.jsx(Ju,{}),o.jsx(fj,{}),o.jsx(cj,{}),o.jsx(vj,{visible:b,layout:a,onClose:C,showOnLoad:p?.showOnLoad!==!1,onToggleShowOnLoad:j}),o.jsx(dj,{visible:r,mode:f,onEnterFullscreen:d,onDismiss:y})]})}function Mg(){const{session:a,setRole:l,subscribeAll:i,connected:r}=_e(),[f,d]=m.useState(!1);return m.useEffect(()=>{let y=!1;async function p(){if(a?.mode==="lockdown"){d(!1);return}try{a?.role!=="spectator"&&await l("spectator"),await i(),y||d(!0)}catch(g){console.error("Failed to enter spectator mode",g),y||d(!1)}}return p(),()=>{y=!0}},[r,a?.mode,a?.role,l,i]),f}function Tj({roverId:a,session:l}){const i=l?.activeDrivers?.[a]||null,f=(l?.users||[]).find(g=>g.socketId===i)?.nickname||(i?i.slice(0,6):"No driver"),d=l?.mode,y=l?.turnQueues?.[a];return d==="turns"&&y?.current?`${f} (turns)`:f}function Rj({rover:a,frame:l,snapshotFeed:i,audioInfo:r,session:f}){const d=Tj({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(rf,{sessionInfo:null,videoMode:"snapshot",snapshotFeed:i,audioSessionInfo:r,label:a.name,telemetryFrame:l,batteryConfig:a.battery,hudVariant:"spectator",driverLabel:d,hudForceMap:!0,hudMapPosition:"bottom-left"})})})}function Mj({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(Rj,{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 kj(){return o.jsx("section",{className:"min-h-0",children:o.jsx("div",{className:"surface min-h-[14rem] overflow-hidden",children:o.jsx(tf,{defaultOrientation:"horizontal",hideLayoutToggle:!0,hideHeader:!0,panelId:"spectator-secondary"})})})}function _j({className:a=""}){return o.jsx("div",{className:`panel ${a}`,children:o.jsx(nf,{})})}function Dj(){const{session:a}=_e(),l=a?.mode==="lockdown";yf(),Mg();const i=Ku(),r=a?.roster??[],f=lf(r.map(p=>p.id),{enabled:!l,version:a?.mode}),d=r.flatMap(p=>p.media?.audioPublishUrl?[{type:"rover",id:`${p.id}-audio`,key:`${p.id}-audio`}]:[]),y=af(d,{enabled:!l,version:a?.mode});return l?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."})]})}):o.jsxs("div",{className:"min-h-screen bg-black text-slate-100 md:h-screen md:overflow-hidden",children:[o.jsxs("main",{className:"grid min-h-screen grid-cols-1 gap-0.5 p-0 md:h-full md:min-h-0 md:grid-cols-[minmax(0,1fr)_18rem] lg:grid-cols-[minmax(0,1fr)_20rem]",children:[o.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col gap-0.5 md:overflow-y-auto",children:[o.jsx(Mj,{roster:r,frames:i,snapshotFeeds:f,audioSources:y,session:a}),o.jsx(kj,{})]}),o.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col gap-0.5 md:h-full",children:[o.jsx(vf,{layout:"desktop"}),o.jsx("div",{className:"panel",children:o.jsx(_r,{title:"Rovers"})}),o.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:o.jsx(gf,{hideNicknameForm:!0,hideHeader:!0,fillHeight:!0,className:"h-full"})}),o.jsx("div",{className:"min-h-0 min-w-0 flex-[1.1] overflow-hidden",children:o.jsx(Hs,{hideInput:!0,hideSpectatorNotice:!0,fillHeight:!0})}),o.jsx("div",{className:"min-h-0 min-w-0",children:o.jsx(_j,{className:"h-40 overflow-hidden"})})]})]}),o.jsx(Ju,{})]})}function Oj(){return o.jsx(Zu,{children:o.jsx(Dj,{})})}const Bj=2e4,zj=10800*1e3;function Lj({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,y=l?.turnQueues?.[a];return d==="turns"&&y?.current?`${f} (turns)`:f}function Uj(){const{session:a}=_e(),l=Mg();yf();const i=a?.mode==="lockdown",r=Ku(),f=a?.roster??[],[d,y]=m.useState(0),p=a?.activeDrivers||{},g=m.useMemo(()=>f.filter(G=>p[G.id]),[f,p]),v=lf(g.map(G=>G.id),{enabled:!i,version:a?.mode}),b=m.useMemo(()=>g.flatMap(G=>{if(!G?.id||!G.media?.audioPublishUrl)return[];const K=String(G.id);return[{type:"rover",id:`${K}-audio`,key:`${K}-audio`}]}),[g]),S=af(b,{enabled:!i,version:a?.mode}),w=m.useMemo(()=>{if(!g.length)return[];const G=g.filter(K=>v[K.id]?.objectUrl);return G.length?G:g},[g,v]),C=m.useMemo(()=>w.map(G=>({type:"rover",rover:G})),[w]),j=m.useMemo(()=>C.map(G=>`r:${G.rover.id}`).join("|"),[C]);m.useEffect(()=>{y(0)},[j]),m.useEffect(()=>{if(!C.length)return;const G=setInterval(()=>{y(K=>(K+1)%C.length)},Bj);return()=>clearInterval(G)},[C.length,j]);const R=C.length?C[d%C.length]:null,A=R?.type==="rover"?R.rover:null,E=A&&v[A.id]||null,N=A&&S[`${A.id}-audio`]||null,D=A&&r[A.id]||null,J=A?Lj({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 h-screen w-screen overflow-hidden bg-black p-0 text-slate-100 flex flex-col gap-0.5",children:[o.jsx(Vj,{}),o.jsx("section",{className:"panel relative flex min-h-0 flex-1 overflow-hidden",children:l?A?o.jsx(Yj,{children:o.jsx(rf,{sessionInfo:null,videoMode:"snapshot",snapshotFeed:E,audioSessionInfo:N,label:A.name||A.id,telemetryFrame:D,batteryConfig:A.battery,layoutFormat:"mobile",hudVariant:"spectator",driverLabel:J,hudLabelScale:5,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:g.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…"})})]})}function Hj(){return m.useEffect(()=>{if(typeof window>"u")return;const a=setTimeout(()=>{const l=new URL(window.location.href);l.searchParams.set("refresh",Date.now().toString()),window.location.replace(l.toString())},zj);return()=>clearTimeout(a)},[]),o.jsx(Zu,{children:o.jsxs(o.Fragment,{children:[o.jsx(Uj,{}),o.jsx(Ju,{scale:3})]})})}function Vj(){return o.jsx("div",{className:"pointer-events-none absolute left-1/2 top-1 z-30",style:{transform:"translate(-50%, 0) scale(0.7)",transformOrigin:"top center"},children:o.jsx("div",{className:"pointer-events-none overflow-hidden rounded-md",style:{width:"50vw",minWidth:"16rem",maxWidth:"24rem",opacity:.55,maxHeight:"12rem"},children:o.jsx(Hs,{hideInput:!0,hideSpectatorNotice:!0})})})}function Yj({children:a}){return o.jsx("div",{className:"flex h-full w-full items-center justify-center 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})})})}nx.createRoot(document.getElementById("root")).render(o.jsx(m.StrictMode,{children:o.jsx(w1,{children:o.jsx(q1,{children:o.jsx(C1,{children:o.jsx(xS,{children:o.jsx(yb,{children:o.jsxs(Zx,{children:[o.jsx(hr,{path:"/",element:o.jsx(qj,{})}),o.jsx(hr,{path:"/spectate",element:o.jsx(Oj,{})}),o.jsx(hr,{path:"/mini",element:o.jsx(Hj,{})})]})})})})})})}));
|