mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 09:31:20 -04:00
120 lines
439 KiB
JavaScript
120 lines
439 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 g of d.addedNodes)g.tagName==="LINK"&&g.rel==="modulepreload"&&r(g)}).observe(document,{childList:!0,subtree:!0});function i(f){const d={};return f.integrity&&(d.integrity=f.integrity),f.referrerPolicy&&(d.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?d.credentials="include":f.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(f){if(f.ep)return;f.ep=!0;const d=i(f);fetch(f.href,d)}})();function Gv(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Xo={exports:{}},xs={};var dp;function Qv(){if(dp)return xs;dp=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function i(r,f,d){var g=null;if(d!==void 0&&(g=""+d),f.key!==void 0&&(g=""+f.key),"key"in f){d={};for(var p in f)p!=="key"&&(d[p]=f[p])}else d=f;return f=d.ref,{$$typeof:a,type:r,key:g,ref:f!==void 0?f:null,props:d}}return xs.Fragment=l,xs.jsx=i,xs.jsxs=i,xs}var hp;function Xv(){return hp||(hp=1,Xo.exports=Qv()),Xo.exports}var o=Xv(),$o={exports:{}},he={};var mp;function $v(){if(mp)return he;mp=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),g=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),v=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),T=Symbol.iterator;function q(C){return C===null||typeof C!="object"?null:(C=T&&C[T]||C["@@iterator"],typeof C=="function"?C:null)}var j={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,A={};function E(C,U,M){this.props=C,this.context=U,this.refs=A,this.updater=M||j}E.prototype.isReactComponent={},E.prototype.setState=function(C,U){if(typeof C!="object"&&typeof C!="function"&&C!=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,C,U,"setState")},E.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function N(){}N.prototype=E.prototype;function k(C,U,M){this.props=C,this.context=U,this.refs=A,this.updater=M||j}var Z=k.prototype=new N;Z.constructor=k,R(Z,E.prototype),Z.isPureReactComponent=!0;var V=Array.isArray;function G(){}var $={H:null,A:null,T:null,S:null},P=Object.prototype.hasOwnProperty;function I(C,U,M){var D=M.ref;return{$$typeof:a,type:C,key:U,ref:D!==void 0?D:null,props:M}}function te(C,U){return I(C.type,U,C.props)}function ne(C){return typeof C=="object"&&C!==null&&C.$$typeof===a}function se(C){var U={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(M){return U[M]})}var ge=/\/+/g;function ye(C,U){return typeof C=="object"&&C!==null&&C.key!=null?se(""+C.key):U.toString(36)}function re(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then(G,G):(C.status="pending",C.then(function(U){C.status==="pending"&&(C.status="fulfilled",C.value=U)},function(U){C.status==="pending"&&(C.status="rejected",C.reason=U)})),C.status){case"fulfilled":return C.value;case"rejected":throw C.reason}}throw C}function z(C,U,M,D,K){var ee=typeof C;(ee==="undefined"||ee==="boolean")&&(C=null);var oe=!1;if(C===null)oe=!0;else switch(ee){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(C.$$typeof){case a:case l:oe=!0;break;case S:return oe=C._init,z(oe(C._payload),U,M,D,K)}}if(oe)return K=K(C),oe=D===""?"."+ye(C,0):D,V(K)?(M="",oe!=null&&(M=oe.replace(ge,"$&/")+"/"),z(K,U,M,"",function(cn){return cn})):K!=null&&(ne(K)&&(K=te(K,M+(K.key==null||C&&C.key===K.key?"":(""+K.key).replace(ge,"$&/")+"/")+oe)),U.push(K)),1;oe=0;var Ne=D===""?".":D+":";if(V(C))for(var de=0;de<C.length;de++)D=C[de],ee=Ne+ye(D,de),oe+=z(D,U,M,ee,K);else if(de=q(C),typeof de=="function")for(C=de.call(C),de=0;!(D=C.next()).done;)D=D.value,ee=Ne+ye(D,de++),oe+=z(D,U,M,ee,K);else if(ee==="object"){if(typeof C.then=="function")return z(re(C),U,M,D,K);throw U=String(C),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(C).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return oe}function Q(C,U,M){if(C==null)return C;var D=[],K=0;return z(C,D,"","",function(ee){return U.call(M,ee,K++)}),D}function W(C){if(C._status===-1){var U=C._result;U=U(),U.then(function(M){(C._status===0||C._status===-1)&&(C._status=1,C._result=M)},function(M){(C._status===0||C._status===-1)&&(C._status=2,C._result=M)}),C._status===-1&&(C._status=0,C._result=U)}if(C._status===1)return C._result.default;throw C._result}var ae=typeof reportError=="function"?reportError:function(C){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof C=="object"&&C!==null&&typeof C.message=="string"?String(C.message):String(C),error:C});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",C);return}console.error(C)},ue={map:Q,forEach:function(C,U,M){Q(C,function(){U.apply(this,arguments)},M)},count:function(C){var U=0;return Q(C,function(){U++}),U},toArray:function(C){return Q(C,function(U){return U})||[]},only:function(C){if(!ne(C))throw Error("React.Children.only expected to receive a single React element child.");return C}};return he.Activity=b,he.Children=ue,he.Component=E,he.Fragment=i,he.Profiler=f,he.PureComponent=k,he.StrictMode=r,he.Suspense=y,he.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,he.__COMPILER_RUNTIME={__proto__:null,c:function(C){return $.H.useMemoCache(C)}},he.cache=function(C){return function(){return C.apply(null,arguments)}},he.cacheSignal=function(){return null},he.cloneElement=function(C,U,M){if(C==null)throw Error("The argument must be a React element, but you passed "+C+".");var D=R({},C.props),K=C.key;if(U!=null)for(ee in U.key!==void 0&&(K=""+U.key),U)!P.call(U,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&U.ref===void 0||(D[ee]=U[ee]);var ee=arguments.length-2;if(ee===1)D.children=M;else if(1<ee){for(var oe=Array(ee),Ne=0;Ne<ee;Ne++)oe[Ne]=arguments[Ne+2];D.children=oe}return I(C.type,K,D)},he.createContext=function(C){return C={$$typeof:g,_currentValue:C,_currentValue2:C,_threadCount:0,Provider:null,Consumer:null},C.Provider=C,C.Consumer={$$typeof:d,_context:C},C},he.createElement=function(C,U,M){var D,K={},ee=null;if(U!=null)for(D in U.key!==void 0&&(ee=""+U.key),U)P.call(U,D)&&D!=="key"&&D!=="__self"&&D!=="__source"&&(K[D]=U[D]);var oe=arguments.length-2;if(oe===1)K.children=M;else if(1<oe){for(var Ne=Array(oe),de=0;de<oe;de++)Ne[de]=arguments[de+2];K.children=Ne}if(C&&C.defaultProps)for(D in oe=C.defaultProps,oe)K[D]===void 0&&(K[D]=oe[D]);return I(C,ee,K)},he.createRef=function(){return{current:null}},he.forwardRef=function(C){return{$$typeof:p,render:C}},he.isValidElement=ne,he.lazy=function(C){return{$$typeof:S,_payload:{_status:-1,_result:C},_init:W}},he.memo=function(C,U){return{$$typeof:v,type:C,compare:U===void 0?null:U}},he.startTransition=function(C){var U=$.T,M={};$.T=M;try{var D=C(),K=$.S;K!==null&&K(M,D),typeof D=="object"&&D!==null&&typeof D.then=="function"&&D.then(G,ae)}catch(ee){ae(ee)}finally{U!==null&&M.types!==null&&(U.types=M.types),$.T=U}},he.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},he.use=function(C){return $.H.use(C)},he.useActionState=function(C,U,M){return $.H.useActionState(C,U,M)},he.useCallback=function(C,U){return $.H.useCallback(C,U)},he.useContext=function(C){return $.H.useContext(C)},he.useDebugValue=function(){},he.useDeferredValue=function(C,U){return $.H.useDeferredValue(C,U)},he.useEffect=function(C,U){return $.H.useEffect(C,U)},he.useEffectEvent=function(C){return $.H.useEffectEvent(C)},he.useId=function(){return $.H.useId()},he.useImperativeHandle=function(C,U,M){return $.H.useImperativeHandle(C,U,M)},he.useInsertionEffect=function(C,U){return $.H.useInsertionEffect(C,U)},he.useLayoutEffect=function(C,U){return $.H.useLayoutEffect(C,U)},he.useMemo=function(C,U){return $.H.useMemo(C,U)},he.useOptimistic=function(C,U){return $.H.useOptimistic(C,U)},he.useReducer=function(C,U,M){return $.H.useReducer(C,U,M)},he.useRef=function(C){return $.H.useRef(C)},he.useState=function(C){return $.H.useState(C)},he.useSyncExternalStore=function(C,U,M){return $.H.useSyncExternalStore(C,U,M)},he.useTransition=function(){return $.H.useTransition()},he.version="19.2.0",he}var pp;function Ru(){return pp||(pp=1,$o.exports=$v()),$o.exports}var m=Ru();const Ca=Gv(m);var Ko={exports:{}},bs={},Zo={exports:{}},Jo={};var gp;function Kv(){return gp||(gp=1,(function(a){function l(z,Q){var W=z.length;z.push(Q);e:for(;0<W;){var ae=W-1>>>1,ue=z[ae];if(0<f(ue,Q))z[ae]=Q,z[W]=ue,W=ae;else break e}}function i(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var Q=z[0],W=z.pop();if(W!==Q){z[0]=W;e:for(var ae=0,ue=z.length,C=ue>>>1;ae<C;){var U=2*(ae+1)-1,M=z[U],D=U+1,K=z[D];if(0>f(M,W))D<ue&&0>f(K,M)?(z[ae]=K,z[D]=W,ae=D):(z[ae]=M,z[U]=W,ae=U);else if(D<ue&&0>f(K,W))z[ae]=K,z[D]=W,ae=D;else break e}}return Q}function f(z,Q){var W=z.sortIndex-Q.sortIndex;return W!==0?W:z.id-Q.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;a.unstable_now=function(){return d.now()}}else{var g=Date,p=g.now();a.unstable_now=function(){return g.now()-p}}var y=[],v=[],S=1,b=null,T=3,q=!1,j=!1,R=!1,A=!1,E=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function Z(z){for(var Q=i(v);Q!==null;){if(Q.callback===null)r(v);else if(Q.startTime<=z)r(v),Q.sortIndex=Q.expirationTime,l(y,Q);else break;Q=i(v)}}function V(z){if(R=!1,Z(z),!j)if(i(y)!==null)j=!0,G||(G=!0,se());else{var Q=i(v);Q!==null&&re(V,Q.startTime-z)}}var G=!1,$=-1,P=5,I=-1;function te(){return A?!0:!(a.unstable_now()-I<P)}function ne(){if(A=!1,G){var z=a.unstable_now();I=z;var Q=!0;try{e:{j=!1,R&&(R=!1,N($),$=-1),q=!0;var W=T;try{t:{for(Z(z),b=i(y);b!==null&&!(b.expirationTime>z&&te());){var ae=b.callback;if(typeof ae=="function"){b.callback=null,T=b.priorityLevel;var ue=ae(b.expirationTime<=z);if(z=a.unstable_now(),typeof ue=="function"){b.callback=ue,Z(z),Q=!0;break t}b===i(y)&&r(y),Z(z)}else r(y);b=i(y)}if(b!==null)Q=!0;else{var C=i(v);C!==null&&re(V,C.startTime-z),Q=!1}}break e}finally{b=null,T=W,q=!1}Q=void 0}}finally{Q?se():G=!1}}}var se;if(typeof k=="function")se=function(){k(ne)};else if(typeof MessageChannel<"u"){var ge=new MessageChannel,ye=ge.port2;ge.port1.onmessage=ne,se=function(){ye.postMessage(null)}}else se=function(){E(ne,0)};function re(z,Q){$=E(function(){z(a.unstable_now())},Q)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(z){z.callback=null},a.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P=0<z?Math.floor(1e3/z):5},a.unstable_getCurrentPriorityLevel=function(){return T},a.unstable_next=function(z){switch(T){case 1:case 2:case 3:var Q=3;break;default:Q=T}var W=T;T=Q;try{return z()}finally{T=W}},a.unstable_requestPaint=function(){A=!0},a.unstable_runWithPriority=function(z,Q){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var W=T;T=z;try{return Q()}finally{T=W}},a.unstable_scheduleCallback=function(z,Q,W){var ae=a.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?ae+W:ae):W=ae,z){case 1:var ue=-1;break;case 2:ue=250;break;case 5:ue=1073741823;break;case 4:ue=1e4;break;default:ue=5e3}return ue=W+ue,z={id:S++,callback:Q,priorityLevel:z,startTime:W,expirationTime:ue,sortIndex:-1},W>ae?(z.sortIndex=W,l(v,z),i(y)===null&&z===i(v)&&(R?(N($),$=-1):R=!0,re(V,W-ae))):(z.sortIndex=ue,l(y,z),j||q||(j=!0,G||(G=!0,se()))),z},a.unstable_shouldYield=te,a.unstable_wrapCallback=function(z){var Q=T;return function(){var W=T;T=Q;try{return z.apply(this,arguments)}finally{T=W}}}})(Jo)),Jo}var yp;function Zv(){return yp||(yp=1,Zo.exports=Kv()),Zo.exports}var Fo={exports:{}},ut={};var vp;function Jv(){if(vp)return ut;vp=1;var a=Ru();function l(y){var v="https://react.dev/errors/"+y;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)v+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+y+"; 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(y,v,S){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:f,key:b==null?null:""+b,children:y,containerInfo:v,implementation:S}}var g=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(y,v){if(y==="font")return"";if(typeof v=="string")return v==="use-credentials"?v:""}return ut.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,ut.createPortal=function(y,v){var S=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(y,v,null,S)},ut.flushSync=function(y){var v=g.T,S=r.p;try{if(g.T=null,r.p=2,y)return y()}finally{g.T=v,r.p=S,r.d.f()}},ut.preconnect=function(y,v){typeof y=="string"&&(v?(v=v.crossOrigin,v=typeof v=="string"?v==="use-credentials"?v:"":void 0):v=null,r.d.C(y,v))},ut.prefetchDNS=function(y){typeof y=="string"&&r.d.D(y)},ut.preinit=function(y,v){if(typeof y=="string"&&v&&typeof v.as=="string"){var S=v.as,b=p(S,v.crossOrigin),T=typeof v.integrity=="string"?v.integrity:void 0,q=typeof v.fetchPriority=="string"?v.fetchPriority:void 0;S==="style"?r.d.S(y,typeof v.precedence=="string"?v.precedence:void 0,{crossOrigin:b,integrity:T,fetchPriority:q}):S==="script"&&r.d.X(y,{crossOrigin:b,integrity:T,fetchPriority:q,nonce:typeof v.nonce=="string"?v.nonce:void 0})}},ut.preinitModule=function(y,v){if(typeof y=="string")if(typeof v=="object"&&v!==null){if(v.as==null||v.as==="script"){var S=p(v.as,v.crossOrigin);r.d.M(y,{crossOrigin:S,integrity:typeof v.integrity=="string"?v.integrity:void 0,nonce:typeof v.nonce=="string"?v.nonce:void 0})}}else v==null&&r.d.M(y)},ut.preload=function(y,v){if(typeof y=="string"&&typeof v=="object"&&v!==null&&typeof v.as=="string"){var S=v.as,b=p(S,v.crossOrigin);r.d.L(y,S,{crossOrigin:b,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})}},ut.preloadModule=function(y,v){if(typeof y=="string")if(v){var S=p(v.as,v.crossOrigin);r.d.m(y,{as:typeof v.as=="string"&&v.as!=="script"?v.as:void 0,crossOrigin:S,integrity:typeof v.integrity=="string"?v.integrity:void 0})}else r.d.m(y)},ut.requestFormReset=function(y){r.d.r(y)},ut.unstable_batchedUpdates=function(y,v){return y(v)},ut.useFormState=function(y,v,S){return g.H.useFormState(y,v,S)},ut.useFormStatus=function(){return g.H.useHostTransitionStatus()},ut.version="19.2.0",ut}var xp;function Fv(){if(xp)return Fo.exports;xp=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),Fo.exports=Jv(),Fo.exports}var bp;function Iv(){if(bp)return bs;bp=1;var a=Zv(),l=Ru(),i=Fv();function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function f(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function g(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function 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 y(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 y(c),e;if(u===s)return y(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 S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,T=Symbol.for("react.element"),q=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"),k=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),te=Symbol.for("react.memo_cache_sentinel"),ne=Symbol.iterator;function se(e){return e===null||typeof e!="object"?null:(e=ne&&e[ne]||e["@@iterator"],typeof e=="function"?e:null)}var ge=Symbol.for("react.client.reference");function ye(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ge?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 V:return"Suspense";case G:return"SuspenseList";case I:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case j:return"Portal";case k:return e.displayName||"Context";case N:return(e._context.displayName||"Context")+".Consumer";case Z:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case $:return t=e.displayName||null,t!==null?t:ye(e.type)||"Memo";case P:t=e._payload,e=e._init;try{return ye(e(t))}catch{}}return null}var re=Array.isArray,z=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},ae=[],ue=-1;function C(e){return{current:e}}function U(e){0>ue||(e.current=ae[ue],ae[ue]=null,ue--)}function M(e,t){ue++,ae[ue]=e.current,e.current=t}var D=C(null),K=C(null),ee=C(null),oe=C(null);function Ne(e,t){switch(M(ee,t),M(K,e),M(D,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Dm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Dm(t),e=zm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}U(D),M(D,e)}function de(){U(D),U(K),U(ee)}function cn(e){e.memoizedState!==null&&M(oe,e);var t=D.current,n=zm(t,e.type);t!==n&&(M(K,e),M(D,n))}function On(e){K.current===e&&(U(D),U(K)),oe.current===e&&(U(oe),ps._currentValue=W)}var Gt,oa;function Qt(e){if(Gt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Gt=t&&t[1]||"",oa=-1<n.stack.indexOf(`
|
||
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
||
`+Gt+e+oa}var ht=!1;function Xt(e,t){if(!e||ht)return"";ht=!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 w=h.split(`
|
||
`),L=x.split(`
|
||
`);for(c=s=0;s<w.length&&!w[s].includes("DetermineComponentFrameRoot");)s++;for(;c<L.length&&!L[c].includes("DetermineComponentFrameRoot");)c++;if(s===w.length||c===L.length)for(s=w.length-1,c=L.length-1;1<=s&&0<=c&&w[s]!==L[c];)c--;for(;1<=s&&0<=c;s--,c--)if(w[s]!==L[c]){if(s!==1||c!==1)do if(s--,c--,0>c||w[s]!==L[c]){var X=`
|
||
`+w[s].replace(" at new "," at ");return e.displayName&&X.includes("<anonymous>")&&(X=X.replace("<anonymous>",e.displayName)),X}while(1<=s&&0<=c);break}}}finally{ht=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Qt(n):""}function on(e,t){switch(e.tag){case 26:case 27:case 5:return Qt(e.type);case 16:return Qt("Lazy");case 13:return e.child!==t&&t!==null?Qt("Suspense Fallback"):Qt("Suspense");case 19:return Qt("SuspenseList");case 0:case 15:return Xt(e.type,!1);case 11:return Xt(e.type.render,!1);case 1:return Xt(e.type,!0);case 31:return Qt("Activity");default:return""}}function jl(e){try{var t="",n=null;do t+=on(e,n),n=e,e=e.return;while(e);return t}catch(s){return`
|
||
Error generating stack: `+s.message+`
|
||
`+s.stack}}var Nl=Object.prototype.hasOwnProperty,El=a.unstable_scheduleCallback,wl=a.unstable_cancelCallback,Ls=a.unstable_shouldYield,Ee=a.unstable_requestPaint,ze=a.unstable_now,mt=a.unstable_getCurrentPriorityLevel,Le=a.unstable_ImmediatePriority,Xe=a.unstable_UserBlockingPriority,_e=a.unstable_NormalPriority,Rr=a.unstable_LowPriority,pf=a.unstable_IdlePriority,Eg=a.log,wg=a.unstable_setDisableYieldValue,ql=null,At=null;function Dn(e){if(typeof Eg=="function"&&wg(e),At&&typeof At.setStrictMode=="function")try{At.setStrictMode(ql,e)}catch{}}var jt=Math.clz32?Math.clz32:Tg,qg=Math.log,Cg=Math.LN2;function Tg(e){return e>>>=0,e===0?32:31-(qg(e)/Cg|0)|0}var Us=256,Hs=262144,Vs=4194304;function ua(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 Ys(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=ua(s):(h&=x,h!==0?c=ua(h):n||(n=x&~e,n!==0&&(c=ua(n))))):(x=s&~u,x!==0?c=ua(x):h!==0?c=ua(h):n||(n=s&~e,n!==0&&(c=ua(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 Cl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Mg(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 gf(){var e=Vs;return Vs<<=1,(Vs&62914560)===0&&(Vs=4194304),e}function _r(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Tl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Rg(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,w=e.expirationTimes,L=e.hiddenUpdates;for(n=h&~n;0<n;){var X=31-jt(n),F=1<<X;x[X]=0,w[X]=-1;var H=L[X];if(H!==null)for(L[X]=null,X=0;X<H.length;X++){var Y=H[X];Y!==null&&(Y.lane&=-536870913)}n&=~F}s!==0&&yf(e,s,0),u!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=u&~(h&~t))}function yf(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-jt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|n&261930}function vf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var s=31-jt(n),c=1<<s;c&t|e[s]&t&&(e[s]|=t),n&=~c}}function xf(e,t){var n=t&-t;return n=(n&42)!==0?1:kr(n),(n&(e.suspendedLanes|t))!==0?0:n}function kr(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 Or(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function bf(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:sp(e.type))}function Sf(e,t){var n=Q.p;try{return Q.p=e,t()}finally{Q.p=n}}var zn=Math.random().toString(36).slice(2),at="__reactFiber$"+zn,pt="__reactProps$"+zn,Ma="__reactContainer$"+zn,Dr="__reactEvents$"+zn,_g="__reactListeners$"+zn,kg="__reactHandles$"+zn,Af="__reactResources$"+zn,Ml="__reactMarker$"+zn;function zr(e){delete e[at],delete e[pt],delete e[Dr],delete e[_g],delete e[kg]}function Ra(e){var t=e[at];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ma]||n[at]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Gm(e);e!==null;){if(n=e[at])return n;e=Gm(e)}return t}e=n,n=e.parentNode}return null}function _a(e){if(e=e[at]||e[Ma]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Rl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(r(33))}function ka(e){var t=e[Af];return t||(t=e[Af]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function tt(e){e[Ml]=!0}var jf=new Set,Nf={};function fa(e,t){Oa(e,t),Oa(e+"Capture",t)}function Oa(e,t){for(Nf[e]=t,e=0;e<t.length;e++)jf.add(t[e])}var Og=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]*$"),Ef={},wf={};function Dg(e){return Nl.call(wf,e)?!0:Nl.call(Ef,e)?!1:Og.test(e)?wf[e]=!0:(Ef[e]=!0,!1)}function Gs(e,t,n){if(Dg(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 Qs(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 un(e,t,n,s){if(s===null)e.removeAttribute(n);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+s)}}function Rt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function zg(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 Br(e){if(!e._valueTracker){var t=qf(e)?"checked":"value";e._valueTracker=zg(e,t,""+e[t])}}function Cf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=qf(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function Xs(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 Bg=/[\n"\\]/g;function _t(e){return e.replace(Bg,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Lr(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=""+Rt(t)):e.value!==""+Rt(t)&&(e.value=""+Rt(t)):h!=="submit"&&h!=="reset"||e.removeAttribute("value"),t!=null?Ur(e,h,Rt(t)):n!=null?Ur(e,h,Rt(n)):s!=null&&e.removeAttribute("value"),c==null&&u!=null&&(e.defaultChecked=!!u),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?e.name=""+Rt(x):e.removeAttribute("name")}function Tf(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)){Br(e);return}n=n!=null?""+Rt(n):"",t=t!=null?""+Rt(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),Br(e)}function Ur(e,t,n){t==="number"&&Xs(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Da(e,t,n,s){if(e=e.options,t){t={};for(var c=0;c<n.length;c++)t["$"+n[c]]=!0;for(n=0;n<e.length;n++)c=t.hasOwnProperty("$"+e[n].value),e[n].selected!==c&&(e[n].selected=c),c&&s&&(e[n].defaultSelected=!0)}else{for(n=""+Rt(n),t=null,c=0;c<e.length;c++){if(e[c].value===n){e[c].selected=!0,s&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function Mf(e,t,n){if(t!=null&&(t=""+Rt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Rt(n):""}function Rf(e,t,n,s){if(t==null){if(s!=null){if(n!=null)throw Error(r(92));if(re(s)){if(1<s.length)throw Error(r(93));s=s[0]}n=s}n==null&&(n=""),t=n}n=Rt(t),e.defaultValue=n,s=e.textContent,s===n&&s!==""&&s!==null&&(e.value=s),Br(e)}function za(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Lg=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 _f(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||Lg.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function kf(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&&_f(e,c,s)}else for(var u in t)t.hasOwnProperty(u)&&_f(e,u,t[u])}function Hr(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 Ug=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"]]),Hg=/^[\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 $s(e){return Hg.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function fn(){}var Vr=null;function Yr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ba=null,La=null;function Of(e){var t=_a(e);if(t&&(e=t.stateNode)){var n=e[pt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Lr(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="'+_t(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var s=n[t];if(s!==e&&s.form===e.form){var c=s[pt]||null;if(!c)throw Error(r(90));Lr(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&&Cf(s)}break e;case"textarea":Mf(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Da(e,!!n.multiple,t,!1)}}}var Gr=!1;function Df(e,t,n){if(Gr)return e(t,n);Gr=!0;try{var s=e(t);return s}finally{if(Gr=!1,(Ba!==null||La!==null)&&(ki(),Ba&&(t=Ba,e=La,La=Ba=null,Of(t),e)))for(t=0;t<e.length;t++)Of(e[t])}}function _l(e,t){var n=e.stateNode;if(n===null)return null;var s=n[pt]||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 dn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qr=!1;if(dn)try{var kl={};Object.defineProperty(kl,"passive",{get:function(){Qr=!0}}),window.addEventListener("test",kl,kl),window.removeEventListener("test",kl,kl)}catch{Qr=!1}var Bn=null,Xr=null,Ks=null;function zf(){if(Ks)return Ks;var e,t=Xr,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 Ks=c.slice(e,1<s?1-s:void 0)}function Zs(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 Js(){return!0}function Bf(){return!1}function gt(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)?Js:Bf,this.isPropagationStopped=Bf,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Js)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Js)},persist:function(){},isPersistent:Js}),t}var da={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Fs=gt(da),Ol=b({},da,{view:0,detail:0}),Vg=gt(Ol),$r,Kr,Dl,Is=b({},Ol,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Jr,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!==Dl&&(Dl&&e.type==="mousemove"?($r=e.screenX-Dl.screenX,Kr=e.screenY-Dl.screenY):Kr=$r=0,Dl=e),$r)},movementY:function(e){return"movementY"in e?e.movementY:Kr}}),Lf=gt(Is),Yg=b({},Is,{dataTransfer:0}),Gg=gt(Yg),Qg=b({},Ol,{relatedTarget:0}),Zr=gt(Qg),Xg=b({},da,{animationName:0,elapsedTime:0,pseudoElement:0}),$g=gt(Xg),Kg=b({},da,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Zg=gt(Kg),Jg=b({},da,{data:0}),Uf=gt(Jg),Fg={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ig={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"},Wg={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Pg(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Wg[e])?!!t[e]:!1}function Jr(){return Pg}var ey=b({},Ol,{key:function(e){if(e.key){var t=Fg[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Zs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ig[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Jr,charCode:function(e){return e.type==="keypress"?Zs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Zs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ty=gt(ey),ny=b({},Is,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hf=gt(ny),ay=b({},Ol,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Jr}),ly=gt(ay),sy=b({},da,{propertyName:0,elapsedTime:0,pseudoElement:0}),iy=gt(sy),ry=b({},Is,{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}),cy=gt(ry),oy=b({},da,{newState:0,oldState:0}),uy=gt(oy),fy=[9,13,27,32],Fr=dn&&"CompositionEvent"in window,zl=null;dn&&"documentMode"in document&&(zl=document.documentMode);var dy=dn&&"TextEvent"in window&&!zl,Vf=dn&&(!Fr||zl&&8<zl&&11>=zl),Yf=" ",Gf=!1;function Qf(e,t){switch(e){case"keyup":return fy.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ua=!1;function hy(e,t){switch(e){case"compositionend":return Xf(t);case"keypress":return t.which!==32?null:(Gf=!0,Yf);case"textInput":return e=t.data,e===Yf&&Gf?null:e;default:return null}}function my(e,t){if(Ua)return e==="compositionend"||!Fr&&Qf(e,t)?(e=zf(),Ks=Xr=Bn=null,Ua=!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 Vf&&t.locale!=="ko"?null:t.data;default:return null}}var py={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 $f(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!py[e.type]:t==="textarea"}function Kf(e,t,n,s){Ba?La?La.push(s):La=[s]:Ba=s,t=Hi(t,"onChange"),0<t.length&&(n=new Fs("onChange","change",null,n,s),e.push({event:n,listeners:t}))}var Bl=null,Ll=null;function gy(e){Tm(e,0)}function Ws(e){var t=Rl(e);if(Cf(t))return e}function Zf(e,t){if(e==="change")return t}var Jf=!1;if(dn){var Ir;if(dn){var Wr="oninput"in document;if(!Wr){var Ff=document.createElement("div");Ff.setAttribute("oninput","return;"),Wr=typeof Ff.oninput=="function"}Ir=Wr}else Ir=!1;Jf=Ir&&(!document.documentMode||9<document.documentMode)}function If(){Bl&&(Bl.detachEvent("onpropertychange",Wf),Ll=Bl=null)}function Wf(e){if(e.propertyName==="value"&&Ws(Ll)){var t=[];Kf(t,Ll,e,Yr(e)),Df(gy,t)}}function yy(e,t,n){e==="focusin"?(If(),Bl=t,Ll=n,Bl.attachEvent("onpropertychange",Wf)):e==="focusout"&&If()}function vy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ws(Ll)}function xy(e,t){if(e==="click")return Ws(t)}function by(e,t){if(e==="input"||e==="change")return Ws(t)}function Sy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Nt=typeof Object.is=="function"?Object.is:Sy;function Ul(e,t){if(Nt(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(!Nl.call(t,c)||!Nt(e[c],t[c]))return!1}return!0}function Pf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ed(e,t){var n=Pf(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=Pf(n)}}function td(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?td(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function nd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Xs(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=Xs(e.document)}return t}function Pr(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 Ay=dn&&"documentMode"in document&&11>=document.documentMode,Ha=null,ec=null,Hl=null,tc=!1;function ad(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;tc||Ha==null||Ha!==Xs(s)||(s=Ha,"selectionStart"in s&&Pr(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}),Hl&&Ul(Hl,s)||(Hl=s,s=Hi(ec,"onSelect"),0<s.length&&(t=new Fs("onSelect","select",null,t,n),e.push({event:t,listeners:s}),t.target=Ha)))}function ha(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Va={animationend:ha("Animation","AnimationEnd"),animationiteration:ha("Animation","AnimationIteration"),animationstart:ha("Animation","AnimationStart"),transitionrun:ha("Transition","TransitionRun"),transitionstart:ha("Transition","TransitionStart"),transitioncancel:ha("Transition","TransitionCancel"),transitionend:ha("Transition","TransitionEnd")},nc={},ld={};dn&&(ld=document.createElement("div").style,"AnimationEvent"in window||(delete Va.animationend.animation,delete Va.animationiteration.animation,delete Va.animationstart.animation),"TransitionEvent"in window||delete Va.transitionend.transition);function ma(e){if(nc[e])return nc[e];if(!Va[e])return e;var t=Va[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ld)return nc[e]=t[n];return e}var sd=ma("animationend"),id=ma("animationiteration"),rd=ma("animationstart"),jy=ma("transitionrun"),Ny=ma("transitionstart"),Ey=ma("transitioncancel"),cd=ma("transitionend"),od=new Map,ac="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(" ");ac.push("scrollEnd");function $t(e,t){od.set(e,t),fa(t,[e])}var Ps=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)},kt=[],Ya=0,lc=0;function ei(){for(var e=Ya,t=lc=Ya=0;t<e;){var n=kt[t];kt[t++]=null;var s=kt[t];kt[t++]=null;var c=kt[t];kt[t++]=null;var u=kt[t];if(kt[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&&ud(n,c,u)}}function ti(e,t,n,s){kt[Ya++]=e,kt[Ya++]=t,kt[Ya++]=n,kt[Ya++]=s,lc|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function sc(e,t,n,s){return ti(e,t,n,s),ni(e)}function pa(e,t){return ti(e,null,null,t),ni(e)}function ud(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-jt(n),e=u.hiddenUpdates,s=e[c],s===null?e[c]=[t]:s.push(t),t.lane=n|536870912),u):null}function ni(e){if(50<cs)throw cs=0,po=null,Error(r(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ga={};function wy(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 wy(e,t,n,s)}function ic(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hn(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 fd(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 ai(e,t,n,s,c,u){var h=0;if(s=e,typeof e=="function")ic(e)&&(h=1);else if(typeof e=="string")h=Rv(e,n,D.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 ga(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 V:return e=Et(13,n,t,c),e.elementType=V,e.lanes=u,e;case G:return e=Et(19,n,t,c),e.elementType=G,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case k:h=10;break e;case N:h=9;break e;case Z:h=11;break e;case $:h=14;break e;case P: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 ga(e,t,n,s){return e=Et(7,e,s,t),e.lanes=n,e}function rc(e,t,n){return e=Et(6,e,null,t),e.lanes=n,e}function dd(e){var t=Et(18,null,null,0);return t.stateNode=e,t}function cc(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 hd=new WeakMap;function Ot(e,t){if(typeof e=="object"&&e!==null){var n=hd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:jl(t)},hd.set(e,t),t)}return{value:e,source:t,stack:jl(t)}}var Qa=[],Xa=0,li=null,Vl=0,Dt=[],zt=0,Ln=null,Pt=1,en="";function mn(e,t){Qa[Xa++]=Vl,Qa[Xa++]=li,li=e,Vl=t}function md(e,t,n){Dt[zt++]=Pt,Dt[zt++]=en,Dt[zt++]=Ln,Ln=e;var s=Pt;e=en;var c=32-jt(s)-1;s&=~(1<<c),n+=1;var u=32-jt(t)+c;if(30<u){var h=c-c%5;u=(s&(1<<h)-1).toString(32),s>>=h,c-=h,Pt=1<<32-jt(t)+c|n<<c|s,en=u+e}else Pt=1<<u|n<<c|s,en=e}function oc(e){e.return!==null&&(mn(e,1),md(e,1,0))}function uc(e){for(;e===li;)li=Qa[--Xa],Qa[Xa]=null,Vl=Qa[--Xa],Qa[Xa]=null;for(;e===Ln;)Ln=Dt[--zt],Dt[zt]=null,en=Dt[--zt],Dt[zt]=null,Pt=Dt[--zt],Dt[zt]=null}function pd(e,t){Dt[zt++]=Pt,Dt[zt++]=en,Dt[zt++]=Ln,Pt=t.id,en=t.overflow,Ln=e}var lt=null,Ue=null,Ae=!1,Un=null,Bt=!1,fc=Error(r(519));function Hn(e){var t=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Yl(Ot(t,e)),fc}function gd(e){var t=e.stateNode,n=e.type,s=e.memoizedProps;switch(t[at]=e,t[pt]=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<us.length;n++)xe(us[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),Tf(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),Rf(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||km(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=fn),t=!0):t=!1,t||Hn(e,!0)}function yd(e){for(lt=e.return;lt;)switch(lt.tag){case 5:case 31:case 13:Bt=!1;return;case 27:case 3:Bt=!0;return;default:lt=lt.return}}function $a(e){if(e!==lt)return!1;if(!Ae)return yd(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")||Mo(e.type,e.memoizedProps)),n=!n),n&&Ue&&Hn(e),yd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Ue=Ym(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));Ue=Ym(e)}else t===27?(t=Ue,ea(e.type)?(e=Do,Do=null,Ue=e):Ue=t):Ue=lt?Ut(e.stateNode.nextSibling):null;return!0}function ya(){Ue=lt=null,Ae=!1}function dc(){var e=Un;return e!==null&&(bt===null?bt=e:bt.push.apply(bt,e),Un=null),e}function Yl(e){Un===null?Un=[e]:Un.push(e)}var hc=C(null),va=null,pn=null;function Vn(e,t,n){M(hc,t._currentValue),t._currentValue=n}function gn(e){e._currentValue=hc.current,U(hc)}function mc(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 pc(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 w=0;w<t.length;w++)if(x.context===t[w]){u.lanes|=n,x=u.alternate,x!==null&&(x.lanes|=n),mc(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),mc(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 Ka(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;Nt(c.pendingProps.value,h.value)||(e!==null?e.push(x):e=[x])}}else if(c===oe.current){if(h=c.alternate,h===null)throw Error(r(387));h.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(ps):e=[ps])}c=c.return}e!==null&&pc(t,e,n,s),t.flags|=262144}function si(e){for(e=e.firstContext;e!==null;){if(!Nt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function xa(e){va=e,pn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function st(e){return vd(va,e)}function ii(e,t){return va===null&&xa(e),vd(e,t)}function vd(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},pn===null){if(e===null)throw Error(r(308));pn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else pn=pn.next=t;return n}var qy=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()})}},Cy=a.unstable_scheduleCallback,Ty=a.unstable_NormalPriority,Ze={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gc(){return{controller:new qy,data:new Map,refCount:0}}function Gl(e){e.refCount--,e.refCount===0&&Cy(Ty,function(){e.controller.abort()})}var Ql=null,yc=0,Za=0,Ja=null;function My(e,t){if(Ql===null){var n=Ql=[];yc=0,Za=So(),Ja={status:"pending",value:void 0,then:function(s){n.push(s)}}}return yc++,t.then(xd,xd),t}function xd(){if(--yc===0&&Ql!==null){Ja!==null&&(Ja.status="fulfilled");var e=Ql;Ql=null,Za=0,Ja=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ry(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 bd=z.S;z.S=function(e,t){am=ze(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&My(e,t),bd!==null&&bd(e,t)};var ba=C(null);function vc(){var e=ba.current;return e!==null?e:Be.pooledCache}function ri(e,t){t===null?M(ba,ba.current):M(ba,t.pool)}function Sd(){var e=vc();return e===null?null:{parent:Ze._currentValue,pool:e}}var Fa=Error(r(460)),xc=Error(r(474)),ci=Error(r(542)),oi={then:function(){}};function Ad(e){return e=e.status,e==="fulfilled"||e==="rejected"}function jd(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(fn,fn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Ed(e),e;default:if(typeof t.status=="string")t.then(fn,fn);else{if(e=Be,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,Ed(e),e}throw Aa=t,Fa}}function Sa(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Aa=n,Fa):n}}var Aa=null;function Nd(){if(Aa===null)throw Error(r(459));var e=Aa;return Aa=null,e}function Ed(e){if(e===Fa||e===ci)throw Error(r(483))}var Ia=null,Xl=0;function ui(e){var t=Xl;return Xl+=1,Ia===null&&(Ia=[]),jd(Ia,e,t)}function $l(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function fi(e,t){throw t.$$typeof===T?Error(r(525)):(e=Object.prototype.toString.call(t),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function wd(e){function t(O,_){if(e){var B=O.deletions;B===null?(O.deletions=[_],O.flags|=16):B.push(_)}}function n(O,_){if(!e)return null;for(;_!==null;)t(O,_),_=_.sibling;return null}function s(O){for(var _=new Map;O!==null;)O.key!==null?_.set(O.key,O):_.set(O.index,O),O=O.sibling;return _}function c(O,_){return O=hn(O,_),O.index=0,O.sibling=null,O}function u(O,_,B){return O.index=B,e?(B=O.alternate,B!==null?(B=B.index,B<_?(O.flags|=67108866,_):B):(O.flags|=67108866,_)):(O.flags|=1048576,_)}function h(O){return e&&O.alternate===null&&(O.flags|=67108866),O}function x(O,_,B,J){return _===null||_.tag!==6?(_=rc(B,O.mode,J),_.return=O,_):(_=c(_,B),_.return=O,_)}function w(O,_,B,J){var ce=B.type;return ce===R?X(O,_,B.props.children,J,B.key):_!==null&&(_.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===P&&Sa(ce)===_.type)?(_=c(_,B.props),$l(_,B),_.return=O,_):(_=ai(B.type,B.key,B.props,null,O.mode,J),$l(_,B),_.return=O,_)}function L(O,_,B,J){return _===null||_.tag!==4||_.stateNode.containerInfo!==B.containerInfo||_.stateNode.implementation!==B.implementation?(_=cc(B,O.mode,J),_.return=O,_):(_=c(_,B.children||[]),_.return=O,_)}function X(O,_,B,J,ce){return _===null||_.tag!==7?(_=ga(B,O.mode,J,ce),_.return=O,_):(_=c(_,B),_.return=O,_)}function F(O,_,B){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=rc(""+_,O.mode,B),_.return=O,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case q:return B=ai(_.type,_.key,_.props,null,O.mode,B),$l(B,_),B.return=O,B;case j:return _=cc(_,O.mode,B),_.return=O,_;case P:return _=Sa(_),F(O,_,B)}if(re(_)||se(_))return _=ga(_,O.mode,B,null),_.return=O,_;if(typeof _.then=="function")return F(O,ui(_),B);if(_.$$typeof===k)return F(O,ii(O,_),B);fi(O,_)}return null}function H(O,_,B,J){var ce=_!==null?_.key:null;if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return ce!==null?null:x(O,_,""+B,J);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case q:return B.key===ce?w(O,_,B,J):null;case j:return B.key===ce?L(O,_,B,J):null;case P:return B=Sa(B),H(O,_,B,J)}if(re(B)||se(B))return ce!==null?null:X(O,_,B,J,null);if(typeof B.then=="function")return H(O,_,ui(B),J);if(B.$$typeof===k)return H(O,_,ii(O,B),J);fi(O,B)}return null}function Y(O,_,B,J,ce){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return O=O.get(B)||null,x(_,O,""+J,ce);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case q:return O=O.get(J.key===null?B:J.key)||null,w(_,O,J,ce);case j:return O=O.get(J.key===null?B:J.key)||null,L(_,O,J,ce);case P:return J=Sa(J),Y(O,_,B,J,ce)}if(re(J)||se(J))return O=O.get(B)||null,X(_,O,J,ce,null);if(typeof J.then=="function")return Y(O,_,B,ui(J),ce);if(J.$$typeof===k)return Y(O,_,B,ii(_,J),ce);fi(_,J)}return null}function le(O,_,B,J){for(var ce=null,we=null,ie=_,pe=_=0,Se=null;ie!==null&&pe<B.length;pe++){ie.index>pe?(Se=ie,ie=null):Se=ie.sibling;var qe=H(O,ie,B[pe],J);if(qe===null){ie===null&&(ie=Se);break}e&&ie&&qe.alternate===null&&t(O,ie),_=u(qe,_,pe),we===null?ce=qe:we.sibling=qe,we=qe,ie=Se}if(pe===B.length)return n(O,ie),Ae&&mn(O,pe),ce;if(ie===null){for(;pe<B.length;pe++)ie=F(O,B[pe],J),ie!==null&&(_=u(ie,_,pe),we===null?ce=ie:we.sibling=ie,we=ie);return Ae&&mn(O,pe),ce}for(ie=s(ie);pe<B.length;pe++)Se=Y(ie,O,pe,B[pe],J),Se!==null&&(e&&Se.alternate!==null&&ie.delete(Se.key===null?pe:Se.key),_=u(Se,_,pe),we===null?ce=Se:we.sibling=Se,we=Se);return e&&ie.forEach(function(sa){return t(O,sa)}),Ae&&mn(O,pe),ce}function fe(O,_,B,J){if(B==null)throw Error(r(151));for(var ce=null,we=null,ie=_,pe=_=0,Se=null,qe=B.next();ie!==null&&!qe.done;pe++,qe=B.next()){ie.index>pe?(Se=ie,ie=null):Se=ie.sibling;var sa=H(O,ie,qe.value,J);if(sa===null){ie===null&&(ie=Se);break}e&&ie&&sa.alternate===null&&t(O,ie),_=u(sa,_,pe),we===null?ce=sa:we.sibling=sa,we=sa,ie=Se}if(qe.done)return n(O,ie),Ae&&mn(O,pe),ce;if(ie===null){for(;!qe.done;pe++,qe=B.next())qe=F(O,qe.value,J),qe!==null&&(_=u(qe,_,pe),we===null?ce=qe:we.sibling=qe,we=qe);return Ae&&mn(O,pe),ce}for(ie=s(ie);!qe.done;pe++,qe=B.next())qe=Y(ie,O,pe,qe.value,J),qe!==null&&(e&&qe.alternate!==null&&ie.delete(qe.key===null?pe:qe.key),_=u(qe,_,pe),we===null?ce=qe:we.sibling=qe,we=qe);return e&&ie.forEach(function(Yv){return t(O,Yv)}),Ae&&mn(O,pe),ce}function De(O,_,B,J){if(typeof B=="object"&&B!==null&&B.type===R&&B.key===null&&(B=B.props.children),typeof B=="object"&&B!==null){switch(B.$$typeof){case q:e:{for(var ce=B.key;_!==null;){if(_.key===ce){if(ce=B.type,ce===R){if(_.tag===7){n(O,_.sibling),J=c(_,B.props.children),J.return=O,O=J;break e}}else if(_.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===P&&Sa(ce)===_.type){n(O,_.sibling),J=c(_,B.props),$l(J,B),J.return=O,O=J;break e}n(O,_);break}else t(O,_);_=_.sibling}B.type===R?(J=ga(B.props.children,O.mode,J,B.key),J.return=O,O=J):(J=ai(B.type,B.key,B.props,null,O.mode,J),$l(J,B),J.return=O,O=J)}return h(O);case j:e:{for(ce=B.key;_!==null;){if(_.key===ce)if(_.tag===4&&_.stateNode.containerInfo===B.containerInfo&&_.stateNode.implementation===B.implementation){n(O,_.sibling),J=c(_,B.children||[]),J.return=O,O=J;break e}else{n(O,_);break}else t(O,_);_=_.sibling}J=cc(B,O.mode,J),J.return=O,O=J}return h(O);case P:return B=Sa(B),De(O,_,B,J)}if(re(B))return le(O,_,B,J);if(se(B)){if(ce=se(B),typeof ce!="function")throw Error(r(150));return B=ce.call(B),fe(O,_,B,J)}if(typeof B.then=="function")return De(O,_,ui(B),J);if(B.$$typeof===k)return De(O,_,ii(O,B),J);fi(O,B)}return typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint"?(B=""+B,_!==null&&_.tag===6?(n(O,_.sibling),J=c(_,B),J.return=O,O=J):(n(O,_),J=rc(B,O.mode,J),J.return=O,O=J),h(O)):n(O,_)}return function(O,_,B,J){try{Xl=0;var ce=De(O,_,B,J);return Ia=null,ce}catch(ie){if(ie===Fa||ie===ci)throw ie;var we=Et(29,ie,null,O.mode);return we.lanes=J,we.return=O,we}finally{}}}var ja=wd(!0),qd=wd(!1),Yn=!1;function bc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sc(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 Gn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Qn(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Ce&2)!==0){var c=s.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),s.pending=t,t=ni(e),ud(e,null,n),t}return ti(e,s,t,n),ni(e)}function Kl(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,vf(e,n)}}function Ac(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 jc=!1;function Zl(){if(jc){var e=Ja;if(e!==null)throw e}}function Jl(e,t,n,s){jc=!1;var c=e.updateQueue;Yn=!1;var u=c.firstBaseUpdate,h=c.lastBaseUpdate,x=c.shared.pending;if(x!==null){c.shared.pending=null;var w=x,L=w.next;w.next=null,h===null?u=L:h.next=L,h=w;var X=e.alternate;X!==null&&(X=X.updateQueue,x=X.lastBaseUpdate,x!==h&&(x===null?X.firstBaseUpdate=L:x.next=L,X.lastBaseUpdate=w))}if(u!==null){var F=c.baseState;h=0,X=L=w=null,x=u;do{var H=x.lane&-536870913,Y=H!==x.lane;if(Y?(be&H)===H:(s&H)===H){H!==0&&H===Za&&(jc=!0),X!==null&&(X=X.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var le=e,fe=x;H=t;var De=n;switch(fe.tag){case 1:if(le=fe.payload,typeof le=="function"){F=le.call(De,F,H);break e}F=le;break e;case 3:le.flags=le.flags&-65537|128;case 0:if(le=fe.payload,H=typeof le=="function"?le.call(De,F,H):le,H==null)break e;F=b({},F,H);break e;case 2:Yn=!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},X===null?(L=X=Y,w=F):X=X.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);X===null&&(w=F),c.baseState=w,c.firstBaseUpdate=L,c.lastBaseUpdate=X,u===null&&(c.shared.lanes=0),Jn|=h,e.lanes=h,e.memoizedState=F}}function Cd(e,t){if(typeof e!="function")throw Error(r(191,e));e.call(t)}function Td(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Cd(n[e],t)}var Wa=C(null),di=C(0);function Md(e,t){e=En,M(di,e),M(Wa,t),En=e|t.baseLanes}function Nc(){M(di,En),M(Wa,Wa.current)}function Ec(){En=di.current,U(Wa),U(di)}var wt=C(null),Lt=null;function Xn(e){var t=e.alternate;M($e,$e.current&1),M(wt,e),Lt===null&&(t===null||Wa.current!==null||t.memoizedState!==null)&&(Lt=e)}function wc(e){M($e,$e.current),M(wt,e),Lt===null&&(Lt=e)}function Rd(e){e.tag===22?(M($e,$e.current),M(wt,e),Lt===null&&(Lt=e)):$n()}function $n(){M($e,$e.current),M(wt,wt.current)}function qt(e){U(wt),Lt===e&&(Lt=null),U($e)}var $e=C(0);function hi(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ko(n)||Oo(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 yn=0,me=null,ke=null,Je=null,mi=!1,Pa=!1,Na=!1,pi=0,Fl=0,el=null,_y=0;function Ge(){throw Error(r(321))}function qc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Nt(e[n],t[n]))return!1;return!0}function Cc(e,t,n,s,c,u){return yn=u,me=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,z.H=e===null||e.memoizedState===null?mh:Gc,Na=!1,u=n(s,c),Na=!1,Pa&&(u=kd(t,n,s,c)),_d(e),u}function _d(e){z.H=Pl;var t=ke!==null&&ke.next!==null;if(yn=0,Je=ke=me=null,mi=!1,Fl=0,el=null,t)throw Error(r(300));e===null||Fe||(e=e.dependencies,e!==null&&si(e)&&(Fe=!0))}function kd(e,t,n,s){me=e;var c=0;do{if(Pa&&(el=null),Fl=0,Pa=!1,25<=c)throw Error(r(301));if(c+=1,Je=ke=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}z.H=ph,u=t(n,s)}while(Pa);return u}function ky(){var e=z.H,t=e.useState()[0];return t=typeof t.then=="function"?Il(t):t,e=e.useState()[0],(ke!==null?ke.memoizedState:null)!==e&&(me.flags|=1024),t}function Tc(){var e=pi!==0;return pi=0,e}function Mc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Rc(e){if(mi){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}mi=!1}yn=0,Je=ke=me=null,Pa=!1,Fl=pi=0,el=null}function ft(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Je===null?me.memoizedState=Je=e:Je=Je.next=e,Je}function Ke(){if(ke===null){var e=me.alternate;e=e!==null?e.memoizedState:null}else e=ke.next;var t=Je===null?me.memoizedState:Je.next;if(t!==null)Je=t,ke=e;else{if(e===null)throw me.alternate===null?Error(r(467)):Error(r(310));ke=e,e={memoizedState:ke.memoizedState,baseState:ke.baseState,baseQueue:ke.baseQueue,queue:ke.queue,next:null},Je===null?me.memoizedState=Je=e:Je=Je.next=e}return Je}function gi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Il(e){var t=Fl;return Fl+=1,el===null&&(el=[]),e=jd(el,e,t),t=me,(Je===null?t.memoizedState:Je.next)===null&&(t=t.alternate,z.H=t===null||t.memoizedState===null?mh:Gc),e}function yi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Il(e);if(e.$$typeof===k)return st(e)}throw Error(r(438,String(e)))}function _c(e){var t=null,n=me.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var s=me.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=gi(),me.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),s=0;s<e;s++)n[s]=te;return t.index++,n}function vn(e,t){return typeof t=="function"?t(e):t}function vi(e){var t=Ke();return kc(t,ke,e)}function kc(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,w=null,L=t,X=!1;do{var F=L.lane&-536870913;if(F!==L.lane?(be&F)===F:(yn&F)===F){var H=L.revertLane;if(H===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null}),F===Za&&(X=!0);else if((yn&H)===H){L=L.next,H===Za&&(X=!0);continue}else F={lane:0,revertLane:L.revertLane,gesture:null,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null},w===null?(x=w=F,h=u):w=w.next=F,me.lanes|=H,Jn|=H;F=L.action,Na&&n(u,F),u=L.hasEagerState?L.eagerState:n(u,F)}else H={lane:F,revertLane:L.revertLane,gesture:L.gesture,action:L.action,hasEagerState:L.hasEagerState,eagerState:L.eagerState,next:null},w===null?(x=w=H,h=u):w=w.next=H,me.lanes|=F,Jn|=F;L=L.next}while(L!==null&&L!==t);if(w===null?h=u:w.next=x,!Nt(u,e.memoizedState)&&(Fe=!0,X&&(n=Ja,n!==null)))throw n;e.memoizedState=u,e.baseState=h,e.baseQueue=w,s.lastRenderedState=u}return c===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Oc(e){var t=Ke(),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);Nt(u,t.memoizedState)||(Fe=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,s]}function Od(e,t,n){var s=me,c=Ke(),u=Ae;if(u){if(n===void 0)throw Error(r(407));n=n()}else n=t();var h=!Nt((ke||c).memoizedState,n);if(h&&(c.memoizedState=n,Fe=!0),c=c.queue,Bc(Bd.bind(null,s,c,e),[e]),c.getSnapshot!==t||h||Je!==null&&Je.memoizedState.tag&1){if(s.flags|=2048,tl(9,{destroy:void 0},zd.bind(null,s,c,n,t),null),Be===null)throw Error(r(349));u||(yn&127)!==0||Dd(s,t,n)}return n}function Dd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=me.updateQueue,t===null?(t=gi(),me.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zd(e,t,n,s){t.value=n,t.getSnapshot=s,Ld(t)&&Ud(e)}function Bd(e,t,n){return n(function(){Ld(t)&&Ud(e)})}function Ld(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Nt(e,n)}catch{return!0}}function Ud(e){var t=pa(e,2);t!==null&&St(t,e,2)}function Dc(e){var t=ft();if(typeof e=="function"){var n=e;if(e=n(),Na){Dn(!0);try{n()}finally{Dn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vn,lastRenderedState:e},t}function Hd(e,t,n,s){return e.baseState=n,kc(e,ke,typeof s=="function"?s:vn)}function Oy(e,t,n,s,c){if(Si(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)}};z.T!==null?n(!0):u.isTransition=!1,s(u),n=t.pending,n===null?(u.next=t.pending=u,Vd(t,u)):(u.next=n.next,t.pending=n.next=u)}}function Vd(e,t){var n=t.action,s=t.payload,c=e.state;if(t.isTransition){var u=z.T,h={};z.T=h;try{var x=n(c,s),w=z.S;w!==null&&w(h,x),Yd(e,t,x)}catch(L){zc(e,t,L)}finally{u!==null&&h.types!==null&&(u.types=h.types),z.T=u}}else try{u=n(c,s),Yd(e,t,u)}catch(L){zc(e,t,L)}}function Yd(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(s){Gd(e,t,s)},function(s){return zc(e,t,s)}):Gd(e,t,n)}function Gd(e,t,n){t.status="fulfilled",t.value=n,Qd(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Vd(e,n)))}function zc(e,t,n){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=n,Qd(t),t=t.next;while(t!==s)}e.action=null}function Qd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xd(e,t){return t}function $d(e,t){if(Ae){var n=Be.formState;if(n!==null){e:{var s=me;if(Ae){if(Ue){t:{for(var c=Ue,u=Bt;c.nodeType!==8;){if(!u){c=null;break t}if(c=Ut(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){Ue=Ut(c.nextSibling),s=c.data==="F!";break e}}Hn(s)}s=!1}s&&(t=n[0])}}return n=ft(),n.memoizedState=n.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xd,lastRenderedState:t},n.queue=s,n=fh.bind(null,me,s),s.dispatch=n,s=Dc(!1),u=Yc.bind(null,me,!1,s.queue),s=ft(),c={state:t,dispatch:null,action:e,pending:null},s.queue=c,n=Oy.bind(null,me,c,u,n),c.dispatch=n,s.memoizedState=e,[t,n,!1]}function Kd(e){var t=Ke();return Zd(t,ke,e)}function Zd(e,t,n){if(t=kc(e,t,Xd)[0],e=vi(vn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=Il(t)}catch(h){throw h===Fa?ci:h}else s=t;t=Ke();var c=t.queue,u=c.dispatch;return n!==t.memoizedState&&(me.flags|=2048,tl(9,{destroy:void 0},Dy.bind(null,c,n),null)),[s,u,e]}function Dy(e,t){e.action=t}function Jd(e){var t=Ke(),n=ke;if(n!==null)return Zd(t,n,e);Ke(),t=t.memoizedState,n=Ke();var s=n.queue.dispatch;return n.memoizedState=e,[t,s,!1]}function tl(e,t,n,s){return e={tag:e,create:n,deps:s,inst:t,next:null},t=me.updateQueue,t===null&&(t=gi(),me.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 Fd(){return Ke().memoizedState}function xi(e,t,n,s){var c=ft();me.flags|=e,c.memoizedState=tl(1|t,{destroy:void 0},n,s===void 0?null:s)}function bi(e,t,n,s){var c=Ke();s=s===void 0?null:s;var u=c.memoizedState.inst;ke!==null&&s!==null&&qc(s,ke.memoizedState.deps)?c.memoizedState=tl(t,u,n,s):(me.flags|=e,c.memoizedState=tl(1|t,u,n,s))}function Id(e,t){xi(8390656,8,e,t)}function Bc(e,t){bi(2048,8,e,t)}function zy(e){me.flags|=4;var t=me.updateQueue;if(t===null)t=gi(),me.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Wd(e){var t=Ke().memoizedState;return zy({ref:t,nextImpl:e}),function(){if((Ce&2)!==0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function Pd(e,t){return bi(4,2,e,t)}function eh(e,t){return bi(4,4,e,t)}function th(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 nh(e,t,n){n=n!=null?n.concat([e]):null,bi(4,4,th.bind(null,t,e),n)}function Lc(){}function ah(e,t){var n=Ke();t=t===void 0?null:t;var s=n.memoizedState;return t!==null&&qc(t,s[1])?s[0]:(n.memoizedState=[e,t],e)}function lh(e,t){var n=Ke();t=t===void 0?null:t;var s=n.memoizedState;if(t!==null&&qc(t,s[1]))return s[0];if(s=e(),Na){Dn(!0);try{e()}finally{Dn(!1)}}return n.memoizedState=[s,t],s}function Uc(e,t,n){return n===void 0||(yn&1073741824)!==0&&(be&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=sm(),me.lanes|=e,Jn|=e,n)}function sh(e,t,n,s){return Nt(n,t)?n:Wa.current!==null?(e=Uc(e,n,s),Nt(e,t)||(Fe=!0),e):(yn&42)===0||(yn&1073741824)!==0&&(be&261930)===0?(Fe=!0,e.memoizedState=n):(e=sm(),me.lanes|=e,Jn|=e,t)}function ih(e,t,n,s,c){var u=Q.p;Q.p=u!==0&&8>u?u:8;var h=z.T,x={};z.T=x,Yc(e,!1,t,n);try{var w=c(),L=z.S;if(L!==null&&L(x,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var X=Ry(w,s);Wl(e,t,X,Mt(e))}else Wl(e,t,s,Mt(e))}catch(F){Wl(e,t,{then:function(){},status:"rejected",reason:F},Mt())}finally{Q.p=u,h!==null&&x.types!==null&&(h.types=x.types),z.T=h}}function By(){}function Hc(e,t,n,s){if(e.tag!==5)throw Error(r(476));var c=rh(e).queue;ih(e,c,t,W,n===null?By:function(){return ch(e),n(s)})}function rh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vn,lastRenderedState:W},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vn,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ch(e){var t=rh(e);t.next===null&&(t=e.alternate.memoizedState),Wl(e,t.next.queue,{},Mt())}function Vc(){return st(ps)}function oh(){return Ke().memoizedState}function uh(){return Ke().memoizedState}function Ly(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Mt();e=Gn(n);var s=Qn(t,e,n);s!==null&&(St(s,t,n),Kl(s,t,n)),t={cache:gc()},e.payload=t;return}t=t.return}}function Uy(e,t,n){var s=Mt();n={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Si(e)?dh(t,n):(n=sc(e,t,n,s),n!==null&&(St(n,e,s),hh(n,t,s)))}function fh(e,t,n){var s=Mt();Wl(e,t,n,s)}function Wl(e,t,n,s){var c={lane:s,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Si(e))dh(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,Nt(x,h))return ti(e,t,c,0),Be===null&&ei(),!1}catch{}finally{}if(n=sc(e,t,c,s),n!==null)return St(n,e,s),hh(n,t,s),!0}return!1}function Yc(e,t,n,s){if(s={lane:2,revertLane:So(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Si(e)){if(t)throw Error(r(479))}else t=sc(e,n,s,2),t!==null&&St(t,e,2)}function Si(e){var t=e.alternate;return e===me||t!==null&&t===me}function dh(e,t){Pa=mi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hh(e,t,n){if((n&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,vf(e,n)}}var Pl={readContext:st,use:yi,useCallback:Ge,useContext:Ge,useEffect:Ge,useImperativeHandle:Ge,useLayoutEffect:Ge,useInsertionEffect:Ge,useMemo:Ge,useReducer:Ge,useRef:Ge,useState:Ge,useDebugValue:Ge,useDeferredValue:Ge,useTransition:Ge,useSyncExternalStore:Ge,useId:Ge,useHostTransitionStatus:Ge,useFormState:Ge,useActionState:Ge,useOptimistic:Ge,useMemoCache:Ge,useCacheRefresh:Ge};Pl.useEffectEvent=Ge;var mh={readContext:st,use:yi,useCallback:function(e,t){return ft().memoizedState=[e,t===void 0?null:t],e},useContext:st,useEffect:Id,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,xi(4194308,4,th.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xi(4194308,4,e,t)},useInsertionEffect:function(e,t){xi(4,2,e,t)},useMemo:function(e,t){var n=ft();t=t===void 0?null:t;var s=e();if(Na){Dn(!0);try{e()}finally{Dn(!1)}}return n.memoizedState=[s,t],s},useReducer:function(e,t,n){var s=ft();if(n!==void 0){var c=n(t);if(Na){Dn(!0);try{n(t)}finally{Dn(!1)}}}else c=t;return s.memoizedState=s.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},s.queue=e,e=e.dispatch=Uy.bind(null,me,e),[s.memoizedState,e]},useRef:function(e){var t=ft();return e={current:e},t.memoizedState=e},useState:function(e){e=Dc(e);var t=e.queue,n=fh.bind(null,me,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Lc,useDeferredValue:function(e,t){var n=ft();return Uc(n,e,t)},useTransition:function(){var e=Dc(!1);return e=ih.bind(null,me,e.queue,!0,!1),ft().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var s=me,c=ft();if(Ae){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Be===null)throw Error(r(349));(be&127)!==0||Dd(s,t,n)}c.memoizedState=n;var u={value:n,getSnapshot:t};return c.queue=u,Id(Bd.bind(null,s,u,e),[e]),s.flags|=2048,tl(9,{destroy:void 0},zd.bind(null,s,u,n,t),null),n},useId:function(){var e=ft(),t=Be.identifierPrefix;if(Ae){var n=en,s=Pt;n=(s&~(1<<32-jt(s)-1)).toString(32)+n,t="_"+t+"R_"+n,n=pi++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=_y++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Vc,useFormState:$d,useActionState:$d,useOptimistic:function(e){var t=ft();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Yc.bind(null,me,!0,n),n.dispatch=t,[e,t]},useMemoCache:_c,useCacheRefresh:function(){return ft().memoizedState=Ly.bind(null,me)},useEffectEvent:function(e){var t=ft(),n={impl:e};return t.memoizedState=n,function(){if((Ce&2)!==0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},Gc={readContext:st,use:yi,useCallback:ah,useContext:st,useEffect:Bc,useImperativeHandle:nh,useInsertionEffect:Pd,useLayoutEffect:eh,useMemo:lh,useReducer:vi,useRef:Fd,useState:function(){return vi(vn)},useDebugValue:Lc,useDeferredValue:function(e,t){var n=Ke();return sh(n,ke.memoizedState,e,t)},useTransition:function(){var e=vi(vn)[0],t=Ke().memoizedState;return[typeof e=="boolean"?e:Il(e),t]},useSyncExternalStore:Od,useId:oh,useHostTransitionStatus:Vc,useFormState:Kd,useActionState:Kd,useOptimistic:function(e,t){var n=Ke();return Hd(n,ke,e,t)},useMemoCache:_c,useCacheRefresh:uh};Gc.useEffectEvent=Wd;var ph={readContext:st,use:yi,useCallback:ah,useContext:st,useEffect:Bc,useImperativeHandle:nh,useInsertionEffect:Pd,useLayoutEffect:eh,useMemo:lh,useReducer:Oc,useRef:Fd,useState:function(){return Oc(vn)},useDebugValue:Lc,useDeferredValue:function(e,t){var n=Ke();return ke===null?Uc(n,e,t):sh(n,ke.memoizedState,e,t)},useTransition:function(){var e=Oc(vn)[0],t=Ke().memoizedState;return[typeof e=="boolean"?e:Il(e),t]},useSyncExternalStore:Od,useId:oh,useHostTransitionStatus:Vc,useFormState:Jd,useActionState:Jd,useOptimistic:function(e,t){var n=Ke();return ke!==null?Hd(n,ke,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:_c,useCacheRefresh:uh};ph.useEffectEvent=Wd;function Qc(e,t,n,s){t=e.memoizedState,n=n(s,t),n=n==null?t:b({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Xc={enqueueSetState:function(e,t,n){e=e._reactInternals;var s=Mt(),c=Gn(s);c.payload=t,n!=null&&(c.callback=n),t=Qn(e,c,s),t!==null&&(St(t,e,s),Kl(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var s=Mt(),c=Gn(s);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=Qn(e,c,s),t!==null&&(St(t,e,s),Kl(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Mt(),s=Gn(n);s.tag=2,t!=null&&(s.callback=t),t=Qn(e,s,n),t!==null&&(St(t,e,n),Kl(t,e,n))}};function gh(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?!Ul(n,s)||!Ul(c,u):!0}function yh(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&&Xc.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=b({},n));for(var c in e)n[c]===void 0&&(n[c]=e[c])}return n}function vh(e){Ps(e)}function xh(e){console.error(e)}function bh(e){Ps(e)}function Ai(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Sh(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 $c(e,t,n){return n=Gn(n),n.tag=3,n.payload={element:null},n.callback=function(){Ai(e,t)},n}function Ah(e){return e=Gn(e),e.tag=3,e}function jh(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(){Sh(t,n,s)}}var h=n.stateNode;h!==null&&typeof h.componentDidCatch=="function"&&(e.callback=function(){Sh(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 Hy(e,t,n,s,c){if(n.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=n.alternate,t!==null&&Ka(t,n,c,!0),n=wt.current,n!==null){switch(n.tag){case 31:case 13:return Lt===null?Oi():n.alternate===null&&Qe===0&&(Qe=3),n.flags&=-257,n.flags|=65536,n.lanes=c,s===oi?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([s]):t.add(s),vo(e,s,c)),!1;case 22:return n.flags|=65536,s===oi?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)),vo(e,s,c)),!1}throw Error(r(435,n.tag))}return vo(e,s,c),Oi(),!1}if(Ae)return t=wt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,s!==fc&&(e=Error(r(422),{cause:s}),Yl(Ot(e,n)))):(s!==fc&&(t=Error(r(423),{cause:s}),Yl(Ot(t,n))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,s=Ot(s,n),c=$c(e.stateNode,s,c),Ac(e,c),Qe!==4&&(Qe=2)),!1;var u=Error(r(520),{cause:s});if(u=Ot(u,n),rs===null?rs=[u]:rs.push(u),Qe!==4&&(Qe=2),t===null)return!0;s=Ot(s,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=c&-c,n.lanes|=e,e=$c(n.stateNode,s,e),Ac(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=Ah(c),jh(c,e,n,s),Ac(n,c),!1}n=n.return}while(n!==null);return!1}var Kc=Error(r(461)),Fe=!1;function it(e,t,n,s){t.child=e===null?qd(t,null,n,s):ja(t,e.child,n,s)}function Nh(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 xa(t),s=Cc(e,t,n,h,u,c),x=Tc(),e!==null&&!Fe?(Mc(e,t,c),xn(e,t,c)):(Ae&&x&&oc(t),t.flags|=1,it(e,t,s,c),t.child)}function Eh(e,t,n,s,c){if(e===null){var u=n.type;return typeof u=="function"&&!ic(u)&&u.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=u,wh(e,t,u,s,c)):(e=ai(n.type,null,s,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!to(e,c)){var h=u.memoizedProps;if(n=n.compare,n=n!==null?n:Ul,n(h,s)&&e.ref===t.ref)return xn(e,t,c)}return t.flags|=1,e=hn(u,s),e.ref=t.ref,e.return=t,t.child=e}function wh(e,t,n,s,c){if(e!==null){var u=e.memoizedProps;if(Ul(u,s)&&e.ref===t.ref)if(Fe=!1,t.pendingProps=s=u,to(e,c))(e.flags&131072)!==0&&(Fe=!0);else return t.lanes=e.lanes,xn(e,t,c)}return Zc(e,t,n,s,c)}function qh(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 Ch(e,t,u,n,s)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ri(t,u!==null?u.cachePool:null),u!==null?Md(t,u):Nc(),Rd(t);else return s=t.lanes=536870912,Ch(e,t,u!==null?u.baseLanes|n:n,n,s)}else u!==null?(ri(t,u.cachePool),Md(t,u),$n(),t.memoizedState=null):(e!==null&&ri(t,null),Nc(),$n());return it(e,t,c,n),t.child}function es(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Ch(e,t,n,s,c){var u=vc();return u=u===null?null:{parent:Ze._currentValue,pool:u},t.memoizedState={baseLanes:n,cachePool:u},e!==null&&ri(t,null),Nc(),Rd(t),e!==null&&Ka(e,t,s,!0),t.childLanes=c,null}function ji(e,t){return t=Ei({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Th(e,t,n){return ja(t,e.child,null,n),e=ji(t,t.pendingProps),e.flags|=2,qt(t),t.memoizedState=null,e}function Vy(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=ji(t,s),t.lanes=536870912,es(null,e);if(wc(t),(e=Ue)?(e=Vm(e,Bt),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ln!==null?{id:Pt,overflow:en}:null,retryLane:536870912,hydrationErrors:null},n=dd(e),n.return=t,t.child=n,lt=t,Ue=null)):e=null,e===null)throw Hn(t);return t.lanes=536870912,null}return ji(t,s)}var u=e.memoizedState;if(u!==null){var h=u.dehydrated;if(wc(t),c)if(t.flags&256)t.flags&=-257,t=Th(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(r(558));else if(Fe||Ka(e,t,n,!1),c=(n&e.childLanes)!==0,Fe||c){if(s=Be,s!==null&&(h=xf(s,n),h!==0&&h!==u.retryLane))throw u.retryLane=h,pa(e,h),St(s,e,h),Kc;Oi(),t=Th(e,t,n)}else e=u.treeContext,Ue=Ut(h.nextSibling),lt=t,Ae=!0,Un=null,Bt=!1,e!==null&&pd(t,e),t=ji(t,s),t.flags|=4096;return t}return e=hn(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ni(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 Zc(e,t,n,s,c){return xa(t),n=Cc(e,t,n,s,void 0,c),s=Tc(),e!==null&&!Fe?(Mc(e,t,c),xn(e,t,c)):(Ae&&s&&oc(t),t.flags|=1,it(e,t,n,c),t.child)}function Mh(e,t,n,s,c,u){return xa(t),t.updateQueue=null,n=kd(t,s,n,c),_d(e),s=Tc(),e!==null&&!Fe?(Mc(e,t,u),xn(e,t,u)):(Ae&&s&&oc(t),t.flags|=1,it(e,t,n,u),t.child)}function Rh(e,t,n,s,c){if(xa(t),t.stateNode===null){var u=Ga,h=n.contextType;typeof h=="object"&&h!==null&&(u=st(h)),u=new n(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Xc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},bc(t),h=n.contextType,u.context=typeof h=="object"&&h!==null?st(h):Ga,u.state=t.memoizedState,h=n.getDerivedStateFromProps,typeof h=="function"&&(Qc(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&&Xc.enqueueReplaceState(u,u.state,null),Jl(t,s,u,c),Zl(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var x=t.memoizedProps,w=Ea(n,x);u.props=w;var L=u.context,X=n.contextType;h=Ga,typeof X=="object"&&X!==null&&(h=st(X));var F=n.getDerivedStateFromProps;X=typeof F=="function"||typeof u.getSnapshotBeforeUpdate=="function",x=t.pendingProps!==x,X||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(x||L!==h)&&yh(t,u,s,h),Yn=!1;var H=t.memoizedState;u.state=H,Jl(t,s,u,c),Zl(),L=t.memoizedState,x||H!==L||Yn?(typeof F=="function"&&(Qc(t,n,F,s),L=t.memoizedState),(w=Yn||gh(t,n,w,s,H,L,h))?(X||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=L),u.props=s,u.state=L,u.context=h,s=w):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,Sc(e,t),h=t.memoizedProps,X=Ea(n,h),u.props=X,F=t.pendingProps,H=u.context,L=n.contextType,w=Ga,typeof L=="object"&&L!==null&&(w=st(L)),x=n.getDerivedStateFromProps,(L=typeof x=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(h!==F||H!==w)&&yh(t,u,s,w),Yn=!1,H=t.memoizedState,u.state=H,Jl(t,s,u,c),Zl();var Y=t.memoizedState;h!==F||H!==Y||Yn||e!==null&&e.dependencies!==null&&si(e.dependencies)?(typeof x=="function"&&(Qc(t,n,x,s),Y=t.memoizedState),(X=Yn||gh(t,n,X,s,H,Y,w)||e!==null&&e.dependencies!==null&&si(e.dependencies))?(L||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,Y,w),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,Y,w)),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=w,s=X):(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,Ni(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=ja(t,e.child,null,c),t.child=ja(t,null,n,c)):it(e,t,n,c),t.memoizedState=u.state,e=t.child):e=xn(e,t,c),e}function _h(e,t,n,s){return ya(),t.flags|=256,it(e,t,n,s),t.child}var Jc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Fc(e){return{baseLanes:e,cachePool:Sd()}}function Ic(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Tt),e}function kh(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:($e.current&2)!==0),h&&(c=!0,t.flags&=-129),h=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ae){if(c?Xn(t):$n(),(e=Ue)?(e=Vm(e,Bt),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ln!==null?{id:Pt,overflow:en}:null,retryLane:536870912,hydrationErrors:null},n=dd(e),n.return=t,t.child=n,lt=t,Ue=null)):e=null,e===null)throw Hn(t);return Oo(e)?t.lanes=32:t.lanes=536870912,null}var x=s.children;return s=s.fallback,c?($n(),c=t.mode,x=Ei({mode:"hidden",children:x},c),s=ga(s,c,n,null),x.return=t,s.return=t,x.sibling=s,t.child=x,s=t.child,s.memoizedState=Fc(n),s.childLanes=Ic(e,h,n),t.memoizedState=Jc,es(null,s)):(Xn(t),Wc(t,x))}var w=e.memoizedState;if(w!==null&&(x=w.dehydrated,x!==null)){if(u)t.flags&256?(Xn(t),t.flags&=-257,t=Pc(e,t,n)):t.memoizedState!==null?($n(),t.child=e.child,t.flags|=128,t=null):($n(),x=s.fallback,c=t.mode,s=Ei({mode:"visible",children:s.children},c),x=ga(x,c,n,null),x.flags|=2,s.return=t,x.return=t,s.sibling=x,t.child=s,ja(t,e.child,null,n),s=t.child,s.memoizedState=Fc(n),s.childLanes=Ic(e,h,n),t.memoizedState=Jc,t=es(null,s));else if(Xn(t),Oo(x)){if(h=x.nextSibling&&x.nextSibling.dataset,h)var L=h.dgst;h=L,s=Error(r(419)),s.stack="",s.digest=h,Yl({value:s,source:null,stack:null}),t=Pc(e,t,n)}else if(Fe||Ka(e,t,n,!1),h=(n&e.childLanes)!==0,Fe||h){if(h=Be,h!==null&&(s=xf(h,n),s!==0&&s!==w.retryLane))throw w.retryLane=s,pa(e,s),St(h,e,s),Kc;ko(x)||Oi(),t=Pc(e,t,n)}else ko(x)?(t.flags|=192,t.child=e.child,t=null):(e=w.treeContext,Ue=Ut(x.nextSibling),lt=t,Ae=!0,Un=null,Bt=!1,e!==null&&pd(t,e),t=Wc(t,s.children),t.flags|=4096);return t}return c?($n(),x=s.fallback,c=t.mode,w=e.child,L=w.sibling,s=hn(w,{mode:"hidden",children:s.children}),s.subtreeFlags=w.subtreeFlags&65011712,L!==null?x=hn(L,x):(x=ga(x,c,n,null),x.flags|=2),x.return=t,s.return=t,s.sibling=x,t.child=s,es(null,s),s=t.child,x=e.child.memoizedState,x===null?x=Fc(n):(c=x.cachePool,c!==null?(w=Ze._currentValue,c=c.parent!==w?{parent:w,pool:w}:c):c=Sd(),x={baseLanes:x.baseLanes|n,cachePool:c}),s.memoizedState=x,s.childLanes=Ic(e,h,n),t.memoizedState=Jc,es(e.child,s)):(Xn(t),n=e.child,e=n.sibling,n=hn(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 Wc(e,t){return t=Ei({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ei(e,t){return e=Et(22,e,null,t),e.lanes=0,e}function Pc(e,t,n){return ja(t,e.child,null,n),e=Wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Oh(e,t,n){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),mc(e.return,t,n)}function eo(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 Dh(e,t,n){var s=t.pendingProps,c=s.revealOrder,u=s.tail;s=s.children;var h=$e.current,x=(h&2)!==0;if(x?(h=h&1|2,t.flags|=128):h&=1,M($e,h),it(e,t,s,n),s=Ae?Vl:0,!x&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Oh(e,n,t);else if(e.tag===19)Oh(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&&hi(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),eo(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&&hi(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}eo(t,!0,n,null,u,s);break;case"together":eo(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function xn(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Jn|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Ka(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=hn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=hn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function to(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&si(e)))}function Yy(e,t,n){switch(t.tag){case 3:Ne(t,t.stateNode.containerInfo),Vn(t,Ze,e.memoizedState.cache),ya();break;case 27:case 5:cn(t);break;case 4:Ne(t,t.stateNode.containerInfo);break;case 10:Vn(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,wc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(Xn(t),t.flags|=128,null):(n&t.child.childLanes)!==0?kh(e,t,n):(Xn(t),e=xn(e,t,n),e!==null?e.sibling:null);Xn(t);break;case 19:var c=(e.flags&128)!==0;if(s=(n&t.childLanes)!==0,s||(Ka(e,t,n,!1),s=(n&t.childLanes)!==0),c){if(s)return Dh(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),M($e,$e.current),s)break;return null;case 22:return t.lanes=0,qh(e,t,n,t.pendingProps);case 24:Vn(t,Ze,e.memoizedState.cache)}return xn(e,t,n)}function zh(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Fe=!0;else{if(!to(e,n)&&(t.flags&128)===0)return Fe=!1,Yy(e,t,n);Fe=(e.flags&131072)!==0}else Fe=!1,Ae&&(t.flags&1048576)!==0&&md(t,Vl,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=Sa(t.elementType),t.type=e,typeof e=="function")ic(e)?(s=Ea(e,s),t.tag=1,t=Rh(null,t,e,s,n)):(t.tag=0,t=Zc(null,t,e,s,n));else{if(e!=null){var c=e.$$typeof;if(c===Z){t.tag=11,t=Nh(null,t,e,s,n);break e}else if(c===$){t.tag=14,t=Eh(null,t,e,s,n);break e}}throw t=ye(e)||e,Error(r(306,t,""))}}return t;case 0:return Zc(e,t,t.type,t.pendingProps,n);case 1:return s=t.type,c=Ea(s,t.pendingProps),Rh(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,Sc(e,t),Jl(t,s,null,n);var h=t.memoizedState;if(s=h.cache,Vn(t,Ze,s),s!==u.cache&&pc(t,[Ze],n,!0),Zl(),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=_h(e,t,s,n);break e}else if(s!==c){c=Ot(Error(r(424)),t),Yl(c),t=_h(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(Ue=Ut(e.firstChild),lt=t,Ae=!0,Un=null,Bt=!0,n=qd(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ya(),s===c){t=xn(e,t,n);break e}it(e,t,s,n)}t=t.child}return t;case 26:return Ni(e,t),e===null?(n=Km(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ae||(n=t.type,e=t.pendingProps,s=Vi(ee.current).createElement(n),s[at]=t,s[pt]=e,rt(s,n,e),tt(s),t.stateNode=s):t.memoizedState=Km(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return cn(t),e===null&&Ae&&(s=t.stateNode=Qm(t.type,t.pendingProps,ee.current),lt=t,Bt=!0,c=Ue,ea(t.type)?(Do=c,Ue=Ut(s.firstChild)):Ue=c),it(e,t,t.pendingProps.children,n),Ni(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ae&&((c=s=Ue)&&(s=vv(s,t.type,t.pendingProps,Bt),s!==null?(t.stateNode=s,lt=t,Ue=Ut(s.firstChild),Bt=!1,c=!0):c=!1),c||Hn(t)),cn(t),c=t.type,u=t.pendingProps,h=e!==null?e.memoizedProps:null,s=u.children,Mo(c,u)?s=null:h!==null&&Mo(c,h)&&(t.flags|=32),t.memoizedState!==null&&(c=Cc(e,t,ky,null,null,n),ps._currentValue=c),Ni(e,t),it(e,t,s,n),t.child;case 6:return e===null&&Ae&&((e=n=Ue)&&(n=xv(n,t.pendingProps,Bt),n!==null?(t.stateNode=n,lt=t,Ue=null,e=!0):e=!1),e||Hn(t)),null;case 13:return kh(e,t,n);case 4:return Ne(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=ja(t,null,s,n):it(e,t,s,n),t.child;case 11:return Nh(e,t,t.type,t.pendingProps,n);case 7:return it(e,t,t.pendingProps,n),t.child;case 8:return it(e,t,t.pendingProps.children,n),t.child;case 12:return it(e,t,t.pendingProps.children,n),t.child;case 10:return s=t.pendingProps,Vn(t,t.type,s.value),it(e,t,s.children,n),t.child;case 9:return c=t.type._context,s=t.pendingProps.children,xa(t),c=st(c),s=s(c),t.flags|=1,it(e,t,s,n),t.child;case 14:return Eh(e,t,t.type,t.pendingProps,n);case 15:return wh(e,t,t.type,t.pendingProps,n);case 19:return Dh(e,t,n);case 31:return Vy(e,t,n);case 22:return qh(e,t,n,t.pendingProps);case 24:return xa(t),s=st(Ze),e===null?(c=vc(),c===null&&(c=Be,u=gc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=n),c=u),t.memoizedState={parent:s,cache:c},bc(t),Vn(t,Ze,c)):((e.lanes&n)!==0&&(Sc(e,t),Jl(t,null,null,n),Zl()),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),Vn(t,Ze,s)):(s=u.cache,Vn(t,Ze,s),s!==c.cache&&pc(t,[Ze],n,!0))),it(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function bn(e){e.flags|=4}function no(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(om())e.flags|=8192;else throw Aa=oi,xc}else e.flags&=-16777217}function Bh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Wm(t))if(om())e.flags|=8192;else throw Aa=oi,xc}function wi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?gf():536870912,e.lanes|=t,sl|=t)}function ts(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 He(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 Gy(e,t,n){var s=t.pendingProps;switch(uc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return He(t),null;case 1:return He(t),null;case 3:return n=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),gn(Ze),de(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&($a(t)?bn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,dc())),He(t),null;case 26:var c=t.type,u=t.memoizedState;return e===null?(bn(t),u!==null?(He(t),Bh(t,u)):(He(t),no(t,c,null,s,n))):u?u!==e.memoizedState?(bn(t),He(t),Bh(t,u)):(He(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&bn(t),He(t),no(t,c,e,s,n)),null;case 27:if(On(t),n=ee.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&bn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return He(t),null}e=D.current,$a(t)?gd(t):(e=Qm(c,s,n),t.stateNode=e,bn(t))}return He(t),null;case 5:if(On(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&bn(t);else{if(!s){if(t.stateNode===null)throw Error(r(166));return He(t),null}if(u=D.current,$a(t))gd(t);else{var h=Vi(ee.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[at]=t,u[pt]=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(rt(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&&bn(t)}}return He(t),no(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&bn(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(r(166));if(e=ee.current,$a(t)){if(e=t.stateNode,n=t.memoizedProps,s=null,c=lt,c!==null)switch(c.tag){case 27:case 5:s=c.memoizedProps}e[at]=t,e=!!(e.nodeValue===n||s!==null&&s.suppressHydrationWarning===!0||km(e.nodeValue,n)),e||Hn(t,!0)}else e=Vi(e).createTextNode(s),e[at]=t,t.stateNode=e}return He(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(s=$a(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[at]=t}else ya(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;He(t),e=!1}else n=dc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(qt(t),t):(qt(t),null);if((t.flags&128)!==0)throw Error(r(558))}return He(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=$a(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[at]=t}else ya(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;He(t),c=!1}else c=dc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(qt(t),t):(qt(t),null)}return qt(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),wi(t,t.updateQueue),He(t),null);case 4:return de(),e===null&&Eo(t.stateNode.containerInfo),He(t),null;case 10:return gn(t.type),He(t),null;case 19:if(U($e),s=t.memoizedState,s===null)return He(t),null;if(c=(t.flags&128)!==0,u=s.rendering,u===null)if(c)ts(s,!1);else{if(Qe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=hi(e),u!==null){for(t.flags|=128,ts(s,!1),e=u.updateQueue,t.updateQueue=e,wi(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)fd(n,e),n=n.sibling;return M($e,$e.current&1|2),Ae&&mn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&ze()>Ri&&(t.flags|=128,c=!0,ts(s,!1),t.lanes=4194304)}else{if(!c)if(e=hi(u),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,wi(t,e),ts(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!Ae)return He(t),null}else 2*ze()-s.renderingStartTime>Ri&&n!==536870912&&(t.flags|=128,c=!0,ts(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=ze(),e.sibling=null,n=$e.current,M($e,c?n&1|2:n&1),Ae&&mn(t,s.treeForkCount),e):(He(t),null);case 22:case 23:return qt(t),Ec(),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&&(He(t),t.subtreeFlags&6&&(t.flags|=8192)):He(t),n=t.updateQueue,n!==null&&wi(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&&U(ba),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),gn(Ze),He(t),null;case 25:return null;case 30:return null}throw Error(r(156,t.tag))}function Qy(e,t){switch(uc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return gn(Ze),de(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return On(t),null;case 31:if(t.memoizedState!==null){if(qt(t),t.alternate===null)throw Error(r(340));ya()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(qt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ya()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return U($e),null;case 4:return de(),null;case 10:return gn(t.type),null;case 22:case 23:return qt(t),Ec(),e!==null&&U(ba),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return gn(Ze),null;case 25:return null;default:return null}}function Lh(e,t){switch(uc(t),t.tag){case 3:gn(Ze),de();break;case 26:case 27:case 5:On(t);break;case 4:de();break;case 31:t.memoizedState!==null&&qt(t);break;case 13:qt(t);break;case 19:U($e);break;case 10:gn(t.type);break;case 22:case 23:qt(t),Ec(),e!==null&&U(ba);break;case 24:gn(Ze)}}function ns(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){Me(t,t.return,x)}}function Kn(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 w=n,L=x;try{L()}catch(X){Me(c,w,X)}}}s=s.next}while(s!==u)}}catch(X){Me(t,t.return,X)}}function Uh(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Td(t,n)}catch(s){Me(e,e.return,s)}}}function Hh(e,t,n){n.props=Ea(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(s){Me(e,t,s)}}function as(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){Me(e,t,c)}}function tn(e,t){var n=e.ref,s=e.refCleanup;if(n!==null)if(typeof s=="function")try{s()}catch(c){Me(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){Me(e,t,c)}else n.current=null}function Vh(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){Me(e,e.return,c)}}function ao(e,t,n){try{var s=e.stateNode;dv(s,e.type,n,t),s[pt]=t}catch(c){Me(e,e.return,c)}}function Yh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ea(e.type)||e.tag===4}function lo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yh(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&&ea(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 so(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=fn));else if(s!==4&&(s===27&&ea(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(so(e,t,n),e=e.sibling;e!==null;)so(e,t,n),e=e.sibling}function qi(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&&ea(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(qi(e,t,n),e=e.sibling;e!==null;)qi(e,t,n),e=e.sibling}function Gh(e){var t=e.stateNode,n=e.memoizedProps;try{for(var s=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);rt(t,s,n),t[at]=e,t[pt]=n}catch(u){Me(e,e.return,u)}}var Sn=!1,Ie=!1,io=!1,Qh=typeof WeakSet=="function"?WeakSet:Set,nt=null;function Xy(e,t){if(e=e.containerInfo,Co=Zi,e=nd(e),Pr(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,w=-1,L=0,X=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||(w=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&&++L===c&&(x=h),H===u&&++X===s&&(w=h),(Y=F.nextSibling)!==null)break;F=H,H=F.parentNode}F=Y}n=x===-1||w===-1?null:{start:x,end:w}}else n=null}n=n||{start:0,end:0}}else n=null;for(To={focusedElem:e,selectionRange:n},Zi=!1,nt=t;nt!==null;)if(t=nt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,nt=e;else for(;nt!==null;){switch(t=nt,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 le=Ea(n.type,c);e=s.getSnapshotBeforeUpdate(le,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(fe){Me(n,n.return,fe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)_o(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":_o(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,nt=e;break}nt=t.return}}function Xh(e,t,n){var s=n.flags;switch(n.tag){case 0:case 11:case 15:jn(e,n),s&4&&ns(5,n);break;case 1:if(jn(e,n),s&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(h){Me(n,n.return,h)}else{var c=Ea(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(h){Me(n,n.return,h)}}s&64&&Uh(n),s&512&&as(n,n.return);break;case 3:if(jn(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{Td(e,t)}catch(h){Me(n,n.return,h)}}break;case 27:t===null&&s&4&&Gh(n);case 26:case 5:jn(e,n),t===null&&s&4&&Vh(n),s&512&&as(n,n.return);break;case 12:jn(e,n);break;case 31:jn(e,n),s&4&&Zh(e,n);break;case 13:jn(e,n),s&4&&Jh(e,n),s&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=ev.bind(null,n),bv(e,n))));break;case 22:if(s=n.memoizedState!==null||Sn,!s){t=t!==null&&t.memoizedState!==null||Ie,c=Sn;var u=Ie;Sn=s,(Ie=t)&&!u?Nn(e,n,(n.subtreeFlags&8772)!==0):jn(e,n),Sn=c,Ie=u}break;case 30:break;default:jn(e,n)}}function $h(e){var t=e.alternate;t!==null&&(e.alternate=null,$h(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&zr(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 Ve=null,yt=!1;function An(e,t,n){for(n=n.child;n!==null;)Kh(e,t,n),n=n.sibling}function Kh(e,t,n){if(At&&typeof At.onCommitFiberUnmount=="function")try{At.onCommitFiberUnmount(ql,n)}catch{}switch(n.tag){case 26:Ie||tn(n,t),An(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Ie||tn(n,t);var s=Ve,c=yt;ea(n.type)&&(Ve=n.stateNode,yt=!1),An(e,t,n),ds(n.stateNode),Ve=s,yt=c;break;case 5:Ie||tn(n,t);case 6:if(s=Ve,c=yt,Ve=null,An(e,t,n),Ve=s,yt=c,Ve!==null)if(yt)try{(Ve.nodeType===9?Ve.body:Ve.nodeName==="HTML"?Ve.ownerDocument.body:Ve).removeChild(n.stateNode)}catch(u){Me(n,t,u)}else try{Ve.removeChild(n.stateNode)}catch(u){Me(n,t,u)}break;case 18:Ve!==null&&(yt?(e=Ve,Um(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),hl(e)):Um(Ve,n.stateNode));break;case 4:s=Ve,c=yt,Ve=n.stateNode.containerInfo,yt=!0,An(e,t,n),Ve=s,yt=c;break;case 0:case 11:case 14:case 15:Kn(2,n,t),Ie||Kn(4,n,t),An(e,t,n);break;case 1:Ie||(tn(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"&&Hh(n,t,s)),An(e,t,n);break;case 21:An(e,t,n);break;case 22:Ie=(s=Ie)||n.memoizedState!==null,An(e,t,n),Ie=s;break;default:An(e,t,n)}}function Zh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hl(e)}catch(n){Me(t,t.return,n)}}}function Jh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hl(e)}catch(n){Me(t,t.return,n)}}function $y(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Qh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Qh),t;default:throw Error(r(435,e.tag))}}function Ci(e,t){var n=$y(e);t.forEach(function(s){if(!n.has(s)){n.add(s);var c=tv.bind(null,e,s);s.then(c,c)}})}function vt(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(ea(x.type)){Ve=x.stateNode,yt=!1;break e}break;case 5:Ve=x.stateNode,yt=!1;break e;case 3:case 4:Ve=x.stateNode.containerInfo,yt=!0;break e}x=x.return}if(Ve===null)throw Error(r(160));Kh(u,h,c),Ve=null,yt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Fh(t,e),t=t.sibling}var Kt=null;function Fh(e,t){var n=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:vt(t,e),xt(e),s&4&&(Kn(3,e,e.return),ns(3,e),Kn(5,e,e.return));break;case 1:vt(t,e),xt(e),s&512&&(Ie||n===null||tn(n,n.return)),s&64&&Sn&&(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=Kt;if(vt(t,e),xt(e),s&512&&(Ie||n===null||tn(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[Ml]||u[at]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(s),c.head.insertBefore(u,c.querySelector("head > title"))),rt(u,s,n),u[at]=e,tt(u),s=u;break e;case"link":var h=Fm("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),rt(u,s,n),c.head.appendChild(u);break;case"meta":if(h=Fm("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),rt(u,s,n),c.head.appendChild(u);break;default:throw Error(r(468,s))}u[at]=e,tt(u),s=u}e.stateNode=s}else Im(c,e.type,e.stateNode);else e.stateNode=Jm(c,s,e.memoizedProps);else u!==s?(u===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):u.count--,s===null?Im(c,e.type,e.stateNode):Jm(c,s,e.memoizedProps)):s===null&&e.stateNode!==null&&ao(e,e.memoizedProps,n.memoizedProps)}break;case 27:vt(t,e),xt(e),s&512&&(Ie||n===null||tn(n,n.return)),n!==null&&s&4&&ao(e,e.memoizedProps,n.memoizedProps);break;case 5:if(vt(t,e),xt(e),s&512&&(Ie||n===null||tn(n,n.return)),e.flags&32){c=e.stateNode;try{za(c,"")}catch(le){Me(e,e.return,le)}}s&4&&e.stateNode!=null&&(c=e.memoizedProps,ao(e,c,n!==null?n.memoizedProps:c)),s&1024&&(io=!0);break;case 6:if(vt(t,e),xt(e),s&4){if(e.stateNode===null)throw Error(r(162));s=e.memoizedProps,n=e.stateNode;try{n.nodeValue=s}catch(le){Me(e,e.return,le)}}break;case 3:if(Qi=null,c=Kt,Kt=Yi(t.containerInfo),vt(t,e),Kt=c,xt(e),s&4&&n!==null&&n.memoizedState.isDehydrated)try{hl(t.containerInfo)}catch(le){Me(e,e.return,le)}io&&(io=!1,Ih(e));break;case 4:s=Kt,Kt=Yi(e.stateNode.containerInfo),vt(t,e),xt(e),Kt=s;break;case 12:vt(t,e),xt(e);break;case 31:vt(t,e),xt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ci(e,s)));break;case 13:vt(t,e),xt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Mi=ze()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ci(e,s)));break;case 22:c=e.memoizedState!==null;var w=n!==null&&n.memoizedState!==null,L=Sn,X=Ie;if(Sn=L||c,Ie=X||w,vt(t,e),Ie=X,Sn=L,xt(e),s&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||w||Sn||Ie||wa(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){w=n=t;try{if(u=w.stateNode,c)h=u.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none";else{x=w.stateNode;var F=w.memoizedProps.style,H=F!=null&&F.hasOwnProperty("display")?F.display:null;x.style.display=H==null||typeof H=="boolean"?"":(""+H).trim()}}catch(le){Me(w,w.return,le)}}}else if(t.tag===6){if(n===null){w=t;try{w.stateNode.nodeValue=c?"":w.memoizedProps}catch(le){Me(w,w.return,le)}}}else if(t.tag===18){if(n===null){w=t;try{var Y=w.stateNode;c?Hm(Y,!0):Hm(w.stateNode,!1)}catch(le){Me(w,w.return,le)}}}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,Ci(e,n))));break;case 19:vt(t,e),xt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Ci(e,s)));break;case 30:break;case 21:break;default:vt(t,e),xt(e)}}function xt(e){var t=e.flags;if(t&2){try{for(var n,s=e.return;s!==null;){if(Yh(s)){n=s;break}s=s.return}if(n==null)throw Error(r(160));switch(n.tag){case 27:var c=n.stateNode,u=lo(e);qi(e,u,c);break;case 5:var h=n.stateNode;n.flags&32&&(za(h,""),n.flags&=-33);var x=lo(e);qi(e,x,h);break;case 3:case 4:var w=n.stateNode.containerInfo,L=lo(e);so(e,L,w);break;default:throw Error(r(161))}}catch(X){Me(e,e.return,X)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ih(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Ih(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function jn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Xh(e,t.alternate,t),t=t.sibling}function wa(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Kn(4,t,t.return),wa(t);break;case 1:tn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Hh(t,t.return,n),wa(t);break;case 27:ds(t.stateNode);case 26:case 5:tn(t,t.return),wa(t);break;case 22:t.memoizedState===null&&wa(t);break;case 30:wa(t);break;default:wa(t)}e=e.sibling}}function Nn(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:Nn(c,u,n),ns(4,u);break;case 1:if(Nn(c,u,n),s=u,c=s.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(L){Me(s,s.return,L)}if(s=u,c=s.updateQueue,c!==null){var x=s.stateNode;try{var w=c.shared.hiddenCallbacks;if(w!==null)for(c.shared.hiddenCallbacks=null,c=0;c<w.length;c++)Cd(w[c],x)}catch(L){Me(s,s.return,L)}}n&&h&64&&Uh(u),as(u,u.return);break;case 27:Gh(u);case 26:case 5:Nn(c,u,n),n&&s===null&&h&4&&Vh(u),as(u,u.return);break;case 12:Nn(c,u,n);break;case 31:Nn(c,u,n),n&&h&4&&Zh(c,u);break;case 13:Nn(c,u,n),n&&h&4&&Jh(c,u);break;case 22:u.memoizedState===null&&Nn(c,u,n),as(u,u.return);break;case 30:break;default:Nn(c,u,n)}t=t.sibling}}function ro(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&&Gl(n))}function co(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Gl(e))}function Zt(e,t,n,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Wh(e,t,n,s),t=t.sibling}function Wh(e,t,n,s){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Zt(e,t,n,s),c&2048&&ns(9,t);break;case 1:Zt(e,t,n,s);break;case 3:Zt(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&&Gl(e)));break;case 12:if(c&2048){Zt(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(w){Me(t,t.return,w)}}else Zt(e,t,n,s);break;case 31:Zt(e,t,n,s);break;case 13:Zt(e,t,n,s);break;case 23:break;case 22:u=t.stateNode,h=t.alternate,t.memoizedState!==null?u._visibility&2?Zt(e,t,n,s):ls(e,t):u._visibility&2?Zt(e,t,n,s):(u._visibility|=2,nl(e,t,n,s,(t.subtreeFlags&10256)!==0||!1)),c&2048&&ro(h,t);break;case 24:Zt(e,t,n,s),c&2048&&co(t.alternate,t);break;default:Zt(e,t,n,s)}}function nl(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,w=s,L=h.flags;switch(h.tag){case 0:case 11:case 15:nl(u,h,x,w,c),ns(8,h);break;case 23:break;case 22:var X=h.stateNode;h.memoizedState!==null?X._visibility&2?nl(u,h,x,w,c):ls(u,h):(X._visibility|=2,nl(u,h,x,w,c)),c&&L&2048&&ro(h.alternate,h);break;case 24:nl(u,h,x,w,c),c&&L&2048&&co(h.alternate,h);break;default:nl(u,h,x,w,c)}t=t.sibling}}function ls(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:ls(n,s),c&2048&&ro(s.alternate,s);break;case 24:ls(n,s),c&2048&&co(s.alternate,s);break;default:ls(n,s)}t=t.sibling}}var ss=8192;function al(e,t,n){if(e.subtreeFlags&ss)for(e=e.child;e!==null;)Ph(e,t,n),e=e.sibling}function Ph(e,t,n){switch(e.tag){case 26:al(e,t,n),e.flags&ss&&e.memoizedState!==null&&_v(n,Kt,e.memoizedState,e.memoizedProps);break;case 5:al(e,t,n);break;case 3:case 4:var s=Kt;Kt=Yi(e.stateNode.containerInfo),al(e,t,n),Kt=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=ss,ss=16777216,al(e,t,n),ss=s):al(e,t,n));break;default:al(e,t,n)}}function em(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 is(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];nt=s,nm(s,e)}em(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)tm(e),e=e.sibling}function tm(e){switch(e.tag){case 0:case 11:case 15:is(e),e.flags&2048&&Kn(9,e,e.return);break;case 3:is(e);break;case 12:is(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ti(e)):is(e);break;default:is(e)}}function Ti(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];nt=s,nm(s,e)}em(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Kn(8,t,t.return),Ti(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ti(t));break;default:Ti(t)}e=e.sibling}}function nm(e,t){for(;nt!==null;){var n=nt;switch(n.tag){case 0:case 11:case 15:Kn(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:Gl(n.memoizedState.cache)}if(s=n.child,s!==null)s.return=n,nt=s;else e:for(n=e;nt!==null;){s=nt;var c=s.sibling,u=s.return;if($h(s),s===n){nt=null;break e}if(c!==null){c.return=u,nt=c;break e}nt=u}}}var Ky={getCacheForType:function(e){var t=st(Ze),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return st(Ze).controller.signal}},Zy=typeof WeakMap=="function"?WeakMap:Map,Ce=0,Be=null,ve=null,be=0,Te=0,Ct=null,Zn=!1,ll=!1,oo=!1,En=0,Qe=0,Jn=0,qa=0,uo=0,Tt=0,sl=0,rs=null,bt=null,fo=!1,Mi=0,am=0,Ri=1/0,_i=null,Fn=null,et=0,In=null,il=null,wn=0,ho=0,mo=null,lm=null,cs=0,po=null;function Mt(){return(Ce&2)!==0&&be!==0?be&-be:z.T!==null?So():bf()}function sm(){if(Tt===0)if((be&536870912)===0||Ae){var e=Hs;Hs<<=1,(Hs&3932160)===0&&(Hs=262144),Tt=e}else Tt=536870912;return e=wt.current,e!==null&&(e.flags|=32),Tt}function St(e,t,n){(e===Be&&(Te===2||Te===9)||e.cancelPendingCommit!==null)&&(rl(e,0),Wn(e,be,Tt,!1)),Tl(e,n),((Ce&2)===0||e!==Be)&&(e===Be&&((Ce&2)===0&&(qa|=n),Qe===4&&Wn(e,be,Tt,!1)),nn(e))}function im(e,t,n){if((Ce&6)!==0)throw Error(r(327));var s=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Cl(e,t),c=s?Iy(e,t):yo(e,t,!0),u=s;do{if(c===0){ll&&!s&&Wn(e,t,0,!1);break}else{if(n=e.current.alternate,u&&!Jy(n)){c=yo(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=rs;var w=x.current.memoizedState.isDehydrated;if(w&&(rl(x,h).flags|=256),h=yo(x,h,!1),h!==2){if(oo&&!w){x.errorRecoveryDisabledLanes|=u,qa|=u,c=4;break e}u=bt,bt=c,u!==null&&(bt===null?bt=u:bt.push.apply(bt,u))}c=h}if(u=!1,c!==2)continue}}if(c===1){rl(e,0),Wn(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:Wn(s,t,Tt,!Zn);break e;case 2:bt=null;break;case 3:case 5:break;default:throw Error(r(329))}if((t&62914560)===t&&(c=Mi+300-ze(),10<c)){if(Wn(s,t,Tt,!Zn),Ys(s,0,!0)!==0)break e;wn=t,s.timeoutHandle=Bm(rm.bind(null,s,n,bt,_i,fo,t,Tt,qa,sl,Zn,u,"Throttled",-0,0),c);break e}rm(s,n,bt,_i,fo,t,Tt,qa,sl,Zn,u,null,-0,0)}}break}while(!0);nn(e)}function rm(e,t,n,s,c,u,h,x,w,L,X,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:fn},Ph(t,u,F);var le=(u&62914560)===u?Mi-ze():(u&4194048)===u?am-ze():0;if(le=kv(F,le),le!==null){wn=u,e.cancelPendingCommit=le(pm.bind(null,e,t,u,n,s,c,h,x,w,X,F,null,H,Y)),Wn(e,u,h,!L);return}}pm(e,t,u,n,s,c,h,x,w)}function Jy(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var s=0;s<n.length;s++){var c=n[s],u=c.getSnapshot;c=c.value;try{if(!Nt(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 Wn(e,t,n,s){t&=~uo,t&=~qa,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var c=t;0<c;){var u=31-jt(c),h=1<<u;s[u]=-1,c&=~h}n!==0&&yf(e,n,t)}function ki(){return(Ce&6)===0?(os(0),!1):!0}function go(){if(ve!==null){if(Te===0)var e=ve.return;else e=ve,pn=va=null,Rc(e),Ia=null,Xl=0,e=ve;for(;e!==null;)Lh(e.alternate,e),e=e.return;ve=null}}function rl(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,pv(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),wn=0,go(),Be=e,ve=n=hn(e.current,null),be=t,Te=0,Ct=null,Zn=!1,ll=Cl(e,t),oo=!1,sl=Tt=uo=qa=Jn=Qe=0,bt=rs=null,fo=!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-jt(s),u=1<<c;t|=e[c],s&=~u}return En=t,ei(),n}function cm(e,t){me=null,z.H=Pl,t===Fa||t===ci?(t=Nd(),Te=3):t===xc?(t=Nd(),Te=4):Te=t===Kc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Ct=t,ve===null&&(Qe=1,Ai(e,Ot(t,e.current)))}function om(){var e=wt.current;return e===null?!0:(be&4194048)===be?Lt===null:(be&62914560)===be||(be&536870912)!==0?e===Lt:!1}function um(){var e=z.H;return z.H=Pl,e===null?Pl:e}function fm(){var e=z.A;return z.A=Ky,e}function Oi(){Qe=4,Zn||(be&4194048)!==be&&wt.current!==null||(ll=!0),(Jn&134217727)===0&&(qa&134217727)===0||Be===null||Wn(Be,be,Tt,!1)}function yo(e,t,n){var s=Ce;Ce|=2;var c=um(),u=fm();(Be!==e||be!==t)&&(_i=null,rl(e,t)),t=!1;var h=Qe;e:do try{if(Te!==0&&ve!==null){var x=ve,w=Ct;switch(Te){case 8:go(),h=6;break e;case 3:case 2:case 9:case 6:wt.current===null&&(t=!0);var L=Te;if(Te=0,Ct=null,cl(e,x,w,L),n&&ll){h=0;break e}break;default:L=Te,Te=0,Ct=null,cl(e,x,w,L)}}Fy(),h=Qe;break}catch(X){cm(e,X)}while(!0);return t&&e.shellSuspendCounter++,pn=va=null,Ce=s,z.H=c,z.A=u,ve===null&&(Be=null,be=0,ei()),h}function Fy(){for(;ve!==null;)dm(ve)}function Iy(e,t){var n=Ce;Ce|=2;var s=um(),c=fm();Be!==e||be!==t?(_i=null,Ri=ze()+500,rl(e,t)):ll=Cl(e,t);e:do try{if(Te!==0&&ve!==null){t=ve;var u=Ct;t:switch(Te){case 1:Te=0,Ct=null,cl(e,t,u,1);break;case 2:case 9:if(Ad(u)){Te=0,Ct=null,hm(t);break}t=function(){Te!==2&&Te!==9||Be!==e||(Te=7),nn(e)},u.then(t,t);break e;case 3:Te=7;break e;case 4:Te=5;break e;case 7:Ad(u)?(Te=0,Ct=null,hm(t)):(Te=0,Ct=null,cl(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?Wm(h):x.stateNode.complete){Te=0,Ct=null;var w=x.sibling;if(w!==null)ve=w;else{var L=x.return;L!==null?(ve=L,Di(L)):ve=null}break t}}Te=0,Ct=null,cl(e,t,u,5);break;case 6:Te=0,Ct=null,cl(e,t,u,6);break;case 8:go(),Qe=6;break e;default:throw Error(r(462))}}Wy();break}catch(X){cm(e,X)}while(!0);return pn=va=null,z.H=s,z.A=c,Ce=n,ve!==null?0:(Be=null,be=0,ei(),Qe)}function Wy(){for(;ve!==null&&!Ls();)dm(ve)}function dm(e){var t=zh(e.alternate,e,En);e.memoizedProps=e.pendingProps,t===null?Di(e):ve=t}function hm(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Mh(n,t,t.pendingProps,t.type,void 0,be);break;case 11:t=Mh(n,t,t.pendingProps,t.type.render,t.ref,be);break;case 5:Rc(t);default:Lh(n,t),t=ve=fd(t,En),t=zh(n,t,En)}e.memoizedProps=e.pendingProps,t===null?Di(e):ve=t}function cl(e,t,n,s){pn=va=null,Rc(t),Ia=null,Xl=0;var c=t.return;try{if(Hy(e,c,t,n,be)){Qe=1,Ai(e,Ot(n,e.current)),ve=null;return}}catch(u){if(c!==null)throw ve=c,u;Qe=1,Ai(e,Ot(n,e.current)),ve=null;return}t.flags&32768?(Ae||s===1?e=!0:ll||(be&536870912)!==0?e=!1:(Zn=e=!0,(s===2||s===9||s===3||s===6)&&(s=wt.current,s!==null&&s.tag===13&&(s.flags|=16384))),mm(t,e)):Di(t)}function Di(e){var t=e;do{if((t.flags&32768)!==0){mm(t,Zn);return}e=t.return;var n=Gy(t.alternate,t,En);if(n!==null){ve=n;return}if(t=t.sibling,t!==null){ve=t;return}ve=t=e}while(t!==null);Qe===0&&(Qe=5)}function mm(e,t){do{var n=Qy(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);Qe=6,ve=null}function pm(e,t,n,s,c,u,h,x,w){e.cancelPendingCommit=null;do zi();while(et!==0);if((Ce&6)!==0)throw Error(r(327));if(t!==null){if(t===e.current)throw Error(r(177));if(u=t.lanes|t.childLanes,u|=lc,Rg(e,n,u,h,x,w),e===Be&&(ve=Be=null,be=0),il=t,In=e,wn=n,ho=u,mo=c,lm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,nv(_e,function(){return bm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=z.T,z.T=null,c=Q.p,Q.p=2,h=Ce,Ce|=4;try{Xy(e,t,n)}finally{Ce=h,Q.p=c,z.T=s}}et=1,gm(),ym(),vm()}}function gm(){if(et===1){et=0;var e=In,t=il,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=z.T,z.T=null;var s=Q.p;Q.p=2;var c=Ce;Ce|=4;try{Fh(t,e);var u=To,h=nd(e.containerInfo),x=u.focusedElem,w=u.selectionRange;if(h!==x&&x&&x.ownerDocument&&td(x.ownerDocument.documentElement,x)){if(w!==null&&Pr(x)){var L=w.start,X=w.end;if(X===void 0&&(X=L),"selectionStart"in x)x.selectionStart=L,x.selectionEnd=Math.min(X,x.value.length);else{var F=x.ownerDocument||document,H=F&&F.defaultView||window;if(H.getSelection){var Y=H.getSelection(),le=x.textContent.length,fe=Math.min(w.start,le),De=w.end===void 0?fe:Math.min(w.end,le);!Y.extend&&fe>De&&(h=De,De=fe,fe=h);var O=ed(x,fe),_=ed(x,De);if(O&&_&&(Y.rangeCount!==1||Y.anchorNode!==O.node||Y.anchorOffset!==O.offset||Y.focusNode!==_.node||Y.focusOffset!==_.offset)){var B=F.createRange();B.setStart(O.node,O.offset),Y.removeAllRanges(),fe>De?(Y.addRange(B),Y.extend(_.node,_.offset)):(B.setEnd(_.node,_.offset),Y.addRange(B))}}}}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 J=F[x];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}Zi=!!Co,To=Co=null}finally{Ce=c,Q.p=s,z.T=n}}e.current=t,et=2}}function ym(){if(et===2){et=0;var e=In,t=il,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=z.T,z.T=null;var s=Q.p;Q.p=2;var c=Ce;Ce|=4;try{Xh(e,t.alternate,t)}finally{Ce=c,Q.p=s,z.T=n}}et=3}}function vm(){if(et===4||et===3){et=0,Ee();var e=In,t=il,n=wn,s=lm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?et=5:(et=0,il=In=null,xm(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Fn=null),Or(n),t=t.stateNode,At&&typeof At.onCommitFiberRoot=="function")try{At.onCommitFiberRoot(ql,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=z.T,c=Q.p,Q.p=2,z.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{z.T=t,Q.p=c}}(wn&3)!==0&&zi(),nn(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===po?cs++:(cs=0,po=e):cs=0,os(0)}}function xm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Gl(t)))}function zi(){return gm(),ym(),vm(),bm()}function bm(){if(et!==5)return!1;var e=In,t=ho;ho=0;var n=Or(wn),s=z.T,c=Q.p;try{Q.p=32>n?32:n,z.T=null,n=mo,mo=null;var u=In,h=wn;if(et=0,il=In=null,wn=0,(Ce&6)!==0)throw Error(r(331));var x=Ce;if(Ce|=4,tm(u.current),Wh(u,u.current,h,n),Ce=x,os(0,!1),At&&typeof At.onPostCommitFiberRoot=="function")try{At.onPostCommitFiberRoot(ql,u)}catch{}return!0}finally{Q.p=c,z.T=s,xm(e,t)}}function Sm(e,t,n){t=Ot(n,t),t=$c(e.stateNode,t,2),e=Qn(e,t,2),e!==null&&(Tl(e,2),nn(e))}function Me(e,t,n){if(e.tag===3)Sm(e,e,n);else for(;t!==null;){if(t.tag===3){Sm(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=Ot(n,e),n=Ah(2),s=Qn(t,n,2),s!==null&&(jh(n,s,t,e),Tl(s,2),nn(s));break}}t=t.return}}function vo(e,t,n){var s=e.pingCache;if(s===null){s=e.pingCache=new Zy;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)||(oo=!0,c.add(n),e=Py.bind(null,e,t,n),t.then(e,e))}function Py(e,t,n){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Be===e&&(be&n)===n&&(Qe===4||Qe===3&&(be&62914560)===be&&300>ze()-Mi?(Ce&2)===0&&rl(e,0):uo|=n,sl===be&&(sl=0)),nn(e)}function Am(e,t){t===0&&(t=gf()),e=pa(e,t),e!==null&&(Tl(e,t),nn(e))}function ev(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Am(e,n)}function tv(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),Am(e,n)}function nv(e,t){return El(e,t)}var Bi=null,ol=null,xo=!1,Li=!1,bo=!1,Pn=0;function nn(e){e!==ol&&e.next===null&&(ol===null?Bi=ol=e:ol=ol.next=e),Li=!0,xo||(xo=!0,lv())}function os(e,t){if(!bo&&Li){bo=!0;do for(var n=!1,s=Bi;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-jt(42|e)+1)-1,u&=c&~(h&~x),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,wm(s,u))}else u=be,u=Ys(s,s===Be?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||Cl(s,u)||(n=!0,wm(s,u));s=s.next}while(n);bo=!1}}function av(){jm()}function jm(){Li=xo=!1;var e=0;Pn!==0&&mv()&&(e=Pn);for(var t=ze(),n=null,s=Bi;s!==null;){var c=s.next,u=Nm(s,t);u===0?(s.next=null,n===null?Bi=c:n.next=c,c===null&&(ol=n)):(n=s,(e!==0||(u&3)!==0)&&(Li=!0)),s=c}et!==0&&et!==5||os(e),Pn!==0&&(Pn=0)}function Nm(e,t){for(var n=e.suspendedLanes,s=e.pingedLanes,c=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var h=31-jt(u),x=1<<h,w=c[h];w===-1?((x&n)===0||(x&s)!==0)&&(c[h]=Mg(x,t)):w<=t&&(e.expiredLanes|=x),u&=~x}if(t=Be,n=be,n=Ys(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,n===0||e===t&&(Te===2||Te===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&wl(s),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Cl(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(s!==null&&wl(s),Or(n)){case 2:case 8:n=Xe;break;case 32:n=_e;break;case 268435456:n=pf;break;default:n=_e}return s=Em.bind(null,e),n=El(n,s),e.callbackPriority=t,e.callbackNode=n,t}return s!==null&&s!==null&&wl(s),e.callbackPriority=2,e.callbackNode=null,2}function Em(e,t){if(et!==0&&et!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(zi()&&e.callbackNode!==n)return null;var s=be;return s=Ys(e,e===Be?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(im(e,s,t),Nm(e,ze()),e.callbackNode!=null&&e.callbackNode===n?Em.bind(null,e):null)}function wm(e,t){if(zi())return null;im(e,t,!0)}function lv(){gv(function(){(Ce&6)!==0?El(Le,av):jm()})}function So(){if(Pn===0){var e=Za;e===0&&(e=Us,Us<<=1,(Us&261888)===0&&(Us=256)),Pn=e}return Pn}function qm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:$s(""+e)}function Cm(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 sv(e,t,n,s,c){if(t==="submit"&&n&&n.stateNode===c){var u=qm((c[pt]||null).action),h=s.submitter;h&&(t=(t=h[pt]||null)?qm(t.formAction):h.getAttribute("formAction"),t!==null&&(u=t,h=null));var x=new Fs("action","action",null,s,c);e.push({event:x,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Pn!==0){var w=h?Cm(c,h):new FormData(c);Hc(n,{pending:!0,data:w,method:c.method,action:u},null,w)}}else typeof u=="function"&&(x.preventDefault(),w=h?Cm(c,h):new FormData(c),Hc(n,{pending:!0,data:w,method:c.method,action:u},u,w))},currentTarget:c}]})}}for(var Ao=0;Ao<ac.length;Ao++){var jo=ac[Ao],iv=jo.toLowerCase(),rv=jo[0].toUpperCase()+jo.slice(1);$t(iv,"on"+rv)}$t(sd,"onAnimationEnd"),$t(id,"onAnimationIteration"),$t(rd,"onAnimationStart"),$t("dblclick","onDoubleClick"),$t("focusin","onFocus"),$t("focusout","onBlur"),$t(jy,"onTransitionRun"),$t(Ny,"onTransitionStart"),$t(Ey,"onTransitionCancel"),$t(cd,"onTransitionEnd"),Oa("onMouseEnter",["mouseout","mouseover"]),Oa("onMouseLeave",["mouseout","mouseover"]),Oa("onPointerEnter",["pointerout","pointerover"]),Oa("onPointerLeave",["pointerout","pointerover"]),fa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),fa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),fa("onBeforeInput",["compositionend","keypress","textInput","paste"]),fa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),fa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),fa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var us="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(" "),cv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(us));function Tm(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],w=x.instance,L=x.currentTarget;if(x=x.listener,w!==u&&c.isPropagationStopped())break e;u=x,c.currentTarget=L;try{u(c)}catch(X){Ps(X)}c.currentTarget=null,u=w}else for(h=0;h<s.length;h++){if(x=s[h],w=x.instance,L=x.currentTarget,x=x.listener,w!==u&&c.isPropagationStopped())break e;u=x,c.currentTarget=L;try{u(c)}catch(X){Ps(X)}c.currentTarget=null,u=w}}}}function xe(e,t){var n=t[Dr];n===void 0&&(n=t[Dr]=new Set);var s=e+"__bubble";n.has(s)||(Mm(t,e,2,!1),n.add(s))}function No(e,t,n){var s=0;t&&(s|=4),Mm(n,e,s,t)}var Ui="_reactListening"+Math.random().toString(36).slice(2);function Eo(e){if(!e[Ui]){e[Ui]=!0,jf.forEach(function(n){n!=="selectionchange"&&(cv.has(n)||No(n,!1,e),No(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ui]||(t[Ui]=!0,No("selectionchange",!1,t))}}function Mm(e,t,n,s){switch(sp(t)){case 2:var c=zv;break;case 8:c=Bv;break;default:c=Ho}n=c.bind(null,t,n,e),c=void 0,!Qr||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 wo(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 w=h.tag;if((w===3||w===4)&&h.stateNode.containerInfo===c)return;h=h.return}for(;x!==null;){if(h=Ra(x),h===null)return;if(w=h.tag,w===5||w===6||w===26||w===27){s=u=h;continue e}x=x.parentNode}}s=s.return}Df(function(){var L=u,X=Yr(n),F=[];e:{var H=od.get(e);if(H!==void 0){var Y=Fs,le=e;switch(e){case"keypress":if(Zs(n)===0)break e;case"keydown":case"keyup":Y=ty;break;case"focusin":le="focus",Y=Zr;break;case"focusout":le="blur",Y=Zr;break;case"beforeblur":case"afterblur":Y=Zr;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=Lf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=Gg;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=ly;break;case sd:case id:case rd:Y=$g;break;case cd:Y=iy;break;case"scroll":case"scrollend":Y=Vg;break;case"wheel":Y=cy;break;case"copy":case"cut":case"paste":Y=Zg;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=Hf;break;case"toggle":case"beforetoggle":Y=uy}var fe=(t&4)!==0,De=!fe&&(e==="scroll"||e==="scrollend"),O=fe?H!==null?H+"Capture":null:H;fe=[];for(var _=L,B;_!==null;){var J=_;if(B=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||B===null||O===null||(J=_l(_,O),J!=null&&fe.push(fs(_,J,B))),De)break;_=_.return}0<fe.length&&(H=new Y(H,le,null,n,X),F.push({event:H,listeners:fe}))}}if((t&7)===0){e:{if(H=e==="mouseover"||e==="pointerover",Y=e==="mouseout"||e==="pointerout",H&&n!==Vr&&(le=n.relatedTarget||n.fromElement)&&(Ra(le)||le[Ma]))break e;if((Y||H)&&(H=X.window===X?X:(H=X.ownerDocument)?H.defaultView||H.parentWindow:window,Y?(le=n.relatedTarget||n.toElement,Y=L,le=le?Ra(le):null,le!==null&&(De=d(le),fe=le.tag,le!==De||fe!==5&&fe!==27&&fe!==6)&&(le=null)):(Y=null,le=L),Y!==le)){if(fe=Lf,J="onMouseLeave",O="onMouseEnter",_="mouse",(e==="pointerout"||e==="pointerover")&&(fe=Hf,J="onPointerLeave",O="onPointerEnter",_="pointer"),De=Y==null?H:Rl(Y),B=le==null?H:Rl(le),H=new fe(J,_+"leave",Y,n,X),H.target=De,H.relatedTarget=B,J=null,Ra(X)===L&&(fe=new fe(O,_+"enter",le,n,X),fe.target=B,fe.relatedTarget=De,J=fe),De=J,Y&&le)t:{for(fe=ov,O=Y,_=le,B=0,J=O;J;J=fe(J))B++;J=0;for(var ce=_;ce;ce=fe(ce))J++;for(;0<B-J;)O=fe(O),B--;for(;0<J-B;)_=fe(_),J--;for(;B--;){if(O===_||_!==null&&O===_.alternate){fe=O;break t}O=fe(O),_=fe(_)}fe=null}else fe=null;Y!==null&&Rm(F,H,Y,fe,!1),le!==null&&De!==null&&Rm(F,De,le,fe,!0)}}e:{if(H=L?Rl(L):window,Y=H.nodeName&&H.nodeName.toLowerCase(),Y==="select"||Y==="input"&&H.type==="file")var we=Zf;else if($f(H))if(Jf)we=by;else{we=vy;var ie=yy}else Y=H.nodeName,!Y||Y.toLowerCase()!=="input"||H.type!=="checkbox"&&H.type!=="radio"?L&&Hr(L.elementType)&&(we=Zf):we=xy;if(we&&(we=we(e,L))){Kf(F,we,n,X);break e}ie&&ie(e,H,L),e==="focusout"&&L&&H.type==="number"&&L.memoizedProps.value!=null&&Ur(H,"number",H.value)}switch(ie=L?Rl(L):window,e){case"focusin":($f(ie)||ie.contentEditable==="true")&&(Ha=ie,ec=L,Hl=null);break;case"focusout":Hl=ec=Ha=null;break;case"mousedown":tc=!0;break;case"contextmenu":case"mouseup":case"dragend":tc=!1,ad(F,n,X);break;case"selectionchange":if(Ay)break;case"keydown":case"keyup":ad(F,n,X)}var pe;if(Fr)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 Ua?Qf(e,n)&&(Se="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Se="onCompositionStart");Se&&(Vf&&n.locale!=="ko"&&(Ua||Se!=="onCompositionStart"?Se==="onCompositionEnd"&&Ua&&(pe=zf()):(Bn=X,Xr="value"in Bn?Bn.value:Bn.textContent,Ua=!0)),ie=Hi(L,Se),0<ie.length&&(Se=new Uf(Se,e,null,n,X),F.push({event:Se,listeners:ie}),pe?Se.data=pe:(pe=Xf(n),pe!==null&&(Se.data=pe)))),(pe=dy?hy(e,n):my(e,n))&&(Se=Hi(L,"onBeforeInput"),0<Se.length&&(ie=new Uf("onBeforeInput","beforeinput",null,n,X),F.push({event:ie,listeners:Se}),ie.data=pe)),sv(F,e,L,n,X)}Tm(F,t)})}function fs(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Hi(e,t){for(var n=t+"Capture",s=[];e!==null;){var c=e,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=_l(e,n),c!=null&&s.unshift(fs(e,c,u)),c=_l(e,t),c!=null&&s.push(fs(e,c,u))),e.tag===3)return s;e=e.return}return[]}function ov(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Rm(e,t,n,s,c){for(var u=t._reactName,h=[];n!==null&&n!==s;){var x=n,w=x.alternate,L=x.stateNode;if(x=x.tag,w!==null&&w===s)break;x!==5&&x!==26&&x!==27||L===null||(w=L,c?(L=_l(n,u),L!=null&&h.unshift(fs(n,L,w))):c||(L=_l(n,u),L!=null&&h.push(fs(n,L,w)))),n=n.return}h.length!==0&&e.push({event:t,listeners:h})}var uv=/\r\n?/g,fv=/\u0000|\uFFFD/g;function _m(e){return(typeof e=="string"?e:""+e).replace(uv,`
|
||
`).replace(fv,"")}function km(e,t){return t=_m(t),_m(e)===t}function Oe(e,t,n,s,c,u){switch(n){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||za(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&za(e,""+s);break;case"className":Qs(e,"class",s);break;case"tabIndex":Qs(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Qs(e,n,s);break;case"style":kf(e,s,u);break;case"data":if(t!=="object"){Qs(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=$s(""+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=$s(""+s),e.setAttribute(n,s);break;case"onClick":s!=null&&(e.onclick=fn);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=$s(""+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),Gs(e,"popover",s);break;case"xlinkActuate":un(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":un(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":un(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":un(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":un(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":un(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":un(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":un(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":un(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Gs(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=Ug.get(n)||n,Gs(e,n,s))}}function qo(e,t,n,s,c,u){switch(n){case"style":kf(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"?za(e,s):(typeof s=="number"||typeof s=="bigint")&&za(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=fn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Nf.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[pt]||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,""):Gs(e,n,s)}}}function rt(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,w=null,L=null;for(s in n)if(n.hasOwnProperty(s)){var X=n[s];if(X!=null)switch(s){case"name":c=X;break;case"type":h=X;break;case"checked":w=X;break;case"defaultChecked":L=X;break;case"value":u=X;break;case"defaultValue":x=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,t));break;default:Oe(e,t,s,X,n,null)}}Tf(e,u,x,w,L,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?Da(e,!!s,t,!1):n!=null&&Da(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)}Rf(e,s,c,u);return;case"option":for(w in n)if(n.hasOwnProperty(w)&&(s=n[w],s!=null))switch(w){case"selected":e.selected=s&&typeof s!="function"&&typeof s!="symbol";break;default:Oe(e,t,w,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<us.length;s++)xe(us[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(L in n)if(n.hasOwnProperty(L)&&(s=n[L],s!=null))switch(L){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,t));default:Oe(e,t,L,s,n,null)}return;default:if(Hr(t)){for(X in n)n.hasOwnProperty(X)&&(s=n[X],s!==void 0&&qo(e,t,X,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 dv(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,w=null,L=null,X=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":w=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":L=Y;break;case"defaultChecked":X=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)}}Lr(e,h,x,w,L,X,u,c);return;case"select":Y=h=x=H=null;for(u in n)if(w=n[u],n.hasOwnProperty(u)&&w!=null)switch(u){case"value":break;case"multiple":Y=w;default:s.hasOwnProperty(u)||Oe(e,t,u,null,s,w)}for(c in s)if(u=s[c],w=n[c],s.hasOwnProperty(c)&&(u!=null||w!=null))switch(c){case"value":H=u;break;case"defaultValue":x=u;break;case"multiple":h=u;default:u!==w&&Oe(e,t,c,u,s,w)}t=x,n=h,s=Y,H!=null?Da(e,!!n,H,!1):!!s!=!!n&&(t!=null?Da(e,!!n,t,!0):Da(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)}Mf(e,H,Y);return;case"option":for(var le in n)if(H=n[le],n.hasOwnProperty(le)&&H!=null&&!s.hasOwnProperty(le))switch(le){case"selected":e.selected=!1;break;default:Oe(e,t,le,null,s,H)}for(w in s)if(H=s[w],Y=n[w],s.hasOwnProperty(w)&&H!==Y&&(H!=null||Y!=null))switch(w){case"selected":e.selected=H&&typeof H!="function"&&typeof H!="symbol";break;default:Oe(e,t,w,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 fe in n)H=n[fe],n.hasOwnProperty(fe)&&H!=null&&!s.hasOwnProperty(fe)&&Oe(e,t,fe,null,s,H);for(L in s)if(H=s[L],Y=n[L],s.hasOwnProperty(L)&&H!==Y&&(H!=null||Y!=null))switch(L){case"children":case"dangerouslySetInnerHTML":if(H!=null)throw Error(r(137,t));break;default:Oe(e,t,L,H,s,Y)}return;default:if(Hr(t)){for(var De in n)H=n[De],n.hasOwnProperty(De)&&H!==void 0&&!s.hasOwnProperty(De)&&qo(e,t,De,void 0,s,H);for(X in s)H=s[X],Y=n[X],!s.hasOwnProperty(X)||H===Y||H===void 0&&Y===void 0||qo(e,t,X,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 Om(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function hv(){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&&Om(h)){for(h=0,x=c.responseEnd,s+=1;s<n.length;s++){var w=n[s],L=w.startTime;if(L>x)break;var X=w.transferSize,F=w.initiatorType;X&&Om(F)&&(w=w.responseEnd,h+=X*(w<x?1:(x-L)/(w-L)))}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 Co=null,To=null;function Vi(e){return e.nodeType===9?e:e.ownerDocument}function Dm(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 zm(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 Mo(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 Ro=null;function mv(){var e=window.event;return e&&e.type==="popstate"?e===Ro?!1:(Ro=e,!0):(Ro=null,!1)}var Bm=typeof setTimeout=="function"?setTimeout:void 0,pv=typeof clearTimeout=="function"?clearTimeout:void 0,Lm=typeof Promise=="function"?Promise:void 0,gv=typeof queueMicrotask=="function"?queueMicrotask:typeof Lm<"u"?function(e){return Lm.resolve(null).then(e).catch(yv)}:Bm;function yv(e){setTimeout(function(){throw e})}function ea(e){return e==="head"}function Um(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),hl(t);return}s--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")s++;else if(n==="html")ds(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,ds(n);for(var u=n.firstChild;u;){var h=u.nextSibling,x=u.nodeName;u[Ml]||x==="SCRIPT"||x==="STYLE"||x==="LINK"&&u.rel.toLowerCase()==="stylesheet"||n.removeChild(u),u=h}}else n==="body"&&ds(e.ownerDocument.body);n=c}while(n);hl(t)}function Hm(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 _o(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":_o(n),zr(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function vv(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[Ml])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=Ut(e.nextSibling),e===null)break}return null}function xv(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Ut(e.nextSibling),e===null))return null;return e}function Vm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Ut(e.nextSibling),e===null))return null;return e}function ko(e){return e.data==="$?"||e.data==="$~"}function Oo(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function bv(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var s=function(){t(),n.removeEventListener("DOMContentLoaded",s)};n.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function Ut(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Do=null;function Ym(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Ut(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Gm(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 Qm(e,t,n){switch(t=Vi(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 ds(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);zr(e)}var Ht=new Map,Xm=new Set;function Yi(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var qn=Q.d;Q.d={f:Sv,r:Av,D:jv,C:Nv,L:Ev,m:wv,X:Cv,S:qv,M:Tv};function Sv(){var e=qn.f(),t=ki();return e||t}function Av(e){var t=_a(e);t!==null&&t.tag===5&&t.type==="form"?ch(t):qn.r(e)}var ul=typeof document>"u"?null:document;function $m(e,t,n){var s=ul;if(s&&typeof t=="string"&&t){var c=_t(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),Xm.has(c)||(Xm.add(c),e={rel:e,crossOrigin:n,href:t},s.querySelector(c)===null&&(t=s.createElement("link"),rt(t,"link",e),tt(t),s.head.appendChild(t)))}}function jv(e){qn.D(e),$m("dns-prefetch",e,null)}function Nv(e,t){qn.C(e,t),$m("preconnect",e,t)}function Ev(e,t,n){qn.L(e,t,n);var s=ul;if(s&&e&&t){var c='link[rel="preload"][as="'+_t(t)+'"]';t==="image"&&n&&n.imageSrcSet?(c+='[imagesrcset="'+_t(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(c+='[imagesizes="'+_t(n.imageSizes)+'"]')):c+='[href="'+_t(e)+'"]';var u=c;switch(t){case"style":u=fl(e);break;case"script":u=dl(e)}Ht.has(u)||(e=b({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Ht.set(u,e),s.querySelector(c)!==null||t==="style"&&s.querySelector(hs(u))||t==="script"&&s.querySelector(ms(u))||(t=s.createElement("link"),rt(t,"link",e),tt(t),s.head.appendChild(t)))}}function wv(e,t){qn.m(e,t);var n=ul;if(n&&e){var s=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+_t(s)+'"][href="'+_t(e)+'"]',u=c;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=dl(e)}if(!Ht.has(u)&&(e=b({rel:"modulepreload",href:e},t),Ht.set(u,e),n.querySelector(c)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ms(u)))return}s=n.createElement("link"),rt(s,"link",e),tt(s),n.head.appendChild(s)}}}function qv(e,t,n){qn.S(e,t,n);var s=ul;if(s&&e){var c=ka(s).hoistableStyles,u=fl(e);t=t||"default";var h=c.get(u);if(!h){var x={loading:0,preload:null};if(h=s.querySelector(hs(u)))x.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Ht.get(u))&&zo(e,n);var w=h=s.createElement("link");tt(w),rt(w,"link",e),w._p=new Promise(function(L,X){w.onload=L,w.onerror=X}),w.addEventListener("load",function(){x.loading|=1}),w.addEventListener("error",function(){x.loading|=2}),x.loading|=4,Gi(h,t,s)}h={type:"stylesheet",instance:h,count:1,state:x},c.set(u,h)}}}function Cv(e,t){qn.X(e,t);var n=ul;if(n&&e){var s=ka(n).hoistableScripts,c=dl(e),u=s.get(c);u||(u=n.querySelector(ms(c)),u||(e=b({src:e,async:!0},t),(t=Ht.get(c))&&Bo(e,t),u=n.createElement("script"),tt(u),rt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function Tv(e,t){qn.M(e,t);var n=ul;if(n&&e){var s=ka(n).hoistableScripts,c=dl(e),u=s.get(c);u||(u=n.querySelector(ms(c)),u||(e=b({src:e,async:!0,type:"module"},t),(t=Ht.get(c))&&Bo(e,t),u=n.createElement("script"),tt(u),rt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(c,u))}}function Km(e,t,n,s){var c=(c=ee.current)?Yi(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=fl(n.href),n=ka(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=fl(n.href);var u=ka(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(hs(e)))&&!u._p&&(h.instance=u,h.state.loading=5),Ht.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Ht.set(e,n),u||Mv(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=dl(n),n=ka(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 fl(e){return'href="'+_t(e)+'"'}function hs(e){return'link[rel="stylesheet"]['+e+"]"}function Zm(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Mv(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}),rt(t,"link",n),tt(t),e.head.appendChild(t))}function dl(e){return'[src="'+_t(e)+'"]'}function ms(e){return"script[async]"+e}function Jm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+_t(n.href)+'"]');if(s)return t.instance=s,tt(s),s;var c=b({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),tt(s),rt(s,"style",c),Gi(s,n.precedence,e),t.instance=s;case"stylesheet":c=fl(n.href);var u=e.querySelector(hs(c));if(u)return t.state.loading|=4,t.instance=u,tt(u),u;s=Zm(n),(c=Ht.get(c))&&zo(s,c),u=(e.ownerDocument||e).createElement("link"),tt(u);var h=u;return h._p=new Promise(function(x,w){h.onload=x,h.onerror=w}),rt(u,"link",s),t.state.loading|=4,Gi(u,n.precedence,e),t.instance=u;case"script":return u=dl(n.src),(c=e.querySelector(ms(u)))?(t.instance=c,tt(c),c):(s=n,(c=Ht.get(u))&&(s=b({},n),Bo(s,c)),e=e.ownerDocument||e,c=e.createElement("script"),tt(c),rt(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,Gi(s,n.precedence,e));return t.instance}function Gi(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 zo(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Bo(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Qi=null;function Fm(e,t,n){if(Qi===null){var s=new Map,c=Qi=new Map;c.set(n,s)}else c=Qi,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[Ml]||u[at]||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 Im(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Rv(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 Wm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function _v(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=fl(s.href),u=t.querySelector(hs(c));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Xi.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,tt(u);return}u=t.ownerDocument||t,s=Zm(s),(c=Ht.get(c))&&zo(s,c),u=u.createElement("link"),tt(u);var h=u;h._p=new Promise(function(x,w){h.onload=x,h.onerror=w}),rt(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=Xi.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Lo=0;function kv(e,t){return e.stylesheets&&e.count===0&&Ki(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var s=setTimeout(function(){if(e.stylesheets&&Ki(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Lo===0&&(Lo=62500*hv());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Ki(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Lo?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(c)}}:null}function Xi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ki(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $i=null;function Ki(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$i=new Map,t.forEach(Ov,e),$i=null,Xi.call(e))}function Ov(e,t){if(!(t.state.loading&4)){var n=$i.get(e);if(n)var s=n.get(null);else{n=new Map,$i.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=Xi.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 ps={$$typeof:k,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function Dv(e,t,n,s,c,u,h,x,w){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=_r(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_r(0),this.hiddenUpdates=_r(null),this.identifierPrefix=s,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=h,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function Pm(e,t,n,s,c,u,h,x,w,L,X,F){return e=new Dv(e,t,n,h,w,L,X,F,x),t=1,u===!0&&(t|=24),u=Et(3,null,null,t),e.current=u,u.stateNode=e,t=gc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:n,cache:t},bc(u),e}function ep(e){return e?(e=Ga,e):Ga}function tp(e,t,n,s,c,u){c=ep(c),s.context===null?s.context=c:s.pendingContext=c,s=Gn(t),s.payload={element:n},u=u===void 0?null:u,u!==null&&(s.callback=u),n=Qn(e,s,t),n!==null&&(St(n,e,t),Kl(n,e,t))}function np(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Uo(e,t){np(e,t),(e=e.alternate)&&np(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=pa(e,67108864);t!==null&&St(t,e,67108864),Uo(e,67108864)}}function lp(e){if(e.tag===13||e.tag===31){var t=Mt();t=kr(t);var n=pa(e,t);n!==null&&St(n,e,t),Uo(e,t)}}var Zi=!0;function zv(e,t,n,s){var c=z.T;z.T=null;var u=Q.p;try{Q.p=2,Ho(e,t,n,s)}finally{Q.p=u,z.T=c}}function Bv(e,t,n,s){var c=z.T;z.T=null;var u=Q.p;try{Q.p=8,Ho(e,t,n,s)}finally{Q.p=u,z.T=c}}function Ho(e,t,n,s){if(Zi){var c=Vo(s);if(c===null)wo(e,t,s,Ji,n),ip(e,s);else if(Uv(c,e,t,n,s))s.stopPropagation();else if(ip(e,s),t&4&&-1<Lv.indexOf(e)){for(;c!==null;){var u=_a(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var h=ua(u.pendingLanes);if(h!==0){var x=u;for(x.pendingLanes|=2,x.entangledLanes|=2;h;){var w=1<<31-jt(h);x.entanglements[1]|=w,h&=~w}nn(u),(Ce&6)===0&&(Ri=ze()+500,os(0))}}break;case 31:case 13:x=pa(u,2),x!==null&&St(x,u,2),ki(),Uo(u,2)}if(u=Vo(s),u===null&&wo(e,t,s,Ji,n),u===c)break;c=u}c!==null&&s.stopPropagation()}else wo(e,t,s,null,n)}}function Vo(e){return e=Yr(e),Yo(e)}var Ji=null;function Yo(e){if(Ji=null,e=Ra(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=g(t),e!==null)return e;e=null}else if(n===31){if(e=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 Ji=e,null}function sp(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(mt()){case Le:return 2;case Xe:return 8;case _e:case Rr:return 32;case pf:return 268435456;default:return 32}default:return 32}}var Go=!1,ta=null,na=null,aa=null,gs=new Map,ys=new Map,la=[],Lv="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 ip(e,t){switch(e){case"focusin":case"focusout":ta=null;break;case"dragenter":case"dragleave":na=null;break;case"mouseover":case"mouseout":aa=null;break;case"pointerover":case"pointerout":gs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ys.delete(t.pointerId)}}function vs(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=_a(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function Uv(e,t,n,s,c){switch(t){case"focusin":return ta=vs(ta,e,t,n,s,c),!0;case"dragenter":return na=vs(na,e,t,n,s,c),!0;case"mouseover":return aa=vs(aa,e,t,n,s,c),!0;case"pointerover":var u=c.pointerId;return gs.set(u,vs(gs.get(u)||null,e,t,n,s,c)),!0;case"gotpointercapture":return u=c.pointerId,ys.set(u,vs(ys.get(u)||null,e,t,n,s,c)),!0}return!1}function rp(e){var t=Ra(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=g(n),t!==null){e.blockedOn=t,Sf(e.priority,function(){lp(n)});return}}else if(t===31){if(t=p(n),t!==null){e.blockedOn=t,Sf(e.priority,function(){lp(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 Fi(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Vo(e.nativeEvent);if(n===null){n=e.nativeEvent;var s=new n.constructor(n.type,n);Vr=s,n.target.dispatchEvent(s),Vr=null}else return t=_a(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function cp(e,t,n){Fi(e)&&n.delete(t)}function Hv(){Go=!1,ta!==null&&Fi(ta)&&(ta=null),na!==null&&Fi(na)&&(na=null),aa!==null&&Fi(aa)&&(aa=null),gs.forEach(cp),ys.forEach(cp)}function Ii(e,t){e.blockedOn===t&&(e.blockedOn=null,Go||(Go=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Hv)))}var Wi=null;function op(e){Wi!==e&&(Wi=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Wi===e&&(Wi=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(Yo(s||n)===null)continue;break}var u=_a(n);u!==null&&(e.splice(t,3),t-=3,Hc(u,{pending:!0,data:c,method:n.method,action:s},s,c))}}))}function hl(e){function t(w){return Ii(w,e)}ta!==null&&Ii(ta,e),na!==null&&Ii(na,e),aa!==null&&Ii(aa,e),gs.forEach(t),ys.forEach(t);for(var n=0;n<la.length;n++){var s=la[n];s.blockedOn===e&&(s.blockedOn=null)}for(;0<la.length&&(n=la[0],n.blockedOn===null);)rp(n),n.blockedOn===null&&la.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[pt]||null;if(typeof u=="function")h||op(n);else if(h){var x=null;if(u&&u.hasAttribute("formAction")){if(c=u,h=u[pt]||null)x=h.formAction;else if(Yo(c)!==null)continue}else x=h.action;typeof x=="function"?n[s+1]=x:(n.splice(s,3),s-=3),op(n)}}}function up(){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 Qo(e){this._internalRoot=e}Pi.prototype.render=Qo.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));var n=t.current,s=Mt();tp(n,s,e,t,null,null)},Pi.prototype.unmount=Qo.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;tp(e.current,2,null,e,null,null),ki(),t[Ma]=null}};function Pi(e){this._internalRoot=e}Pi.prototype.unstable_scheduleHydration=function(e){if(e){var t=bf();e={blockedOn:null,target:e,priority:t};for(var n=0;n<la.length&&t!==0&&t<la[n].priority;n++);la.splice(n,0,e),n===0&&rp(e)}};var fp=l.version;if(fp!=="19.2.0")throw Error(r(527,fp,"19.2.0"));Q.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?S(e):null,e=e===null?null:e.stateNode,e};var Vv={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var er=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!er.isDisabled&&er.supportsFiber)try{ql=er.inject(Vv),At=er}catch{}}return bs.createRoot=function(e,t){if(!f(e))throw Error(r(299));var n=!1,s="",c=vh,u=xh,h=bh;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=Pm(e,1,!1,null,null,n,s,null,c,u,h,up),e[Ma]=t.current,Eo(e),new Qo(t)},bs.hydrateRoot=function(e,t,n){if(!f(e))throw Error(r(299));var s=!1,c="",u=vh,h=xh,x=bh,w=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&&(w=n.formState)),t=Pm(e,1,!0,t,n??null,s,c,w,u,h,x,up),t.context=ep(null),n=t.current,s=Mt(),s=kr(s),c=Gn(s),c.callback=null,Qn(n,c,s),n=s,t.current.lanes=n,Tl(t,n),nn(t),e[Ma]=t.current,Eo(e),new Pi(t)},bs.version="19.2.0",bs}var Sp;function Wv(){if(Sp)return Ko.exports;Sp=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(),Ko.exports=Iv(),Ko.exports}var Pv=Wv();var Ap="popstate";function ex(a={}){function l(r,f){let{pathname:d,search:g,hash:p}=r.location;return gu("",{pathname:d,search:g,hash:p},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function i(r,f){return typeof f=="string"?f:Cs(f)}return nx(l,i,null,a)}function Ye(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function Wt(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function tx(){return Math.random().toString(36).substring(2,10)}function jp(a,l){return{usr:a.state,key:a.key,idx:l}}function gu(a,l,i=null,r){return{pathname:typeof a=="string"?a:a.pathname,search:"",hash:"",...typeof l=="string"?xl(l):l,state:i,key:l&&l.key||r||tx()}}function Cs({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 xl(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 nx(a,l,i,r={}){let{window:f=document.defaultView,v5Compat:d=!1}=r,g=f.history,p="POP",y=null,v=S();v==null&&(v=0,g.replaceState({...g.state,idx:v},""));function S(){return(g.state||{idx:null}).idx}function b(){p="POP";let A=S(),E=A==null?null:A-v;v=A,y&&y({action:p,location:R.location,delta:E})}function T(A,E){p="PUSH";let N=gu(R.location,A,E);v=S()+1;let k=jp(N,v),Z=R.createHref(N);try{g.pushState(k,"",Z)}catch(V){if(V instanceof DOMException&&V.name==="DataCloneError")throw V;f.location.assign(Z)}d&&y&&y({action:p,location:R.location,delta:1})}function q(A,E){p="REPLACE";let N=gu(R.location,A,E);v=S();let k=jp(N,v),Z=R.createHref(N);g.replaceState(k,"",Z),d&&y&&y({action:p,location:R.location,delta:0})}function j(A){return ax(A)}let R={get action(){return p},get location(){return a(f,g)},listen(A){if(y)throw new Error("A history only accepts one active listener");return f.addEventListener(Ap,b),y=A,()=>{f.removeEventListener(Ap,b),y=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:T,replace:q,go(A){return g.go(A)}};return R}function ax(a,l=!1){let i="http://localhost";typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),Ye(i,"No window.location.(origin|href) available to create URL");let r=typeof a=="string"?a:Cs(a);return r=r.replace(/ $/,"%20"),!l&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function u0(a,l,i="/"){return lx(a,l,i,!1)}function lx(a,l,i,r){let f=typeof l=="string"?xl(l):l,d=_n(f.pathname||"/",i);if(d==null)return null;let g=f0(a);sx(g);let p=null;for(let y=0;p==null&&y<g.length;++y){let v=gx(d);p=mx(g[y],v,r)}return p}function f0(a,l=[],i=[],r="",f=!1){let d=(g,p,y=f,v)=>{let S={relativePath:v===void 0?g.path||"":v,caseSensitive:g.caseSensitive===!0,childrenIndex:p,route:g};if(S.relativePath.startsWith("/")){if(!S.relativePath.startsWith(r)&&y)return;Ye(S.relativePath.startsWith(r),`Absolute route path "${S.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),S.relativePath=S.relativePath.slice(r.length)}let b=Mn([r,S.relativePath]),T=i.concat(S);g.children&&g.children.length>0&&(Ye(g.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),f0(g.children,l,T,b,y)),!(g.path==null&&!g.index)&&l.push({path:b,score:dx(b,g.index),routesMeta:T})};return a.forEach((g,p)=>{if(g.path===""||!g.path?.includes("?"))d(g,p);else for(let y of d0(g.path))d(g,p,!0,y)}),l}function d0(a){let l=a.split("/");if(l.length===0)return[];let[i,...r]=l,f=i.endsWith("?"),d=i.replace(/\?$/,"");if(r.length===0)return f?[d,""]:[d];let g=d0(r.join("/")),p=[];return p.push(...g.map(y=>y===""?d:[d,y].join("/"))),f&&p.push(...g),p.map(y=>a.startsWith("/")&&y===""?"/":y)}function sx(a){a.sort((l,i)=>l.score!==i.score?i.score-l.score:hx(l.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var ix=/^:[\w-]+$/,rx=3,cx=2,ox=1,ux=10,fx=-2,Np=a=>a==="*";function dx(a,l){let i=a.split("/"),r=i.length;return i.some(Np)&&(r+=fx),l&&(r+=cx),i.filter(f=>!Np(f)).reduce((f,d)=>f+(ix.test(d)?rx:d===""?ox:ux),r)}function hx(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 mx(a,l,i=!1){let{routesMeta:r}=a,f={},d="/",g=[];for(let p=0;p<r.length;++p){let y=r[p],v=p===r.length-1,S=d==="/"?l:l.slice(d.length)||"/",b=xr({path:y.relativePath,caseSensitive:y.caseSensitive,end:v},S),T=y.route;if(!b&&v&&i&&!r[r.length-1].route.index&&(b=xr({path:y.relativePath,caseSensitive:y.caseSensitive,end:!1},S)),!b)return null;Object.assign(f,b.params),g.push({params:f,pathname:Mn([d,b.pathname]),pathnameBase:Sx(Mn([d,b.pathnameBase])),route:T}),b.pathnameBase!=="/"&&(d=Mn([d,b.pathnameBase]))}return g}function xr(a,l){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[i,r]=px(a.path,a.caseSensitive,a.end),f=l.match(i);if(!f)return null;let d=f[0],g=d.replace(/(.)\/+$/,"$1"),p=f.slice(1);return{params:r.reduce((v,{paramName:S,isOptional:b},T)=>{if(S==="*"){let j=p[T]||"";g=d.slice(0,d.length-j.length).replace(/(.)\/+$/,"$1")}const q=p[T];return b&&!q?v[S]=void 0:v[S]=(q||"").replace(/%2F/g,"/"),v},{}),pathname:d,pathnameBase:g,pattern:a}}function px(a,l=!1,i=!0){Wt(a==="*"||!a.endsWith("*")||a.endsWith("/*"),`Route path "${a}" will be treated as if it were "${a.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${a.replace(/\*$/,"/*")}".`);let r=[],f="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(g,p,y)=>(r.push({paramName:p,isOptional:y!=null}),y?"/?([^\\/]+)?":"/([^\\/]+)")).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 gx(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Wt(!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 _n(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 yx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vx=a=>yx.test(a);function xx(a,l="/"){let{pathname:i,search:r="",hash:f=""}=typeof a=="string"?xl(a):a,d;if(i)if(vx(i))d=i;else{if(i.includes("//")){let g=i;i=i.replace(/\/\/+/g,"/"),Wt(!1,`Pathnames cannot have embedded double slashes - normalizing ${g} -> ${i}`)}i.startsWith("/")?d=Ep(i.substring(1),"/"):d=Ep(i,l)}else d=l;return{pathname:d,search:Ax(r),hash:jx(f)}}function Ep(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 Io(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 bx(a){return a.filter((l,i)=>i===0||l.route.path&&l.route.path.length>0)}function h0(a){let l=bx(a);return l.map((i,r)=>r===l.length-1?i.pathname:i.pathnameBase)}function m0(a,l,i,r=!1){let f;typeof a=="string"?f=xl(a):(f={...a},Ye(!f.pathname||!f.pathname.includes("?"),Io("?","pathname","search",f)),Ye(!f.pathname||!f.pathname.includes("#"),Io("#","pathname","hash",f)),Ye(!f.search||!f.search.includes("#"),Io("#","search","hash",f)));let d=a===""||f.pathname==="",g=d?"/":f.pathname,p;if(g==null)p=i;else{let b=l.length-1;if(!r&&g.startsWith("..")){let T=g.split("/");for(;T[0]==="..";)T.shift(),b-=1;f.pathname=T.join("/")}p=b>=0?l[b]:"/"}let y=xx(f,p),v=g&&g!=="/"&&g.endsWith("/"),S=(d||g===".")&&i.endsWith("/");return!y.pathname.endsWith("/")&&(v||S)&&(y.pathname+="/"),y}var Mn=a=>a.join("/").replace(/\/\/+/g,"/"),Sx=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),Ax=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,jx=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function Nx(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 p0=["POST","PUT","PATCH","DELETE"];new Set(p0);var Ex=["GET",...p0];new Set(Ex);var bl=m.createContext(null);bl.displayName="DataRouter";var jr=m.createContext(null);jr.displayName="DataRouterState";m.createContext(!1);var g0=m.createContext({isTransitioning:!1});g0.displayName="ViewTransition";var wx=m.createContext(new Map);wx.displayName="Fetchers";var qx=m.createContext(null);qx.displayName="Await";var sn=m.createContext(null);sn.displayName="Navigation";var ks=m.createContext(null);ks.displayName="Location";var kn=m.createContext({outlet:null,matches:[],isDataRoute:!1});kn.displayName="Route";var _u=m.createContext(null);_u.displayName="RouteError";function Cx(a,{relative:l}={}){Ye(Os(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:r}=m.useContext(sn),{hash:f,pathname:d,search:g}=Ds(a,{relative:l}),p=d;return i!=="/"&&(p=d==="/"?i:Mn([i,d])),r.createHref({pathname:p,search:g,hash:f})}function Os(){return m.useContext(ks)!=null}function Ta(){return Ye(Os(),"useLocation() may be used only in the context of a <Router> component."),m.useContext(ks).location}var y0="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function v0(a){m.useContext(sn).static||m.useLayoutEffect(a)}function Tx(){let{isDataRoute:a}=m.useContext(kn);return a?Yx():Mx()}function Mx(){Ye(Os(),"useNavigate() may be used only in the context of a <Router> component.");let a=m.useContext(bl),{basename:l,navigator:i}=m.useContext(sn),{matches:r}=m.useContext(kn),{pathname:f}=Ta(),d=JSON.stringify(h0(r)),g=m.useRef(!1);return v0(()=>{g.current=!0}),m.useCallback((y,v={})=>{if(Wt(g.current,y0),!g.current)return;if(typeof y=="number"){i.go(y);return}let S=m0(y,JSON.parse(d),f,v.relative==="path");a==null&&l!=="/"&&(S.pathname=S.pathname==="/"?l:Mn([l,S.pathname])),(v.replace?i.replace:i.push)(S,v.state,v)},[l,i,d,f,a])}m.createContext(null);function Ds(a,{relative:l}={}){let{matches:i}=m.useContext(kn),{pathname:r}=Ta(),f=JSON.stringify(h0(i));return m.useMemo(()=>m0(a,JSON.parse(f),r,l==="path"),[a,f,r,l])}function Rx(a,l){return x0(a,l)}function x0(a,l,i,r,f){Ye(Os(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:d}=m.useContext(sn),{matches:g}=m.useContext(kn),p=g[g.length-1],y=p?p.params:{},v=p?p.pathname:"/",S=p?p.pathnameBase:"/",b=p&&p.route;{let N=b&&b.path||"";b0(v,!b||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 T=Ta(),q;if(l){let N=typeof l=="string"?xl(l):l;Ye(S==="/"||N.pathname?.startsWith(S),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${S}" but pathname "${N.pathname}" was given in the \`location\` prop.`),q=N}else q=T;let j=q.pathname||"/",R=j;if(S!=="/"){let N=S.replace(/^\//,"").split("/");R="/"+j.replace(/^\//,"").split("/").slice(N.length).join("/")}let A=u0(a,{pathname:R});Wt(b||A!=null,`No routes matched location "${q.pathname}${q.search}${q.hash}" `),Wt(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 "${q.pathname}${q.search}${q.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=zx(A&&A.map(N=>Object.assign({},N,{params:Object.assign({},y,N.params),pathname:Mn([S,d.encodeLocation?d.encodeLocation(N.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?S:Mn([S,d.encodeLocation?d.encodeLocation(N.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:N.pathnameBase])})),g,i,r,f);return l&&E?m.createElement(ks.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...q},navigationType:"POP"}},E):E}function _x(){let a=Vx(),l=Nx(a)?`${a.status} ${a.statusText}`:a instanceof Error?a.message:JSON.stringify(a),i=a instanceof Error?a.stack:null,r="rgba(200,200,200, 0.5)",f={padding:"0.5rem",backgroundColor:r},d={padding:"2px 4px",backgroundColor:r},g=null;return console.error("Error handled by React Router default ErrorBoundary:",a),g=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,g)}var kx=m.createElement(_x,null),Ox=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(_u.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function Dx({routeContext:a,match:l,children:i}){let r=m.useContext(bl);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 zx(a,l=[],i=null,r=null,f=null){if(a==null){if(!i)return null;if(i.errors)a=i.matches;else if(l.length===0&&!i.initialized&&i.matches.length>0)a=i.matches;else return null}let d=a,g=i?.errors;if(g!=null){let S=d.findIndex(b=>b.route.id&&g?.[b.route.id]!==void 0);Ye(S>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(g).join(",")}`),d=d.slice(0,Math.min(d.length,S+1))}let p=!1,y=-1;if(i)for(let S=0;S<d.length;S++){let b=d[S];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(y=S),b.route.id){let{loaderData:T,errors:q}=i,j=b.route.loader&&!T.hasOwnProperty(b.route.id)&&(!q||q[b.route.id]===void 0);if(b.route.lazy||j){p=!0,y>=0?d=d.slice(0,y+1):d=[d[0]];break}}}let v=i&&r?(S,b)=>{r(S,{location:i.location,params:i.matches?.[0]?.params??{},errorInfo:b})}:void 0;return d.reduceRight((S,b,T)=>{let q,j=!1,R=null,A=null;i&&(q=g&&b.route.id?g[b.route.id]:void 0,R=b.route.errorElement||kx,p&&(y<0&&T===0?(b0("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),j=!0,A=null):y===T&&(j=!0,A=b.route.hydrateFallbackElement||null)));let E=l.concat(d.slice(0,T+1)),N=()=>{let k;return q?k=R:j?k=A:b.route.Component?k=m.createElement(b.route.Component,null):b.route.element?k=b.route.element:k=S,m.createElement(Dx,{match:b,routeContext:{outlet:S,matches:E,isDataRoute:i!=null},children:k})};return i&&(b.route.ErrorBoundary||b.route.errorElement||T===0)?m.createElement(Ox,{location:i.location,revalidation:i.revalidation,component:R,error:q,children:N(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:v}):N()},null)}function ku(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Bx(a){let l=m.useContext(bl);return Ye(l,ku(a)),l}function Lx(a){let l=m.useContext(jr);return Ye(l,ku(a)),l}function Ux(a){let l=m.useContext(kn);return Ye(l,ku(a)),l}function Ou(a){let l=Ux(a),i=l.matches[l.matches.length-1];return Ye(i.route.id,`${a} can only be used on routes that contain a unique "id"`),i.route.id}function Hx(){return Ou("useRouteId")}function Vx(){let a=m.useContext(_u),l=Lx("useRouteError"),i=Ou("useRouteError");return a!==void 0?a:l.errors?.[i]}function Yx(){let{router:a}=Bx("useNavigate"),l=Ou("useNavigate"),i=m.useRef(!1);return v0(()=>{i.current=!0}),m.useCallback(async(f,d={})=>{Wt(i.current,y0),i.current&&(typeof f=="number"?a.navigate(f):await a.navigate(f,{fromRouteId:l,...d}))},[a,l])}var wp={};function b0(a,l,i){!l&&!wp[a]&&(wp[a]=!0,Wt(!1,i))}m.memo(Gx);function Gx({routes:a,future:l,state:i,unstable_onError:r}){return x0(a,void 0,i,r,l)}function ur(a){Ye(!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 Qx({basename:a="/",children:l=null,location:i,navigationType:r="POP",navigator:f,static:d=!1}){Ye(!Os(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let g=a.replace(/^\/*/,"/"),p=m.useMemo(()=>({basename:g,navigator:f,static:d,future:{}}),[g,f,d]);typeof i=="string"&&(i=xl(i));let{pathname:y="/",search:v="",hash:S="",state:b=null,key:T="default"}=i,q=m.useMemo(()=>{let j=_n(y,g);return j==null?null:{location:{pathname:j,search:v,hash:S,state:b,key:T},navigationType:r}},[g,y,v,S,b,T,r]);return Wt(q!=null,`<Router basename="${g}"> is not able to match the URL "${y}${v}${S}" because it does not start with the basename, so the <Router> won't render anything.`),q==null?null:m.createElement(sn.Provider,{value:p},m.createElement(ks.Provider,{children:l,value:q}))}function Xx({children:a,location:l}){return Rx(yu(a),l)}function yu(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,yu(r.props.children,d));return}Ye(r.type===ur,`[${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>`),Ye(!r.props.index||!r.props.children,"An index route cannot have child routes.");let g={id:r.props.id||d.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(g.children=yu(r.props.children,d)),i.push(g)}),i}var fr="get",dr="application/x-www-form-urlencoded";function Nr(a){return a!=null&&typeof a.tagName=="string"}function $x(a){return Nr(a)&&a.tagName.toLowerCase()==="button"}function Kx(a){return Nr(a)&&a.tagName.toLowerCase()==="form"}function Zx(a){return Nr(a)&&a.tagName.toLowerCase()==="input"}function Jx(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function Fx(a,l){return a.button===0&&(!l||l==="_self")&&!Jx(a)}var tr=null;function Ix(){if(tr===null)try{new FormData(document.createElement("form"),0),tr=!1}catch{tr=!0}return tr}var Wx=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Wo(a){return a!=null&&!Wx.has(a)?(Wt(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${dr}"`),null):a}function Px(a,l){let i,r,f,d,g;if(Kx(a)){let p=a.getAttribute("action");r=p?_n(p,l):null,i=a.getAttribute("method")||fr,f=Wo(a.getAttribute("enctype"))||dr,d=new FormData(a)}else if($x(a)||Zx(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 y=a.getAttribute("formaction")||p.getAttribute("action");if(r=y?_n(y,l):null,i=a.getAttribute("formmethod")||p.getAttribute("method")||fr,f=Wo(a.getAttribute("formenctype"))||Wo(p.getAttribute("enctype"))||dr,d=new FormData(p,a),!Ix()){let{name:v,type:S,value:b}=a;if(S==="image"){let T=v?`${v}.`:"";d.append(`${T}x`,"0"),d.append(`${T}y`,"0")}else v&&d.append(v,b)}}else{if(Nr(a))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=fr,r=null,f=dr,g=a}return d&&f==="text/plain"&&(g=d,d=void 0),{action:r,method:i.toLowerCase(),encType:f,formData:d,body:g}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Du(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function eb(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&&_n(r.pathname,l)==="/"?r.pathname=`${l.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function tb(a,l){if(a.id in l)return l[a.id];try{let i=await import(a.module);return l[a.id]=i,i}catch(i){return console.error(`Error loading route module \`${a.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function nb(a){return a==null?!1:a.href==null?a.rel==="preload"&&typeof a.imageSrcSet=="string"&&typeof a.imageSizes=="string":typeof a.rel=="string"&&typeof a.href=="string"}async function ab(a,l,i){let r=await Promise.all(a.map(async f=>{let d=l.routes[f.route.id];if(d){let g=await tb(d,i);return g.links?g.links():[]}return[]}));return rb(r.flat(1).filter(nb).filter(f=>f.rel==="stylesheet"||f.rel==="preload").map(f=>f.rel==="stylesheet"?{...f,rel:"prefetch",as:"style"}:{...f,rel:"prefetch"}))}function qp(a,l,i,r,f,d){let g=(y,v)=>i[v]?y.route.id!==i[v].route.id:!0,p=(y,v)=>i[v].pathname!==y.pathname||i[v].route.path?.endsWith("*")&&i[v].params["*"]!==y.params["*"];return d==="assets"?l.filter((y,v)=>g(y,v)||p(y,v)):d==="data"?l.filter((y,v)=>{let S=r.routes[y.route.id];if(!S||!S.hasLoader)return!1;if(g(y,v)||p(y,v))return!0;if(y.route.shouldRevalidate){let b=y.route.shouldRevalidate({currentUrl:new URL(f.pathname+f.search+f.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(a,window.origin),nextParams:y.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function lb(a,l,{includeHydrateFallback:i}={}){return sb(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 sb(a){return[...new Set(a)]}function ib(a){let l={},i=Object.keys(a).sort();for(let r of i)l[r]=a[r];return l}function rb(a,l){let i=new Set;return new Set(l),a.reduce((r,f)=>{let d=JSON.stringify(ib(f));return i.has(d)||(i.add(d),r.push({key:d,link:f})),r},[])}function S0(){let a=m.useContext(bl);return Du(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function cb(){let a=m.useContext(jr);return Du(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var zu=m.createContext(void 0);zu.displayName="FrameworkContext";function A0(){let a=m.useContext(zu);return Du(a,"You must render this element inside a <HydratedRouter> element"),a}function ob(a,l){let i=m.useContext(zu),[r,f]=m.useState(!1),[d,g]=m.useState(!1),{onFocus:p,onBlur:y,onMouseEnter:v,onMouseLeave:S,onTouchStart:b}=l,T=m.useRef(null);m.useEffect(()=>{if(a==="render"&&g(!0),a==="viewport"){let R=E=>{E.forEach(N=>{g(N.isIntersecting)})},A=new IntersectionObserver(R,{threshold:.5});return T.current&&A.observe(T.current),()=>{A.disconnect()}}},[a]),m.useEffect(()=>{if(r){let R=setTimeout(()=>{g(!0)},100);return()=>{clearTimeout(R)}}},[r]);let q=()=>{f(!0)},j=()=>{f(!1),g(!1)};return i?a!=="intent"?[d,T,{}]:[d,T,{onFocus:Ss(p,q),onBlur:Ss(y,j),onMouseEnter:Ss(v,q),onMouseLeave:Ss(S,j),onTouchStart:Ss(b,q)}]:[!1,T,{}]}function Ss(a,l){return i=>{a&&a(i),i.defaultPrevented||l(i)}}function ub({page:a,...l}){let{router:i}=S0(),r=m.useMemo(()=>u0(i.routes,a,i.basename),[i.routes,a,i.basename]);return r?m.createElement(db,{page:a,matches:r,...l}):null}function fb(a){let{manifest:l,routeModules:i}=A0(),[r,f]=m.useState([]);return m.useEffect(()=>{let d=!1;return ab(a,l,i).then(g=>{d||f(g)}),()=>{d=!0}},[a,l,i]),r}function db({page:a,matches:l,...i}){let r=Ta(),{manifest:f,routeModules:d}=A0(),{basename:g}=S0(),{loaderData:p,matches:y}=cb(),v=m.useMemo(()=>qp(a,l,y,f,r,"data"),[a,l,y,f,r]),S=m.useMemo(()=>qp(a,l,y,f,r,"assets"),[a,l,y,f,r]),b=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(k=>k.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=eb(a,g,"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]},[g,p,r,f,v,l,a,d]),T=m.useMemo(()=>lb(S,f),[S,f]),q=fb(S);return m.createElement(m.Fragment,null,b.map(j=>m.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...i})),T.map(j=>m.createElement("link",{key:j,rel:"modulepreload",href:j,...i})),q.map(({key:j,link:R})=>m.createElement("link",{key:j,nonce:i.nonce,...R})))}function hb(...a){return l=>{a.forEach(i=>{typeof i=="function"?i(l):i!=null&&(i.current=l)})}}var j0=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{j0&&(window.__reactRouterVersion="7.9.6")}catch{}function mb({basename:a,children:l,window:i}){let r=m.useRef();r.current==null&&(r.current=ex({window:i,v5Compat:!0}));let f=r.current,[d,g]=m.useState({action:f.action,location:f.location}),p=m.useCallback(y=>{m.startTransition(()=>g(y))},[g]);return m.useLayoutEffect(()=>f.listen(p),[f,p]),m.createElement(Qx,{basename:a,children:l,location:d.location,navigationType:d.action,navigator:f})}var N0=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,E0=m.forwardRef(function({onClick:l,discover:i="render",prefetch:r="none",relative:f,reloadDocument:d,replace:g,state:p,target:y,to:v,preventScrollReset:S,viewTransition:b,...T},q){let{basename:j}=m.useContext(sn),R=typeof v=="string"&&N0.test(v),A,E=!1;if(typeof v=="string"&&R&&(A=v,j0))try{let I=new URL(window.location.href),te=v.startsWith("//")?new URL(I.protocol+v):new URL(v),ne=_n(te.pathname,j);te.origin===I.origin&&ne!=null?v=ne+te.search+te.hash:E=!0}catch{Wt(!1,`<Link to="${v}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let N=Cx(v,{relative:f}),[k,Z,V]=ob(r,T),G=vb(v,{replace:g,state:p,target:y,preventScrollReset:S,relative:f,viewTransition:b});function $(I){l&&l(I),I.defaultPrevented||G(I)}let P=m.createElement("a",{...T,...V,href:A||N,onClick:E||d?l:$,ref:hb(q,Z),target:y,"data-discover":!R&&i==="render"?"true":void 0});return k&&!R?m.createElement(m.Fragment,null,P,m.createElement(ub,{page:N})):P});E0.displayName="Link";var pb=m.forwardRef(function({"aria-current":l="page",caseSensitive:i=!1,className:r="",end:f=!1,style:d,to:g,viewTransition:p,children:y,...v},S){let b=Ds(g,{relative:v.relative}),T=Ta(),q=m.useContext(jr),{navigator:j,basename:R}=m.useContext(sn),A=q!=null&&jb(b)&&p===!0,E=j.encodeLocation?j.encodeLocation(b).pathname:b.pathname,N=T.pathname,k=q&&q.navigation&&q.navigation.location?q.navigation.location.pathname:null;i||(N=N.toLowerCase(),k=k?k.toLowerCase():null,E=E.toLowerCase()),k&&R&&(k=_n(k,R)||k);const Z=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let V=N===E||!f&&N.startsWith(E)&&N.charAt(Z)==="/",G=k!=null&&(k===E||!f&&k.startsWith(E)&&k.charAt(E.length)==="/"),$={isActive:V,isPending:G,isTransitioning:A},P=V?l:void 0,I;typeof r=="function"?I=r($):I=[r,V?"active":null,G?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let te=typeof d=="function"?d($):d;return m.createElement(E0,{...v,"aria-current":P,className:I,ref:S,style:te,to:g,viewTransition:p},typeof y=="function"?y($):y)});pb.displayName="NavLink";var gb=m.forwardRef(({discover:a="render",fetcherKey:l,navigate:i,reloadDocument:r,replace:f,state:d,method:g=fr,action:p,onSubmit:y,relative:v,preventScrollReset:S,viewTransition:b,...T},q)=>{let j=Sb(),R=Ab(p,{relative:v}),A=g.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&N0.test(p),N=k=>{if(y&&y(k),k.defaultPrevented)return;k.preventDefault();let Z=k.nativeEvent.submitter,V=Z?.getAttribute("formmethod")||g;j(Z||k.currentTarget,{fetcherKey:l,method:V,navigate:i,replace:f,state:d,relative:v,preventScrollReset:S,viewTransition:b})};return m.createElement("form",{ref:q,method:A,action:R,onSubmit:r?y:N,...T,"data-discover":!E&&a==="render"?"true":void 0})});gb.displayName="Form";function yb(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function w0(a){let l=m.useContext(bl);return Ye(l,yb(a)),l}function vb(a,{target:l,replace:i,state:r,preventScrollReset:f,relative:d,viewTransition:g}={}){let p=Tx(),y=Ta(),v=Ds(a,{relative:d});return m.useCallback(S=>{if(Fx(S,l)){S.preventDefault();let b=i!==void 0?i:Cs(y)===Cs(v);p(a,{replace:b,state:r,preventScrollReset:f,relative:d,viewTransition:g})}},[y,p,v,i,r,l,a,f,d,g])}var xb=0,bb=()=>`__${String(++xb)}__`;function Sb(){let{router:a}=w0("useSubmit"),{basename:l}=m.useContext(sn),i=Hx();return m.useCallback(async(r,f={})=>{let{action:d,method:g,encType:p,formData:y,body:v}=Px(r,l);if(f.navigate===!1){let S=f.fetcherKey||bb();await a.fetch(S,i,f.action||d,{preventScrollReset:f.preventScrollReset,formData:y,body:v,formMethod:f.method||g,formEncType:f.encType||p,flushSync:f.flushSync})}else await a.navigate(f.action||d,{preventScrollReset:f.preventScrollReset,formData:y,body:v,formMethod:f.method||g,formEncType:f.encType||p,replace:f.replace,state:f.state,fromRouteId:i,flushSync:f.flushSync,viewTransition:f.viewTransition})},[a,l,i])}function Ab(a,{relative:l}={}){let{basename:i}=m.useContext(sn),r=m.useContext(kn);Ye(r,"useFormAction must be used inside a RouteContext");let[f]=r.matches.slice(-1),d={...Ds(a||".",{relative:l})},g=Ta();if(a==null){d.search=g.search;let p=new URLSearchParams(d.search),y=p.getAll("index");if(y.some(S=>S==="")){p.delete("index"),y.filter(b=>b).forEach(b=>p.append("index",b));let S=p.toString();d.search=S?`?${S}`:""}}return(!a||a===".")&&f.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(d.pathname=d.pathname==="/"?i:Mn([i,d.pathname])),Cs(d)}function jb(a,{relative:l}={}){let i=m.useContext(g0);Ye(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=w0("useViewTransitionState"),f=Ds(a,{relative:l});if(!i.isTransitioning)return!1;let d=_n(i.currentLocation.pathname,r)||i.currentLocation.pathname,g=_n(i.nextLocation.pathname,r)||i.nextLocation.pathname;return xr(f.pathname,g)!=null||xr(f.pathname,d)!=null}const ln=Object.create(null);ln.open="0";ln.close="1";ln.ping="2";ln.pong="3";ln.message="4";ln.upgrade="5";ln.noop="6";const hr=Object.create(null);Object.keys(ln).forEach(a=>{hr[ln[a]]=a});const vu={type:"error",data:"parser error"},q0=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",C0=typeof ArrayBuffer=="function",T0=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer,Bu=({type:a,data:l},i,r)=>q0&&l instanceof Blob?i?r(l):Cp(l,r):C0&&(l instanceof ArrayBuffer||T0(l))?i?r(l):Cp(new Blob([l]),r):r(ln[a]+(l||"")),Cp=(a,l)=>{const i=new FileReader;return i.onload=function(){const r=i.result.split(",")[1];l("b"+(r||""))},i.readAsDataURL(a)};function Tp(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}let Po;function Nb(a,l){if(q0&&a.data instanceof Blob)return a.data.arrayBuffer().then(Tp).then(l);if(C0&&(a.data instanceof ArrayBuffer||T0(a.data)))return l(Tp(a.data));Bu(a,!1,i=>{Po||(Po=new TextEncoder),l(Po.encode(i))})}const Mp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Es=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let a=0;a<Mp.length;a++)Es[Mp.charCodeAt(a)]=a;const Eb=a=>{let l=a.length*.75,i=a.length,r,f=0,d,g,p,y;a[a.length-1]==="="&&(l--,a[a.length-2]==="="&&l--);const v=new ArrayBuffer(l),S=new Uint8Array(v);for(r=0;r<i;r+=4)d=Es[a.charCodeAt(r)],g=Es[a.charCodeAt(r+1)],p=Es[a.charCodeAt(r+2)],y=Es[a.charCodeAt(r+3)],S[f++]=d<<2|g>>4,S[f++]=(g&15)<<4|p>>2,S[f++]=(p&3)<<6|y&63;return v},wb=typeof ArrayBuffer=="function",Lu=(a,l)=>{if(typeof a!="string")return{type:"message",data:M0(a,l)};const i=a.charAt(0);return i==="b"?{type:"message",data:qb(a.substring(1),l)}:hr[i]?a.length>1?{type:hr[i],data:a.substring(1)}:{type:hr[i]}:vu},qb=(a,l)=>{if(wb){const i=Eb(a);return M0(i,l)}else return{base64:!0,data:a}},M0=(a,l)=>{switch(l){case"blob":return a instanceof Blob?a:new Blob([a]);case"arraybuffer":default:return a instanceof ArrayBuffer?a:a.buffer}},R0="",Cb=(a,l)=>{const i=a.length,r=new Array(i);let f=0;a.forEach((d,g)=>{Bu(d,!1,p=>{r[g]=p,++f===i&&l(r.join(R0))})})},Tb=(a,l)=>{const i=a.split(R0),r=[];for(let f=0;f<i.length;f++){const d=Lu(i[f],l);if(r.push(d),d.type==="error")break}return r};function Mb(){return new TransformStream({transform(a,l){Nb(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 eu;function nr(a){return a.reduce((l,i)=>l+i.length,0)}function ar(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 Rb(a,l){eu||(eu=new TextDecoder);const i=[];let r=0,f=-1,d=!1;return new TransformStream({transform(g,p){for(i.push(g);;){if(r===0){if(nr(i)<1)break;const y=ar(i,1);d=(y[0]&128)===128,f=y[0]&127,f<126?r=3:f===126?r=1:r=2}else if(r===1){if(nr(i)<2)break;const y=ar(i,2);f=new DataView(y.buffer,y.byteOffset,y.length).getUint16(0),r=3}else if(r===2){if(nr(i)<8)break;const y=ar(i,8),v=new DataView(y.buffer,y.byteOffset,y.length),S=v.getUint32(0);if(S>Math.pow(2,21)-1){p.enqueue(vu);break}f=S*Math.pow(2,32)+v.getUint32(4),r=3}else{if(nr(i)<f)break;const y=ar(i,f);p.enqueue(Lu(d?y:eu.decode(y),l)),r=0}if(f===0||f>a){p.enqueue(vu);break}}}})}const _0=4;function Pe(a){if(a)return _b(a)}function _b(a){for(var l in Pe.prototype)a[l]=Pe.prototype[l];return a}Pe.prototype.on=Pe.prototype.addEventListener=function(a,l){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(l),this};Pe.prototype.once=function(a,l){function i(){this.off(a,i),l.apply(this,arguments)}return i.fn=l,this.on(a,i),this};Pe.prototype.off=Pe.prototype.removeListener=Pe.prototype.removeAllListeners=Pe.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};Pe.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};Pe.prototype.emitReserved=Pe.prototype.emit;Pe.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks["$"+a]||[]};Pe.prototype.hasListeners=function(a){return!!this.listeners(a).length};const Er=typeof Promise=="function"&&typeof Promise.resolve=="function"?l=>Promise.resolve().then(l):(l,i)=>i(l,0),Yt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),kb="arraybuffer";function k0(a,...l){return l.reduce((i,r)=>(a.hasOwnProperty(r)&&(i[r]=a[r]),i),{})}const Ob=Yt.setTimeout,Db=Yt.clearTimeout;function wr(a,l){l.useNativeTimers?(a.setTimeoutFn=Ob.bind(Yt),a.clearTimeoutFn=Db.bind(Yt)):(a.setTimeoutFn=Yt.setTimeout.bind(Yt),a.clearTimeoutFn=Yt.clearTimeout.bind(Yt))}const zb=1.33;function Bb(a){return typeof a=="string"?Lb(a):Math.ceil((a.byteLength||a.size)*zb)}function Lb(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 O0(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ub(a){let l="";for(let i in a)a.hasOwnProperty(i)&&(l.length&&(l+="&"),l+=encodeURIComponent(i)+"="+encodeURIComponent(a[i]));return l}function Hb(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 Vb extends Error{constructor(l,i,r){super(l),this.description=i,this.context=r,this.type="TransportError"}}class Uu extends Pe{constructor(l){super(),this.writable=!1,wr(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 Vb(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=Lu(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=Ub(l);return i.length?"?"+i:""}}class Yb extends Uu{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)};Tb(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,Cb(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]=O0()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(l,i)}}let D0=!1;try{D0=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Gb=D0;function Qb(){}class Xb extends Yb{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 an extends Pe{constructor(l,i,r){super(),this.createRequest=l,wr(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=k0(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=an.requestsCount++,an.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=Qb,l)try{this._xhr.abort()}catch{}typeof document<"u"&&delete an.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()}}an.requestsCount=0;an.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Rp);else if(typeof addEventListener=="function"){const a="onpagehide"in Yt?"pagehide":"unload";addEventListener(a,Rp,!1)}}function Rp(){for(let a in an.requests)an.requests.hasOwnProperty(a)&&an.requests[a].abort()}const $b=(function(){const a=z0({xdomain:!1});return a&&a.responseType!==null})();class Kb extends Xb{constructor(l){super(l);const i=l&&l.forceBase64;this.supportsBinary=$b&&!i}request(l={}){return Object.assign(l,{xd:this.xd},this.opts),new an(z0,this.uri(),l)}}function z0(a){const l=a.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!l||Gb))return new XMLHttpRequest}catch{}if(!l)try{return new Yt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const B0=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Zb extends Uu{get name(){return"websocket"}doOpen(){const l=this.uri(),i=this.opts.protocols,r=B0?{}:k0(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;Bu(r,this.supportsBinary,d=>{try{this.doWrite(r,d)}catch{}f&&Er(()=>{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]=O0()),this.supportsBinary||(i.b64=1),this.createUri(l,i)}}const tu=Yt.WebSocket||Yt.MozWebSocket;class Jb extends Zb{createSocket(l,i,r){return B0?new tu(l,i,r):i?new tu(l,i):new tu(l)}doWrite(l,i){this.ws.send(i)}}class Fb extends Uu{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=Rb(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=l.readable.pipeThrough(i).getReader(),f=Mb();f.readable.pipeTo(l.writable),this._writer=f.writable.getWriter();const d=()=>{r.read().then(({done:p,value:y})=>{p||(this.onPacket(y),d())}).catch(p=>{})};d();const g={type:"open"};this.query.sid&&(g.data=`{"sid":"${this.query.sid}"}`),this._writer.write(g).then(()=>this.onOpen())})})}write(l){this.writable=!1;for(let i=0;i<l.length;i++){const r=l[i],f=i===l.length-1;this._writer.write(r).then(()=>{f&&Er(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var l;(l=this._transport)===null||l===void 0||l.close()}}const Ib={websocket:Jb,webtransport:Fb,polling:Kb},Wb=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Pb=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function xu(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=Wb.exec(a||""),d={},g=14;for(;g--;)d[Pb[g]]=f[g]||"";return i!=-1&&r!=-1&&(d.source=l,d.host=d.host.substring(1,d.host.length-1).replace(/;/g,":"),d.authority=d.authority.replace("[","").replace("]","").replace(/;/g,":"),d.ipv6uri=!0),d.pathNames=e1(d,d.path),d.queryKey=t1(d,d.query),d}function e1(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 t1(a,l){const i={};return l.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,f,d){f&&(i[f]=d)}),i}const bu=typeof addEventListener=="function"&&typeof removeEventListener=="function",mr=[];bu&&addEventListener("offline",()=>{mr.forEach(a=>a())},!1);class ra extends Pe{constructor(l,i){if(super(),this.binaryType=kb,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=xu(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=xu(i.host).host);wr(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=Hb(this.opts.query)),bu&&(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"})},mr.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(l){const i=Object.assign({},this.opts.query);i.EIO=_0,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&&ra.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",ra.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+=Bb(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,Er(()=>{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(ra.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(),bu&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=mr.indexOf(this._offlineEventListener);r!==-1&&mr.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",l,i),this.writeBuffer=[],this._prevBufferLen=0}}}ra.protocol=_0;class n1 extends ra{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;ra.priorWebsocketSuccess=!1;const f=()=>{r||(i.send([{type:"ping",data:"probe"}]),i.once("packet",b=>{if(!r)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;ra.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(S(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{const T=new Error("probe error");T.transport=i.name,this.emitReserved("upgradeError",T)}}))};function d(){r||(r=!0,S(),i.close(),i=null)}const g=b=>{const T=new Error("probe error: "+b);T.transport=i.name,d(),this.emitReserved("upgradeError",T)};function p(){g("transport closed")}function y(){g("socket closed")}function v(b){i&&b.name!==i.name&&d()}const S=()=>{i.removeListener("open",f),i.removeListener("error",g),i.removeListener("close",p),this.off("close",y),this.off("upgrading",v)};i.once("open",f),i.once("error",g),i.once("close",p),this.once("close",y),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 a1=class extends n1{constructor(l,i={}){const r=typeof l=="object"?l:i;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(f=>Ib[f]).filter(f=>!!f)),super(l,r)}};function l1(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=xu(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 s1=typeof ArrayBuffer=="function",i1=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,L0=Object.prototype.toString,r1=typeof Blob=="function"||typeof Blob<"u"&&L0.call(Blob)==="[object BlobConstructor]",c1=typeof File=="function"||typeof File<"u"&&L0.call(File)==="[object FileConstructor]";function Hu(a){return s1&&(a instanceof ArrayBuffer||i1(a))||r1&&a instanceof Blob||c1&&a instanceof File}function pr(a,l){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let i=0,r=a.length;i<r;i++)if(pr(a[i]))return!0;return!1}if(Hu(a))return!0;if(a.toJSON&&typeof a.toJSON=="function"&&arguments.length===1)return pr(a.toJSON(),!0);for(const i in a)if(Object.prototype.hasOwnProperty.call(a,i)&&pr(a[i]))return!0;return!1}function o1(a){const l=[],i=a.data,r=a;return r.data=Su(i,l),r.attachments=l.length,{packet:r,buffers:l}}function Su(a,l){if(!a)return a;if(Hu(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]=Su(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]=Su(a[r],l));return i}return a}function u1(a,l){return a.data=Au(a.data,l),delete a.attachments,a}function Au(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]=Au(a[i],l);else if(typeof a=="object")for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&(a[i]=Au(a[i],l));return a}const f1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],d1=5;var je;(function(a){a[a.CONNECT=0]="CONNECT",a[a.DISCONNECT=1]="DISCONNECT",a[a.EVENT=2]="EVENT",a[a.ACK=3]="ACK",a[a.CONNECT_ERROR=4]="CONNECT_ERROR",a[a.BINARY_EVENT=5]="BINARY_EVENT",a[a.BINARY_ACK=6]="BINARY_ACK"})(je||(je={}));class h1{constructor(l){this.replacer=l}encode(l){return(l.type===je.EVENT||l.type===je.ACK)&&pr(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=o1(l),r=this.encodeAsString(i.packet),f=i.buffers;return f.unshift(r),f}}function _p(a){return Object.prototype.toString.call(a)==="[object Object]"}class Vu extends Pe{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 m1(i),i.attachments===0&&super.emitReserved("decoded",i)):super.emitReserved("decoded",i)}else if(Hu(l)||l.base64)if(this.reconstructor)i=this.reconstructor.takeBinaryData(l),i&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+l)}decodeString(l){let i=0;const r={type:Number(l.charAt(0))};if(je[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===je.BINARY_EVENT||r.type===je.BINARY_ACK){const d=i+1;for(;l.charAt(++i)!=="-"&&i!=l.length;);const g=l.substring(d,i);if(g!=Number(g)||l.charAt(i)!=="-")throw new Error("Illegal attachments");r.attachments=Number(g)}if(l.charAt(i+1)==="/"){const d=i+1;for(;++i&&!(l.charAt(i)===","||i===l.length););r.nsp=l.substring(d,i)}else r.nsp="/";const f=l.charAt(i+1);if(f!==""&&Number(f)==f){const d=i+1;for(;++i;){const g=l.charAt(i);if(g==null||Number(g)!=g){--i;break}if(i===l.length)break}r.id=Number(l.substring(d,i+1))}if(l.charAt(++i)){const d=this.tryParse(l.substr(i));if(Vu.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 _p(i);case je.DISCONNECT:return i===void 0;case je.CONNECT_ERROR:return typeof i=="string"||_p(i);case je.EVENT:case je.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&f1.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 m1{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=u1(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const p1=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Vu,Encoder:h1,get PacketType(){return je},protocol:d1},Symbol.toStringTag,{value:"Module"}));function Jt(a,l,i){return a.on(l,i),function(){a.off(l,i)}}const g1=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class U0 extends Pe{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=[Jt(l,"open",this.onopen.bind(this)),Jt(l,"packet",this.onpacket.bind(this)),Jt(l,"error",this.onerror.bind(this)),Jt(l,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...l){return l.unshift("message"),this.emit.apply(this,l),this}emit(l,...i){var r,f,d;if(g1.hasOwnProperty(l))throw new Error('"'+l.toString()+'" is a reserved event name');if(i.unshift(l),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;const g={type:je.EVENT,data:i};if(g.options={},g.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const S=this.ids++,b=i.pop();this._registerAckCallback(S,b),g.id=S}const p=(f=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||f===void 0?void 0:f.writable,y=this.connected&&!(!((d=this.io.engine)===null||d===void 0)&&d._hasPingExpired());return this.flags.volatile&&!p||(y?(this.notifyOutgoingListeners(g),this.packet(g)):this.sendBuffer.push(g)),this.flags={},this}_registerAckCallback(l,i){var r;const f=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(f===void 0){this.acks[l]=i;return}const d=this.io.setTimeoutFn(()=>{delete this.acks[l];for(let 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),g=(...p)=>{this.io.clearTimeoutFn(d),i.apply(this,p)};g.withError=!0,this.acks[l]=g}emitWithAck(l,...i){return new Promise((r,f)=>{const d=(g,p)=>g?f(g):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 Sl(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}Sl.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};Sl.prototype.reset=function(){this.attempts=0};Sl.prototype.setMin=function(a){this.ms=a};Sl.prototype.setMax=function(a){this.max=a};Sl.prototype.setJitter=function(a){this.jitter=a};class ju extends Pe{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,wr(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 Sl({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||p1;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 a1(this.uri,this.opts);const i=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const f=Jt(i,"open",function(){r.onopen(),l&&l()}),d=p=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",p),l?l(p):this.maybeReconnectOnOpen()},g=Jt(i,"error",d);if(this._timeout!==!1){const p=this._timeout,y=this.setTimeoutFn(()=>{f(),d(new Error("timeout")),i.close()},p);this.opts.autoUnref&&y.unref(),this.subs.push(()=>{this.clearTimeoutFn(y)})}return this.subs.push(f),this.subs.push(g),this}connect(l){return this.open(l)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const l=this.engine;this.subs.push(Jt(l,"ping",this.onping.bind(this)),Jt(l,"data",this.ondata.bind(this)),Jt(l,"error",this.onerror.bind(this)),Jt(l,"close",this.onclose.bind(this)),Jt(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){Er(()=>{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 U0(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 As={};function gr(a,l){typeof a=="object"&&(l=a,a=void 0),l=l||{};const i=l1(a,l.path||"/socket.io"),r=i.source,f=i.id,d=i.path,g=As[f]&&d in As[f].nsps,p=l.forceNew||l["force new connection"]||l.multiplex===!1||g;let y;return p?y=new ju(r,l):(As[f]||(As[f]=new ju(r,l)),y=As[f]),i.query&&!l.query&&(l.query=i.queryKey),y.socket(i.path,l)}Object.assign(gr,{Manager:ju,Socket:U0,io:gr,connect:gr});const H0="roverSettings",y1=3600*24*365;function v1(a){try{const l=decodeURIComponent(a??"");return JSON.parse(l)}catch(l){return console.warn("Failed to parse settings cookie",l),null}}function Nu(){if(typeof document>"u")return{};const a=`${H0}=`,l=document.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(a));if(!l)return{};const i=l.substring(a.length);return v1(i)??{}}function kp(a){if(typeof document>"u")return!1;try{const l=encodeURIComponent(JSON.stringify(a??{})),i=`${H0}=${l}; path=/; max-age=${y1}; samesite=strict`;return document.cookie=i,!0}catch(l){return console.warn("Failed to write settings cookie",l),!1}}const V0=window.location.origin;console.info("[socket] connecting to",V0);const x1=Nu(),b1=x1?.page?.connectionTransport||"websocket",S1=b1==="polling"?["polling"]:["websocket","polling"],Yu=gr(V0,{transports:S1,timeout:15e3});Yu.on("connect_error",a=>console.error("connect_error",a.code,a.message,a.data));const Y0=m.createContext(Yu),A1=({children:a})=>o.jsx(Y0.Provider,{value:Yu,children:a}),rn=()=>m.useContext(Y0),G0=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 j1(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 N1({children:a}){const l=rn(),i=j1(l),[r,f]=m.useState(null),[d,g]=m.useState([]),[p,y]=m.useState([]),[v,S]=m.useState(l.connected);m.useEffect(()=>{const q=()=>S(!0),j=()=>S(!1);return l.on("connect",q),l.on("disconnect",j),()=>{l.off("connect",q),l.off("disconnect",j)}},[l]),m.useEffect(()=>{function q(A){f(A)}function j(A=[]){g(A)}function R(A){g(E=>[...E.slice(-199),A])}return l.on("session:sync",q),l.on("log:init",j),l.on("log:entry",R),l.on("alert:new",(A={})=>{y(E=>[...E.slice(-49),{...A,receivedAt:Date.now()}])}),()=>{l.off("session:sync",q),l.off("log:init",j),l.off("log:entry",R),l.off("alert:new")}},[l]);const b=m.useMemo(()=>({login:(q,j)=>i("auth:login",{username:q,password:j}),setRole:q=>i("session:setRole",{role:q}),requestControl:(q,j={})=>i("session:requestControl",{roverId:q,...j}),releaseControl:q=>i("session:releaseControl",{roverId:q}),subscribeAll:()=>i("session:subscribeAll"),lockRover:(q,j)=>i("session:lockRover",{roverId:q,locked:j}),setMode:q=>i("setMode",{mode:q}),homeAssistantToggle:q=>i("homeAssistant:toggle",{entityId:q}),homeAssistantSetState:(q,j)=>i("homeAssistant:setState",{entityId:q,state:j}),setNickname:q=>i("nickname:set",{nickname:q}),triggerReplay:(q=[])=>i("replay:trigger",{sources:q}),setCommunityGoal:q=>i("communityGoal:set",{text:q}),pushAlert:q=>y(j=>[...j.slice(-49),{...q,receivedAt:Date.now(),id:q.id||Math.random().toString(36).slice(2)}])}),[i]),T=m.useMemo(()=>({connected:v,session:r,logs:d,alerts:p,...b}),[b,p,v,d,r]);return o.jsx(G0.Provider,{value:T,children:a})}function Re(){return m.useContext(G0)}const Q0=m.createContext({frames:{}});function E1({children:a}){const l=rn(),[i,r]=m.useState({});m.useEffect(()=>{function d({roverId:g,sensors:p={},frame:y={}}){g&&r(v=>({...v,[g]:{roverId:g,sensors:p,raw:y?.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(Q0.Provider,{value:f,children:a})}function Gu(){return m.useContext(Q0).frames}function Al(a){const l=Gu();return a?l[a]??null:null}const w1=650,q1={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 nu(a){if(typeof a!="number"||a<=0)return null;const l=q1[a];return l?{code:a,...l}:null}function C1(a,l={}){const i=l.holdMs||w1,[r,f]=m.useState({left:null,right:null,omni:null}),[d,g]=m.useState(0);return m.useEffect(()=>{const p=setInterval(()=>g(Date.now()),Math.max(i/2,100));return()=>clearInterval(p)},[i]),m.useEffect(()=>{const p=Date.now(),y=nu(a?.infraredCharacterLeft),v=nu(a?.infraredCharacterRight),S=nu(a?.infraredCharacterOmni);!y&&!v&&!S||f(b=>({left:y?{...y,ts:p}:b.left,right:v?{...v,ts:p}:b.right,omni:S?{...S,ts:p}:b.omni}))},[a?.infraredCharacterLeft,a?.infraredCharacterRight,a?.infraredCharacterOmni]),m.useEffect(()=>{const{left:p,right:y,omni:v}=r;if(!(p?.ts||y?.ts||v?.ts))return;const b=new Date().toISOString();console.debug("[DockIR]",b,{left:p?.code??0,omni:v?.code??0,right:y?.code??0})},[r.left?.code,r.right?.code,r.omni?.code]),m.useMemo(()=>{const p=Date.now(),y=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=y(r.left),S=y(r.right),b=y(r.omni),T=v.force||S.force||b.force,q=v.active||S.active||b.active,j=v.active&&!S.active?"right":S.active&&!v.active?"left":"center",R=(S.active?1:0)-(v.active?1:0);return{visible:q,forceDetected:T,left:v,right:S,omni:b,bias:j,balance:Math.max(-1,Math.min(1,R))}},[r.left,r.right,r.omni,i,d])}function T1(){const{connected:a,session:l}=Re(),i=l?.assignment?.roverId,r=Al(i),f=r?.sensors||{},d=C1(f),g=f.voltageMv!=null?`${(f.voltageMv/1e3).toFixed(2)} V`:null,p=f.currentMa!=null?`${f.currentMa} mA`:null,y=f.batteryTemperatureC!=null?`${f.batteryTemperatureC} °C`:null,v=f.batteryChargeMah,S=f.batteryCapacityMah;r?.receivedAt&&new Date(r.receivedAt).toLocaleTimeString();const b=r?.raw?r.raw:null,T=i?l?.activeDrivers?.[i]:null;return m.useMemo(()=>i?T?T===l?.socketId?"You":(l?.users||[]).find(j=>j.socketId===T)?.nickname||T.slice(0,6):"Available":"n/a",[T,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(M1,{sensors:f,voltage:g,current:p,batteryTemp:y,charge:v,capacity:S}),o.jsx(R1,{sensors:f,dockState:d})]}):o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for sensor frames…"}):o.jsx("p",{className:"text-sm text-slate-500",children:"Assign a rover to view sensors."}),b&&o.jsx("pre",{className:"surface whitespace-pre-wrap break-words text-xs text-lime-300",children:b})]})}function M1({sensors:a,voltage:l,current:i,batteryTemp:r,charge:f,capacity:d}){const g=f!=null&&d?`${Math.round(f/d*100)}`:"--",p=a?.oiMode?.label||"--",y=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(Cn,{label:"Voltage",value:l??"--"}),o.jsx(Cn,{label:"Current",value:i??"--"}),o.jsx(Cn,{label:"Battery temp",value:r??"--"}),o.jsx(Cn,{label:"Charge",value:f!=null?`${f} mAh`:"--"}),o.jsx(Cn,{label:"Capacity",value:d!=null?`${d} mAh`:"--"}),o.jsx(Cn,{label:"Charge",value:g}),o.jsx(Cn,{label:"OI mode",value:p}),o.jsx(Cn,{label:"Docked",value:y}),o.jsx(Cn,{label:"Charging state",value:v})]})}function Cn({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 R1({sensors:a,dockState:l}){const i=a?.bumpsAndWheelDrops||{},r=a?.wheelOvercurrents||{},f=[{label:"Left",value:a?.lightBumpLeftSignal},{label:"Front Left",value:a?.lightBumpFrontLeftSignal},{label:"Center Left",value:a?.lightBumpCenterLeftSignal},{label:"Center Right",value:a?.lightBumpCenterRightSignal},{label:"Front Right",value:a?.lightBumpFrontRightSignal},{label:"Right",value:a?.lightBumpRightSignal}],d=[{label:"Left",value:a?.cliffLeftSignal,active:a?.cliffLeft},{label:"Front Left",value:a?.cliffFrontLeftSignal,active:a?.cliffFrontLeft},{label:"Front Right",value:a?.cliffFrontRightSignal,active:a?.cliffFrontRight},{label:"Right",value:a?.cliffRightSignal,active:a?.cliffRight}],g=[{label:"Wheel L",value:a?.wheelLeftCurrentMa,over:r.leftWheel},{label:"Wheel R",value:a?.wheelRightCurrentMa,over:r.rightWheel},{label:"Side brush",value:a?.sideBrushCurrentMa,over:r.sideBrush},{label:"Main brush",value:a?.mainBrushCurrentMa,over:r.mainBrush}];return o.jsxs("div",{className:"grid gap-0.5 md:grid-cols-2",children:[o.jsxs(ml,{title:"Dock IR",children:[o.jsx(_1,{sensors:a}),o.jsx(k1,{state:l})]}),o.jsxs(ml,{title:"Bumps & drops",children:[o.jsx(Tn,{label:"Bump L",value:o.jsx(js,{active:i.bumpLeft})}),o.jsx(Tn,{label:"Bump R",value:o.jsx(js,{active:i.bumpRight})}),o.jsx(Tn,{label:"Wheel drop L",value:o.jsx(js,{active:i.wheelDropLeft,tone:"amber"})}),o.jsx(Tn,{label:"Wheel drop R",value:o.jsx(js,{active:i.wheelDropRight,tone:"amber"})})]}),o.jsx(ml,{title:"Light bumps (raw)",children:f.map(p=>o.jsx(Tn,{label:p.label,value:Ns(p.value)},p.label))}),o.jsx(ml,{title:"Cliff sensors",children:d.map(p=>o.jsx(Tn,{label:p.label,value:`${Ns(p.value)} · ${p.active?"bool: true":"bool: false"}`},p.label))}),o.jsx(ml,{title:"Currents",children:g.map(p=>o.jsx(Tn,{label:p.label,value:o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:Ns(p.value,"mA")}),p.over?o.jsx(js,{active:!0,tone:"red",label:"over"}):null]})},p.label))}),o.jsxs(ml,{title:"Dirt detect",children:[o.jsx(Tn,{label:"Left",value:Ns(a?.dirtDetectLeft)}),o.jsx(Tn,{label:"Right",value:Ns(a?.dirtDetect)})]})]})}function ml({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 Tn({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 js({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 Ns(a,l){return a==null||Number.isNaN(a)?"--":l?`${a} ${l}`:a}function _1({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 k1({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 X0=m.createContext(null);function Qu({children:a}){const[l,i]=m.useState(()=>({status:"loading",data:{}}));m.useEffect(()=>{const p=Nu();i({status:"ready",data:p??{}})},[]);const r=m.useCallback(()=>{const p=Nu();i({status:"ready",data:p??{}})},[]),f=m.useCallback(p=>{const y=kp(p??{});return i(y?{status:"ready",data:p??{}}:v=>({...v,status:"error"})),y},[]),d=m.useCallback((p,y)=>{i(v=>{const S=v.data[p]||{},b=typeof y=="function"?y(S):{...S,...y??{}},T={...v.data,[p]:b};return kp(T)?{status:"ready",data:T}:{...v,status:"error"}})},[]),g=m.useMemo(()=>({data:l.data,status:l.status,reload:r,saveAll:f,setNamespace:d}),[l,r,f,d]);return o.jsx(X0.Provider,{value:g,children:a})}function O1(){const a=m.useContext(X0);if(!a)throw new Error("useSettings must be used within SettingsProvider");return a}function ot(a,l={}){const{data:i,status:r,setNamespace:f}=O1(),d=i[a]??l??{},g=m.useCallback(v=>{f(a,S=>{const b=S??{};return typeof v=="function"?v(b):{...b,...v??{}}})},[a,f]),p=m.useCallback(v=>{f(a,()=>v??{})},[a,f]),y=m.useCallback(()=>{const v=typeof l=="object"?{...l}:l;f(a,()=>v??{})},[l,a,f]);return{value:d,status:r,save:g,replace:p,reset:y}}function D1(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 Xu({panelId:a="replay-sources",fillHeight:l=!1}){const{session:i,triggerReplay:r}=Re(),f=D1(i?.replaySources||[]),{value:d,save:g}=ot("replaySources",{}),[p,y]=m.useState([]),[v,S]=m.useState(!1),[b,T]=m.useState(null),[q,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){y(I);return}y(N)},[d?.[a],N,a]),m.useEffect(()=>{const I=new Set(f.map(te=>te.key));y(te=>te.filter(ne=>I.has(ne)))},[f]);const k=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 ne=R.lastTriggeredAt+R.cooldownMs-Date.now();E(Math.max(0,ne))};I();const te=setInterval(I,250);return()=>clearInterval(te)},[R?.lastTriggeredAt,R?.cooldownMs,R?.remainingMs]);const Z=v||i?.mode==="lockdown"||A>0||!p.length,V=I=>{y(te=>{const ne=te.includes(I)?te.filter(se=>se!==I):[...te,I];return g(se=>({...se||{},[a]:ne})),ne}),j(null)},G=async()=>{if(!Z){S(!0),T(null),j(null);try{const I=p.map(te=>{const[ne,se]=te.split(":");return{type:ne,id:se}});await r(I),j("Replay sent. Check the Discord replay channel.")}catch(I){T(I.message)}finally{S(!1)}}},$=l?"h-full flex flex-col":"",P=l?"flex-1 min-h-0 overflow-y-auto":"";return o.jsxs("section",{className:`panel-section p-0.75 text-sm ${$}`,children:[o.jsxs("header",{className:"panel-muted flex items-center justify-between text-xs",children:[o.jsx("span",{children:"Replay Sources"}),o.jsx("span",{children:f.length})]}),o.jsxs("div",{className:`grid gap-0.5 md:grid-cols-2 ${P}`,children:[o.jsx(Op,{title:"Rovers",items:k.rovers,selected:p,onToggle:V}),o.jsx(Op,{title:"Room Cams",items:k.rooms,selected:p,onToggle:V})]}),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:G,disabled:Z,children:A>0?`Replay (${Math.ceil(A/1e3)}s)`:v?"Replay…":"Replay"}),b?o.jsx("div",{className:"text-xs text-amber-400",children:b}):null,q?o.jsx("div",{className:"text-xs text-emerald-300",children:q}):null]})]})}function Op({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 $0={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Dp=Ca.createContext&&Ca.createContext($0),z1=["attr","size","title"];function B1(a,l){if(a==null)return{};var i=L1(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 L1(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 br(){return br=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},br.apply(this,arguments)}function zp(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 Sr(a){for(var l=1;l<arguments.length;l++){var i=arguments[l]!=null?arguments[l]:{};l%2?zp(Object(i),!0).forEach(function(r){U1(a,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):zp(Object(i)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(i,r))})}return a}function U1(a,l,i){return l=H1(l),l in a?Object.defineProperty(a,l,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[l]=i,a}function H1(a){var l=V1(a,"string");return typeof l=="symbol"?l:l+""}function V1(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 K0(a){return a&&a.map((l,i)=>Ca.createElement(l.tag,Sr({key:i},l.attr),K0(l.child)))}function Z0(a){return l=>Ca.createElement(Y1,br({attr:Sr({},a.attr)},l),K0(a.child))}function Y1(a){var l=i=>{var{attr:r,size:f,title:d}=a,g=B1(a,z1),p=f||i.size||"1em",y;return i.className&&(y=i.className),a.className&&(y=(y?y+" ":"")+a.className),Ca.createElement("svg",br({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},i.attr,r,g,{className:y,style:Sr(Sr({color:a.color||i.color},i.style),a.style),height:p,width:p,xmlns:"http://www.w3.org/2000/svg"}),d&&Ca.createElement("title",null,d),a.children)};return Dp!==void 0?Ca.createElement(Dp.Consumer,null,i=>l(i)):l($0)}function J0(a){return Z0({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 G1(a){return Z0({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 Q1(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 X1(a){const l=new Date(a);return`${l.getHours().toString().padStart(2,"0")}:${l.getMinutes().toString().padStart(2,"0")}`}function Bp(a){return a.nickname||a.socketId?.slice(0,6)||"unknown"}function $1({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 F0({message:a}){const l=a.role==="admin"||a.role==="lockdown"||a.role==="lockdown-admin",i=a.fromDiscord?`${a.discordGuildName||"Discord"} · ${Bp(a)}`:null;return o.jsxs("div",{className:`surface-muted relative flex flex-wrap items-start gap-0.5 text-sm ${l?"border border-amber-400/30":a.fromDiscord?"border border-indigo-400/30 bg-indigo-900/20":""}`,children:[a.fromDiscord?o.jsxs(o.Fragment,{children:[o.jsx(J0,{className:"h-3.5 w-3.5 text-indigo-200"}),o.jsx($1,{guildIconUrl:a.discordGuildIconUrl,userAvatarUrl:a.discordUserAvatarUrl,label:i})]}):null,o.jsx("span",{className:`font-semibold text-[0.85rem] ${Q1(a.role)}`,children:Bp(a)}),a.roverId&&o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem]",children:a.roverId}),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:X1(a.ts)})]})}const K1=3e3,Z1="#2196f3";function J1(a){return a.id?a.id:a.timestamp?`${a.timestamp}-${a.message}`:`${a.title||"alert"}-${a.message}`}function $u({scale:a=1}){const{alerts:l}=Re(),[i,r]=m.useState(()=>Date.now()),f=m.useMemo(()=>l.slice(-3).map(y=>({alert:y,key:J1(y)})),[l]);m.useEffect(()=>{if(!f.length)return;const y=setInterval(()=>r(Date.now()),200);return()=>clearInterval(y)},[f.length]);const d=f.map(y=>({...y,age:i-(y.alert.receivedAt??y.alert.timestamp??0)})).filter(y=>y.age<=K1);if(!d.length)return null;const g=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:g,children:d.map(y=>o.jsx(F1,{alert:y.alert},y.key))})}function Lp(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 F1({alert:a}){if(a.kind==="chat"&&a.payload)return o.jsx(F0,{message:a.payload});const l=Lp(a.color)||Lp(Z1),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 pl={main:[-127,127],side:[-127,127],vacuum:[0,127]},au={maxSpeed:500,baseSpeed:250,boostSpeed:400},Eu=100,Ku=[31,127],yl=60,wu=8,I1=250,W1={start:[128],safe:[131],full:[132],passive:[128],dock:[143]},ws={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"]},I0=[{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:Eu},{type:"oi",command:"dock"},{type:"pause",duration:Eu},{type:"oi",command:"full"}]},{id:"seek-dock",label:"Dock",description:"Send the seek dock command.",steps:[{type:"oi",command:"dock"}]}];function qu(){return{vector:{x:0,y:0,boost:!1},speeds:{left:0,right:0},source:null,lastUpdatedAt:0}}function Cu(){return{main:0,side:0,vacuum:0}}function P1(){return{enabled:!1,angle:null,config:null}}function yr(){return{note:yl}}const Up={roverId:null,mode:"drive",drive:qu(),aux:Cu(),camera:P1(),song:yr(),lastControlIntentAt:0,macros:I0,keymap:ws,inputs:{}};function eS(a,l){switch(l.type){case"control/set-rover":return{...a,roverId:l.payload??null,drive:l.payload?a.drive:qu(),aux:l.payload?a.aux:Cu(),song:l.payload?a.song:yr(),lastControlIntentAt:l.payload?a.lastControlIntentAt:0};case"control/set-mode":return a.mode===l.payload?a:{...a,mode:l.payload==="dock"?"dock":"drive"};case"control/update-drive":{const{vector:i,speeds:r,source:f}=l.payload;return{...a,drive:{vector:i??a.drive.vector,speeds:r??a.drive.speeds,source:f??a.drive.source,lastUpdatedAt:Date.now()}}}case"control/set-aux-motors":return{...a,aux:{...a.aux,...l.payload}};case"control/set-camera-config":return{...a,camera:{...a.camera,enabled:!!l.payload?.config,config:l.payload?.config??null,angle:typeof l.payload?.angle=="number"?l.payload.angle:l.payload?.config?l.payload.config.homeAngle??a.camera.angle:null}};case"control/set-camera-angle":return{...a,camera:{...a.camera,angle:l.payload}};case"control/register-input-state":{const i=l.payload?.source||"unknown";return{...a,inputs:{...a.inputs,[i]:{...a.inputs[i]??{},...l.payload?.state,updatedAt:Date.now()}}}}case"control/set-keymap":return{...a,keymap:{...a.keymap,...l.payload??{}}};case"control/set-macros":return{...a,macros:Array.isArray(l.payload)?l.payload:a.macros};case"control/reset":return{...a,drive:qu(),aux:Cu(),song:yr(),lastControlIntentAt:0};case"control/record-intent":return{...a,lastControlIntentAt:Date.now()};case"control/set-song-note":return{...a,song:{...a.song||yr(),note:l.payload??yl}};default:return a}}function vl(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 Vt(a,l){return!Array.isArray(l)||l.length!==2?a:vl(a,l[0],l[1])}function tS(a={}){const l=Rn(a.x??0),i=Rn(a.y??0);return{x:l,y:i,boost:!!a.boost}}function nS(a={},l={}){const i=tS(a),r=typeof l.maxSpeed=="number"?l.maxSpeed:au.maxSpeed,f=typeof l.baseSpeed=="number"?l.baseSpeed:au.baseSpeed,d=typeof l.boostSpeed=="number"?l.boostSpeed:au.boostSpeed,g=i.boost?d:f,p=i.y*g,y=i.x*g;return{vector:i,speeds:{left:vl(Math.round(p+y),-r,r),right:vl(Math.round(p-y),-r,r)}}}function aS(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 Hp(a){return new Promise(l=>setTimeout(l,a))}function lS(a={}){const{driveTransform:l,auxTransform:i}=a,r=rn(),{session:f}=Re(),d=f?.assignment?.roverId,g=m.useMemo(()=>!d||!Array.isArray(f?.roster)?null:f.roster.find(N=>String(N.id)===String(d))||null,[d,f?.roster]),p=m.useMemo(()=>!g?.cameraServo||!g.cameraServo.enabled?null:g.cameraServo,[g]),y=m.useMemo(()=>!g?.nightVision||!g.nightVision.enabled?null:g.nightVision,[g]),v=m.useCallback((N,k)=>{d&&r.emit("command",{roverId:d,...N},k)},[r,d]),S=m.useCallback(()=>{d&&v({type:"sensorStream",data:{sensorStream:{enable:!0}}})},[v,d]),b=m.useCallback(N=>{if(!d)return null;const k={left:Vt(N?.left??0,[-500,500]),right:Vt(N?.right??0,[-500,500])},Z=l?l(k):k,V={left:Vt(Z?.left??0,[-500,500]),right:Vt(Z?.right??0,[-500,500])};return v({type:"drive",data:{driveDirect:V}}),V},[l,v,d]),T=m.useCallback(({main:N=0,side:k=0,vacuum:Z=0}={})=>{if(!d)return null;const V={main:Vt(N,pl.main),side:Vt(k,pl.side),vacuum:Vt(Z,pl.vacuum)},G=i?i(V):V,$={main:Vt(G?.main??0,pl.main),side:Vt(G?.side??0,pl.side),vacuum:Vt(G?.vacuum??0,pl.vacuum)};return v({type:"motors",data:{motorPwm:$}}),$},[i,v,d]),q=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 k=Array.isArray(N)?N:typeof N=="string"?W1[N]:null;return k?(v({type:"raw",data:{raw:aS(k)}}),S(),!0):!1},[v,S,d]),R=m.useCallback(async N=>{if(!(!N||!Array.isArray(N.steps)||!d))for(const k of N.steps){if(!d)break;switch(k.type){case"oi":j(k.command);break;case"drive":b(k.speeds??{left:0,right:0});break;case"motors":T(k.values??{});break;case"servo":q(k.angle);break;case"pause":await Hp(k.duration??Eu);break}if(k.delay||k.delayMs){const Z=k.delayMs??k.delay;typeof Z=="number"&&Z>0&&await Hp(Z)}}},[d,j,b,T,q]),A=m.useCallback((N="toggle")=>!d||!y?null:(v({type:"nightVision",data:{nightVision:{action:N}}}),N),[v,y,d]),E=m.useCallback((N=[],k={})=>{if(!d)return null;const V=(Array.isArray(N)&&N.length>0?N:[{note:yl,duration:wu}]).slice(0,16).map(G=>({note:Vt(Math.round(G?.note??yl),Ku),duration:Vt(Math.round(G?.duration??wu),[1,255])}));return v({type:"song",data:{song:{notes:V,slot:k.slot,loop:k.loop}}}),V},[v,d]);return m.useMemo(()=>({roverId:d,rosterEntry:g,servoConfig:p,nightVision:y,emitCommand:v,enableSensorStream:S,sendDriveDirect:b,sendAuxMotors:T,sendServoAngle:q,sendOiCommand:j,sendNightVision:A,sendSong:E,runMacroSteps:R}),[d,g,p,y,v,S,b,T,q,j,A,R])}const sS={"{":"[","}":"]",":":";",'"':"'","<":",",">":".","?":"/","|":"\\",_:"-","+":"="},Vp={"[":"BracketLeft","]":"BracketRight","\\":"Backslash",";":"Semicolon","'":"Quote",",":"Comma",".":"Period","/":"Slash","-":"Minus","=":"Equal","`":"Backquote"};function zs(a){if(typeof a!="string")return"";const l=a.toLowerCase();return sS[l]??l}function iS(a){const l=zs(a);if(!l)return null;if(Vp[l])return Vp[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 W0(a){const l=zs(a);return l?`key:${l}`:null}function rS(a){const l=iS(a);return l?`code:${l}`:null}function Yp(a){const l=new Set,i=W0(a?.key??"");i&&l.add(i);const r=a?.code?`code:${a.code}`:null;return r&&l.add(r),Array.from(l)}function cS(a={}){return Object.fromEntries(Object.entries(a).map(([l,i])=>{const r=Array.isArray(i)?i:[i],f=new Set;return r.forEach(d=>{const g=W0(String(d));g&&f.add(g);const p=rS(String(d));p&&f.add(p)}),[l,f]}))}function ca(a){const l=zs(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 gl=[{key:"drive",motors:["leftWheel","rightWheel"]},{key:"aux",motors:["mainBrush","sideBrush"]}],oS={heatUpSec:4,coolDownSec:12,kneeSec:1.5,outputRateMs:250};function Gp(){return gl.reduce((a,l)=>(a[l.key]=0,a),{})}function lr(a){return Number.isFinite(a)?Math.max(0,Math.min(1,a)):0}function uS(a,l,i,r){if(!Number.isFinite(i)||i<=0)return r==="up"?1:0;const f=l/i;return r==="up"?a+f:a-f}function fS(a,l={}){const{session:i}=Re(),d=(Al(a)?.sensors||{})?.wheelOvercurrents||{},g=m.useMemo(()=>({...oS,...l.config||{}}),[l.config]),[p,y]=m.useState(()=>Gp()),v=m.useRef(typeof performance<"u"?performance.now():Date.now()),S=m.useRef(d);m.useEffect(()=>{S.current=d||{}},[d]),m.useEffect(()=>{y(Gp())},[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||y(N=>{let k=!1;const Z={};return gl.forEach(V=>{const G=Number.isFinite(N[V.key])?N[V.key]:0,$=V.motors.some(I=>!!S.current?.[I]),P=lr(uS(G,E,$?g.heatUpSec:g.coolDownSec,$?"up":"down"));Math.abs(P-G)>1e-4&&(k=!0),Z[V.key]=P}),k?Z:N})},100);return()=>clearInterval(j)},[g.heatUpSec,g.coolDownSec]);const b=m.useMemo(()=>{const j=Number.isFinite(g.kneeSec)?Math.max(0,g.kneeSec):0,R=Number.isFinite(g.heatUpSec)?Math.max(.001,g.heatUpSec):.001,A=lr(j/R),E=gl.reduce((N,k)=>{const Z=Number.isFinite(p?.[k.key])?p[k.key]:0,V=A>=1?0:lr((Z-A)/(1-A));return N[k.key]=lr(1-V),N},{});return{perGroup:E,drive:{left:E.drive??1,right:E.drive??1},aux:{main:E.aux??1,side:E.aux??1,vacuum:1}}},[g.heatUpSec,g.kneeSec,p]),T=m.useMemo(()=>{const j={};gl.forEach(A=>{A.motors.forEach(E=>{j[E]=!!d?.[E]})});const R=gl.reduce((A,E)=>(A[E.key]=E.motors.some(N=>!!d?.[N]),A),{});return{motors:j,groups:R}},[d]),q=i?.role==="admin"||i?.role==="lockdown"||i?.role==="lockdown-admin";return m.useMemo(()=>({temperatures:p,overcurrent:T,scales:b,isActive:(b?.drive?.left??1)<1||(b?.drive?.right??1)<1||(b?.aux?.main??1)<1||(b?.aux?.side??1)<1,config:g,adminImmune:q}),[p,T,b,g,q])}function dS(a={},l,i=!1){if(i||!l?.drive)return a;const r=typeof l.drive.left=="number"?l.drive.left:1,f=typeof l.drive.right=="number"?l.drive.right:1;return r>=.999&&f>=.999?a:{left:Math.round((a.left??0)*r),right:Math.round((a.right??0)*f)}}function hS(a={},l,i=!1){if(i||!l?.aux)return a;const r=typeof l.aux.main=="number"?l.aux.main:1,f=typeof l.aux.side=="number"?l.aux.side:1,d=typeof l.aux.vacuum=="number"?l.aux.vacuum:1;return r>=.999&&f>=.999&&d>=.999?a:{main:Math.round((a.main??0)*r),side:Math.round((a.side??0)*f),vacuum:Math.round((a.vacuum??0)*d)}}const P0=m.createContext(null);function Qp(a){return Object.fromEntries(Object.entries(a||{}).map(([l,i])=>[l,Array.isArray(i)?[...i]:[]]))}function mS(a,l){if(!a)return l;const i=typeof a.minAngle=="number"?a.minAngle:-45,r=typeof a.maxAngle=="number"?a.maxAngle:45;return vl(l,i,r)}function pS({children:a}){const[l,i]=m.useReducer(eS,Up),r=m.useRef(null),f=m.useRef(!1),d=m.useRef(Up.camera.angle),{value:g,save:p}=ot("controls",{keymap:ws,macros:I0}),{session:y,homeAssistantSetState:v}=Re(),S=y?.assignment?.roverId??null,b=fS(S),T=m.useCallback(M=>dS(M,b.scales,b.adminImmune),[b.adminImmune,b.scales]),q=m.useCallback(M=>hS(M,b.scales,b.adminImmune),[b.adminImmune,b.scales]),j=lS({driveTransform:T,auxTransform:q}),R=m.useCallback(()=>{const D=(y?.homeAssistant?.entities||[]).filter(K=>(K.type==="light"||K.type==="switch")&&K.available!==!1&&K.state!=="on");if(D.length===0){f.current=!1;return}f.current=!0,D.forEach(K=>{v(K.id,"on").catch(()=>{})}),f.current=!1},[y?.homeAssistant?.entities,v]);m.useEffect(()=>{i({type:"control/set-rover",payload:j.roverId})},[j.roverId]),m.useEffect(()=>{const M=r.current;r.current=l.mode,M!=="drive"&&l.mode==="drive"&&y?.homeAssistant?.entities?R():M!=="drive"&&l.mode==="drive"&&(f.current=!0)},[l.mode,y?.homeAssistant?.entities,R]),m.useEffect(()=>{f.current&&y?.homeAssistant?.entities&&R()},[y?.homeAssistant?.entities,R]),m.useEffect(()=>{const M={...ws,...g?.keymap||{}};i({type:"control/set-keymap",payload:M}),g?.macros&&i({type:"control/set-macros",payload:g.macros})},[g?.keymap,g?.macros]),m.useEffect(()=>{const M=j.servoConfig;if(!M){i({type:"control/set-camera-config",payload:{config:null}}),d.current=null;return}const D=typeof M.minAngle=="number"?M.minAngle:-45,K=typeof M.maxAngle=="number"?M.maxAngle:45,ee=typeof M.homeAngle=="number"?M.homeAngle:(D+K)/2,oe=typeof d.current=="number"?vl(d.current,D,K):null,Ne=oe??vl(ee,D,K);i({type:"control/set-camera-config",payload:{config:M,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(M=>{i({type:"control/set-mode",payload:M})},[]),E=m.useCallback(()=>{i({type:"control/record-intent"})},[]),N=m.useRef(l.drive.speeds),k=m.useRef(l.aux),Z=m.useMemo(()=>JSON.stringify(b.scales),[b.scales]),V=m.useRef(0),G=m.useRef(0);m.useEffect(()=>{N.current=l.drive.speeds},[l.drive.speeds]),m.useEffect(()=>{k.current=l.aux},[l.aux]),m.useEffect(()=>{if(!j.roverId||b.adminImmune||!b.isActive)return;const M=Math.max(0,Number(b?.config?.outputRateMs)||0),D=typeof performance<"u"?performance.now():Date.now(),K=N.current||{left:0,right:0},ee=k.current||{main:0,side:0,vacuum:0},oe=!!(K.left||K.right),Ne=!!(ee.main||ee.side||ee.vacuum);!oe&&!Ne||(oe&&D-V.current>=M&&(V.current=D,j.sendDriveDirect(K)),Ne&&D-G.current>=M&&(G.current=D,j.sendAuxMotors(ee)))},[Z,b.adminImmune,b.config,b.isActive,j]);const $=m.useCallback((M,D={})=>{const K=nS(M,D.speedOptions);i({type:"control/update-drive",payload:{...K,source:D.source??null}}),E(),j.sendDriveDirect(K.speeds)},[j,E]),P=m.useCallback((M={})=>{const D=j.sendAuxMotors(M)??M;i({type:"control/set-aux-motors",payload:D}),E()},[j,E]),I=m.useCallback((M,D)=>{if(!M)return!1;const K=zs(D);if(!K)return!1;const ee=Qp(l.keymap);return ee[M]=[K],i({type:"control/set-keymap",payload:ee}),p(oe=>({...oe??{},keymap:ee})),!0},[l.keymap,p]),te=m.useCallback(()=>{const M=Qp(ws);i({type:"control/set-keymap",payload:M}),p(D=>({...D??{},keymap:M}))},[p]),ne=m.useCallback(M=>{if(!j.servoConfig)return;const D=mS(j.servoConfig,M);i({type:"control/set-camera-angle",payload:D}),j.sendServoAngle(D),d.current=D,E()},[j,E]),se=m.useCallback((M=0)=>{const D=j.servoConfig;if(!D)return;const K=typeof M=="number"&&M!==0?M:D.nudgeDegrees||1,ee=typeof d.current=="number"?d.current:typeof D.homeAngle=="number"?D.homeAngle:0;ne(ee+K)},[j.servoConfig,ne]),ge=m.useCallback(()=>{const M=j.servoConfig;if(!M)return;const D=typeof M.homeAngle=="number"?M.homeAngle:typeof M.minAngle=="number"&&typeof M.maxAngle=="number"?(M.minAngle+M.maxAngle)/2:0;ne(D)},[j.servoConfig,ne]),ye=m.useCallback(async M=>{const D=l.macros.find(K=>K.id===M)||null;D&&(M==="drive-sequence"?(R(),y?.homeAssistant?.entities||(f.current=!0),E()):M==="seek-dock"&&E(),await j.runMacroSteps(D))},[j,E,y?.homeAssistant?.entities,l.macros,R]),re=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]),z=m.useCallback(M=>{j.sendOiCommand(M)},[j]),Q=m.useCallback(M=>{j.roverId&&j.emitCommand({type:"sensorStream",data:{sensorStream:{enable:M}}})},[j]),W=m.useCallback(()=>{j.sendNightVision("toggle"),E()},[j,E]),ae=m.useCallback(M=>{const D=typeof M=="number"?M:yl;return i({type:"control/set-song-note",payload:D}),D},[]),ue=m.useCallback((M,D)=>j.sendSong(M,D),[j]),C=m.useCallback((M,D)=>{i({type:"control/register-input-state",payload:{source:M,state:D}})},[]),U=m.useMemo(()=>({state:l,dispatch:i,pipeline:j,overcurrentLimiter:b,actions:{setMode:A,setDriveVector:$,setAuxMotors:P,setServoAngle:ne,nudgeServo:se,goServoHome:ge,runMacro:ye,stopAllMotion:re,sendOiCommand:z,setSensorStream:Q,toggleNightVision:W,updateKeyBinding:I,resetKeyBindings:te,registerInputState:C,setSongNote:ae,sendSong:ue}}),[l,j,b,A,$,P,ne,se,ge,ye,re,z,Q,W,I,te,C,ae,ue]);return o.jsx(P0.Provider,{value:U,children:a})}function dt(){const a=m.useContext(P0);if(!a)throw new Error("useControlSystem must be used within ControlSystemProvider");return a}const gS="data:audio/mpeg;base64,//uQxAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAANAAAIpQBKSkpKSkpKXFxcXFxcXFxra2tra2tra3p6enp6enqJiYmJiYmJiZiYmJiYmJiYpqampqamprW1tbW1tbW1xMTExMTExMTT09PT09PT4uLi4uLi4uLx8fHx8fHx8f////////8AAABQTEFNRTMuMTAwBLkAAAAAAAAAABUgJAUYQQAB4AAACKVpqtMZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//ugxAAAwqQPR8CIwCh0BCj5jDwlIAAjW87wAACcOsAKPMk8ARj8w9OAWwNlV/gCgQMHEhAOVnFaNzWWAPI2zyjHjd8FAoKqyAa88AAAAABNjEd9CQOglIY9dtC+a51bGZrZgTewD3c+AAYx5hxIMheIcudKAyaykG1/h5EsPB0iTEFNRTMuMTAwqqqqqqrIBZqvAAAAAC9JXFIAHrCgAp0D0hUYOInIluqg1TNdKCzMeAAFQCKKsxUmVfireKILLBgSVgb4qBVtPWpMQU1FMy4xMDCqqqqqqqqqqqqqqqqpApm/AAAAAC7QYaHPHoCjkCysmc+QY9NNWRbKE+mqowNobwAAoSQQMLGChDlOrKMqVMC/6xy/CXbFaL7AZUxBTUUzLjEwMFVVVVVVVVVVVacDqZ8AAAAAMgzaYFBPNgIOnVCQfFfwmBBhLVNJQSdxdQRofwAGxF9xAAYs4AZDuE87li0YCASIBwaCiXUj+2BqTEFNRTMuMTAwqqqqqqqqlwOonwAAAAAtkABQSEZ1INNDgx8HeaaLCXiu5dqSciylQNXjv8GdmACQ5ogYKbnsmxkoChog+w9IhU6GsgzCIQBSxFpMQQAAMBiHjgAAAAv6FQQILmJmGLltnax9HszIVEAoEq1p8olpcPLlGpXFastuWosKNFlmlqADJbwAEFRI4iJJy0oDumUW//sgxOEAw5wfU8fnAGBvg6n5nDxUh7QuwcEzkK5Ztz7AZUxBTUUzLjEwMFVVVVVVVZUAhd8AAAAALZAAamQMWKtC7Avib0WLplt2IAp0SKV0pFFxCADLX6AIPFrWJIBQqPGW/x0QDTRLGaQYCRAZzKeoU6uqTEFN6AB3n/7wAAAxq//7EMT0AMPUHU/MawJgc4PpuYy8VQZjocBw2OgQQyQyECnbABEUC/ZoM0J56Jm0tqzNJaq8KospqUAQ5/QBghnCqQAhR4Mz1D1gJPstYsI1sYIg079I5cYjY6pMQU1FMy4xMDCqqqqq//sQxPUAw+AdT8zvAih6hCk5nWBFqqqWAFOf4AAAAEAIQZPkMcwUzFVE51cSBjIHpJRIEIjWgGar9VhgCUvwAFAUMk0RCpMkwXjPQDcoLBU+n5RuR4ZrPQLPckxBTUUzLjEwMKqqqqr/+xDE9oDEAB1NzG8CKIGEKPmd5EWqxgBWn9AAAAAKIiC5GcLJIczCEvNbWsF31jo4Bw0rXktvJF5YRyABlj+ABIQ2RGsHgdc0XsPntoEDUzaQOjTBqblFPUE1TEFNRckAt68AAAAALv/7EMT4AMQIHU3M7wIojwUo+Y2MZfAgKcwITAQIYN1TosJeLtDA0ubWNrFSADJoln4AC0hVaLiIIUChs+4HST4BgCpQHITPMBQkEnj73ORZfylh+sRLEGUiNIpMQU1FMy4xMDCqqqqq//sQxP6AxlgtK+13Yih3hCj5neBNqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqrIkT7UNAZ7NS7yMqcihSKLMn8DlKYq8ZdPCVEoJBuWqkxBTUUzLjEwMKqqqqr/+xDE+ADEXCVHzGjDIIQEqLm9PIWqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/7EMT+AMWoL0XNcwJoiASoeY3gVaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq//sQxPgAxHAnRcxvAmiBBKj5jehEqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqr/+xDE+IDEmCVDzPMCKH6EqLmNYE2qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqv/7EMT9gEPgI0vMZwQgvYWlPY5gFaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq//sQxOYDw+gpIIfgwWgAADSAAAAEqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqo=",eg=m.createContext({messages:[],sendMessage:async()=>{},focusChat:()=>{},blurChat:()=>{},registerInputRef:()=>{},onInputFocus:()=>{},onInputBlur:()=>{},isChatFocused:!1});function yS({children:a}){const l=rn(),{session:i,pushAlert:r}=Re(),[f,d]=m.useState([]),[g,p]=m.useState(!1),y=m.useRef(null),v=m.useRef(null),S=m.useRef(null);m.useEffect(()=>{S.current=new Audio(gS),S.current.load()},[]);const b=m.useCallback(()=>{const k=S.current;k&&(k.currentTime=0,k.play().catch(()=>{}))},[]);m.useEffect(()=>{function k(Z={}){d(V=>[...V.slice(-99),Z]),!(Z?.socketId&&i?.socketId&&Z.socketId===i.socketId)&&(b(),r?.({kind:"chat",payload:Z,id:`chat-${Z.id||Math.random().toString(36).slice(2)}`,receivedAt:Date.now()}))}return l.on("chat:message",k),()=>{l.off("chat:message",k)}},[b,i?.socketId,l]),m.useEffect(()=>{function k(Z=[]){Array.isArray(Z)&&d(V=>{if(V.length===0)return Z.slice(-100);const G=new Set(Z.map(P=>P?.id));return[...Z,...V.filter(P=>P?.id&&!G.has(P.id))].slice(-100)})}return l.on("chat:init",k),()=>{l.off("chat:init",k)}},[l]);const T=m.useCallback((k,Z=null)=>new Promise((V,G)=>{l.emit("chat:send",{text:k,tts:Z},($={})=>{$.error?G(new Error($.error)):V($)})}),[l]),q=m.useCallback((k,Z={})=>{(Z?.target==="hud"?"hud":"panel")==="hud"?v.current=k:y.current=k},[]),j=m.useCallback(()=>{p(!0),(v.current||y.current)?.focus()},[]),R=m.useCallback(()=>{p(!1),v.current?.blur(),y.current?.blur()},[]),A=m.useCallback(()=>p(!0),[]),E=m.useCallback(()=>p(!1),[]),N=m.useMemo(()=>({messages:f,sendMessage:T,focusChat:j,blurChat:R,registerInputRef:q,onInputFocus:A,onInputBlur:E,isChatFocused:g,selfSocketId:i?.socketId||null}),[R,j,g,f,E,A,q,T,i?.socketId]);return o.jsx(eg.Provider,{value:N,children:a})}function Zu(){const a=m.useContext(eg);if(!a)throw new Error("useChat must be used inside ChatProvider");return a}const ct={keyboard:{baseSpeed:250,turboSpeed:400,precisionSpeed:125,tiltSpeed:80,tiltIntervalMs:110},gamepad:{driveDeadzone:.2,cameraDeadzone:.25,servoStep:2,auxReverseScale:.55}},Ar={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}},lu="keyboard",su={x:0,y:0,boost:!1},iu={main:0,side:0,vacuum:0},Xp=Ku[0],$p=Ku[1],Ju=5,Ts=500,Ms=1,Fu=100;function ru(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}function vS(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Ju,Math.min(Ts,i)):l}function tg(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(Ms,Math.min(Fu,i)):l}function xS(a){const i=(tg(a,a)-Ms)/(Fu-Ms),r=Ts-i*(Ts-Ju);return Math.round(r)}function bS(a){const l=vS(a,a),i=(Ts-l)/(Ts-Ju),r=Ms+i*(Fu-Ms);return Math.round(r)}function SS(a){const l=a.target;if(!l)return!1;const i=l.tagName;return i==="INPUT"||i==="TEXTAREA"||l.isContentEditable||i==="SELECT"}function We(a,l){if(!a||a.size===0)return!1;for(const i of l)if(a.has(i))return!0;return!1}function AS(a,l){const i=We(l.driveForward,a),r=We(l.driveBackward,a),f=We(l.driveLeft,a),d=We(l.driveRight,a),g=We(l.boostModifier,a),p=We(l.slowModifier,a);let y=0;i&&!r?y=1:r&&!i&&(y=-1);let v=0;f&&!d?v=-1:d&&!f&&(v=1);const S=p?.4:1;return{x:v*S,y:y*S,boost:g&&!p}}function jS(a,l){if(We(l.auxAllForward,a))return{main:127,side:127,vacuum:127};const r=We(l.auxMainForward,a)?127:We(l.auxMainReverse,a)?-127:0,f=We(l.auxSideForward,a)?127:We(l.auxSideReverse,a)?-70:0,d=We(l.auxVacuumFast,a)?127:We(l.auxVacuumSlow,a)?50:0;return{main:r,side:f,vacuum:d}}function NS(){const{state:a,actions:{setMode:l,setDriveVector:i,setAuxMotors:r,nudgeServo:f,runMacro:d,stopAllMotion:g,registerInputState:p,toggleNightVision:y,setSongNote:v,sendSong:S}}=dt(),{session:b,homeAssistantSetState:T}=Re(),{focusChat:q,blurChat:j,isChatFocused:R}=Zu(),{value:A}=ot("inputs",ct),E=m.useMemo(()=>cS(a.keymap),[a.keymap]),N=m.useMemo(()=>{const U=new Set;return Object.values(E).forEach(M=>{M&&M.forEach(D=>U.add(D))}),U},[E]),k=m.useMemo(()=>{const U=ct.keyboard,M=A?.keyboard??{};return{baseSpeed:ru(M.baseSpeed,U.baseSpeed),turboSpeed:ru(M.turboSpeed,U.turboSpeed),precisionSpeed:ru(M.precisionSpeed,U.precisionSpeed)}},[A?.keyboard]),Z=m.useMemo(()=>{const U=ct.keyboard,M=A?.keyboard??{},D=tg(typeof M.tiltSpeed=="number"?M.tiltSpeed:typeof M.tiltIntervalMs=="number"?bS(M.tiltIntervalMs):U.tiltSpeed,U.tiltSpeed);return xS(D)},[A?.keyboard]),V=m.useMemo(()=>Math.abs(a.camera?.config?.nudgeDegrees||1),[a.camera?.config?.nudgeDegrees]),G=m.useRef(new Set),$=m.useRef(su),P=m.useRef(iu),I=m.useRef(null),te=m.useRef(null),ne=m.useCallback(()=>{const U=new Set(G.current);We(E.boostModifier,U);const D=We(E.slowModifier,U)?{baseSpeed:k.precisionSpeed,boostSpeed:k.precisionSpeed}:{baseSpeed:k.baseSpeed,boostSpeed:k.turboSpeed},K=AS(U,E),ee=jS(U,E);(K.x!==$.current.x||K.y!==$.current.y||K.boost!==$.current.boost)&&($.current=K,i(K,{source:lu,speedOptions:D})),(ee.main!==P.current.main||ee.side!==P.current.side||ee.vacuum!==P.current.vacuum)&&(P.current=ee,r(ee)),p(lu,{keys:Array.from(U),vector:K,aux:ee})},[E,k,p,r,i]),se=m.useCallback(()=>{I.current&&(clearTimeout(I.current),I.current=null)},[]),ge=m.useCallback(()=>{const U=new Set(G.current),M=We(E.cameraUp,U),D=We(E.cameraDown,U);return(M?1:0)-(D?1:0)},[E]),ye=m.useCallback(()=>{if(ge()===0){se();return}if(I.current)return;const M=()=>{const D=ge();if(D===0){se();return}f(D*V),I.current=setTimeout(M,Z)};I.current=setTimeout(M,0)},[ge,f,Z,V,se]),re=m.useCallback(()=>{te.current&&(clearTimeout(te.current),te.current=null)},[]),z=m.useCallback(()=>{const U=new Set(G.current),M=We(E.songNoteUp,U),D=We(E.songNoteDown,U);return(M?1:0)-(D?1:0)},[E]),Q=m.useCallback(U=>{if(U===0)return;let D=(typeof a.song?.note=="number"?a.song.note:yl)+U;D>$p?D=Xp:D<Xp&&(D=$p);const K=v(D);S([{note:K,duration:wu}],{slot:0})},[S,v,a.song?.note]),W=m.useCallback(()=>{if(z()===0){re();return}if(te.current)return;const M=()=>{const D=z();if(D===0){re();return}Q(D),te.current=setTimeout(M,I1)};te.current=setTimeout(M,0)},[z,re,Q]),ae=m.useCallback(()=>{G.current.clear(),$.current=su,P.current=iu,se(),re(),g(),p(lu,{keys:[],vector:su,aux:iu})},[p,g,se,re]),ue=m.useCallback(U=>{const M=b?.homeAssistant;if(!M?.enabled||!M?.connected)return;const K=(M.entities||[]).filter(ee=>(ee.type==="light"||ee.type==="switch")&&ee.available!==!1&&ee.state!=="unavailable");if(K.length!==0){if(U==="on"){const ee=K.find(oe=>oe.state!=="on");ee&&T(ee.id,"on").catch(()=>{});return}if(U==="off")for(let ee=K.length-1;ee>=0;ee-=1){const oe=K[ee];if(oe.state==="on"){T(oe.id,"off").catch(()=>{});break}}}},[T,b?.homeAssistant]);m.useEffect(()=>{function U(K){if(SS(K))return;const ee=Yp(K);if(ee.length===0)return;const oe=new Set(ee);if(We(E.chatFocus,oe)){K.preventDefault(),ae(),R||q();return}ee.some(de=>N.has(de))&&K.preventDefault();const Ne=ee.filter(de=>!G.current.has(de));Ne.forEach(de=>G.current.add(de)),Ne.length>0&&(Ne.some(de=>E.driveMacro?.has(de))?(l("drive"),d("drive-sequence")):Ne.some(de=>E.dockMacro?.has(de))?(l("dock"),d("seek-dock")):Ne.some(de=>E.nightVisionToggle?.has(de))?y():Ne.some(de=>E.homeAssistantOn?.has(de))?ue("on"):Ne.some(de=>E.homeAssistantOff?.has(de))&&ue("off")),ye(),W(),ne()}function M(K){Yp(K).forEach(oe=>G.current.delete(oe)),ye(),W(),ne()}function D(){ae()}return window.addEventListener("keydown",U),window.addEventListener("keyup",M),window.addEventListener("blur",D),()=>{window.removeEventListener("keydown",U),window.removeEventListener("keyup",M),window.removeEventListener("blur",D)}},[N,j,ne,ye,W,q,R,E.chatFocus,E.dockMacro,E.driveMacro,ae,d,l,g,re,ue]);const C=m.useRef(ae);return m.useEffect(()=>{C.current=ae},[ae]),m.useEffect(()=>{C.current()},[a.roverId]),m.useEffect(()=>()=>{se(),re()},[se,re]),null}const sr="gamepad";function cu(a,l){return Math.abs(a)<l?0:a}function Kp(a,l){return a&&l&&a.x===l.x&&a.y===l.y&&a.boost===l.boost}function Zp(a,l){return a&&l&&a.main===l.main&&a.side===l.side&&a.vacuum===l.vacuum}function ES(){const{actions:{setMode:a,setDriveVector:l,setAuxMotors:i,nudgeServo:r,runMacro:f,registerInputState:d}}=dt(),{value:g}=ot("inputs",ct),{value:p}=ot("gamepadMapping",Ar),y=g.gamepad??ct.gamepad,v=Math.min(Math.max(y.driveDeadzone??.2,0),.8),S=Math.min(Math.max(y.cameraDeadzone??.25,0),.9),b=y.servoStep??ct.gamepad.servoStep,T=y.auxReverseScale??ct.gamepad.auxReverseScale,q=!!(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,k=!!p?.buttons?.allAux,Z=N||k,V=!!p?.buttons?.mainReverse,G=!!p?.buttons?.sideReverse,$=V||G,P=!!p?.buttons?.drive,I=!!p?.buttons?.dock,ne=q||j||E||Z||$||(P||I),se=m.useRef(null),ge=m.useRef({x:0,y:0,boost:!1}),ye=m.useRef({main:0,side:0,vacuum:0}),re=m.useRef(new Map),z=m.useRef(0),Q=m.useRef({main:!1,side:!1}),W=m.useCallback((M,D)=>{const K=re.current.get(M)||!1;return re.current.set(M,D),D&&!K},[]),ae=m.useCallback((M,D)=>{if(!D)return 0;const K=M.axes?.[D.index]??0;return D.invert?-K:K},[]),ue=m.useCallback((M,D)=>{if(!D)return 0;const K=M.buttons?.[D.index];return K?typeof K.value=="number"?K.value:K.pressed?1:0:0},[]),C=m.useCallback((M,D)=>{if(!D)return!1;const K=M.buttons?.[D.index];return K?K.pressed||K.value>.5:!1},[]),U=m.useCallback(()=>{if(typeof navigator>"u"||!navigator.getGamepads)return;const M=navigator.getGamepads(),D=M&&Array.from(M).find(Boolean);if(!D){Kp(ge.current,{x:0,y:0,boost:!1})||(ge.current={x:0,y:0,boost:!1},l({x:0,y:0,boost:!1},{source:sr})),Zp(ye.current,{main:0,side:0,vacuum:0})||(ye.current={main:0,side:0,vacuum:0},i({main:0,side:0,vacuum:0})),d(sr,{connected:!1,mappingReady:ne});return}const K=q?Rn(cu(ae(D,p.drive.horizontal),v)):0,ee=q?Rn(cu(-ae(D,p.drive.vertical),v)):0,oe={x:K,y:ee,boost:!1};Kp(oe,ge.current)||(ge.current=oe,l(oe,{source:sr}));const Ne=R?ae(D,p.brushes.mainAxis):0,de=Math.round(Math.min(Math.abs(Ne),1)*127),cn=Q.current.main?-de:de,On=A?ae(D,p.brushes.sideAxis):0,Gt=Math.round(Math.min(Math.abs(On),1)*127),oa=Q.current.side?-Math.round(Gt*T):Math.round(Gt*T),Qt=N&&C(D,p.buttons.vacuum)?127:0;let ht={main:R?cn:0,side:A?oa:0,vacuum:Qt};k&&C(D,p.buttons.allAux)&&(ht={main:127,side:127,vacuum:127}),Zp(ht,ye.current)||(ye.current=ht,i(ht));const Xt=j?Rn(cu(-ae(D,p.camera.vertical),S)):0,on=performance.now();j&&Math.abs(Xt)>.25&&on-z.current>120&&(z.current=on,r(Xt>0?b:-b)),V&&W("toggle-main",C(D,p.buttons.mainReverse))&&(Q.current.main=!Q.current.main),G&&W("toggle-side",C(D,p.buttons.sideReverse))&&(Q.current.side=!Q.current.side),P&&W(`macro-${p.buttons.drive.index}`,C(D,p.buttons.drive))&&(a("drive"),f("drive-sequence")),I&&W(`macro-${p.buttons.dock.index}`,C(D,p.buttons.dock))&&(a("dock"),f("seek-dock")),d(sr,{connected:!0,mappingReady:ne,id:D.id,index:D.index,axes:[K,ee,Xt],reverse:{...Q.current},bindings:{drive:q,camera:j,brushes:E,auxButtons:{vacuum:N,allAux:k},reverseButtons:{main:V,side:G},macros:{drive:P,dock:I}}})},[T,S,v,ae,ue,W,C,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,ne,r,d,f,b,i,l,a]);return m.useEffect(()=>{function M(){U(),se.current=requestAnimationFrame(M)}return se.current=requestAnimationFrame(M),()=>{se.current&&cancelAnimationFrame(se.current)}},[U]),null}function ng(a){const l=a?.sensors||{},i=l.oiMode?.label||"Unknown",r=i.toLowerCase(),f=l.chargingState?.label||"",d=!!l.chargingSources?.homeBase,g=d&&f.toLowerCase()!=="not charging"&&f!=="";return{driving:r==="full",docked:d,charging:g,dockedNotCharging:d&&!g,dockingInProgress:!d&&!g&&r==="passive",oiLabel:i,chargingLabel:f}}function ag(a){const l=Al(a);return m.useMemo(()=>ng(l),[l])}function ia({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 Jp({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function ou({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 wS({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(Tu,{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 lg({layout:a="desktop",expand:l=!1,driveDockState:i}){const r=a==="mobile",{state:{roverId:f,keymap:d},actions:g}=dt(),p=Al(f),y=i??ng(p),{driving:v,docked:S,charging:b,dockedNotCharging:T,dockingInProgress:q,oiLabel:j}=y,[R,A]=m.useState(null),[E,N]=m.useState(!1),[k,Z]=m.useState(!1),V=!f||R!==null,G=!f||R!==null,$=ca(d?.driveMacro?.[0]),P=ca(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"]},te="Click this button to initate auto-dock.",ne={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"]},se=async()=>{if(!(!f||R)){A("drive");try{g.setMode("drive"),await g.runMacro("drive-sequence")}catch(K){alert(K.message)}finally{A(null)}}},ge=async()=>{if(!(!f||R)){N(!1),Z(!1),A("drive");try{g.setMode("drive"),await g.runMacro("drive-sequence")}catch(K){alert(K.message)}finally{A(null)}}},ye=async()=>{if(!(!f||R)){A("dock");try{g.setMode("dock"),await g.runMacro("seek-dock")}catch(K){alert(K.message)}finally{A(null),N(!1),Z(!1)}}},re=()=>{G||(Z(!0),N(!0))},z="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",ae="text-center items-center justify-between",ue=r?"text-sm font-semibold":"",C="border-emerald-300/70 bg-emerald-800 text-emerald-50 hover:bg-emerald-700 focus-visible:ring-emerald-300",U="border-amber-300/70 bg-amber-900 text-amber-50 hover:bg-amber-800 focus-visible:ring-amber-300",M="border-indigo-300/70 bg-indigo-900 text-indigo-50 hover:bg-indigo-800 focus-visible:ring-indigo-300",D=l?"h-full flex-1":"";if(!v&&!q)return o.jsxs("button",{type:"button",onClick:ge,disabled:V,className:`${z} ${D} ${ae} ${ue} ${C}`,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&&$?o.jsx(Jp,{label:$}):null,r?null:o.jsx(ou,{label:"Click to start",tone:"emerald"})]}),o.jsx("p",{className:"text-sm text-emerald-50/90",children:ne.summary}),o.jsx(Tu,{steps:ne.steps,tone:"emerald"})]}),o.jsxs("div",{className:"flex w-full flex-col gap-0.5",children:[o.jsx(ia,{label:`OI: ${j}`,active:j.toLowerCase()==="full"}),o.jsx(ia,{label:S?"Docked!":"Not docked",active:S}),o.jsx(ia,{label:b?"Charging!":"Not charging",active:b})]})]});if(q){const K={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:V,onClick:se,className:`${z} ${D} ${ae} ${ue} ${U}`,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(ou,{label:"Click to return to driving mode",tone:"amber"})]}),o.jsx("p",{className:"text-sm text-amber-50/90",children:K.summary})]}),o.jsxs("div",{className:"flex w-full flex-col gap-0.5",children:[o.jsx(ia,{label:S?"Docked":"Not docked",active:S}),o.jsx(ia,{label:b?"Charging":"Not charging",active:b})]}),o.jsx(Tu,{steps:K.steps,tone:"amber"})]})}return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",disabled:G,onClick:re,className:r?`flex w-full items-center justify-center ${z} ${ae} ${ue} ${M}`:`${z} ${D} ${ae} ${ue} ${M}`,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&&P?o.jsx(Jp,{label:P}):null,r?null:o.jsx(ou,{label:"Click to begin docking",tone:"indigo"})]}),!r&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-indigo-50/90",children:te}),o.jsxs("div",{className:"flex w-full flex-col gap-0.5",children:[o.jsx(ia,{label:S?"Docked":"Not docked",active:S}),o.jsx(ia,{label:b?"Charging":"Not charging",active:b}),T?o.jsx(ia,{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."})]})]}),k||!r&&E?o.jsx(wS,{instructions:I,pending:R==="dock",onCancel:()=>{Z(!1),N(!1)},onConfirm:ye}):null]})}function Tu({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 ir="mobile-joystick",qS=80,CS=.15,TS=[{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 MS({disabled:a,layout:l,radius:i,onMove:r,onStop:f}){const d=m.useRef(null),g=m.useRef(null),p=m.useRef({x:0,y:0}),[y,v]=m.useState({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),S=m.useCallback(()=>{g.current=null,v({active:!1,base:{x:0,y:0},knob:{x:0,y:0}}),f?.()},[f]),b=m.useCallback(R=>{if(a||g.current!==null)return;R.preventDefault();const A=d.current;if(!A)return;const E=A.getBoundingClientRect(),N=R.clientX-E.left,k=R.clientY-E.top;p.current={x:N,y:k},g.current=R.pointerId,A.setPointerCapture?.(R.pointerId),v({active:!0,base:{x:N,y:k},knob:{x:0,y:0}})},[a]),T=m.useCallback(R=>{if(a||g.current!==R.pointerId)return;R.preventDefault();const A=d.current;if(!A)return;const E=A.getBoundingClientRect(),N=R.clientX-E.left,k=R.clientY-E.top,Z=N-p.current.x,V=k-p.current.y,G=Math.min(Math.hypot(Z,V),i),$=Math.atan2(V,Z),P=Math.cos($)*G,I=Math.sin($)*G,te={x:Rn(P/i),y:Rn(-I/i),boost:!1};v(ne=>({...ne,knob:{x:P,y:I}})),r?.(te)},[a,r]),q=m.useCallback(R=>{if(g.current!==R.pointerId)return;R.preventDefault(),d.current?.releasePointerCapture?.(R.pointerId),S()},[S]);m.useEffect(()=>{a&&S()},[a,S]);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:b,onPointerMove:T,onPointerUp:q,onPointerLeave:q,onPointerCancel:q,onContextMenu:R=>R.preventDefault(),children:[!y.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"})]}),y.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:y.base.x,top:y.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:y.base.x+y.knob.x,top:y.base.y+y.knob.y}})]})]})}function sg({layout:a}){const{state:{roverId:l,camera:i},pipeline:r,actions:{setDriveVector:f,registerInputState:d,setServoAngle:g,toggleNightVision:p}}=dt(),y=ag(l),v=y.docked&&!y.driving,S=!l,b=i?.config,T=!!(l&&i?.enabled&&b),q=!!(l&&r?.nightVision),j=typeof b?.minAngle=="number"?b.minAngle:-45,R=typeof b?.maxAngle=="number"?b.maxAngle:45,A=typeof i?.angle=="number"?i.angle:typeof b?.homeAngle=="number"?b.homeAngle:(j+R)/2,E=qS,N=CS,k=m.useRef({x:0,y:0,boost:!1});m.useEffect(()=>{S&&(k.current={x:0,y:0,boost:!1})},[S]);const Z=m.useCallback((I={})=>{if(S)return;const te={x:Rn(I.x??0),y:Rn(I.y??0),boost:!!I.boost},ne={x:k.current.x+(te.x-k.current.x)*(1-N),y:k.current.y+(te.y-k.current.y)*(1-N),boost:te.boost};k.current=ne,f(ne,{source:ir}),d(ir,{vector:ne,lastEvent:"move"})},[S,d,f,N]),V=m.useCallback(()=>{if(S)return;const I={x:0,y:0,boost:!1};k.current=I,f(I,{source:ir}),d(ir,{vector:I,lastEvent:"stop"})},[S,d,f]),G=I=>{if(!T)return;const te=Number(I.target.value);Number.isNaN(te)||g(te)},P=`flex h-full flex-col gap-0.5 text-slate-100 ${v?"max-h-screen self-start":""}`;return o.jsxs("div",{className:P,children:[o.jsx(lg,{layout:"mobile",expand:v,driveDockState:y}),v?null:o.jsxs(o.Fragment,{children:[q&&o.jsx("button",{type:"button",onClick:()=>p(),disabled:S,className:"bg-amber-600 px-0.5 py-1 text-sm font-semibold text-amber-50 transition hover:bg-amber-500 disabled:opacity-40",children:"Toggle Night Vision"}),T&&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:G,className:"mt-0 w-full accent-cyan-400"})]}),o.jsx(MS,{disabled:S,layout:a,radius:E,onMove:Z,onStop:V})]})]})}function ig({orientation:a}){const{state:{roverId:l},actions:{setAuxMotors:i}}=dt(),r=m.useRef(null),f=!l,d=m.useCallback(y=>{if(!f){if(y.hold===!1){i(y.values),r.current=null;return}r.current=y.id,i(y.values)}},[f,i]),g=m.useCallback(y=>{f||y.hold===!1||r.current===y.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:TS.map(y=>o.jsx("button",{type:"button",disabled:f,onPointerDown:v=>{v.preventDefault(),d(y)},onPointerUp:()=>g(y),onPointerLeave:()=>g(y),onPointerCancel:()=>g(y),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 ${y.color} hover:brightness-110 disabled:opacity-30 h-10`,children:y.label},y.id))})]})}function RS(){return o.jsx("div",{className:"flex h-full flex-col gap-0.5",children:o.jsx(ig,{orientation:"landscape"})})}function _S(){return o.jsx("div",{className:"flex h-full flex-col gap-0.5",children:o.jsx(sg,{layout:"landscape"})})}function kS(){return o.jsx("section",{className:"panel",children:o.jsxs("div",{className:"grid grid-cols-2 gap-0.5 items-stretch",children:[o.jsx(ig,{orientation:"portrait"}),o.jsx(sg,{layout:"portrait"})]})})}function OS(a=[],l={}){const i=rn(),{enabled:r=!0,version:f=null}=l,[d,g]=m.useState({}),p=m.useRef(new Map),y=m.useMemo(()=>a.map(j=>typeof j=="string"?j:j.id),[a]),v=m.useMemo(()=>{const j=y.join("|");return f?`${j}|v:${f}`:j},[y,f]),S=m.useRef([]),[b,T]=m.useState(0),q=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const j=()=>T(R=>R+1);return i.on("connect",j),()=>i.off("connect",j)},[i]),m.useEffect(()=>{S.current=y},[v,y]),m.useEffect(()=>{p.current.forEach(j=>URL.revokeObjectURL(j)),p.current.clear(),g({})},[v]),m.useEffect(()=>{if(!r){p.current.forEach(N=>URL.revokeObjectURL(N)),p.current.clear(),g({});return}if(!S.current.length||!i)return;let j=!1;const R=S.current,A=(N={},k)=>{if(j||!N.id||!k)return;const Z=k.byteLength??k.length??0,V=Date.now(),G=q.current.get(N.id)||{count:0,totalBytes:0,lastLogAt:0},$={count:G.count+1,totalBytes:G.totalBytes+Z,lastLogAt:G.lastLogAt};if(!$.lastLogAt||V-$.lastLogAt>=1e4){const ne=$.count?$.totalBytes/$.count:0;console.log("[roomCamera]",N.id,`frame=${Z}B`,`avg=${Math.round(ne)}B`,`count=${$.count}`),$.lastLogAt=V}q.current.set(N.id,$);const P=new Blob([k],{type:"image/jpeg"}),I=URL.createObjectURL(P),te=p.current.get(N.id);te&&URL.revokeObjectURL(te),p.current.set(N.id,I),g(ne=>({...ne,[N.id]:{status:"playing",ts:N.ts||Date.now(),error:null,objectUrl:I}}))},E=(N={})=>{j||!N.id||g(k=>({...k,[N.id]:{...k[N.id]||{},status:N.error?"error":k[N.id]?.status||"connecting",error:N.error||null,ts:N.ts||k[N.id]?.ts||null,objectUrl:k[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,b]),d}function DS({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 zS(){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 rg=["horizontal","vertical"];function uu(a,l){return rg.includes(a)?a:l}function Iu({defaultOrientation:a="horizontal",orientation:l,hideLayoutToggle:i=!1,hideHeader:r=!1,panelId:f=null}){const{session:d}=Re(),g=d?.roomCameras||[],p=OS(g.map(A=>({id:A.id}))),{value:y,save:v}=ot("roomCameraPanels",{}),[S,b]=m.useState(()=>uu(f?y?.[f]:a,"horizontal"));m.useEffect(()=>{if(!f)return;const A=y?.[f];A&&b(uu(A,"horizontal"))},[f,y?.[f]]);const T=l?uu(l,"horizontal"):S,q=T==="vertical"?"flex flex-col gap-0.5":"grid gap-0.5 md:grid-cols-2",j=!i&&!l&&g.length>0,R=A=>{b(A),f&&v(E=>({...E||{},[f]:A}))};return g.length===0?o.jsx(zS,{}):o.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[!r&&o.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-0.5 text-sm text-slate-400",children:[o.jsxs("div",{className:"flex items-center gap-0.5",children:[o.jsx("p",{children:"Room cameras"}),o.jsx("span",{className:"text-xs text-slate-500",children:g.length})]}),o.jsx("div",{className:"flex flex-wrap items-center gap-0.5 text-xs",children: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:rg.map(A=>o.jsx("button",{type:"button",className:`px-1 py-0.5 ${T===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:q,children:g.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(DS,{feed:E,label:A.name||A.id})},A.id)})})]})}function Wu(){const{logs:a}=Re();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 BS(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 LS(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 Pu(a=[],l={}){const i=rn(),{enabled:r=!0,version:f=null}=l,[d,g]=m.useState({}),p=m.useMemo(()=>Array.isArray(a)?LS(a.map(BS).filter(Boolean)):[],[a]),y=m.useMemo(()=>{const q=p.map(j=>`${j.type}:${j.id}:${j.key}`).join("|");return f?`${q}|v:${f}`:q},[p,f]),v=m.useRef([]),[S,b]=m.useState(0);return m.useEffect(()=>{if(!i)return;const q=()=>b(j=>j+1);return i.on("connect",q),()=>{i.off("connect",q)}},[i]),m.useEffect(()=>{v.current=p},[p]),m.useEffect(()=>{if(!y||!r){g({});return}const q=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||g(k=>({...k,[A.key]:N}))})}return q.forEach(A=>{R(A)}),()=>{j=!0}},[i,y,r,S]),m.useMemo(()=>{if(!y||!r)return{};const q={};return p.forEach(j=>{d[j.key]&&(q[j.key]=d[j.key])}),q},[y,d,p])}function ef(a=[],l={}){const i=rn(),{enabled:r=!0,version:f=null}=l,[d,g]=m.useState({}),p=m.useRef(new Map),y=m.useMemo(()=>a.map(j=>typeof j=="string"?j:j.id).filter(Boolean),[a]),v=m.useMemo(()=>{const j=y.join("|");return f?`${j}|v:${f}`:j},[y,f]),S=m.useRef([]),[b,T]=m.useState(0),q=m.useRef(new Map);return m.useEffect(()=>{if(!i)return;const j=()=>T(R=>R+1);return i.on("connect",j),()=>i.off("connect",j)},[i]),m.useEffect(()=>{S.current=y},[v,y]),m.useEffect(()=>{p.current.forEach(j=>URL.revokeObjectURL(j)),p.current.clear(),g({})},[v]),m.useEffect(()=>{if(!r){p.current.forEach(N=>URL.revokeObjectURL(N)),p.current.clear(),g({});return}if(!S.current.length||!i)return;let j=!1;const R=S.current,A=(N={},k)=>{if(j||!N.id||!k)return;const Z=k.byteLength??k.length??0,V=Date.now(),G=q.current.get(N.id)||{count:0,totalBytes:0,lastLogAt:0},$={count:G.count+1,totalBytes:G.totalBytes+Z,lastLogAt:G.lastLogAt};if(!$.lastLogAt||V-$.lastLogAt>=1e4){const ne=$.count?$.totalBytes/$.count:0;console.log("[roverSnapshot]",N.id,`frame=${Z}B`,`avg=${Math.round(ne)}B`,`count=${$.count}`),$.lastLogAt=V}q.current.set(N.id,$);const P=new Blob([k],{type:"image/jpeg"}),I=URL.createObjectURL(P),te=p.current.get(N.id);te&&URL.revokeObjectURL(te),p.current.set(N.id,I),g(ne=>({...ne,[N.id]:{status:"playing",ts:N.ts||Date.now(),error:null,objectUrl:I}}))},E=(N={})=>{j||!N.id||g(k=>({...k,[N.id]:{...k[N.id]||{},status:N.error?"error":k[N.id]?.status||"connecting",error:N.error||null,ts:N.ts||k[N.id]?.ts||null,objectUrl:k[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,b]),d}const US={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"turn:your.turn.server:3478",username:"user",credential:"pass"}],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function HS(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 VS(a){if(!a)return{};const l=`${a}:${a}`;return{Authorization:`Basic ${HS(l)}`}}class Fp{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(US);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",...VS(this.token)},body:r.sdp,signal:this.abortController.signal});if(!f.ok)throw new Error(`WHEP request failed: ${f.status}`);const d=await f.text();await l.setRemoteDescription({type:"answer",sdp:d}),l.getReceivers().forEach(g=>{"playoutDelayHint"in g&&(g.playoutDelayHint=0)}),await this.video.play().catch(()=>{}),this.notify("playing")}catch(r){throw this.notify("error",r.message),this.stop(),r}}stop(){this.abortController&&(this.abortController.abort(),this.abortController=null),this.pc&&(this.pc.getSenders().forEach(l=>l.track?.stop()),this.pc.getReceivers().forEach(l=>l.track?.stop()),this.pc.close(),this.pc=null),this.video&&(this.video.srcObject=null),this.notify("stopped")}}function Mu({sensors:a={},variant:l="full",size:i,overlay:r=!1}){const f=i||(l==="mini"?190:260),d=f/2,g=f*.07,p=d,y=d+g,v=d*.8,S=v-4,b=v+4,T=v-14,q=v-6,j=v*.65,R=a?.bumpsAndWheelDrops||{},A=a?.wheelOvercurrents||{},E=a?.wheelLeftCurrentMa??0,N=a?.wheelRightCurrentMa??0,k=a?.sideBrushCurrentMa??0,Z=a?.mainBrushCurrentMa??0,V=6,G=R.bumpLeft?V:0,$=R.bumpRight?V:0,P=ZS({count:6,totalSpan:140,gap:6,startAngle:-70}),I=["L","FL","CL","CR","FR","R"],te=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],ne=P.map((re,z)=>({label:I[z],start:re.start,end:re.end,value:te[z]})),se=[{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}],ge=te.filter(re=>re!=null),ye=ge.length?Math.max(...ge,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–",ye]})]}),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:y,r:v,fill:"#0f172a",stroke:"#334155",strokeWidth:"2"}),o.jsx(Ip,{cx:p-j,cy:y,current:E,drop:R.wheelDropLeft,overcurrent:A.leftWheel,label:"L"}),o.jsx(Ip,{cx:p+j,cy:y,current:N,drop:R.wheelDropRight,overcurrent:A.rightWheel,label:"R"}),o.jsx(QS,{cx:p+v*.65,cy:y-v*.55,current:k,overcurrent:A.sideBrush}),o.jsx(XS,{cx:p,cy:y,current:Z,overcurrent:A.mainBrush,variant:l,dirtLeft:a?.dirtDetectLeft,dirtRight:a?.dirtDetect}),ne.map(re=>{const z=$S(re.value,ye),Q=b+4,W=Q+28;return o.jsx(YS,{cx:p,cy:y,rBase:W,rTip:Q,startDeg:re.start,endDeg:re.end,color:z,value:re.value,max:ye},re.label)}),se.map(re=>{const z=KS(re.value,re.active);return o.jsx(fu,{cx:p,cy:y,rInner:T,rOuter:q,startDeg:re.start,endDeg:re.end,color:z,opacity:1,pulse:!!re.active},re.label)}),o.jsx(fu,{cx:p,cy:y,rInner:S-G,rOuter:b-G,startDeg:-70,endDeg:-6,color:R.bumpLeft?"#ef4444":"#475569",opacity:1,pulse:!!R.bumpLeft}),o.jsx(fu,{cx:p,cy:y,rInner:S-$,rOuter:b-$,startDeg:6,endDeg:70,color:R.bumpRight?"#ef4444":"#475569",opacity:1,pulse:!!R.bumpRight})]})]})}function fu({cx:a,cy:l,rInner:i,rOuter:r,startDeg:f,endDeg:d,color:g,pulse:p=!1,opacity:y=1}){const v=(i+r)/2,S=r-i,b=GS(a,l,v,f,d);return o.jsxs(o.Fragment,{children:[o.jsx("path",{d:b,stroke:g,strokeWidth:S,strokeLinecap:"round",fill:"none",opacity:y}),p?o.jsx("path",{d:b,stroke:"#ef4444",strokeWidth:S,strokeLinecap:"round",fill:"none",className:"animate-pulse",opacity:1}):null]})}function YS({cx:a,cy:l,rBase:i,rTip:r,startDeg:f,endDeg:d,color:g,value:p,max:y}){const v=(f+d)/2,S=qs(a,l,r,v),b=qr(p!=null?p/(y||1):0),T=Math.pow(b,.35),q=i-(i-r)*T,j=qs(a,l,q,f),R=qs(a,l,q,d),A=`M ${S.x} ${S.y} L ${j.x} ${j.y} L ${R.x} ${R.y} Z`;return o.jsx("path",{d:A,fill:g,opacity:1,stroke:"none"})}function GS(a,l,i,r,f){let d=r,g=f;g<=d&&(g+=360);const p=qs(a,l,i,d),y=qs(a,l,i,g);return["M",p.x,p.y,"A",i,i,0,0,1,y.x,y.y].join(" ")}function qs(a,l,i,r){const f=cg(r);return{x:a+i*Math.cos(f),y:l+i*Math.sin(f)}}function cg(a){return(a-90)*Math.PI/180}function tf(a,l){if(l)return"#ef4444";const i=Math.abs(a);return i>900?"#f59e0b":i>300?"#22c55e":"#64748b"}function qr(a){return Math.max(0,Math.min(1,a))}function Ip({cx:a,cy:l,current:i,drop:r,overcurrent:f,label:d}){const g=Math.abs(i),p=qr(g/1200),y=tf(i,f),v=56,S=14,b=9,T=3,q=v*p,j=d==="L"?-1:1,R=j*(-b/2-T/2),A=j*(S/2+T/2),E=S+b+T+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-S/2,y:-v/2,width:S,height:v,fill:"#0f172a",stroke:"#0f172a",strokeWidth:"1",rx:"2"}),o.jsx("rect",{x:R-S/2,y:v/2-q,width:S,height:q,fill:y,className:f?"animate-pulse":""}),o.jsx("rect",{x:A-b/2,y:-v/2,width:b,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 QS({cx:a,cy:l,current:i,overcurrent:r}){const f=Math.abs(i),d=tf(i*3,r),g=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(y=>{const v=cg(y),S=a+g*Math.cos(v),b=l+g*Math.sin(v);return o.jsx("line",{x1:a,y1:l,x2:S,y2:b,stroke:d,strokeWidth:"4",strokeLinecap:"round"},y)}),r?o.jsx("circle",{cx:a,cy:l,r:g+8,stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function XS({cx:a,cy:l,current:i,overcurrent:r,variant:f,dirtLeft:d,dirtRight:g}){const p=Math.abs(i),y=tf(i,r),v=1,S=96,b=12,T=`main-brush-pattern-a-${f}`,q=`main-brush-pattern-b-${f}`,j=p>0?.6:null,R=i>=0?1:-1;return o.jsxs("g",{children:[o.jsx("defs",{children:[T,q].map((A,E)=>o.jsxs("pattern",{id:A,patternUnits:"userSpaceOnUse",width:"6",height:"6",children:[o.jsx("rect",{width:"6",height:"6",fill:y,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-S/2,y:l-14,width:S,height:b,rx:"3",fill:`url(#${T})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("rect",{x:a-S/2,y:l+4,width:S,height:b,rx:"3",fill:`url(#${q})`,stroke:"#64748b",strokeWidth:"1"}),o.jsx("circle",{cx:a-S/4,cy:l-8,r:3.5,fill:"#fbbf24"}),o.jsx("circle",{cx:a+S/4,cy:l+8,r:3.5,fill:"#fbbf24"}),r?o.jsx("rect",{x:a-S/2-4,y:l-16,width:S+8,height:b*2+16,rx:"6",stroke:"#ef4444",strokeWidth:"3",fill:"none",className:"animate-pulse"}):null]})}function $S(a,l){if(a==null||a<=0)return"hsl(200 60% 18%)";const r=qr(a/(l||1));return`hsl(${(200+Math.pow(r,.45)*360)%360} 100% 60%)`}function KS(a,l){if(l)return"#ef4444";const i=qr(a==null?0:a/4095),r=[47,55,69],f=[245,158,11],[d,g,p]=r.map((y,v)=>Math.round(y+(f[v]-y)*i));return`rgb(${d}, ${g}, ${p})`}function ZS({count:a,totalSpan:l,gap:i,startAngle:r}){const d=(l-i*(a-1))/a,g=[];let p=r;for(let y=0;y<a;y+=1){const v=p+d;g.push({start:p,end:v}),p=v+i}return g}function og(){const{value:a,save:l}=ot("page",{hudMapDesktop:!1});return[!!a?.hudMapDesktop,f=>{l({hudMapDesktop:!!f})}]}function Cr({text:a="Join our Discord!",className:l=""}){const{session:i}=Re(),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(J0,{className:"mr-0"}),a]}):null}const Wp=2e3,JS=3e3,FS=3e3;function IS(a,l){const i=l?.Full,r=l?.Warn,f=l?.Urgent??null;if(a==null||i==null||r==null)return{available:!1};const d=i-r;if(d<=0)return{available:!1};const g=(a-r)/d,p=Math.min(1,Math.max(0,g)),y=Math.round(p*100),v=g<=0,S=f!=null&&a<=f;return{available:!0,percentDisplay:y,depleted:v,warnTriggered:S,barClass:v?"bg-red-500 animate-pulse":S?"bg-amber-400":"bg-emerald-500"}}function nf({sessionInfo:a,audioSessionInfo:l,videoMode:i="whep",snapshotFeed:r=null,qualityNotice:f=null,label:d,forceMute:g=!1,telemetryFrame:p,batteryConfig:y,layoutFormat:v="desktop",hudVariant:S="default",driverLabel:b=null,hudForceMap:T=!1,hudMapPosition:q="top-right",hudLabelScale:j=1,fitParent:R=!1,showTurnCue:A=!1,turnTimerText:E=null,turnSeconds:N=null,isActiveDriver:k=!1,idleSkipSeconds:Z=null}){const V=m.useRef(null),G=m.useRef(null),$=m.useRef(null),P=m.useRef(null),I=m.useRef(null),te=m.useRef(null),[ne,se]=m.useState("idle"),[ge,ye]=m.useState(null),[re,z]=m.useState("idle"),[Q,W]=m.useState(null),[ae,ue]=m.useState(0),[C,U]=m.useState(0),[M,D]=m.useState(!0),K=i==="snapshot",ee=p?.sensors,oe=ee?.batteryChargeMah??null,Ne=v==="desktop",de=!Ne,[cn]=og(),On=T||de?!0:cn,Gt=IS(oe,y),oa=ee?.wheelOvercurrents||null,Qt=oa==null?[]:Object.entries(oa).filter(([,Ee])=>!!Ee).map(([Ee])=>Ee),ht=m.useCallback(()=>{clearTimeout($.current),$.current=setTimeout(()=>ue(Date.now()),Wp)},[]),Xt=m.useCallback(()=>{clearTimeout(P.current),P.current=setTimeout(()=>U(Date.now()),Wp)},[]),on=m.useCallback(async()=>{const Ee=V.current;if(Ee)try{Ee.muted=!0,await Ee.play()}catch{}},[]),jl=m.useCallback((Ee=0)=>{if(g)return;clearTimeout(te.current);const ze=()=>{clearTimeout(te.current),te.current=setTimeout(()=>{g||mt()},JS)},mt=async()=>{const Le=V.current;if(Le)try{await on(),Le.muted=!1,await Le.play(),D(!1)}catch{Le.muted=!0,D(!0),ze()}};te.current=setTimeout(mt,Ee)},[on,g]);m.useEffect(()=>()=>{clearTimeout($.current),clearTimeout(P.current),clearTimeout(te.current),clearInterval(I.current)},[]),m.useEffect(()=>{ne==="playing"&&jl(0)},[ne,jl]),m.useEffect(()=>{K&&(se("snapshot"),ye(null))},[K]),m.useEffect(()=>{if(K||!a?.url||!V.current)return;let Ee=!0,ze;const mt=setTimeout(()=>D(!0),0),Le=(Xe,_e)=>{Ee&&(se(Xe),ye(_e||null),Xe==="playing"&&on(),["error","failed","disconnected","closed"].includes(Xe)&&ht())};return ze=new Fp({url:a.url,token:a.token,video:V.current,onStatus:Le}),ze.start().catch(Xe=>{Ee&&(se("error"),ye(Xe.message),ht())}),()=>{Ee=!1,clearTimeout(mt),ze?.stop()}},[K,a?.url,a?.token,ae,ht,on]),m.useEffect(()=>{ne==="stopped"&&a?.url&&ht()},[ne,a?.url,ht]),m.useEffect(()=>{if(!l?.url||!G.current)return;let Ee=!0,ze;const mt=(Le,Xe)=>{Ee&&(W(Xe||(Le==="connected"?"connected":null)),z(_e=>Le==="connected"&&(_e==="playing"||_e==="connecting")||Le==="new"?_e:Le),Le==="playing"&&G.current?.play().catch(()=>{}),["error","failed","disconnected","closed"].includes(Le)&&Xt())};return ze=new Fp({url:l.url,token:l.token,video:G.current,audioOnly:!0,onStatus:mt}),ze.start().catch(Le=>{Ee&&(z("error"),W(Le.message),Xt())}),()=>{Ee=!1,ze?.stop()}},[l?.url,l?.token,C,Xt]),m.useEffect(()=>{const Ee=G.current;if(!l?.url||!Ee){clearInterval(I.current);return}if(!["connecting","connected","playing","paused"].includes(re)){clearInterval(I.current);return}const mt=()=>{const Le=G.current;Le&&(!Le.paused&&!Le.ended||Le.play().then(()=>{z(Xe=>Xe==="connected"?"playing":Xe),W(Xe=>Xe==="paused"?null:Xe)}).catch(Xe=>{W(_e=>_e||Xe?.message||"autoplay blocked")}))};return mt(),I.current=setInterval(mt,FS),()=>clearInterval(I.current)},[l?.url,re]),m.useEffect(()=>{const Ee=G.current;if(!Ee)return;const ze=()=>{z(_e=>_e==="error"?_e:"playing"),W(null)},mt=()=>{z(_e=>["error","failed","disconnected","closed","stopped"].includes(_e)?_e:"paused"),W(_e=>_e||"paused")},Le=()=>{z(_e=>_e==="error"?_e:"stopped"),W(_e=>_e||"ended")},Xe=()=>{const{error:_e}=Ee,Rr=_e?.message||"audio error";z("error"),W(Rr)};return Ee.addEventListener("play",ze),Ee.addEventListener("pause",mt),Ee.addEventListener("ended",Le),Ee.addEventListener("error",Xe),()=>{Ee.removeEventListener("play",ze),Ee.removeEventListener("pause",mt),Ee.removeEventListener("ended",Le),Ee.removeEventListener("error",Xe)}},[l?.url]);const Nl=r?.error?`Error: ${r.error}`:r?.objectUrl?"snapshot":r?.status||"waiting",El=K?Nl:a?.url?ne==="error"?`Error: ${ge||"unknown"}`:ge?`${ne} (${ge})`:ne:"waiting",wl=l?.error?`Error: ${l.error}`:l?.url?re==="error"?`Error: ${Q||"unknown"}`:Q?`${re} (${Q})`:re:null,Ls=S==="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:[K?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:V,muted:g||M,playsInline:!0,autoPlay:!0,controls:!1,className:"h-full w-full object-contain"}),o.jsx("audio",{ref:G,autoPlay:!0,hidden:!0}),A?o.jsx(nA,{mobileHud:de,turnSeconds:N,isActiveDriver:k,idleSkipSeconds:Z}):null,o.jsx(tA,{frame:p,sensors:ee,label:d,status:El,audioStatus:wl,desktopLayout:Ne,layoutFormat:v,variant:S,driverLabel:b,battery:Gt,showTopDown:On,mobileHud:de,mapPosition:q,turnTimerText:E,labelScale:j}),o.jsx(iA,{compact:de}),o.jsx(lA,{motors:Qt,compact:de}),o.jsx(sA,{charge:oe,config:y,compact:de}),Ls&&Gt.available?o.jsx(PS,{visual:Gt}):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 ${de?"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(Cr,{text:"Join our Discord server while you wait!"})})]})}):null]}),!Ls&&o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(eA,{sensors:ee}),o.jsx(WS,{visual:Gt})]})]})}function WS({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 PS({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 eA({sensors:a}){const l=[a?.lightBumpLeftSignal,a?.lightBumpFrontLeftSignal,a?.lightBumpCenterLeftSignal,a?.lightBumpCenterRightSignal,a?.lightBumpFrontRightSignal,a?.lightBumpRightSignal],i=l.filter(p=>p!=null).reduce((p,y)=>Math.max(p,y),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,g=12;return o.jsx("div",{className:"flex w-full items-center justify-center gap-0.5",children:l.map((p,y)=>{const v=r(p),S=y<d/2?-1:1,b=`${v*100}%`,T=f(p);return o.jsx("div",{className:"relative flex-1 min-w-[0]",style:{height:`${g}px`},children:o.jsx("div",{className:"h-full w-full overflow-hidden bg-slate-800",style:{borderRadius:0},children:o.jsx("div",{className:"h-full",style:{width:b,background:T,float:S===-1?"right":"left"}})})},y)})})}function tA({frame:a,sensors:l,label:i,status:r,audioStatus:f,desktopLayout:d=!0,layoutFormat:g="desktop",variant:p="default",driverLabel:y=null,battery:v,showTopDown:S=!1,mobileHud:b=!1,mapPosition:T="top-right",turnTimerText:q=null,labelScale:j=1}){l?.bumpsAndWheelDrops;const[R,A]=m.useState(()=>Date.now());m.useEffect(()=>{const Q=setInterval(()=>A(Date.now()),150);return()=>clearInterval(Q)},[]),a?.receivedAt&&R-a.receivedAt<200;const E=b,N=g==="mobile-portrait",k=E?"text-[0.45rem]":"text-[0.65rem]",Z=E?"px-0.25 py-0.25":"px-1 py-0.5",V=E?"px-0.25 py-0.25":"px-0.5 py-0.5",G=E?"text-[0.55rem]":"text-[0.8rem]",$=E?"left-0.5 top-0.5":"left-1 top-1",P=E?"text-[0.5rem]":"text-[0.7rem]",I=E?"px-0.5 py-0.25":"px-1 py-0.5",te=E?"left-0.5 top-1/2":"left-1 top-1/2",ne="bottom-0.5",se={transform:`translateX(-50%) scale(${j})`,transformOrigin:"center bottom"},ge="240px",z={width:ge,height:ge,opacity:E?.85:.7,transform:`scale(${N?.36:E?.45:.7})`,transformOrigin:T==="bottom-left"?"bottom left":"top right",...T==="bottom-left"?{left:"0.25rem",bottom:"0.25rem"}:{right:"0.25rem",top:"0.25rem"}};if(p==="spectator"){const Q=[["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 ${$} font-medium text-slate-100 ${k}`,children:o.jsxs("div",{className:"flex flex-col gap-0.5 leading-none",children:[o.jsxs("span",{children:["Status: ",r]}),f?o.jsxs("span",{children:["Audio: ",f]}):null]})}),o.jsxs("div",{className:`absolute ${te} flex -translate-y-1/2 flex-col gap-0.5 bg-black/70 text-slate-100 ${k} ${Z}`,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"}),Q.map(([W,ae])=>o.jsxs("span",{className:"flex items-center justify-between gap-0.5",children:[o.jsx("span",{className:"text-slate-400",children:W}),o.jsx("span",{className:"font-semibold text-white",children:ae})]},W))]}),S?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(Mu,{sensors:l,size:160,overlay:!0})})}):null]}),o.jsx("div",{className:`absolute ${ne} left-1/2`,style:se,children:o.jsxs("div",{className:`flex items-center gap-0.5 bg-black/80 text-slate-100 ${V} ${G}`,children:[o.jsx("span",{className:"font-semibold text-white",children:i||"Unnamed Rover"}),y?o.jsxs("span",{className:"text-slate-300",children:["• ",y]}):null]})})]})}return o.jsxs("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:[o.jsx("div",{className:`absolute ${$} font-medium text-slate-100 ${k}`,children:o.jsxs("div",{className:"flex flex-col gap-0.5 leading-none",children:[o.jsxs("span",{children:["Status: ",r]}),f?o.jsxs("span",{children:["Audio: ",f]}):null]})}),q?o.jsx("div",{className:`absolute left-1/2 top-0.5 -translate-x-1/2 rounded bg-black/70 text-slate-100 ${I} ${P}`,children:q}):null,o.jsx("div",{className:`absolute ${ne} left-1/2`,style:se,children:o.jsx("div",{className:`flex gap-0.5 bg-black/80 text-slate-100 ${V} ${G}`,children:o.jsxs("span",{children:['Rover: "',i||"Unnamed Rover",'"']})})}),S&&p!=="spectator"?o.jsx("div",{className:"pointer-events-none absolute rounded",style:{...z},children:o.jsx(Mu,{sensors:l,size:240,overlay:!0})}):null]})}function nA({mobileHud:a=!1,turnSeconds:l=null,isActiveDriver:i=!1,idleSkipSeconds:r=null}){const f=a?"text-3xl":"text-5xl",d=a?"text-xs":"text-sm",g=a?"text-[0.55rem]":"text-[0.75rem]",p=a?"px-4 py-3":"px-6 py-4",y=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!"}),y?o.jsxs("div",{className:`text-red-100/90 ${g}`,children:["Idle skip in ",r,"s"]}):null]})})}const aA={leftWheel:"Left wheel",rightWheel:"Right wheel",mainBrush:"Main brush",sideBrush:"Side brush"};function lA({motors:a,compact:l=!1}){if(!a?.length)return null;const i=a.map(g=>aA[g]||g),r=l?"p-2":"p-4",f=l?"text-lg":"text-4xl",d=l?"text-xs":"text-xl";return o.jsx("div",{className:`pointer-events-none absolute flex items-center justify-center bg-red-900/60 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${r}`,children:o.jsxs("div",{className:`text-center font-semibold text-white animate-pulse ${f}`,children:[o.jsx("div",{children:"OVERCURRENT"}),o.jsx("div",{className:`mt-0 font-medium text-white ${d}`,children:i.join(", ")})]})})}function sA({charge:a,config:l,compact:i=!1}){if(a==null||l==null)return null;const r=l.Full,f=l.Warn,d=l.Urgent??null,g=r-f;if(g<=0)return null;const y=(a-f)/g<=0;if(!(d!=null&&a<=d)&&!y)return null;const S=y?"Battery low! please dock and charge the rover soon.":"BATTERY VERY LOW, PLEASE DOCK THE ROVER AND CHARGE IMMEDIATELY!!",b=i?"p-2 top-6":"p-4 top-10",T=i?"text-sm":"text-2xl";return o.jsx("div",{className:`pointer-events-none absolute flex items-center justify-center bg-amber-900/60 left-1/2 -translate-x-1/2 ${b}`,children:o.jsx("div",{className:`text-center font-semibold text-white animate-pulse ${T}`,children:o.jsx("div",{children:S})})})}function iA({compact:a=!1}){const{session:l}=Re(),{sendMessage:i,onInputFocus:r,onInputBlur:f,blurChat:d,registerInputRef:g}=Zu(),{value:p}=ot("tts",{engine:"flite",voice:"rms",pitch:50}),[y,v]=m.useState(""),[S,b]=m.useState(!1),T=l?.role!=="spectator",q=l?.role==="spectator",j=l?.assignment?.roverId||null,A=!!m.useMemo(()=>l?.roster?.find(G=>String(G.id)===String(j))||null,[j,l?.roster])?.audio?.ttsEnabled,E=m.useMemo(()=>{if(!A)return null;const G=p?.engine==="espeak"?"espeak":"flite";if(G==="espeak"){let P=Number.isFinite(p?.pitch)?Math.round(p.pitch):void 0;return typeof P=="number"&&(P=Math.max(0,Math.min(99,P))),{speak:!0,engine:G,pitch:P}}const $=typeof p?.voice=="string"?p.voice:void 0;return{speak:!0,engine:G,voice:$}},[p?.engine,p?.pitch,p?.voice,A]),N=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",k=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",Z=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 V(G){if(G.preventDefault(),!T)return;const $=y.trim();if($){b(!0);try{await i($,E),v(""),d()}catch(P){alert(P.message)}finally{b(!1)}}}return q?null:o.jsxs("form",{onSubmit:V,className:N,children:[o.jsx("input",{className:k,value:y,onChange:G=>v(G.target.value),onFocus:r,onBlur:f,onKeyDown:G=>{G.key==="Enter"&&!y.trim()&&(G.preventDefault(),d())},ref:G=>g(G,{target:"hud"}),placeholder:T?"Chat (TTS)":"Spectator",disabled:!T}),o.jsx("button",{type:"submit",disabled:!T||S,className:Z,children:"Speak"})]})}function af({layoutFormat:a="desktop"}){const{session:l}=Re(),{state:{song:i,lastControlIntentAt:r}}=dt(),[f,d]=m.useState(()=>Date.now()),[g,p]=m.useState(!1),[y,v]=m.useState(null),S=m.useRef({active:!1,roverId:null});m.useEffect(()=>{if(l?.mode!=="turns")return;const M=setInterval(()=>d(Date.now()),250);return()=>clearInterval(M)},[l?.mode]);const b=l?.assignment?.roverId,q=!!(b&&l?.roster?l.roster.find(M=>String(M.id)===String(b)):null)?.media?.audioPublishUrl,j=b?l?.turnQueues?.[b]:null,R=l?.socketId||null,A=b?l?.activeDrivers?.[b]:null,E=!!(R&&A===R),N=m.useMemo(()=>{const M=j?.queue||[];if(!M.length||!j?.current||M.length<=1)return null;const D=M.findIndex(K=>K===j.current);return D===-1?M[0]||null:M[(D+1)%M.length]||null},[j?.queue,j?.current]),k=!!(R&&N===R),Z=j?.deadline||null,V=j?.idleDeadline||null,G=Z?Z-f:null,$=V?V-f:null,P=l?.mode==="turns"&&k&&G!=null&&G<=5e3&&G>0,I=l?.mode!=="turns"||E||P,te=G!=null&&Number.isFinite(G)?Math.max(0,Math.ceil(G/1e3)):null,ne=$!=null&&Number.isFinite($)?Math.max(0,Math.ceil($/1e3)):null,se=E?te!=null?`${te}s left`:null:k&&te!=null?`Your turn in ${te}s`:null,ge=b?[...I?[{type:"rover",id:b,key:b}]:[],...q?[{type:"rover",id:`${b}-audio`,key:`${b}-audio`}]:[]]:[],ye=Pu(ge),re=b&&I?ye[b]:null,z=b&&q?ye[`${b}-audio`]:null,Q=ef(b?[b]:[],{enabled:!!b,version:l?.mode}),W=b&&Q[b]||null,ae=Al(b),ue=b&&l?.roster?l.roster.find(M=>String(M.id)===String(b)):null,C=ue?.battery??null,U=ue?.name||(b?`Rover ${b}`:"");return m.useEffect(()=>{if(l?.mode!=="turns"){p(!1),v(null),S.current={active:!1,roverId:null};return}const M=S.current,D=E&&!M.active,K=E&&b&&b!==M.roverId;D||K?(p(!0),v(Date.now())):!E&&M.active&&(p(!1),v(null)),S.current={active:E,roverId:b}},[E,b,l?.mode]),m.useEffect(()=>{!g||!y||r>y&&p(!1)},[r,y,g]),o.jsx("section",{className:"panel",children:b?o.jsx(nf,{sessionInfo:re,videoMode:I?"whep":"snapshot",snapshotFeed:W,audioSessionInfo:z,label:U,telemetryFrame:ae,batteryConfig:C,layoutFormat:a,songNote:i?.note,qualityNotice:I?null:"Preview feed (low FPS) until your turn.",showTurnCue:g,turnTimerText:se,turnSeconds:te,isActiveDriver:E,idleSkipSeconds:ne}):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 Pp(...a){return a.filter(Boolean).join(" ")}function rA(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function cA(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function oA({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:Pp("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:Pp("font-semibold",cA(f)),children:["Battery ",rA(f)]})]})]}),r?r(f):null]},f.id))})]})}function uA({keymap:a}){const{state:{roverId:l,camera:i},actions:{setServoAngle:r}}=dt(),f=i?.config,d=!!(l&&i?.enabled&&f),g=typeof f?.minAngle=="number"?f.minAngle:-30,p=typeof f?.maxAngle=="number"?f.maxAngle:30,y=typeof i?.angle=="number"?i.angle:typeof f?.homeAngle=="number"?f.homeAngle:(g+p)/2,[v,S]=m.useState(y),b=m.useRef(!1);m.useEffect(()=>{b.current||S(y)},[y]);const T=A=>{const E=Number.parseFloat(A.target.value);Number.isNaN(E)||(b.current=!0,S(E),r(E))},q=()=>{b.current=!1};if(!d)return null;const j=ca(a?.cameraUp?.[0]),R=ca(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:du(y)})]}),o.jsxs("div",{children:[o.jsx("input",{type:"range",className:"w-full accent-emerald-400",min:g,max:p,step:.5,value:v,onChange:T,onMouseUp:q,onTouchEnd:q,onPointerUp:q}),o.jsxs("div",{className:"mt-0 flex items-center justify-between text-[0.7rem] text-slate-400",children:[o.jsxs("span",{className:"flex items-center gap-0.5",children:[R?o.jsx(e0,{label:R}):null,du(g)]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[du(p),j?o.jsx(e0,{label:j}):null]})]})]})]})}function e0({label:a}){return o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a})}function du(a){return typeof a!="number"||Number.isNaN(a)?"—":`${a>0?"+":""}${a.toFixed(1)}°`}function ug({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 fA({entity:a,connected:l,onToggle:i}){const r=a.state==="unavailable"||!a.available,f=a.state==="on",d=r?"warn":f?"success":"muted",g=r?"Unavailable":f?"On":"Off",p=!l||r,y=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 ${y} 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(ug,{label:g,tone:d}),!l&&o.jsx("span",{className:"text-amber-200",children:" · Offline"})]})]}),o.jsx("div",{className:"text-xs font-semibold text-white/90",children:f?"Turn off":"Turn on"})]})}function fg(){const{state:{keymap:a}}=dt(),{session:l,homeAssistantToggle:i}=Re(),r=l?.homeAssistant,f=m.useMemo(()=>r?.entities||[],[r?.entities]),d=ca(a?.homeAssistantOn?.[0]),g=ca(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(t0,{label:d}):null]}),o.jsxs("span",{className:"flex items-center gap-0.5",children:[o.jsx("span",{children:"Off"}),g?o.jsx(t0,{label:g}):null]})]})]}),o.jsx(ug,{label:p?"Connected":"Offline",tone:p?"success":"warn"})]}),o.jsx("div",{className:"flex flex-wrap gap-0.5",children:f.map(y=>o.jsx(fA,{entity:y,connected:p,onToggle:i},y.id))})]})}function t0({label:a}){return a?o.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:a}):null}function dg(){const{login:a,setRole:l}=Re(),[i,r]=m.useState(""),[f,d]=m.useState(""),[g,p]=m.useState(!1);async function y(v){v.preventDefault(),p(!0);try{await a(i,f),r(""),d("")}catch(S){alert(S.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:y,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:g,className:"button-dark w-full disabled:opacity-50",children:g?"Logging in…":"Login"})]})]})}const dA=[{key:"open",label:"Open"},{key:"turns",label:"Turns"},{key:"admin",label:"Admin"},{key:"lockdown",label:"Lockdown"}];function hA(){const{session:a,lockRover:l,setMode:i,requestControl:r,setCommunityGoal:f}=Re(),d=m.useMemo(()=>a?.roster??[],[a?.roster]),[g,p]=m.useState({}),y=a?.health||null,v=a?.communityGoal?.text||"",S=a?.communityGoal?.updatedAt||null,[b,T]=m.useState(v),q=a?.role==="admin"||a?.role==="lockdown"||a?.role==="lockdown-admin",j=a?.mode??"open",R=async(V,G)=>{try{await l(V,G),p($=>({...$,[V]:G}))}catch($){alert($.message)}},A=async V=>{const G=V.target.value;try{await i(G)}catch($){alert($.message)}},E=async V=>{try{await r(V,{force:!0})}catch(G){alert(G.message)}},N=async()=>{try{await f(b)}catch(V){alert(V.message)}},k=async()=>{try{await f(null)}catch(V){alert(V.message)}};m.useEffect(()=>{T(v)},[v]);const Z=m.useMemo(()=>{const V={};return d.forEach(G=>{V[G.id]=g[G.id]??G.locked}),V},[d,g]);return q?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:dA.map(V=>o.jsx("option",{value:V.key,children:V.label},V.key))})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[o.jsx("span",{children:"Community goal"}),S?o.jsxs("span",{children:["Updated ",new Date(S).toLocaleString()]}):null]}),o.jsx("input",{type:"text",value:b,onChange:V=>T(V.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:k,className:"button-danger",children:"Clear"})]})]}),o.jsx(oA,{roster:d,renderActions:V=>o.jsxs("div",{className:"flex flex-wrap gap-0.5 text-xs",children:[o.jsx("button",{type:"button",onClick:()=>R(V.id,!Z[V.id]),className:"button-dark",children:Z[V.id]?"Unlock":"Lock"}),o.jsx("button",{type:"button",onClick:()=>E(V.id),className:"button-dark",children:"Force"})]})}),o.jsx(mA,{health:y})]}):null}function mA({health:a}){if(!a)return null;const l=a.replay||{sources:[],readyCount:0,totalCount:0},i=a.snapshots||{rovers:[],rooms:[]},r=`${l.readyCount}/${l.totalCount} sources ready`,f=i.rovers.filter(g=>g.stale).length,d=i.rooms.filter(g=>g.stale).length;return o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("div",{className:"panel-muted text-xs uppercase",children:"Health"}),o.jsxs("div",{className:"surface space-y-0.5 text-xs text-slate-200",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:"Replay segments"}),o.jsx("span",{className:"text-slate-400",children:r})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:"Rover snapshots"}),o.jsxs("span",{className:f?"text-amber-300":"text-emerald-300",children:[i.rovers.length-f,"/",i.rovers.length," ok"]})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:"Room cameras"}),o.jsxs("span",{className:d?"text-amber-300":"text-emerald-300",children:[i.rooms.length-d,"/",i.rooms.length," ok"]})]})]}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:l.sources.map(g=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:g.label}),o.jsxs("span",{className:g.ready?"text-emerald-300":"text-amber-300",children:[g.recentCount,"/",g.neededCount]})]},`${g.type}:${g.id}`))}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rovers.map(g=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:g.name}),o.jsx("span",{className:g.stale?"text-amber-300":"text-emerald-300",children:g.stale?"stale":"ok"})]},`rover:${g.id}`))}),o.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.rooms.map(g=>o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{children:g.name}),o.jsx("span",{className:g.stale?"text-amber-300":"text-emerald-300",children:g.error?"error":g.stale?"stale":"ok"})]},`room:${g.id}`))})]})}const pA=[{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 gA(a){return a.reduce((l,i)=>((l[i.group]||(l[i.group]=[])).push(i),l),{})}function yA(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):l}const lf=5,Rs=500,_s=1,sf=100;function vA(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(lf,Math.min(Rs,i)):l}function vr(a,l){const i=Number(a);return Number.isFinite(i)?Math.max(_s,Math.min(sf,i)):l}function xA(a){const i=(vr(a,a)-_s)/(sf-_s),r=Rs-i*(Rs-lf);return Math.round(r)}function bA(a){const l=vA(a,a),i=(Rs-l)/(Rs-lf),r=_s+i*(sf-_s);return Math.round(r)}function SA(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=zs(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 rr({label:a,description:l,value:i,onChange:r,min:f=0,max:d=500,step:g=5}){return o.jsxs("label",{className:"surface-muted block p-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[o.jsx("span",{className:"font-semibold text-slate-100",children:a}),o.jsx("input",{type:"number",min:f,max:d,value:i,onChange: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:g,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 AA(){const{state:{keymap:a},actions:{updateKeyBinding:l,resetKeyBindings:i}}=dt(),{value:r,save:f}=ot("inputs",ct),d={...ct.keyboard,...r.keyboard??{}},g=m.useMemo(()=>typeof d.tiltSpeed=="number"?vr(d.tiltSpeed,ct.keyboard.tiltSpeed):typeof d.tiltIntervalMs=="number"?vr(bA(d.tiltIntervalMs),ct.keyboard.tiltSpeed):ct.keyboard.tiltSpeed,[d.tiltIntervalMs,d.tiltSpeed]),p=m.useMemo(()=>gA(pA),[]),{active:y,startCapture:v,cancel:S}=SA((j,R)=>{l(j,R)}),b=m.useCallback(j=>a?.[j]?.[0]||ws[j]?.[0]||"",[a]),T=m.useCallback((j,R)=>{const A=ct.keyboard,E=yA(R,A[j]);f(N=>({...N??{},keyboard:{...N?.keyboard??A,[j]:E}}))},[f]),q=m.useCallback(j=>{const R=ct.keyboard,A=vr(j,R.tiltSpeed),E=xA(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(rr,{label:"Base speed",description:"Normal driving speed",value:d.baseSpeed,onChange:j=>T("baseSpeed",j)}),o.jsx(rr,{label:"Turbo speed",description:"Used when holding the boost modifier",value:d.turboSpeed,onChange:j=>T("turboSpeed",j)}),o.jsx(rr,{label:"Precision speed",description:"Used when holding the precision modifier",value:d.precisionSpeed,onChange:j=>T("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(rr,{label:"Tilt speed",description:"Higher = faster when holding tilt keys",value:g,onChange:q,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=b(A.id),N=y===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:ca(E)})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[N&&o.jsx("button",{type:"button",onClick:()=>S(),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 jA(){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 NA=new Intl.NumberFormat(void 0,{maximumFractionDigits:2}),EA=[{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 cr({label:a,description:l,min:i,max:r,step:f,value:d,onChange:g}){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:NA.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=>g(Number(p.target.value)),className:"mt-0 w-full accent-emerald-400"})]})}function wA(a){return a?`Axis ${a.index}${a.invert?" (invert)":""}`:"Unassigned"}function qA(a){return a?`Button ${a.index}`:"Unassigned"}function or(a,l,i){const[r,f]=l,d={...a??Ar};return d[r]={...d[r]??Ar[r]},d[r][f]=i(d[r][f]),d}function CA(){const a=jA(),{value:l,save:i,reset:r}=ot("gamepadMapping",Ar),{value:f,save:d}=ot("inputs",ct),g=f.gamepad??ct.gamepad,[p,y]=m.useState(null),v=m.useRef(null),S=A=>{d(E=>({...E,gamepad:{...E.gamepad??ct.gamepad,...A}}))};m.useEffect(()=>{v.current=null},[p]),m.useEffect(()=>{if(!p)return;let A;const E=()=>{const N=navigator.getGamepads?.(),k=N&&Array.from(N).find(Boolean);if(k){if(p.type==="axis"){v.current||(v.current=Array.from(k.axes??[]).map(Z=>Z??0));for(let Z=0;Z<k.axes.length;Z+=1){const V=k.axes[Z],G=v.current?.[Z]??0,$=Math.abs(V-G);if(Math.abs(V)>.65&&$>.5){i(P=>or(P,p.path,()=>({index:Z,invert:V<0}))),y(null);return}}}else if(p.type==="button")for(let Z=0;Z<k.buttons.length;Z+=1){const V=k.buttons[Z];if(V&&(V.pressed||V.value>.6)){i(G=>or(G,p.path,()=>({index:Z}))),y(null);return}}}A=requestAnimationFrame(E)};return A=requestAnimationFrame(E),()=>{A&&cancelAnimationFrame(A)}},[p,i]);const b=m.useMemo(()=>EA.reduce((A,E)=>((A[E.section]||(A[E.section]=[])).push(E),A),{}),[]),T=A=>{const[E,N]=A.path;return l?.[E]?.[N]??null},q=A=>{const E=T(A);return A.type==="axis"?wA(E):qA(E)},j=A=>{i(E=>or(E,A.path,()=>null))},R=A=>{T(A)&&i(N=>or(N,A.path,k=>({...k,invert:!k?.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(cr,{label:"Drive deadzone",description:"Ignore small drive stick movement",min:0,max:.6,step:.01,value:g.driveDeadzone??.2,onChange:A=>S({driveDeadzone:A})}),o.jsx(cr,{label:"Camera deadzone",description:"Tilt stick sensitivity",min:0,max:.6,step:.01,value:g.cameraDeadzone??.25,onChange:A=>S({cameraDeadzone:A})}),o.jsx(cr,{label:"Servo step (deg)",description:"Degrees per camera tick",min:.5,max:6,step:.25,value:g.servoStep??2,onChange:A=>S({servoStep:A})}),o.jsx(cr,{label:"Side reverse multiplier",description:"Scale when reversing the side brush",min:.3,max:1,step:.05,value:g.auxReverseScale??.55,onChange:A=>S({auxReverseScale:A})})]})]}),Object.entries(b).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:q(N)})]}),o.jsxs("div",{className:"flex items-center gap-0.5",children:[N.type==="axis"&&o.jsx("button",{type:"button",disabled:!T(N),onClick:()=>R(N),className:`${T(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:()=>y(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 TA={drive:"Drive wheels",aux:"Aux motors"};function n0(a){return Number.isFinite(a)?`${Math.round(a*100)}%`:"--"}function MA({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 RA(){const{state:{roverId:a},overcurrentLimiter:l}=dt(),i=m.useMemo(()=>gl.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?.temperatures?.[r]??0,d=l?.overcurrent?.groups?.[r]??!1,g=l?.scales?.perGroup?.[r]??1;return o.jsxs("div",{className:"surface space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs",children:[o.jsx("span",{className:"text-slate-200",children:TA[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:"Temperature"}),o.jsx("span",{children:n0(f)})]}),o.jsx(MA,{value:f,color:"bg-amber-500"}),o.jsxs("div",{className:"flex items-center justify-between text-[0.7rem] text-slate-400",children:[o.jsx("span",{children:"Scale"}),o.jsx("span",{children:n0(g)})]})]})]},r)}),o.jsxs("div",{className:"surface text-[0.7rem] text-slate-400",children:[o.jsx("div",{children:`Heat up ${l?.config?.heatUpSec}s · Cool down ${l?.config?.coolDownSec}s`}),o.jsx("div",{children:`Knee ${l?.config?.kneeSec}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 hg=m.createContext(null);function mg(){const a=m.useContext(hg);if(!a)throw new Error("Tabs components must be used within a <Tabs> provider.");return a}const a0={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"}},pg="primary";function rf(...a){return a.filter(Boolean).join(" ")}function cf({children:a,defaultTab:l,currentTab:i,onTabChange:r,variant:f=pg}){const[d,g]=m.useState(l??null),[p,y]=m.useState([]),v=m.useCallback(q=>q?(y(j=>j.includes(q)?j:[...j,q]),()=>y(j=>j.includes(q)?j.filter(R=>R!==q):j)):()=>{},[]),S=i??d??p[0]??null;m.useEffect(()=>{l&&i===void 0&&g(l)},[l,i]);const b=m.useCallback(q=>{q&&(i===void 0&&g(q),r&&r(q))},[i,r]),T=m.useMemo(()=>({activeTab:S,setActiveTab:b,registerTab:v,variant:f}),[S,b,v,f]);return o.jsx(hg.Provider,{value:T,children:a})}function of({children:a,className:l=""}){return o.jsx("div",{className:rf("flex gap-0.5",l),children:a})}function Ft({id:a,children:l,className:i="",disabled:r=!1}){const{activeTab:f,setActiveTab:d,registerTab:g,variant:p}=mg();m.useEffect(()=>g(a),[a,g]);const y=a0[p]??a0[pg],v=f===a,S=rf(y.base,v?y.active:y.inactive,r?"cursor-not-allowed opacity-50":"",i);return o.jsx("button",{type:"button",className:S,onClick:()=>!r&&d(a),"aria-pressed":v,"aria-disabled":r,children:l})}function uf({children:a,className:l=""}){return o.jsx("div",{className:rf("mt-0 space-y-0.5",l),children:a})}function It({id:a,children:l,keepMounted:i=!1}){const{activeTab:r}=mg(),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 _A(){const{session:a}=Re(),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 l0=300,s0=240;function kA(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 OA(a){const i=a.map(r=>kA(r)).join(" ");return i.length>s0?`${i.slice(0,s0)}…`:i}function DA(){const a=rn(),[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=(y,v,S)=>{i(b=>{const T=[...b,{id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,direction:y,event:v,payload:OA(S),timestamp:new Date().toLocaleTimeString()}];return T.length>l0?T.slice(-l0):T})},d=(y,...v)=>f("in",y,v),g=(y,...v)=>f("out",y,v);a.onAny(d);let p=null;if(typeof a.onAnyOutgoing=="function")a.onAnyOutgoing(g),p=()=>a.offAnyOutgoing(g);else{const y=a.emit.bind(a);a.emit=(v,...S)=>(g(v,...S),y(v,...S)),p=()=>{a.emit=y}}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 zA=[{key:"start",label:"Start OI"},{key:"safe",label:"Safe"},{key:"full",label:"Full"},{key:"passive",label:"Passive"},{key:"dock",label:"Dock"}];function gg(){const{state:{roverId:a},actions:{sendOiCommand:l,setSensorStream:i}}=dt(),r=!!a,[f,d]=og(),g=rn(),{value:p,save:y}=ot("page",{hudMapDesktop:!1,connectionTransport:"websocket"}),v=p?.connectionTransport||"websocket",S=m.useMemo(()=>[{key:"start",label:"Enable stream",enable:!0},{key:"stop",label:"Disable stream",enable:!1}],[]),b=q=>{a&&i(q)},T=q=>{const j=q.target.value;y(R=>({...R??{},connectionTransport:j})),g?.io?.opts&&(g.io.opts.transports=j==="polling"?["polling"]:["websocket","polling"],g.disconnect(),g.connect())};return o.jsxs(cf,{defaultTab:"keybindings",children:[o.jsxs(of,{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(uf,{children:[o.jsx(It,{id:"keybindings",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(AA,{})})}),o.jsx(It,{id:"controller",children:o.jsx("div",{className:"space-y-0.5",children:o.jsx(CA,{})})}),o.jsx(It,{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:q=>d(q.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:T,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(It,{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:zA.map(q=>o.jsx("button",{type:"button",onClick:()=>l(q.key),disabled:!r,className:"button-dark text-xs disabled:opacity-30",children:q.label},q.key))})]}),o.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[o.jsx("p",{className:"text-slate-400",children:"Sensor stream"}),o.jsx("div",{className:"surface flex gap-0.5",children:S.map(q=>o.jsx("button",{type:"button",onClick:()=>b(q.enable),disabled:!r,className:"flex-1 button-dark text-xs disabled:opacity-30",children:q.label},q.key))}),!r&&o.jsx("p",{className:"text-xs text-slate-500",children:"Assign a rover to toggle streams."})]}),o.jsx(dg,{}),o.jsx(RA,{}),o.jsx(hA,{}),o.jsx(_A,{}),o.jsx(DA,{})]})})]})]})}const i0={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 BA(a){return i0[a]||i0.desktop}function yg({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:ca(i)})}function r0(a,l){return a.map((i,r)=>typeof i=="string"?o.jsx("span",{children:i},`text-${r}`):i?.action?o.jsx(yg,{actionId:i.action,keymap:l},`pill-${i.action}-${r}`):i?.text?o.jsx("span",{children:i.text},`span-${r}`):null)}function Tr(a,l,i){if(typeof a=="string")return a;if(Array.isArray(a?.segments))return r0(a.segments,l);if(a&&typeof a=="object"){if(typeof a.text=="string")return a.text;if(Array.isArray(a))return r0(a,l)}return String(a??"")}function LA({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:Tr(i,l)},f)})})]}):null}function UA({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:Tr(i,l)},f)})})]})}function HA({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:Tr(i,{})},`callout-${r}`))})]})}function VA({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(yg,{actionId:i.action,keymap:l})]},i.action))})]})}function YA({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(VA,{group:i,keymap:l},i.id))})]}):null}function GA({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:Tr(l,{})},`gamepad-${i}`))})]}):null}function c0({block:a,keymap:l}){if(!a)return null;switch(a.type){case"list":return o.jsx(UA,{block:a,keymap:l});case"callout":return o.jsx(HA,{block:a});case"keyboard":return o.jsx(YA,{block:a,keymap:l});case"gamepad":return o.jsx(GA,{block:a});default:return null}}function vg({layout:a,keymap:l}){const i=m.useMemo(()=>BA(a),[a]),r=l||{},f=i.main||[],d=i.aside||[];return o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(LA,{hero:i.hero,keymap:r}),o.jsxs("div",{className:"grid gap-0.5",style:{gridTemplateColumns:"repeat(auto-fit, minmax(360px, 1fr))"},children:[o.jsx("div",{className:"space-y-0.5",children:f.map((g,p)=>o.jsx(c0,{block:g,keymap:r},g.title||p))}),o.jsx("div",{className:"space-y-0.5",children:d.map((g,p)=>o.jsx(c0,{block:g,keymap:r},g.title||p))})]})]})}function xg({layout:a,onOpenOverlay:l}){const{state:i}=dt();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(vg,{layout:a,keymap:i?.keymap||{}})]})}const QA=["kal","rms","slt","ksp","bdl"],XA=Array.from({length:10},(a,l)=>l*10);function Bs({hideInput:a=!1,hideSpectatorNotice:l=!1,fillHeight:i=!1}){const{session:r}=Re(),{messages:f,sendMessage:d,registerInputRef:g,onInputFocus:p,onInputBlur:y,blurChat:v}=Zu(),{value:S,save:b}=ot("tts",{engine:"flite",voice:"rms",pitch:50}),[T,q]=m.useState(""),[j,R]=m.useState(!1),[A,E]=m.useState(!1),[N,k]=m.useState(()=>S?.engine||"flite"),[Z,V]=m.useState(()=>S?.voice||"rms"),[G,$]=m.useState(()=>Number.isFinite(S?.pitch)?S.pitch:50),P=r?.role!=="spectator",I=m.useRef(null),te=r?.assignment?.roverId||null,se=!!m.useMemo(()=>r?.roster?.find(Q=>String(Q.id)===String(te))||null,[te,r?.roster])?.audio?.ttsEnabled,ge=m.useMemo(()=>f.slice(-200),[f]);m.useEffect(()=>{I.current&&(I.current.scrollTop=I.current.scrollHeight)},[ge]),m.useEffect(()=>{const Q=S?.engine||"flite",W=S?.voice||"rms",ae=Number.isFinite(S?.pitch)?S.pitch:50;N!==Q&&k(Q),Z!==W&&V(W),G!==ae&&$(ae)},[N,G,S?.engine,S?.pitch,S?.voice,Z]),m.useEffect(()=>{E(!!se)},[se]);const ye=m.useMemo(()=>!se||!A?null:N==="espeak"?{speak:!0,engine:N,pitch:G}:{speak:!0,engine:N,voice:Z},[N,G,A,se,Z]);async function re(Q){if(Q.preventDefault(),!P||a)return;const ae=T.replace(/\\n/g,`
|
||
`).trim();if(ae){R(!0);try{await d(ae,ye),q(""),v()}catch(ue){alert(ue.message)}finally{R(!1)}}}const z=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.jsx("div",{className:`surface overflow-y-auto space-y-0.5 px-0 ${z}`,ref:I,children:ge.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"No messages yet."}):ge.map(Q=>o.jsx(F0,{message:Q},Q.id))}),!a&&o.jsxs("form",{className:"flex flex-wrap items-stretch gap-0.5",onSubmit:re,children:[o.jsx("input",{className:"field-input flex-1 min-w-[10rem]",value:T,onChange:Q=>q(Q.target.value),onFocus:p,onBlur:y,onKeyDown:Q=>{Q.key==="Enter"&&!T.trim()&&(Q.preventDefault(),v())},ref:Q=>g(Q,{target:"panel"}),placeholder:P?"Type a message…":l?"":"Spectators cannot chat",disabled:!P}),se&&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:A,onChange:Q=>E(Q.target.checked),className:"accent-cyan-500"}),o.jsx("span",{children:"Speak"})]}),o.jsxs("select",{value:N,onChange:Q=>{const W=Q.target.value;k(W),b(ae=>({...ae||{},engine:W}))},className:"field-input text-xs",children:[o.jsx("option",{value:"flite",children:"flite"}),o.jsx("option",{value:"espeak",children:"espeak"})]}),N==="flite"?o.jsx("select",{value:Z,onChange:Q=>{const W=Q.target.value;V(W),b(ae=>({...ae||{},voice:W}))},className:"field-input text-xs",children:QA.map(Q=>o.jsx("option",{value:Q,children:Q},Q))}):o.jsx("select",{value:G,onChange:Q=>{const W=Number(Q.target.value);$(W),b(ae=>({...ae||{},pitch:W}))},className:"field-input text-xs",children:XA.map(Q=>o.jsxs("option",{value:Q,children:["pitch ",Q]},Q))})]}),o.jsx("button",{type:"submit",disabled:!P||j,className:"button-dark h-full disabled:opacity-50 self-stretch",children:j?"...":"Send"})]})]})}function ff({compact:a=!1}){const{session:l,setNickname:i}=Re(),{value:r,save:f}=ot("profile",{nickname:""}),[d,g]=m.useState(r.nickname||""),[p,y]=m.useState(!1),v=l?.role!=="spectator";m.useEffect(()=>{g(r.nickname||"")},[r.nickname]);async function S(b){if(b.preventDefault(),!v)return;const T=(d||"").trim().slice(0,32);if(T){y(!0);try{await i(T),f({nickname:T})}catch(q){alert(q.message)}finally{y(!1)}}}return o.jsxs("form",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-stretch gap-0.5",onSubmit:S,children:[o.jsx("input",{className:"field-input flex-1 min-w-0",value:d,onChange:b=>g(b.target.value),maxLength:32,placeholder:"Enter a nickname",disabled:!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 bg({text:a="Support me on Ko-fi!",className:l=""}){const{session:i}=Re(),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(G1,{className:"mr-0"}),a]}):null}function $A({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(ff,{compact:a})})})}function KA(){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(Cr,{className:"h-full"}),o.jsx(bg,{className:"h-full"})]})})}function hu(...a){return a.filter(Boolean).join(" ")}function ZA(a){const l=a?.batteryState?.percentDisplay;return l==null?"--":`${l}%`}function JA(a){return a?.batteryState?a.batteryState.urgentActive?"text-red-400":a.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function FA(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 IA(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 Mr({title:a="Rovers"}){const{session:l,requestControl:i}=Re(),[r,f]=m.useState({}),[d,g]=m.useState(()=>Date.now()),p=m.useMemo(()=>l?.role&&l.role!=="spectator",[l?.role]),y=l?.roster??[],v=l?.turnQueues??{},S=l?.users??[],b=l?.socketId||null,T=m.useMemo(()=>Object.values(v||{}).some(A=>A?.deadline||A?.idleDeadline),[v]);m.useEffect(()=>{if(!T)return;const A=setInterval(()=>{g(Date.now())},1e3);return()=>clearInterval(A)},[T]);const q=m.useMemo(()=>{const A=new Set(y.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[...y,...E]},[y,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=>S.find(E=>E.socketId===A)||{socketId:A,nickname:null,role:null};return o.jsxs("div",{className:"space-y-0.5 text-sm",children:[a&&o.jsx("p",{className:"text-sm text-slate-400",children:a}),q.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:q.map(A=>{const E=String(A.id),N=v?.[E]||null,k=N?.queue||[],Z=N?.idleDeadline||N?.deadline||null,V=Z&&Z>d?Math.ceil((Z-d)/1e3):Z?0:null,G=N?.current||null,$=G?k.findIndex(z=>z===G):-1,P=k.length>1?$>=0?k[($+1)%k.length]:k[0]:null,I=!!(b&&G&&G===b),te=!!(b&&P&&P===b),ne=V!=null&&(I||te),se=!!A.locked,ge=A.lockReason?`locked: ${A.lockReason}`:"locked",ye=se?ge:r[E]?"...":"request",re=p&&!se&&!r[E];return o.jsxs("li",{className:hu("surface flex flex-wrap items-start justify-between gap-0.5",re&&"cursor-pointer",se&&"bg-red-900/40"),onClick:()=>{re&&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}),ne?o.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem] text-slate-200",children:I?`${V}s left`:`Your turn in ${V}s`}):null]}),o.jsx("span",{className:hu("text-[0.75rem] font-semibold",JA(A)),children:ZA(A)})]}),k.length===0?o.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"No queue."}):o.jsx("div",{className:"flex flex-wrap items-center gap-0.5",children:k.map((z,Q)=>{const W=R(z),ae=z===G,ue=!!(P&&z===P&&!ae),C=ae?"bg-sky-600 text-white ring-2 ring-amber-300":ue?"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] ${C}`,children:[o.jsx("span",{className:`${FA(W.role)} font-semibold`,children:IA(W,b)}),ae&&o.jsx("span",{className:"text-[0.65rem] text-slate-200",children:"now"}),ue&&o.jsx("span",{className:"text-[0.65rem] text-emerald-100",children:"next"})]},`${E}-${z}-${Q}`)})})]}),p?o.jsx("button",{type:"button",onClick:z=>{z.stopPropagation(),j(A.id)},disabled:r[E]||se,className:hu("button-dark disabled:opacity-40",se&&"bg-red-600/70 text-white hover:bg-red-600"),children:ye}):null]},A.id)})})]})}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 df({hideNicknameForm:a=!1,hideHeader:l=!1,className:i="",fillHeight:r=!1,compact:f=!1}){const{session:d,setNickname:g}=Re(),{value:p}=ot("profile",{nickname:""}),y=m.useRef(null),v=rn(),S=d?.role!=="spectator",b=d?.users??[],T=d?.socketId||null;m.useEffect(()=>{if(!S||!d?.socketId)return;const R=p.nickname||"";if(!R||d.socketId===y.current)return;const A=d.socketId;g(R).then(()=>{y.current=A}).catch(()=>{})},[S,d?.socketId,g,p.nickname]),m.useEffect(()=>{if(!v)return;const R=()=>{if(!S)return;const A=(p.nickname||"").trim();A&&g(A).then(()=>{y.current=d?.socketId||null}).catch(()=>{})};return v.on("connect",R),()=>v.off("connect",R)},[S,g,v,p.nickname,d?.socketId]);const q=m.useMemo(()=>[...b].sort((R,A)=>R.socketId===T?-1:A.socketId===T?1:(R.nickname||"").localeCompare(A.nickname||"")),[T,b]),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(ff,{compact:f})})}),o.jsxs("div",{className:"grid gap-0.5 sm:grid-cols-2 md:grid-cols-1",children:[o.jsx(Cr,{}),o.jsx(bg,{})]})]}),!S&&o.jsx("p",{className:"text-xs text-slate-500",children:"Spectators cannot set nicknames."})]}),o.jsxs("div",{className:`space-y-0.5 ${r?"flex flex-1 min-h-0 flex-col":""}`,children:[!l&&o.jsxs("div",{className:`flex items-center justify-between text-sm text-slate-400 ${f?"text-xs":""}`,children:[o.jsx("span",{children:"Users"}),o.jsx("span",{className:"text-xs text-slate-500",children:q.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:q.length===0?o.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for users…"}):q.map(R=>o.jsx("span",{className:`rounded bg-slate-800/80 px-1 py-0.25 text-[0.7rem] ${WA(R.role)}`,children:PA(R,T)},R.socketId))})]})]})}function ej(){const{state:{roverId:a}}=dt(),i=Al(a)?.sensors||{};return o.jsx("section",{className:"panel-section",children:o.jsx("div",{className:"aspect-square w-full",children:o.jsx(Mu,{sensors:i})})})}function tj(){const{state:{roverId:a,keymap:l}}=dt(),i=ag(a),r=i.docked&&!i.driving;return o.jsxs("section",{className:"panel-section flex h-full flex-col gap-0.5",children:[o.jsx(lg,{layout:"desktop",expand:!0,driveDockState:i}),r?null:o.jsx(uA,{keymap:l})]})}function nj({layout:a,onOpenHelpOverlay:l}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(cf,{defaultTab:"telemetry",children:[o.jsxs(of,{children:[o.jsx(Ft,{id:"telemetry",children:"Controls"}),o.jsx(Ft,{id:"help",children:"Help"}),o.jsx(Ft,{id:"settings",children:"Settings"})]}),o.jsxs(uf,{children:[o.jsx(It,{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(ej,{}),o.jsx(tj,{})]}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.9fr)_minmax(0,0.75fr)]",children:[o.jsx(Mr,{}),o.jsx(Xu,{panelId:"replay-sources-desktop",fillHeight:!0}),o.jsx(KA,{})]}),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(Bs,{fillHeight:!0}),o.jsxs("div",{className:"grid min-h-0 gap-0.5 grid-rows-[minmax(0,1fr)_auto]",children:[o.jsx(df,{compact:!0,hideNicknameForm:!0,fillHeight:!0}),o.jsx($A,{compact:!0})]})]}),o.jsx(fg,{}),o.jsx(Iu,{defaultOrientation:"horizontal",panelId:"rightpane-telemetry"})]})}),o.jsx(It,{id:"help",children:o.jsx(xg,{layout:a,onOpenOverlay:l})}),o.jsx(It,{id:"settings",children:o.jsx(gg,{})})]})]})})}const aj=new Set(["admin","lockdown","lockdown-admin"]),lj=new Set(["admin","lockdown"]);function sj(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 ij(){const{session:a}=Re(),l=a?.mode,i=a?.role,r=lj.has(l),f=aj.has(i);if(!r||f)return null;const d=sj(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(dg,{})}),o.jsx("div",{className:"w-full justify-center items-center",children:o.jsx(Cr,{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(Bs,{}),o.jsx(ff,{})]})]})})}const rj="/assets/turn_alert-DVO8EZJa.mp3";function cj(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 oj(){const{session:a,pushAlert:l}=Re(),i=cj(rj),r=m.useRef(new Set),f=m.useMemo(()=>a?.turnQueues||{},[a?.turnQueues]),d=a?.socketId||null;return m.useEffect(()=>{if(!d)return;const g=[];Object.entries(f).forEach(([p,y])=>{!y||!y.current||y.current!==d||r.current.has(p)||(g.push(p),r.current.add(p))}),Object.keys(f).forEach(p=>{(!f[p]||f[p].current!==d)&&r.current.delete(p)}),g.length!==0&&(g.forEach(p=>{const y=a?.roster?.find(v=>String(v.id)===String(p))?.name||p;l({title:"Your turn!",message:`You now control ${y}.`,color:"#ff5722"})}),i())},[f,i,l,a?.roster,d]),null}function uj({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 Sg="fullscreenPromptDismissed",fj=new Set(["mobile-portrait","mobile-landscape"]),Ag=()=>{if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}},dj=()=>{const a=Ag();if(!a)return!1;try{return a.getItem(Sg)==="1"}catch{return!1}},o0=()=>{const a=Ag();if(a)try{a.setItem(Sg,"1")}catch{}},hj=()=>{if(typeof navigator>"u")return!1;const a=navigator.userAgent||navigator.platform||"";return/iphone|ipad|ipod/i.test(a)},mj=()=>{if(typeof document>"u")return!1;const a=document;return!!(a.fullscreenEnabled||a.webkitFullscreenEnabled||a.mozFullScreenEnabled||a.msFullscreenEnabled)};function pj(a){const l=fj.has(a),[i,r]=m.useState(!1),[f,d]=m.useState("native"),g=m.useMemo(()=>hj(),[]),p=m.useCallback(()=>{if(!l){r(!1);return}if(dj()){r(!1);return}if(g){d("pwa-hint"),r(!0);return}if(!mj()){r(!1);return}if(typeof document<"u"&&document.fullscreenElement){r(!1);return}d("native"),r(!0)},[g,l]);m.useEffect(()=>{p()},[p]),m.useEffect(()=>{if(typeof document>"u")return;const S=()=>{if(document.fullscreenElement){r(!1);return}p()};return document.addEventListener("fullscreenchange",S),document.addEventListener("webkitfullscreenchange",S),()=>{document.removeEventListener("fullscreenchange",S),document.removeEventListener("webkitfullscreenchange",S)}},[p]);const y=m.useCallback(()=>{o0(),r(!1)},[]),v=m.useCallback(async()=>{if(!l||g||typeof document>"u")return!1;const S=document.documentElement;if(!S)return!1;const b=S.requestFullscreen||S.webkitRequestFullscreen||S.mozRequestFullScreen||S.msRequestFullscreen;if(!b)return!1;try{const T=b.call(S);return T&&typeof T.then=="function"&&await T,o0(),r(!1),!0}catch(T){return console.warn("Failed to enter fullscreen",T),!1}},[g,l]);return m.useEffect(()=>{l||r(!1)},[l]),{visible:i,mode:f,enterFullscreen:v,dismiss:y}}function gj({visible:a,layout:l,onClose:i,showOnLoad:r,onToggleShowOnLoad:f}){if(!a)return null;const{state:d}=dt(),g=p=>{const y=!p.target.checked;f?.(y)};return o.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-black/80 px-0.5 py-0.5",children:o.jsxs("div",{className:"pointer-events-auto surface w-full max-w-4xl max-h-[90vh] overflow-hidden shadow-2xl",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-slate-700 px-0.5 py-0.25 text-sm text-slate-200",children:[o.jsx("span",{className:"font-semibold",children:"Help & controls"}),o.jsxs("div",{className:"flex items-center gap-0.5 text-[0.8rem] text-slate-300",children:[o.jsxs("label",{className:"flex items-center gap-0.5",children:[o.jsx("input",{type:"checkbox",checked:!r,onChange:g,className:"accent-cyan-500"}),o.jsx("span",{children:"Don't show again"})]}),o.jsx("button",{type:"button",onClick:i,className:"button-dark px-2 py-0.25 text-[0.8rem]",children:"Close"})]})]}),o.jsx("div",{className:"max-h-[85vh] overflow-y-auto p-0.5",children:o.jsx(vg,{layout:l,keymap:d?.keymap||{}})})]})})}const yj=`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 vj(a){return a?a.charAt(0).toUpperCase()+a.slice(1):""}function xj(){const a=String(yj).split(/\r?\n/).map(i=>i.trim()).filter(Boolean);return a.length?(a[Math.floor(Math.random()*a.length)]||"").trim():""}function hf(){const{setNickname:a}=Re(),{value:l,status:i,save:r}=ot("profile",{nickname:""}),f=m.useRef(!1);m.useEffect(()=>{if(i!=="ready"||f.current||(l.nickname||"").trim())return;f.current=!0;const g=vj(xj()).slice(0,32);if(!g)return;(async()=>{try{await a(g)}catch{}finally{r({nickname:g})}})()},[r,a,i,l.nickname])}const mu=1e4,pu=28,bj=14;function mf({layout:a="desktop",className:l=""}){const{session:i}=Re(),r=i?.communityGoal?.text?String(i.communityGoal.text).trim():"",f=a==="mobile-portrait"||a==="mobile-landscape"||a==="mobile",[d,g]=m.useState(!1),[p,y]=m.useState(pu),[v,S]=m.useState(0),b=m.useRef(null),T=m.useRef(null),q=m.useRef(null);m.useEffect(()=>{if(!r){g(!1);return}if(g(!0),!f)return;const A=Date.now();S(mu);const E=setTimeout(()=>g(!1),mu),N=setInterval(()=>{const k=Date.now()-A;S(Math.max(0,mu-k))},250);return()=>{clearTimeout(E),clearInterval(N)}},[r,f]),m.useEffect(()=>{if(!r)return;y(pu);let A=0;const E=()=>{const k=q.current,Z=T.current;if(!k||!Z)return;const V=k.clientWidth;if(!V)return;const G=Z.scrollWidth;if(!G)return;const $=Math.min(1,V/G),P=Math.max(bj,Math.floor(pu*$));y(P)};A=window.requestAnimationFrame(E);const N=new ResizeObserver(()=>{window.cancelAnimationFrame(A),A=window.requestAnimationFrame(E)});return b.current&&N.observe(b.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:b,className:j,style:{fontSize:`${p}px`,lineHeight:1.1},onClick:()=>g(!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:q,className:"flex-1 overflow-hidden text-slate-100",children:o.jsx("span",{ref:T,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 Sj(){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 Aj({layout:a,onOpenHelpOverlay:l}){return o.jsxs("div",{className:"flex h-full gap-0.5 overflow-hidden",children:[o.jsxs("div",{className:"flex min-w-0 flex-[1.22] flex-col gap-0.5 overflow-y-auto pr-0",children:[o.jsx(af,{}),o.jsx(T1,{}),o.jsx(Wu,{})]}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 overflow-y-auto",children:[o.jsx(mf,{layout:a}),o.jsx(nj,{layout:a,onOpenHelpOverlay:l})]})]})}function jg({layout:a,onOpenHelpOverlay:l,roomPanelId:i,showTelemetry:r=!0}){return o.jsx("section",{className:"panel text-base",children:o.jsxs(cf,{defaultTab:"chat",children:[o.jsxs(of,{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(uf,{children:[o.jsx(It,{id:"chat",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(Bs,{}),o.jsx(df,{})]})}),o.jsx(It,{id:"roomcontrols",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(fg,{}),o.jsx(Iu,{panelId:i})]})}),o.jsx(It,{id:"help",children:o.jsx(xg,{layout:a,onOpenOverlay:l})}),o.jsx(It,{id:"settings",children:o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(gg,{}),o.jsx(Wu,{})]})})]})]})})}function jj({onOpenHelpOverlay:a}){return o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx(af,{layoutFormat:"mobile-portrait"}),o.jsx(kS,{}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(Xu,{panelId:"replay-sources-mobile-portrait"}),o.jsx(Mr,{})]}),o.jsx(jg,{layout:"mobile-portrait",onOpenHelpOverlay:a,roomPanelId:"mobile-portrait-room"})]})}function Nj({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(RS,{}),o.jsxs("div",{children:[o.jsx(af,{layoutFormat:"mobile-landscape"}),o.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,1.4fr)]",children:[o.jsx(Xu,{panelId:"replay-sources-mobile-landscape"}),o.jsx(Mr,{})]})]}),o.jsx(_S,{})]}),o.jsx("div",{className:"flex flex-col gap-0.5 pb-0",children:o.jsx(jg,{layout:"mobile-landscape",onOpenHelpOverlay:a,roomPanelId:"mobile-landscape-room",showTelemetry:!1})})]})}function Ej(){const a=Sj(),l=a==="desktop",i=pj(a);return o.jsx("div",{className:`bg-black text-slate-100 ${l?"h-screen overflow-hidden":"min-h-screen"}`,children:o.jsx(Qu,{children:o.jsx(wj,{layout:a,isDesktop:l,fullscreen:i})})})}function wj({layout:a,isDesktop:l,fullscreen:i}){hf();const{visible:r,mode:f,enterFullscreen:d,dismiss:g}=i,{value:p,status:y,save:v}=ot("help",{showOnLoad:!0}),[S,b]=m.useState(!1);m.useEffect(()=>{y==="ready"&&b(p?.showOnLoad!==!1)},[y,p?.showOnLoad]);const T=m.useCallback(()=>b(!0),[]),q=m.useCallback(()=>b(!1),[]),j=m.useCallback(A=>{const E=!!A;v(N=>({...N??{},showOnLoad:E})),E||b(!1)},[v]),R=m.useMemo(()=>l?o.jsx(Aj,{layout:a,onOpenHelpOverlay:T}):a==="mobile-landscape"?o.jsx(Nj,{onOpenHelpOverlay:T}):o.jsx(jj,{onOpenHelpOverlay:T}),[l,a,T]);return o.jsxs(pS,{children:[o.jsx(NS,{}),o.jsx(ES,{}),o.jsxs("main",{className:`flex w-full flex-col gap-0.5 text-base ${l?"h-full overflow-hidden":""}`,children:[l?null:o.jsx(mf,{layout:a}),R]}),o.jsx($u,{}),o.jsx(oj,{}),o.jsx(ij,{}),o.jsx(gj,{visible:S,layout:a,onClose:q,showOnLoad:p?.showOnLoad!==!1,onToggleShowOnLoad:j}),o.jsx(uj,{visible:r,mode:f,onEnterFullscreen:d,onDismiss:g})]})}function Ng(){const{session:a,setRole:l,subscribeAll:i,connected:r}=Re(),[f,d]=m.useState(!1);return m.useEffect(()=>{let g=!1;async function p(){if(a?.mode==="lockdown"){d(!1);return}try{a?.role!=="spectator"&&await l("spectator"),await i(),g||d(!0)}catch(y){console.error("Failed to enter spectator mode",y),g||d(!1)}}return p(),()=>{g=!0}},[r,a?.mode,a?.role,l,i]),f}function qj({roverId:a,session:l}){const i=l?.activeDrivers?.[a]||null,f=(l?.users||[]).find(y=>y.socketId===i)?.nickname||(i?i.slice(0,6):"No driver"),d=l?.mode,g=l?.turnQueues?.[a];return d==="turns"&&g?.current?`${f} (turns)`:f}function Cj({rover:a,frame:l,snapshotFeed:i,audioInfo:r,session:f}){const d=qj({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(nf,{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 Tj({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(Cj,{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 Mj(){return o.jsx("section",{className:"min-h-0",children:o.jsx("div",{className:"surface min-h-[14rem] overflow-hidden",children:o.jsx(Iu,{defaultOrientation:"horizontal",hideLayoutToggle:!0,hideHeader:!0,panelId:"spectator-secondary"})})})}function Rj({className:a=""}){return o.jsx("div",{className:`panel ${a}`,children:o.jsx(Wu,{})})}function _j(){const{session:a}=Re(),l=a?.mode==="lockdown";hf(),Ng();const i=Gu(),r=a?.roster??[],f=ef(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`}]:[]),g=Pu(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(Tj,{roster:r,frames:i,snapshotFeeds:f,audioSources:g,session:a}),o.jsx(Mj,{})]}),o.jsxs("section",{className:"flex min-h-0 min-w-0 flex-col gap-0.5 md:h-full",children:[o.jsx(mf,{layout:"desktop"}),o.jsx("div",{className:"panel",children:o.jsx(Mr,{title:"Rovers"})}),o.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-hidden",children:o.jsx(df,{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(Bs,{hideInput:!0,hideSpectatorNotice:!0,fillHeight:!0})}),o.jsx("div",{className:"min-h-0 min-w-0",children:o.jsx(Rj,{className:"h-40 overflow-hidden"})})]})]}),o.jsx($u,{})]})}function kj(){return o.jsx(Qu,{children:o.jsx(_j,{})})}const Oj=2e4,Dj=10800*1e3;function zj({roverId:a,session:l}){const i=l?.activeDrivers?.[a]||null,f=(l?.users||[]).find(p=>p.socketId===i)?.nickname||(i?i.slice(0,6):"No driver"),d=l?.mode,g=l?.turnQueues?.[a];return d==="turns"&&g?.current?`${f} (turns)`:f}function Bj(){const{session:a}=Re(),l=Ng();hf();const i=a?.mode==="lockdown",r=Gu(),f=a?.roster??[],[d,g]=m.useState(0),p=a?.activeDrivers||{},y=m.useMemo(()=>f.filter(V=>p[V.id]),[f,p]),v=ef(y.map(V=>V.id),{enabled:!i,version:a?.mode}),S=m.useMemo(()=>y.flatMap(V=>{if(!V?.id||!V.media?.audioPublishUrl)return[];const G=String(V.id);return[{type:"rover",id:`${G}-audio`,key:`${G}-audio`}]}),[y]),b=Pu(S,{enabled:!i,version:a?.mode}),T=m.useMemo(()=>{if(!y.length)return[];const V=y.filter(G=>v[G.id]?.objectUrl);return V.length?V:y},[y,v]),q=m.useMemo(()=>T.map(V=>({type:"rover",rover:V})),[T]),j=m.useMemo(()=>q.map(V=>`r:${V.rover.id}`).join("|"),[q]);m.useEffect(()=>{g(0)},[j]),m.useEffect(()=>{if(!q.length)return;const V=setInterval(()=>{g(G=>(G+1)%q.length)},Oj);return()=>clearInterval(V)},[q.length,j]);const R=q.length?q[d%q.length]:null,A=R?.type==="rover"?R.rover:null,E=A&&v[A.id]||null,N=A&&b[`${A.id}-audio`]||null,k=A&&r[A.id]||null,Z=A?zj({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(Uj,{}),o.jsx("section",{className:"panel relative flex min-h-0 flex-1 overflow-hidden",children:l?A?o.jsx(Hj,{children:o.jsx(nf,{sessionInfo:null,videoMode:"snapshot",snapshotFeed:E,audioSessionInfo:N,label:A.name||A.id,telemetryFrame:k,batteryConfig:A.battery,layoutFormat:"mobile",hudVariant:"spectator",driverLabel:Z,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:y.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 Lj(){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())},Dj);return()=>clearTimeout(a)},[]),o.jsx(Qu,{children:o.jsxs(o.Fragment,{children:[o.jsx(Bj,{}),o.jsx($u,{scale:3})]})})}function Uj(){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(Bs,{hideInput:!0,hideSpectatorNotice:!0})})})}function Hj({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})})})}Pv.createRoot(document.getElementById("root")).render(o.jsx(m.StrictMode,{children:o.jsx(A1,{children:o.jsx(N1,{children:o.jsx(E1,{children:o.jsx(yS,{children:o.jsx(mb,{children:o.jsxs(Xx,{children:[o.jsx(ur,{path:"/",element:o.jsx(Ej,{})}),o.jsx(ur,{path:"/spectate",element:o.jsx(kj,{})}),o.jsx(ur,{path:"/mini",element:o.jsx(Lj,{})})]})})})})})})}));
|