Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

feat(oauth): the owner picks a self-registered client's source at its first consent (#6202)

time-attack7cfeb70179db
diff --git a/admin/dist/assets/index-CaaGFcPc.js b/admin/dist/assets/index-CaaGFcPc.js
new file mode 100644
index 0000000000..f2e999dab9
--- /dev/null
+++ b/admin/dist/assets/index-CaaGFcPc.js
@@ -0,0 +1,54 @@
+(function(){const x=document.createElement("link").relList;if(x&&x.supports&&x.supports("modulepreload"))return;for(const A of document.querySelectorAll('link[rel="modulepreload"]'))o(A);new MutationObserver(A=>{for(const z of A)if(z.type==="childList")for(const q of z.addedNodes)q.tagName==="LINK"&&q.rel==="modulepreload"&&o(q)}).observe(document,{childList:!0,subtree:!0});function b(A){const z={};return A.integrity&&(z.integrity=A.integrity),A.referrerPolicy&&(z.referrerPolicy=A.referrerPolicy),A.crossOrigin==="use-credentials"?z.credentials="include":A.crossOrigin==="anonymous"?z.credentials="omit":z.credentials="same-origin",z}function o(A){if(A.ep)return;A.ep=!0;const z=b(A);fetch(A.href,z)}})();function Gd(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var rs={exports:{}},Tn={};/**
+ * @license React
+ * react-jsx-runtime.production.js
+ *
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var Ad;function gy(){if(Ad)return Tn;Ad=1;var s=Symbol.for("react.transitional.element"),x=Symbol.for("react.fragment");function b(o,A,z){var q=null;if(z!==void 0&&(q=""+z),A.key!==void 0&&(q=""+A.key),"key"in A){z={};for(var H in A)H!=="key"&&(z[H]=A[H])}else z=A;return A=z.ref,{$$typeof:s,type:o,key:q,ref:A!==void 0?A:null,props:z}}return Tn.Fragment=x,Tn.jsx=b,Tn.jsxs=b,Tn}var _d;function py(){return _d||(_d=1,rs.exports=gy()),rs.exports}var u=py(),ds={exports:{}},I={};/**
+ * @license React
+ * react.production.js
+ *
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var zd;function by(){if(zd)return I;zd=1;var s=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),q=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),C=Symbol.iterator;function Y(m){return m===null||typeof m!="object"?null:(m=C&&m[C]||m["@@iterator"],typeof m=="function"?m:null)}var G={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Z=Object.assign,W={};function ae(m,M,B){this.props=m,this.context=M,this.refs=W,this.updater=B||G}ae.prototype.isReactComponent={},ae.prototype.setState=function(m,M){if(typeof m!="object"&&typeof m!="function"&&m!=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,m,M,"setState")},ae.prototype.forceUpdate=function(m){this.updater.enqueueForceUpdate(this,m,"forceUpdate")};function $(){}$.prototype=ae.prototype;function le(m,M,B){this.props=m,this.context=M,this.refs=W,this.updater=B||G}var ne=le.prototype=new $;ne.constructor=le,Z(ne,ae.prototype),ne.isPureReactComponent=!0;var xe=Array.isArray;function k(){}var V={H:null,A:null,T:null,S:null},Se=Object.prototype.hasOwnProperty;function je(m,M,B){var Q=B.ref;return{$$typeof:s,type:m,key:M,ref:Q!==void 0?Q:null,props:B}}function se(m,M){return je(m.type,M,m.props)}function F(m){return typeof m=="object"&&m!==null&&m.$$typeof===s}function de(m){var M={"=":"=0",":":"=2"};return"$"+m.replace(/[=:]/g,function(B){return M[B]})}var we=/\/+/g;function Ne(m,M){return typeof m=="object"&&m!==null&&m.key!=null?de(""+m.key):M.toString(36)}function Ze(m){switch(m.status){case"fulfilled":return m.value;case"rejected":throw m.reason;default:switch(typeof m.status=="string"?m.then(k,k):(m.status="pending",m.then(function(M){m.status==="pending"&&(m.status="fulfilled",m.value=M)},function(M){m.status==="pending"&&(m.status="rejected",m.reason=M)})),m.status){case"fulfilled":return m.value;case"rejected":throw m.reason}}throw m}function T(m,M,B,Q,P){var ie=typeof m;(ie==="undefined"||ie==="boolean")&&(m=null);var ve=!1;if(m===null)ve=!0;else switch(ie){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(m.$$typeof){case s:case x:ve=!0;break;case U:return ve=m._init,T(ve(m._payload),M,B,Q,P)}}if(ve)return P=P(m),ve=Q===""?"."+Ne(m,0):Q,xe(P)?(B="",ve!=null&&(B=ve.replace(we,"$&/")+"/"),T(P,M,B,"",function(Ca){return Ca})):P!=null&&(F(P)&&(P=se(P,B+(P.key==null||m&&m.key===P.key?"":(""+P.key).replace(we,"$&/")+"/")+ve)),M.push(P)),1;ve=0;var et=Q===""?".":Q+":";if(xe(m))for(var He=0;He<m.length;He++)Q=m[He],ie=et+Ne(Q,He),ve+=T(Q,M,B,ie,P);else if(He=Y(m),typeof He=="function")for(m=He.call(m),He=0;!(Q=m.next()).done;)Q=Q.value,ie=et+Ne(Q,He++),ve+=T(Q,M,B,ie,P);else if(ie==="object"){if(typeof m.then=="function")return T(Ze(m),M,B,Q,P);throw M=String(m),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(m).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return ve}function N(m,M,B){if(m==null)return m;var Q=[],P=0;return T(m,Q,"","",function(ie){return M.call(B,ie,P++)}),Q}function w(m){if(m._status===-1){var M=m._result;M=M(),M.then(function(B){(m._status===0||m._status===-1)&&(m._status=1,m._result=B)},function(B){(m._status===0||m._status===-1)&&(m._status=2,m._result=B)}),m._status===-1&&(m._status=0,m._result=M)}if(m._status===1)return m._result.default;throw m._result}var Te=typeof reportError=="function"?reportError:function(m){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof m=="object"&&m!==null&&typeof m.message=="string"?String(m.message):String(m),error:m});if(!window.dispatchEvent(M))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",m);return}console.error(m)},ze={map:N,forEach:function(m,M,B){N(m,function(){M.apply(this,arguments)},B)},count:function(m){var M=0;return N(m,function(){M++}),M},toArray:function(m){return N(m,function(M){return M})||[]},only:function(m){if(!F(m))throw Error("React.Children.only expected to receive a single React element child.");return m}};return I.Activity=j,I.Children=ze,I.Component=ae,I.Fragment=b,I.Profiler=A,I.PureComponent=le,I.StrictMode=o,I.Suspense=_,I.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,I.__COMPILER_RUNTIME={__proto__:null,c:function(m){return V.H.useMemoCache(m)}},I.cache=function(m){return function(){return m.apply(null,arguments)}},I.cacheSignal=function(){return null},I.cloneElement=function(m,M,B){if(m==null)throw Error("The argument must be a React element, but you passed "+m+".");var Q=Z({},m.props),P=m.key;if(M!=null)for(ie in M.key!==void 0&&(P=""+M.key),M)!Se.call(M,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&M.ref===void 0||(Q[ie]=M[ie]);var ie=arguments.length-2;if(ie===1)Q.children=B;else if(1<ie){for(var ve=Array(ie),et=0;et<ie;et++)ve[et]=arguments[et+2];Q.children=ve}return je(m.type,P,Q)},I.createContext=function(m){return m={$$typeof:q,_currentValue:m,_currentValue2:m,_threadCount:0,Provider:null,Consumer:null},m.Provider=m,m.Consumer={$$typeof:z,_context:m},m},I.createElement=function(m,M,B){var Q,P={},ie=null;if(M!=null)for(Q in M.key!==void 0&&(ie=""+M.key),M)Se.call(M,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(P[Q]=M[Q]);var ve=arguments.length-2;if(ve===1)P.children=B;else if(1<ve){for(var et=Array(ve),He=0;He<ve;He++)et[He]=arguments[He+2];P.children=et}if(m&&m.defaultProps)for(Q in ve=m.defaultProps,ve)P[Q]===void 0&&(P[Q]=ve[Q]);return je(m,ie,P)},I.createRef=function(){return{current:null}},I.forwardRef=function(m){return{$$typeof:H,render:m}},I.isValidElement=F,I.lazy=function(m){return{$$typeof:U,_payload:{_status:-1,_result:m},_init:w}},I.memo=function(m,M){return{$$typeof:h,type:m,compare:M===void 0?null:M}},I.startTransition=function(m){var M=V.T,B={};V.T=B;try{var Q=m(),P=V.S;P!==null&&P(B,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(k,Te)}catch(ie){Te(ie)}finally{M!==null&&B.types!==null&&(M.types=B.types),V.T=M}},I.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},I.use=function(m){return V.H.use(m)},I.useActionState=function(m,M,B){return V.H.useActionState(m,M,B)},I.useCallback=function(m,M){return V.H.useCallback(m,M)},I.useContext=function(m){return V.H.useContext(m)},I.useDebugValue=function(){},I.useDeferredValue=function(m,M){return V.H.useDeferredValue(m,M)},I.useEffect=function(m,M){return V.H.useEffect(m,M)},I.useEffectEvent=function(m){return V.H.useEffectEvent(m)},I.useId=function(){return V.H.useId()},I.useImperativeHandle=function(m,M,B){return V.H.useImperativeHandle(m,M,B)},I.useInsertionEffect=function(m,M){return V.H.useInsertionEffect(m,M)},I.useLayoutEffect=function(m,M){return V.H.useLayoutEffect(m,M)},I.useMemo=function(m,M){return V.H.useMemo(m,M)},I.useOptimistic=function(m,M){return V.H.useOptimistic(m,M)},I.useReducer=function(m,M,B){return V.H.useReducer(m,M,B)},I.useRef=function(m){return V.H.useRef(m)},I.useState=function(m){return V.H.useState(m)},I.useSyncExternalStore=function(m,M,B){return V.H.useSyncExternalStore(m,M,B)},I.useTransition=function(){return V.H.useTransition()},I.version="19.2.5",I}var Od;function xs(){return Od||(Od=1,ds.exports=by()),ds.exports}var R=xs();const Xd=Gd(R);var hs={exports:{}},En={},ms={exports:{}},ys={};/**
+ * @license React
+ * scheduler.production.js
+ *
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var Cd;function xy(){return Cd||(Cd=1,(function(s){function x(T,N){var w=T.length;T.push(N);e:for(;0<w;){var Te=w-1>>>1,ze=T[Te];if(0<A(ze,N))T[Te]=N,T[w]=ze,w=Te;else break e}}function b(T){return T.length===0?null:T[0]}function o(T){if(T.length===0)return null;var N=T[0],w=T.pop();if(w!==N){T[0]=w;e:for(var Te=0,ze=T.length,m=ze>>>1;Te<m;){var M=2*(Te+1)-1,B=T[M],Q=M+1,P=T[Q];if(0>A(B,w))Q<ze&&0>A(P,B)?(T[Te]=P,T[Q]=w,Te=Q):(T[Te]=B,T[M]=w,Te=M);else if(Q<ze&&0>A(P,w))T[Te]=P,T[Q]=w,Te=Q;else break e}}return N}function A(T,N){var w=T.sortIndex-N.sortIndex;return w!==0?w:T.id-N.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var z=performance;s.unstable_now=function(){return z.now()}}else{var q=Date,H=q.now();s.unstable_now=function(){return q.now()-H}}var _=[],h=[],U=1,j=null,C=3,Y=!1,G=!1,Z=!1,W=!1,ae=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,le=typeof setImmediate<"u"?setImmediate:null;function ne(T){for(var N=b(h);N!==null;){if(N.callback===null)o(h);else if(N.startTime<=T)o(h),N.sortIndex=N.expirationTime,x(_,N);else break;N=b(h)}}function xe(T){if(Z=!1,ne(T),!G)if(b(_)!==null)G=!0,k||(k=!0,de());else{var N=b(h);N!==null&&Ze(xe,N.startTime-T)}}var k=!1,V=-1,Se=5,je=-1;function se(){return W?!0:!(s.unstable_now()-je<Se)}function F(){if(W=!1,k){var T=s.unstable_now();je=T;var N=!0;try{e:{G=!1,Z&&(Z=!1,$(V),V=-1),Y=!0;var w=C;try{t:{for(ne(T),j=b(_);j!==null&&!(j.expirationTime>T&&se());){var Te=j.callback;if(typeof Te=="function"){j.callback=null,C=j.priorityLevel;var ze=Te(j.expirationTime<=T);if(T=s.unstable_now(),typeof ze=="function"){j.callback=ze,ne(T),N=!0;break t}j===b(_)&&o(_),ne(T)}else o(_);j=b(_)}if(j!==null)N=!0;else{var m=b(h);m!==null&&Ze(xe,m.startTime-T),N=!1}}break e}finally{j=null,C=w,Y=!1}N=void 0}}finally{N?de():k=!1}}}var de;if(typeof le=="function")de=function(){le(F)};else if(typeof MessageChannel<"u"){var we=new MessageChannel,Ne=we.port2;we.port1.onmessage=F,de=function(){Ne.postMessage(null)}}else de=function(){ae(F,0)};function Ze(T,N){V=ae(function(){T(s.unstable_now())},N)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(T){T.callback=null},s.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Se=0<T?Math.floor(1e3/T):5},s.unstable_getCurrentPriorityLevel=function(){return C},s.unstable_next=function(T){switch(C){case 1:case 2:case 3:var N=3;break;default:N=C}var w=C;C=N;try{return T()}finally{C=w}},s.unstable_requestPaint=function(){W=!0},s.unstable_runWithPriority=function(T,N){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var w=C;C=T;try{return N()}finally{C=w}},s.unstable_scheduleCallback=function(T,N,w){var Te=s.unstable_now();switch(typeof w=="object"&&w!==null?(w=w.delay,w=typeof w=="number"&&0<w?Te+w:Te):w=Te,T){case 1:var ze=-1;break;case 2:ze=250;break;case 5:ze=1073741823;break;case 4:ze=1e4;break;default:ze=5e3}return ze=w+ze,T={id:U++,callback:N,priorityLevel:T,startTime:w,expirationTime:ze,sortIndex:-1},w>Te?(T.sortIndex=w,x(h,T),b(_)===null&&T===b(h)&&(Z?($(V),V=-1):Z=!0,Ze(xe,w-Te))):(T.sortIndex=ze,x(_,T),G||Y||(G=!0,k||(k=!0,de()))),T},s.unstable_shouldYield=se,s.unstable_wrapCallback=function(T){var N=C;return function(){var w=C;C=N;try{return T.apply(this,arguments)}finally{C=w}}}})(ys)),ys}var Nd;function Sy(){return Nd||(Nd=1,ms.exports=xy()),ms.exports}var vs={exports:{}},Pe={};/**
+ * @license React
+ * react-dom.production.js
+ *
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var Dd;function jy(){if(Dd)return Pe;Dd=1;var s=xs();function x(_){var h="https://react.dev/errors/"+_;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var U=2;U<arguments.length;U++)h+="&args[]="+encodeURIComponent(arguments[U])}return"Minified React error #"+_+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function b(){}var o={d:{f:b,r:function(){throw Error(x(522))},D:b,C:b,L:b,m:b,X:b,S:b,M:b},p:0,findDOMNode:null},A=Symbol.for("react.portal");function z(_,h,U){var j=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:A,key:j==null?null:""+j,children:_,containerInfo:h,implementation:U}}var q=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function H(_,h){if(_==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Pe.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Pe.createPortal=function(_,h){var U=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(x(299));return z(_,h,null,U)},Pe.flushSync=function(_){var h=q.T,U=o.p;try{if(q.T=null,o.p=2,_)return _()}finally{q.T=h,o.p=U,o.d.f()}},Pe.preconnect=function(_,h){typeof _=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,o.d.C(_,h))},Pe.prefetchDNS=function(_){typeof _=="string"&&o.d.D(_)},Pe.preinit=function(_,h){if(typeof _=="string"&&h&&typeof h.as=="string"){var U=h.as,j=H(U,h.crossOrigin),C=typeof h.integrity=="string"?h.integrity:void 0,Y=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;U==="style"?o.d.S(_,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:j,integrity:C,fetchPriority:Y}):U==="script"&&o.d.X(_,{crossOrigin:j,integrity:C,fetchPriority:Y,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Pe.preinitModule=function(_,h){if(typeof _=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var U=H(h.as,h.crossOrigin);o.d.M(_,{crossOrigin:U,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&o.d.M(_)},Pe.preload=function(_,h){if(typeof _=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var U=h.as,j=H(U,h.crossOrigin);o.d.L(_,U,{crossOrigin:j,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Pe.preloadModule=function(_,h){if(typeof _=="string")if(h){var U=H(h.as,h.crossOrigin);o.d.m(_,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:U,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else o.d.m(_)},Pe.requestFormReset=function(_){o.d.r(_)},Pe.unstable_batchedUpdates=function(_,h){return _(h)},Pe.useFormState=function(_,h,U){return q.H.useFormState(_,h,U)},Pe.useFormStatus=function(){return q.H.useHostTransitionStatus()},Pe.version="19.2.5",Pe}var Md;function Ty(){if(Md)return vs.exports;Md=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(x){console.error(x)}}return s(),vs.exports=jy(),vs.exports}/**
+ * @license React
+ * react-dom-client.production.js
+ *
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */var Rd;function Ey(){if(Rd)return En;Rd=1;var s=Sy(),x=xs(),b=Ty();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}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 A(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function z(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function q(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 H(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 _(e){if(z(e)!==e)throw Error(o(188))}function h(e){var t=e.alternate;if(!t){if(t=z(e),t===null)throw Error(o(188));return t!==e?null:e}for(var l=e,a=t;;){var n=l.return;if(n===null)break;var i=n.alternate;if(i===null){if(a=n.return,a!==null){l=a;continue}break}if(n.child===i.child){for(i=n.child;i;){if(i===l)return _(n),e;if(i===a)return _(n),t;i=i.sibling}throw Error(o(188))}if(l.return!==a.return)l=n,a=i;else{for(var c=!1,f=n.child;f;){if(f===l){c=!0,l=n,a=i;break}if(f===a){c=!0,a=n,l=i;break}f=f.sibling}if(!c){for(f=i.child;f;){if(f===l){c=!0,l=i,a=n;break}if(f===a){c=!0,a=i,l=n;break}f=f.sibling}if(!c)throw Error(o(189))}}if(l.alternate!==a)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function U(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=U(e),t!==null)return t;e=e.sibling}return null}var j=Object.assign,C=Symbol.for("react.element"),Y=Symbol.for("react.transitional.element"),G=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),ae=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),le=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),xe=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),Se=Symbol.for("react.lazy"),je=Symbol.for("react.activity"),se=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function de(e){return e===null||typeof e!="object"?null:(e=F&&e[F]||e["@@iterator"],typeof e=="function"?e:null)}var we=Symbol.for("react.client.reference");function Ne(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===we?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Z:return"Fragment";case ae:return"Profiler";case W:return"StrictMode";case xe:return"Suspense";case k:return"SuspenseList";case je:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case G:return"Portal";case le:return e.displayName||"Context";case $:return(e._context.displayName||"Context")+".Consumer";case ne:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case V:return t=e.displayName||null,t!==null?t:Ne(e.type)||"Memo";case Se:t=e._payload,e=e._init;try{return Ne(e(t))}catch{}}return null}var Ze=Array.isArray,T=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=b.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,w={pending:!1,data:null,method:null,action:null},Te=[],ze=-1;function m(e){return{current:e}}function M(e){0>ze||(e.current=Te[ze],Te[ze]=null,ze--)}function B(e,t){ze++,Te[ze]=e.current,e.current=t}var Q=m(null),P=m(null),ie=m(null),ve=m(null);function et(e,t){switch(B(ie,t),B(P,e),B(Q,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?kr(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=kr(t),e=Wr(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}M(Q),B(Q,e)}function He(){M(Q),M(P),M(ie)}function Ca(e){e.memoizedState!==null&&B(ve,e);var t=Q.current,l=Wr(t,e.type);t!==l&&(B(P,e),B(Q,l))}function zn(e){P.current===e&&(M(Q),M(P)),ve.current===e&&(M(ve),bn._currentValue=w)}var Ji,js;function Al(e){if(Ji===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);Ji=t&&t[1]||"",js=-1<l.stack.indexOf(`
+ at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
+`+Ji+e+js}var ki=!1;function Wi(e,t){if(!e||ki)return"";ki=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var D=function(){throw Error()};if(Object.defineProperty(D.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(D,[])}catch(S){var p=S}Reflect.construct(e,[],D)}else{try{D.call()}catch(S){p=S}e.call(D.prototype)}}else{try{throw Error()}catch(S){p=S}(D=e())&&typeof D.catch=="function"&&D.catch(function(){})}}catch(S){if(S&&p&&typeof S.stack=="string")return[S.stack,p.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=a.DetermineComponentFrameRoot(),c=i[0],f=i[1];if(c&&f){var r=c.split(`
+`),g=f.split(`
+`);for(n=a=0;a<r.length&&!r[a].includes("DetermineComponentFrameRoot");)a++;for(;n<g.length&&!g[n].includes("DetermineComponentFrameRoot");)n++;if(a===r.length||n===g.length)for(a=r.length-1,n=g.length-1;1<=a&&0<=n&&r[a]!==g[n];)n--;for(;1<=a&&0<=n;a--,n--)if(r[a]!==g[n]){if(a!==1||n!==1)do if(a--,n--,0>n||r[a]!==g[n]){var E=`
+`+r[a].replace(" at new "," at ");return e.displayName&&E.includes("<anonymous>")&&(E=E.replace("<anonymous>",e.displayName)),E}while(1<=a&&0<=n);break}}}finally{ki=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?Al(l):""}function kd(e,t){switch(e.tag){case 26:case 27:case 5:return Al(e.type);case 16:return Al("Lazy");case 13:return e.child!==t&&t!==null?Al("Suspense Fallback"):Al("Suspense");case 19:return Al("SuspenseList");case 0:case 15:return Wi(e.type,!1);case 11:return Wi(e.type.render,!1);case 1:return Wi(e.type,!0);case 31:return Al("Activity");default:return""}}function Ts(e){try{var t="",l=null;do t+=kd(e,l),l=e,e=e.return;while(e);return t}catch(a){return`
+Error generating stack: `+a.message+`
+`+a.stack}}var $i=Object.prototype.hasOwnProperty,Fi=s.unstable_scheduleCallback,Ii=s.unstable_cancelCallback,Wd=s.unstable_shouldYield,$d=s.unstable_requestPaint,ft=s.unstable_now,Fd=s.unstable_getCurrentPriorityLevel,Es=s.unstable_ImmediatePriority,As=s.unstable_UserBlockingPriority,On=s.unstable_NormalPriority,Id=s.unstable_LowPriority,_s=s.unstable_IdlePriority,Pd=s.log,eh=s.unstable_setDisableYieldValue,Na=null,ot=null;function el(e){if(typeof Pd=="function"&&eh(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(Na,e)}catch{}}var rt=Math.clz32?Math.clz32:ah,th=Math.log,lh=Math.LN2;function ah(e){return e>>>=0,e===0?32:31-(th(e)/lh|0)|0}var Cn=256,Nn=262144,Dn=4194304;function _l(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 Mn(e,t,l){var a=e.pendingLanes;if(a===0)return 0;var n=0,i=e.suspendedLanes,c=e.pingedLanes;e=e.warmLanes;var f=a&134217727;return f!==0?(a=f&~i,a!==0?n=_l(a):(c&=f,c!==0?n=_l(c):l||(l=f&~e,l!==0&&(n=_l(l))))):(f=a&~i,f!==0?n=_l(f):c!==0?n=_l(c):l||(l=a&~e,l!==0&&(n=_l(l)))),n===0?0:t!==0&&t!==n&&(t&i)===0&&(i=n&-n,l=t&-t,i>=l||i===32&&(l&4194048)!==0)?t:n}function Da(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function nh(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 zs(){var e=Dn;return Dn<<=1,(Dn&62914560)===0&&(Dn=4194304),e}function Pi(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function Ma(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ih(e,t,l,a,n,i){var c=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var f=e.entanglements,r=e.expirationTimes,g=e.hiddenUpdates;for(l=c&~l;0<l;){var E=31-rt(l),D=1<<E;f[E]=0,r[E]=-1;var p=g[E];if(p!==null)for(g[E]=null,E=0;E<p.length;E++){var S=p[E];S!==null&&(S.lane&=-536870913)}l&=~D}a!==0&&Os(e,a,0),i!==0&&n===0&&e.tag!==0&&(e.suspendedLanes|=i&~(c&~t))}function Os(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-rt(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|l&261930}function Cs(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var a=31-rt(l),n=1<<a;n&t|e[a]&t&&(e[a]|=t),l&=~n}}function Ns(e,t){var l=t&-t;return l=(l&42)!==0?1:eu(l),(l&(e.suspendedLanes|t))!==0?0:l}function eu(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 tu(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ds(){var e=N.p;return e!==0?e:(e=window.event,e===void 0?32:pd(e.type))}function Ms(e,t){var l=N.p;try{return N.p=e,t()}finally{N.p=l}}var tl=Math.random().toString(36).slice(2),ke="__reactFiber$"+tl,lt="__reactProps$"+tl,Zl="__reactContainer$"+tl,lu="__reactEvents$"+tl,uh="__reactListeners$"+tl,ch="__reactHandles$"+tl,Rs="__reactResources$"+tl,Ra="__reactMarker$"+tl;function au(e){delete e[ke],delete e[lt],delete e[lu],delete e[uh],delete e[ch]}function Vl(e){var t=e[ke];if(t)return t;for(var l=e.parentNode;l;){if(t=l[Zl]||l[ke]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=ld(e);e!==null;){if(l=e[ke])return l;e=ld(e)}return t}e=l,l=e.parentNode}return null}function Kl(e){if(e=e[ke]||e[Zl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ua(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Jl(e){var t=e[Rs];return t||(t=e[Rs]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ke(e){e[Ra]=!0}var Us=new Set,qs={};function zl(e,t){kl(e,t),kl(e+"Capture",t)}function kl(e,t){for(qs[e]=t,e=0;e<t.length;e++)Us.add(t[e])}var sh=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]*$"),Hs={},Bs={};function fh(e){return $i.call(Bs,e)?!0:$i.call(Hs,e)?!1:sh.test(e)?Bs[e]=!0:(Hs[e]=!0,!1)}function Rn(e,t,l){if(fh(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Un(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function Ht(e,t,l,a){if(a===null)e.removeAttribute(l);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+a)}}function bt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ys(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function oh(e,t,l){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var n=a.get,i=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(c){l=""+c,i.call(this,c)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(c){l=""+c},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function nu(e){if(!e._valueTracker){var t=Ys(e)?"checked":"value";e._valueTracker=oh(e,t,""+e[t])}}function ws(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),a="";return e&&(a=Ys(e)?e.checked?"true":"false":e.value),e=a,e!==l?(t.setValue(e),!0):!1}function qn(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 rh=/[\n"\\]/g;function xt(e){return e.replace(rh,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function iu(e,t,l,a,n,i,c,f){e.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?e.type=c:e.removeAttribute("type"),t!=null?c==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+bt(t)):e.value!==""+bt(t)&&(e.value=""+bt(t)):c!=="submit"&&c!=="reset"||e.removeAttribute("value"),t!=null?uu(e,c,bt(t)):l!=null?uu(e,c,bt(l)):a!=null&&e.removeAttribute("value"),n==null&&i!=null&&(e.defaultChecked=!!i),n!=null&&(e.checked=n&&typeof n!="function"&&typeof n!="symbol"),f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.name=""+bt(f):e.removeAttribute("name")}function Gs(e,t,l,a,n,i,c,f){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.type=i),t!=null||l!=null){if(!(i!=="submit"&&i!=="reset"||t!=null)){nu(e);return}l=l!=null?""+bt(l):"",t=t!=null?""+bt(t):l,f||t===e.value||(e.value=t),e.defaultValue=t}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=f?e.checked:!!a,e.defaultChecked=!!a,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.name=c),nu(e)}function uu(e,t,l){t==="number"&&qn(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Wl(e,t,l,a){if(e=e.options,t){t={};for(var n=0;n<l.length;n++)t["$"+l[n]]=!0;for(l=0;l<e.length;l++)n=t.hasOwnProperty("$"+e[l].value),e[l].selected!==n&&(e[l].selected=n),n&&a&&(e[l].defaultSelected=!0)}else{for(l=""+bt(l),t=null,n=0;n<e.length;n++){if(e[n].value===l){e[n].selected=!0,a&&(e[n].defaultSelected=!0);return}t!==null||e[n].disabled||(t=e[n])}t!==null&&(t.selected=!0)}}function Xs(e,t,l){if(t!=null&&(t=""+bt(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+bt(l):""}function Qs(e,t,l,a){if(t==null){if(a!=null){if(l!=null)throw Error(o(92));if(Ze(a)){if(1<a.length)throw Error(o(93));a=a[0]}l=a}l==null&&(l=""),t=l}l=bt(t),e.defaultValue=l,a=e.textContent,a===l&&a!==""&&a!==null&&(e.value=a),nu(e)}function $l(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var dh=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 Ls(e,t,l){var a=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,l):typeof l!="number"||l===0||dh.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function Zs(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var a in l)!l.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var n in t)a=t[n],t.hasOwnProperty(n)&&l[n]!==a&&Ls(e,n,a)}else for(var i in t)t.hasOwnProperty(i)&&Ls(e,i,t[i])}function cu(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 hh=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"]]),mh=/^[\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 Hn(e){return mh.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Bt(){}var su=null;function fu(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fl=null,Il=null;function Vs(e){var t=Kl(e);if(t&&(e=t.stateNode)){var l=e[lt]||null;e:switch(e=t.stateNode,t.type){case"input":if(iu(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+xt(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var a=l[t];if(a!==e&&a.form===e.form){var n=a[lt]||null;if(!n)throw Error(o(90));iu(a,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name)}}for(t=0;t<l.length;t++)a=l[t],a.form===e.form&&ws(a)}break e;case"textarea":Xs(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Wl(e,!!l.multiple,t,!1)}}}var ou=!1;function Ks(e,t,l){if(ou)return e(t,l);ou=!0;try{var a=e(t);return a}finally{if(ou=!1,(Fl!==null||Il!==null)&&(Ti(),Fl&&(t=Fl,e=Il,Il=Fl=null,Vs(t),e)))for(t=0;t<e.length;t++)Vs(e[t])}}function qa(e,t){var l=e.stateNode;if(l===null)return null;var a=l[lt]||null;if(a===null)return null;l=a[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":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var Yt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ru=!1;if(Yt)try{var Ha={};Object.defineProperty(Ha,"passive",{get:function(){ru=!0}}),window.addEventListener("test",Ha,Ha),window.removeEventListener("test",Ha,Ha)}catch{ru=!1}var ll=null,du=null,Bn=null;function Js(){if(Bn)return Bn;var e,t=du,l=t.length,a,n="value"in ll?ll.value:ll.textContent,i=n.length;for(e=0;e<l&&t[e]===n[e];e++);var c=l-e;for(a=1;a<=c&&t[l-a]===n[i-a];a++);return Bn=n.slice(e,1<a?1-a:void 0)}function Yn(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 wn(){return!0}function ks(){return!1}function at(e){function t(l,a,n,i,c){this._reactName=l,this._targetInst=n,this.type=a,this.nativeEvent=i,this.target=c,this.currentTarget=null;for(var f in e)e.hasOwnProperty(f)&&(l=e[f],this[f]=l?l(i):i[f]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?wn:ks,this.isPropagationStopped=ks,this}return j(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=wn)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=wn)},persist:function(){},isPersistent:wn}),t}var Ol={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gn=at(Ol),Ba=j({},Ol,{view:0,detail:0}),yh=at(Ba),hu,mu,Ya,Xn=j({},Ba,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vu,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!==Ya&&(Ya&&e.type==="mousemove"?(hu=e.screenX-Ya.screenX,mu=e.screenY-Ya.screenY):mu=hu=0,Ya=e),hu)},movementY:function(e){return"movementY"in e?e.movementY:mu}}),Ws=at(Xn),vh=j({},Xn,{dataTransfer:0}),gh=at(vh),ph=j({},Ba,{relatedTarget:0}),yu=at(ph),bh=j({},Ol,{animationName:0,elapsedTime:0,pseudoElement:0}),xh=at(bh),Sh=j({},Ol,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jh=at(Sh),Th=j({},Ol,{data:0}),$s=at(Th),Eh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ah={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"},_h={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function zh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=_h[e])?!!t[e]:!1}function vu(){return zh}var Oh=j({},Ba,{key:function(e){if(e.key){var t=Eh[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Yn(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ah[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vu,charCode:function(e){return e.type==="keypress"?Yn(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Yn(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Ch=at(Oh),Nh=j({},Xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Fs=at(Nh),Dh=j({},Ba,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vu}),Mh=at(Dh),Rh=j({},Ol,{propertyName:0,elapsedTime:0,pseudoElement:0}),Uh=at(Rh),qh=j({},Xn,{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}),Hh=at(qh),Bh=j({},Ol,{newState:0,oldState:0}),Yh=at(Bh),wh=[9,13,27,32],gu=Yt&&"CompositionEvent"in window,wa=null;Yt&&"documentMode"in document&&(wa=document.documentMode);var Gh=Yt&&"TextEvent"in window&&!wa,Is=Yt&&(!gu||wa&&8<wa&&11>=wa),Ps=" ",ef=!1;function tf(e,t){switch(e){case"keyup":return wh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function lf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Pl=!1;function Xh(e,t){switch(e){case"compositionend":return lf(t);case"keypress":return t.which!==32?null:(ef=!0,Ps);case"textInput":return e=t.data,e===Ps&&ef?null:e;default:return null}}function Qh(e,t){if(Pl)return e==="compositionend"||!gu&&tf(e,t)?(e=Js(),Bn=du=ll=null,Pl=!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 Is&&t.locale!=="ko"?null:t.data;default:return null}}var Lh={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 af(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Lh[e.type]:t==="textarea"}function nf(e,t,l,a){Fl?Il?Il.push(a):Il=[a]:Fl=a,t=Ni(t,"onChange"),0<t.length&&(l=new Gn("onChange","change",null,l,a),e.push({event:l,listeners:t}))}var Ga=null,Xa=null;function Zh(e){Qr(e,0)}function Qn(e){var t=Ua(e);if(ws(t))return e}function uf(e,t){if(e==="change")return t}var cf=!1;if(Yt){var pu;if(Yt){var bu="oninput"in document;if(!bu){var sf=document.createElement("div");sf.setAttribute("oninput","return;"),bu=typeof sf.oninput=="function"}pu=bu}else pu=!1;cf=pu&&(!document.documentMode||9<document.documentMode)}function ff(){Ga&&(Ga.detachEvent("onpropertychange",of),Xa=Ga=null)}function of(e){if(e.propertyName==="value"&&Qn(Xa)){var t=[];nf(t,Xa,e,fu(e)),Ks(Zh,t)}}function Vh(e,t,l){e==="focusin"?(ff(),Ga=t,Xa=l,Ga.attachEvent("onpropertychange",of)):e==="focusout"&&ff()}function Kh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Qn(Xa)}function Jh(e,t){if(e==="click")return Qn(t)}function kh(e,t){if(e==="input"||e==="change")return Qn(t)}function Wh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dt=typeof Object.is=="function"?Object.is:Wh;function Qa(e,t){if(dt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),a=Object.keys(t);if(l.length!==a.length)return!1;for(a=0;a<l.length;a++){var n=l[a];if(!$i.call(t,n)||!dt(e[n],t[n]))return!1}return!0}function rf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function df(e,t){var l=rf(e);e=0;for(var a;l;){if(l.nodeType===3){if(a=e+l.textContent.length,e<=t&&a>=t)return{node:l,offset:t-e};e=a}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=rf(l)}}function hf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?hf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function mf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=qn(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=qn(e.document)}return t}function xu(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 $h=Yt&&"documentMode"in document&&11>=document.documentMode,ea=null,Su=null,La=null,ju=!1;function yf(e,t,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ju||ea==null||ea!==qn(a)||(a=ea,"selectionStart"in a&&xu(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),La&&Qa(La,a)||(La=a,a=Ni(Su,"onSelect"),0<a.length&&(t=new Gn("onSelect","select",null,t,l),e.push({event:t,listeners:a}),t.target=ea)))}function Cl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var ta={animationend:Cl("Animation","AnimationEnd"),animationiteration:Cl("Animation","AnimationIteration"),animationstart:Cl("Animation","AnimationStart"),transitionrun:Cl("Transition","TransitionRun"),transitionstart:Cl("Transition","TransitionStart"),transitioncancel:Cl("Transition","TransitionCancel"),transitionend:Cl("Transition","TransitionEnd")},Tu={},vf={};Yt&&(vf=document.createElement("div").style,"AnimationEvent"in window||(delete ta.animationend.animation,delete ta.animationiteration.animation,delete ta.animationstart.animation),"TransitionEvent"in window||delete ta.transitionend.transition);function Nl(e){if(Tu[e])return Tu[e];if(!ta[e])return e;var t=ta[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in vf)return Tu[e]=t[l];return e}var gf=Nl("animationend"),pf=Nl("animationiteration"),bf=Nl("animationstart"),Fh=Nl("transitionrun"),Ih=Nl("transitionstart"),Ph=Nl("transitioncancel"),xf=Nl("transitionend"),Sf=new Map,Eu="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(" ");Eu.push("scrollEnd");function Ct(e,t){Sf.set(e,t),zl(t,[e])}var Ln=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)},St=[],la=0,Au=0;function Zn(){for(var e=la,t=Au=la=0;t<e;){var l=St[t];St[t++]=null;var a=St[t];St[t++]=null;var n=St[t];St[t++]=null;var i=St[t];if(St[t++]=null,a!==null&&n!==null){var c=a.pending;c===null?n.next=n:(n.next=c.next,c.next=n),a.pending=n}i!==0&&jf(l,n,i)}}function Vn(e,t,l,a){St[la++]=e,St[la++]=t,St[la++]=l,St[la++]=a,Au|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function _u(e,t,l,a){return Vn(e,t,l,a),Kn(e)}function Dl(e,t){return Vn(e,null,null,t),Kn(e)}function jf(e,t,l){e.lanes|=l;var a=e.alternate;a!==null&&(a.lanes|=l);for(var n=!1,i=e.return;i!==null;)i.childLanes|=l,a=i.alternate,a!==null&&(a.childLanes|=l),i.tag===22&&(e=i.stateNode,e===null||e._visibility&1||(n=!0)),e=i,i=i.return;return e.tag===3?(i=e.stateNode,n&&t!==null&&(n=31-rt(l),e=i.hiddenUpdates,a=e[n],a===null?e[n]=[t]:a.push(t),t.lane=l|536870912),i):null}function Kn(e){if(50<dn)throw dn=0,qc=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var aa={};function em(e,t,l,a){this.tag=e,this.key=l,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=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ht(e,t,l,a){return new em(e,t,l,a)}function zu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function wt(e,t){var l=e.alternate;return l===null?(l=ht(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Tf(e,t){e.flags&=65011714;var l=e.alternate;return l===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=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Jn(e,t,l,a,n,i){var c=0;if(a=e,typeof e=="function")zu(e)&&(c=1);else if(typeof e=="string")c=iy(e,l,Q.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case je:return e=ht(31,l,t,n),e.elementType=je,e.lanes=i,e;case Z:return Ml(l.children,n,i,t);case W:c=8,n|=24;break;case ae:return e=ht(12,l,t,n|2),e.elementType=ae,e.lanes=i,e;case xe:return e=ht(13,l,t,n),e.elementType=xe,e.lanes=i,e;case k:return e=ht(19,l,t,n),e.elementType=k,e.lanes=i,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case le:c=10;break e;case $:c=9;break e;case ne:c=11;break e;case V:c=14;break e;case Se:c=16,a=null;break e}c=29,l=Error(o(130,e===null?"null":typeof e,"")),a=null}return t=ht(c,l,t,n),t.elementType=e,t.type=a,t.lanes=i,t}function Ml(e,t,l,a){return e=ht(7,e,a,t),e.lanes=l,e}function Ou(e,t,l){return e=ht(6,e,null,t),e.lanes=l,e}function Ef(e){var t=ht(18,null,null,0);return t.stateNode=e,t}function Cu(e,t,l){return t=ht(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Af=new WeakMap;function jt(e,t){if(typeof e=="object"&&e!==null){var l=Af.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Ts(t)},Af.set(e,t),t)}return{value:e,source:t,stack:Ts(t)}}var na=[],ia=0,kn=null,Za=0,Tt=[],Et=0,al=null,Mt=1,Rt="";function Gt(e,t){na[ia++]=Za,na[ia++]=kn,kn=e,Za=t}function _f(e,t,l){Tt[Et++]=Mt,Tt[Et++]=Rt,Tt[Et++]=al,al=e;var a=Mt;e=Rt;var n=32-rt(a)-1;a&=~(1<<n),l+=1;var i=32-rt(t)+n;if(30<i){var c=n-n%5;i=(a&(1<<c)-1).toString(32),a>>=c,n-=c,Mt=1<<32-rt(t)+n|l<<n|a,Rt=i+e}else Mt=1<<i|l<<n|a,Rt=e}function Nu(e){e.return!==null&&(Gt(e,1),_f(e,1,0))}function Du(e){for(;e===kn;)kn=na[--ia],na[ia]=null,Za=na[--ia],na[ia]=null;for(;e===al;)al=Tt[--Et],Tt[Et]=null,Rt=Tt[--Et],Tt[Et]=null,Mt=Tt[--Et],Tt[Et]=null}function zf(e,t){Tt[Et++]=Mt,Tt[Et++]=Rt,Tt[Et++]=al,Mt=t.id,Rt=t.overflow,al=e}var We=null,De=null,re=!1,nl=null,At=!1,Mu=Error(o(519));function il(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Va(jt(t,e)),Mu}function Of(e){var t=e.stateNode,l=e.type,a=e.memoizedProps;switch(t[ke]=e,t[lt]=a,l){case"dialog":ce("cancel",t),ce("close",t);break;case"iframe":case"object":case"embed":ce("load",t);break;case"video":case"audio":for(l=0;l<mn.length;l++)ce(mn[l],t);break;case"source":ce("error",t);break;case"img":case"image":case"link":ce("error",t),ce("load",t);break;case"details":ce("toggle",t);break;case"input":ce("invalid",t),Gs(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":ce("invalid",t);break;case"textarea":ce("invalid",t),Qs(t,a.value,a.defaultValue,a.children)}l=a.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||a.suppressHydrationWarning===!0||Kr(t.textContent,l)?(a.popover!=null&&(ce("beforetoggle",t),ce("toggle",t)),a.onScroll!=null&&ce("scroll",t),a.onScrollEnd!=null&&ce("scrollend",t),a.onClick!=null&&(t.onclick=Bt),t=!0):t=!1,t||il(e,!0)}function Cf(e){for(We=e.return;We;)switch(We.tag){case 5:case 31:case 13:At=!1;return;case 27:case 3:At=!0;return;default:We=We.return}}function ua(e){if(e!==We)return!1;if(!re)return Cf(e),re=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||$c(e.type,e.memoizedProps)),l=!l),l&&De&&il(e),Cf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));De=td(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));De=td(e)}else t===27?(t=De,bl(e.type)?(e=ts,ts=null,De=e):De=t):De=We?zt(e.stateNode.nextSibling):null;return!0}function Rl(){De=We=null,re=!1}function Ru(){var e=nl;return e!==null&&(ct===null?ct=e:ct.push.apply(ct,e),nl=null),e}function Va(e){nl===null?nl=[e]:nl.push(e)}var Uu=m(null),Ul=null,Xt=null;function ul(e,t,l){B(Uu,t._currentValue),t._currentValue=l}function Qt(e){e._currentValue=Uu.current,M(Uu)}function qu(e,t,l){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===l)break;e=e.return}}function Hu(e,t,l,a){var n=e.child;for(n!==null&&(n.return=e);n!==null;){var i=n.dependencies;if(i!==null){var c=n.child;i=i.firstContext;e:for(;i!==null;){var f=i;i=n;for(var r=0;r<t.length;r++)if(f.context===t[r]){i.lanes|=l,f=i.alternate,f!==null&&(f.lanes|=l),qu(i.return,l,e),a||(c=null);break e}i=f.next}}else if(n.tag===18){if(c=n.return,c===null)throw Error(o(341));c.lanes|=l,i=c.alternate,i!==null&&(i.lanes|=l),qu(c,l,e),c=null}else c=n.child;if(c!==null)c.return=n;else for(c=n;c!==null;){if(c===e){c=null;break}if(n=c.sibling,n!==null){n.return=c.return,c=n;break}c=c.return}n=c}}function ca(e,t,l,a){e=null;for(var n=t,i=!1;n!==null;){if(!i){if((n.flags&524288)!==0)i=!0;else if((n.flags&262144)!==0)break}if(n.tag===10){var c=n.alternate;if(c===null)throw Error(o(387));if(c=c.memoizedProps,c!==null){var f=n.type;dt(n.pendingProps.value,c.value)||(e!==null?e.push(f):e=[f])}}else if(n===ve.current){if(c=n.alternate,c===null)throw Error(o(387));c.memoizedState.memoizedState!==n.memoizedState.memoizedState&&(e!==null?e.push(bn):e=[bn])}n=n.return}e!==null&&Hu(t,e,l,a),t.flags|=262144}function Wn(e){for(e=e.firstContext;e!==null;){if(!dt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ql(e){Ul=e,Xt=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function $e(e){return Nf(Ul,e)}function $n(e,t){return Ul===null&&ql(e),Nf(e,t)}function Nf(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},Xt===null){if(e===null)throw Error(o(308));Xt=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xt=Xt.next=t;return l}var tm=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},lm=s.unstable_scheduleCallback,am=s.unstable_NormalPriority,Ge={$$typeof:le,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Bu(){return{controller:new tm,data:new Map,refCount:0}}function Ka(e){e.refCount--,e.refCount===0&&lm(am,function(){e.controller.abort()})}var Ja=null,Yu=0,sa=0,fa=null;function nm(e,t){if(Ja===null){var l=Ja=[];Yu=0,sa=Xc(),fa={status:"pending",value:void 0,then:function(a){l.push(a)}}}return Yu++,t.then(Df,Df),t}function Df(){if(--Yu===0&&Ja!==null){fa!==null&&(fa.status="fulfilled");var e=Ja;Ja=null,sa=0,fa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function im(e,t){var l=[],a={status:"pending",value:null,reason:null,then:function(n){l.push(n)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var n=0;n<l.length;n++)(0,l[n])(t)},function(n){for(a.status="rejected",a.reason=n,n=0;n<l.length;n++)(0,l[n])(void 0)}),a}var Mf=T.S;T.S=function(e,t){vr=ft(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&nm(e,t),Mf!==null&&Mf(e,t)};var Hl=m(null);function wu(){var e=Hl.current;return e!==null?e:Oe.pooledCache}function Fn(e,t){t===null?B(Hl,Hl.current):B(Hl,t.pool)}function Rf(){var e=wu();return e===null?null:{parent:Ge._currentValue,pool:e}}var oa=Error(o(460)),Gu=Error(o(474)),In=Error(o(542)),Pn={then:function(){}};function Uf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function qf(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(Bt,Bt),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Bf(e),e;default:if(typeof t.status=="string")t.then(Bt,Bt);else{if(e=Oe,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var n=t;n.status="fulfilled",n.value=a}},function(a){if(t.status==="pending"){var n=t;n.status="rejected",n.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Bf(e),e}throw Yl=t,oa}}function Bl(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Yl=l,oa):l}}var Yl=null;function Hf(){if(Yl===null)throw Error(o(459));var e=Yl;return Yl=null,e}function Bf(e){if(e===oa||e===In)throw Error(o(483))}var ra=null,ka=0;function ei(e){var t=ka;return ka+=1,ra===null&&(ra=[]),qf(ra,e,t)}function Wa(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ti(e,t){throw t.$$typeof===C?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Yf(e){function t(y,d){if(e){var v=y.deletions;v===null?(y.deletions=[d],y.flags|=16):v.push(d)}}function l(y,d){if(!e)return null;for(;d!==null;)t(y,d),d=d.sibling;return null}function a(y){for(var d=new Map;y!==null;)y.key!==null?d.set(y.key,y):d.set(y.index,y),y=y.sibling;return d}function n(y,d){return y=wt(y,d),y.index=0,y.sibling=null,y}function i(y,d,v){return y.index=v,e?(v=y.alternate,v!==null?(v=v.index,v<d?(y.flags|=67108866,d):v):(y.flags|=67108866,d)):(y.flags|=1048576,d)}function c(y){return e&&y.alternate===null&&(y.flags|=67108866),y}function f(y,d,v,O){return d===null||d.tag!==6?(d=Ou(v,y.mode,O),d.return=y,d):(d=n(d,v),d.return=y,d)}function r(y,d,v,O){var K=v.type;return K===Z?E(y,d,v.props.children,O,v.key):d!==null&&(d.elementType===K||typeof K=="object"&&K!==null&&K.$$typeof===Se&&Bl(K)===d.type)?(d=n(d,v.props),Wa(d,v),d.return=y,d):(d=Jn(v.type,v.key,v.props,null,y.mode,O),Wa(d,v),d.return=y,d)}function g(y,d,v,O){return d===null||d.tag!==4||d.stateNode.containerInfo!==v.containerInfo||d.stateNode.implementation!==v.implementation?(d=Cu(v,y.mode,O),d.return=y,d):(d=n(d,v.children||[]),d.return=y,d)}function E(y,d,v,O,K){return d===null||d.tag!==7?(d=Ml(v,y.mode,O,K),d.return=y,d):(d=n(d,v),d.return=y,d)}function D(y,d,v){if(typeof d=="string"&&d!==""||typeof d=="number"||typeof d=="bigint")return d=Ou(""+d,y.mode,v),d.return=y,d;if(typeof d=="object"&&d!==null){switch(d.$$typeof){case Y:return v=Jn(d.type,d.key,d.props,null,y.mode,v),Wa(v,d),v.return=y,v;case G:return d=Cu(d,y.mode,v),d.return=y,d;case Se:return d=Bl(d),D(y,d,v)}if(Ze(d)||de(d))return d=Ml(d,y.mode,v,null),d.return=y,d;if(typeof d.then=="function")return D(y,ei(d),v);if(d.$$typeof===le)return D(y,$n(y,d),v);ti(y,d)}return null}function p(y,d,v,O){var K=d!==null?d.key:null;if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return K!==null?null:f(y,d,""+v,O);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Y:return v.key===K?r(y,d,v,O):null;case G:return v.key===K?g(y,d,v,O):null;case Se:return v=Bl(v),p(y,d,v,O)}if(Ze(v)||de(v))return K!==null?null:E(y,d,v,O,null);if(typeof v.then=="function")return p(y,d,ei(v),O);if(v.$$typeof===le)return p(y,d,$n(y,v),O);ti(y,v)}return null}function S(y,d,v,O,K){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return y=y.get(v)||null,f(d,y,""+O,K);if(typeof O=="object"&&O!==null){switch(O.$$typeof){case Y:return y=y.get(O.key===null?v:O.key)||null,r(d,y,O,K);case G:return y=y.get(O.key===null?v:O.key)||null,g(d,y,O,K);case Se:return O=Bl(O),S(y,d,v,O,K)}if(Ze(O)||de(O))return y=y.get(v)||null,E(d,y,O,K,null);if(typeof O.then=="function")return S(y,d,v,ei(O),K);if(O.$$typeof===le)return S(y,d,v,$n(d,O),K);ti(d,O)}return null}function X(y,d,v,O){for(var K=null,he=null,L=d,te=d=0,oe=null;L!==null&&te<v.length;te++){L.index>te?(oe=L,L=null):oe=L.sibling;var me=p(y,L,v[te],O);if(me===null){L===null&&(L=oe);break}e&&L&&me.alternate===null&&t(y,L),d=i(me,d,te),he===null?K=me:he.sibling=me,he=me,L=oe}if(te===v.length)return l(y,L),re&&Gt(y,te),K;if(L===null){for(;te<v.length;te++)L=D(y,v[te],O),L!==null&&(d=i(L,d,te),he===null?K=L:he.sibling=L,he=L);return re&&Gt(y,te),K}for(L=a(L);te<v.length;te++)oe=S(L,y,te,v[te],O),oe!==null&&(e&&oe.alternate!==null&&L.delete(oe.key===null?te:oe.key),d=i(oe,d,te),he===null?K=oe:he.sibling=oe,he=oe);return e&&L.forEach(function(El){return t(y,El)}),re&&Gt(y,te),K}function J(y,d,v,O){if(v==null)throw Error(o(151));for(var K=null,he=null,L=d,te=d=0,oe=null,me=v.next();L!==null&&!me.done;te++,me=v.next()){L.index>te?(oe=L,L=null):oe=L.sibling;var El=p(y,L,me.value,O);if(El===null){L===null&&(L=oe);break}e&&L&&El.alternate===null&&t(y,L),d=i(El,d,te),he===null?K=El:he.sibling=El,he=El,L=oe}if(me.done)return l(y,L),re&&Gt(y,te),K;if(L===null){for(;!me.done;te++,me=v.next())me=D(y,me.value,O),me!==null&&(d=i(me,d,te),he===null?K=me:he.sibling=me,he=me);return re&&Gt(y,te),K}for(L=a(L);!me.done;te++,me=v.next())me=S(L,y,te,me.value,O),me!==null&&(e&&me.alternate!==null&&L.delete(me.key===null?te:me.key),d=i(me,d,te),he===null?K=me:he.sibling=me,he=me);return e&&L.forEach(function(vy){return t(y,vy)}),re&&Gt(y,te),K}function _e(y,d,v,O){if(typeof v=="object"&&v!==null&&v.type===Z&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Y:e:{for(var K=v.key;d!==null;){if(d.key===K){if(K=v.type,K===Z){if(d.tag===7){l(y,d.sibling),O=n(d,v.props.children),O.return=y,y=O;break e}}else if(d.elementType===K||typeof K=="object"&&K!==null&&K.$$typeof===Se&&Bl(K)===d.type){l(y,d.sibling),O=n(d,v.props),Wa(O,v),O.return=y,y=O;break e}l(y,d);break}else t(y,d);d=d.sibling}v.type===Z?(O=Ml(v.props.children,y.mode,O,v.key),O.return=y,y=O):(O=Jn(v.type,v.key,v.props,null,y.mode,O),Wa(O,v),O.return=y,y=O)}return c(y);case G:e:{for(K=v.key;d!==null;){if(d.key===K)if(d.tag===4&&d.stateNode.containerInfo===v.containerInfo&&d.stateNode.implementation===v.implementation){l(y,d.sibling),O=n(d,v.children||[]),O.return=y,y=O;break e}else{l(y,d);break}else t(y,d);d=d.sibling}O=Cu(v,y.mode,O),O.return=y,y=O}return c(y);case Se:return v=Bl(v),_e(y,d,v,O)}if(Ze(v))return X(y,d,v,O);if(de(v)){if(K=de(v),typeof K!="function")throw Error(o(150));return v=K.call(v),J(y,d,v,O)}if(typeof v.then=="function")return _e(y,d,ei(v),O);if(v.$$typeof===le)return _e(y,d,$n(y,v),O);ti(y,v)}return typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint"?(v=""+v,d!==null&&d.tag===6?(l(y,d.sibling),O=n(d,v),O.return=y,y=O):(l(y,d),O=Ou(v,y.mode,O),O.return=y,y=O),c(y)):l(y,d)}return function(y,d,v,O){try{ka=0;var K=_e(y,d,v,O);return ra=null,K}catch(L){if(L===oa||L===In)throw L;var he=ht(29,L,null,y.mode);return he.lanes=O,he.return=y,he}finally{}}}var wl=Yf(!0),wf=Yf(!1),cl=!1;function Xu(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Qu(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 sl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function fl(e,t,l){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(ye&2)!==0){var n=a.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),a.pending=t,t=Kn(e),jf(e,null,l),t}return Vn(e,a,t,l),Kn(e)}function $a(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,Cs(e,l)}}function Lu(e,t){var l=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,l===a)){var n=null,i=null;if(l=l.firstBaseUpdate,l!==null){do{var c={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};i===null?n=i=c:i=i.next=c,l=l.next}while(l!==null);i===null?n=i=t:i=i.next=t}else n=i=t;l={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:i,shared:a.shared,callbacks:a.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var Zu=!1;function Fa(){if(Zu){var e=fa;if(e!==null)throw e}}function Ia(e,t,l,a){Zu=!1;var n=e.updateQueue;cl=!1;var i=n.firstBaseUpdate,c=n.lastBaseUpdate,f=n.shared.pending;if(f!==null){n.shared.pending=null;var r=f,g=r.next;r.next=null,c===null?i=g:c.next=g,c=r;var E=e.alternate;E!==null&&(E=E.updateQueue,f=E.lastBaseUpdate,f!==c&&(f===null?E.firstBaseUpdate=g:f.next=g,E.lastBaseUpdate=r))}if(i!==null){var D=n.baseState;c=0,E=g=r=null,f=i;do{var p=f.lane&-536870913,S=p!==f.lane;if(S?(fe&p)===p:(a&p)===p){p!==0&&p===sa&&(Zu=!0),E!==null&&(E=E.next={lane:0,tag:f.tag,payload:f.payload,callback:null,next:null});e:{var X=e,J=f;p=t;var _e=l;switch(J.tag){case 1:if(X=J.payload,typeof X=="function"){D=X.call(_e,D,p);break e}D=X;break e;case 3:X.flags=X.flags&-65537|128;case 0:if(X=J.payload,p=typeof X=="function"?X.call(_e,D,p):X,p==null)break e;D=j({},D,p);break e;case 2:cl=!0}}p=f.callback,p!==null&&(e.flags|=64,S&&(e.flags|=8192),S=n.callbacks,S===null?n.callbacks=[p]:S.push(p))}else S={lane:p,tag:f.tag,payload:f.payload,callback:f.callback,next:null},E===null?(g=E=S,r=D):E=E.next=S,c|=p;if(f=f.next,f===null){if(f=n.shared.pending,f===null)break;S=f,f=S.next,S.next=null,n.lastBaseUpdate=S,n.shared.pending=null}}while(!0);E===null&&(r=D),n.baseState=r,n.firstBaseUpdate=g,n.lastBaseUpdate=E,i===null&&(n.shared.lanes=0),ml|=c,e.lanes=c,e.memoizedState=D}}function Gf(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Xf(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Gf(l[e],t)}var da=m(null),li=m(0);function Qf(e,t){e=Ft,B(li,e),B(da,t),Ft=e|t.baseLanes}function Vu(){B(li,Ft),B(da,da.current)}function Ku(){Ft=li.current,M(da),M(li)}var mt=m(null),_t=null;function ol(e){var t=e.alternate;B(Be,Be.current&1),B(mt,e),_t===null&&(t===null||da.current!==null||t.memoizedState!==null)&&(_t=e)}function Ju(e){B(Be,Be.current),B(mt,e),_t===null&&(_t=e)}function Lf(e){e.tag===22?(B(Be,Be.current),B(mt,e),_t===null&&(_t=e)):rl()}function rl(){B(Be,Be.current),B(mt,mt.current)}function yt(e){M(mt),_t===e&&(_t=null),M(Be)}var Be=m(0);function ai(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Pc(l)||es(l)))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 Lt=0,ee=null,Ee=null,Xe=null,ni=!1,ha=!1,Gl=!1,ii=0,Pa=0,ma=null,um=0;function Ue(){throw Error(o(321))}function ku(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!dt(e[l],t[l]))return!1;return!0}function Wu(e,t,l,a,n,i){return Lt=i,ee=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,T.H=e===null||e.memoizedState===null?zo:oc,Gl=!1,i=l(a,n),Gl=!1,ha&&(i=Vf(t,l,a,n)),Zf(e),i}function Zf(e){T.H=ln;var t=Ee!==null&&Ee.next!==null;if(Lt=0,Xe=Ee=ee=null,ni=!1,Pa=0,ma=null,t)throw Error(o(300));e===null||Qe||(e=e.dependencies,e!==null&&Wn(e)&&(Qe=!0))}function Vf(e,t,l,a){ee=e;var n=0;do{if(ha&&(ma=null),Pa=0,ha=!1,25<=n)throw Error(o(301));if(n+=1,Xe=Ee=null,e.updateQueue!=null){var i=e.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}T.H=Oo,i=t(l,a)}while(ha);return i}function cm(){var e=T.H,t=e.useState()[0];return t=typeof t.then=="function"?en(t):t,e=e.useState()[0],(Ee!==null?Ee.memoizedState:null)!==e&&(ee.flags|=1024),t}function $u(){var e=ii!==0;return ii=0,e}function Fu(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Iu(e){if(ni){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ni=!1}Lt=0,Xe=Ee=ee=null,ha=!1,Pa=ii=0,ma=null}function tt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xe===null?ee.memoizedState=Xe=e:Xe=Xe.next=e,Xe}function Ye(){if(Ee===null){var e=ee.alternate;e=e!==null?e.memoizedState:null}else e=Ee.next;var t=Xe===null?ee.memoizedState:Xe.next;if(t!==null)Xe=t,Ee=e;else{if(e===null)throw ee.alternate===null?Error(o(467)):Error(o(310));Ee=e,e={memoizedState:Ee.memoizedState,baseState:Ee.baseState,baseQueue:Ee.baseQueue,queue:Ee.queue,next:null},Xe===null?ee.memoizedState=Xe=e:Xe=Xe.next=e}return Xe}function ui(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function en(e){var t=Pa;return Pa+=1,ma===null&&(ma=[]),e=qf(ma,e,t),t=ee,(Xe===null?t.memoizedState:Xe.next)===null&&(t=t.alternate,T.H=t===null||t.memoizedState===null?zo:oc),e}function ci(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return en(e);if(e.$$typeof===le)return $e(e)}throw Error(o(438,String(e)))}function Pu(e){var t=null,l=ee.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var a=ee.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(n){return n.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=ui(),ee.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),a=0;a<e;a++)l[a]=se;return t.index++,l}function Zt(e,t){return typeof t=="function"?t(e):t}function si(e){var t=Ye();return ec(t,Ee,e)}function ec(e,t,l){var a=e.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=l;var n=e.baseQueue,i=a.pending;if(i!==null){if(n!==null){var c=n.next;n.next=i.next,i.next=c}t.baseQueue=n=i,a.pending=null}if(i=e.baseState,n===null)e.memoizedState=i;else{t=n.next;var f=c=null,r=null,g=t,E=!1;do{var D=g.lane&-536870913;if(D!==g.lane?(fe&D)===D:(Lt&D)===D){var p=g.revertLane;if(p===0)r!==null&&(r=r.next={lane:0,revertLane:0,gesture:null,action:g.action,hasEagerState:g.hasEagerState,eagerState:g.eagerState,next:null}),D===sa&&(E=!0);else if((Lt&p)===p){g=g.next,p===sa&&(E=!0);continue}else D={lane:0,revertLane:g.revertLane,gesture:null,action:g.action,hasEagerState:g.hasEagerState,eagerState:g.eagerState,next:null},r===null?(f=r=D,c=i):r=r.next=D,ee.lanes|=p,ml|=p;D=g.action,Gl&&l(i,D),i=g.hasEagerState?g.eagerState:l(i,D)}else p={lane:D,revertLane:g.revertLane,gesture:g.gesture,action:g.action,hasEagerState:g.hasEagerState,eagerState:g.eagerState,next:null},r===null?(f=r=p,c=i):r=r.next=p,ee.lanes|=D,ml|=D;g=g.next}while(g!==null&&g!==t);if(r===null?c=i:r.next=f,!dt(i,e.memoizedState)&&(Qe=!0,E&&(l=fa,l!==null)))throw l;e.memoizedState=i,e.baseState=c,e.baseQueue=r,a.lastRenderedState=i}return n===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function tc(e){var t=Ye(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var a=l.dispatch,n=l.pending,i=t.memoizedState;if(n!==null){l.pending=null;var c=n=n.next;do i=e(i,c.action),c=c.next;while(c!==n);dt(i,t.memoizedState)||(Qe=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),l.lastRenderedState=i}return[i,a]}function Kf(e,t,l){var a=ee,n=Ye(),i=re;if(i){if(l===void 0)throw Error(o(407));l=l()}else l=t();var c=!dt((Ee||n).memoizedState,l);if(c&&(n.memoizedState=l,Qe=!0),n=n.queue,nc(Wf.bind(null,a,n,e),[e]),n.getSnapshot!==t||c||Xe!==null&&Xe.memoizedState.tag&1){if(a.flags|=2048,ya(9,{destroy:void 0},kf.bind(null,a,n,l,t),null),Oe===null)throw Error(o(349));i||(Lt&127)!==0||Jf(a,t,l)}return l}function Jf(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=ee.updateQueue,t===null?(t=ui(),ee.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function kf(e,t,l,a){t.value=l,t.getSnapshot=a,$f(t)&&Ff(e)}function Wf(e,t,l){return l(function(){$f(t)&&Ff(e)})}function $f(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!dt(e,l)}catch{return!0}}function Ff(e){var t=Dl(e,2);t!==null&&st(t,e,2)}function lc(e){var t=tt();if(typeof e=="function"){var l=e;if(e=l(),Gl){el(!0);try{l()}finally{el(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zt,lastRenderedState:e},t}function If(e,t,l,a){return e.baseState=l,ec(e,Ee,typeof a=="function"?a:Zt)}function sm(e,t,l,a,n){if(ri(e))throw Error(o(485));if(e=t.action,e!==null){var i={payload:n,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(c){i.listeners.push(c)}};T.T!==null?l(!0):i.isTransition=!1,a(i),l=t.pending,l===null?(i.next=t.pending=i,Pf(t,i)):(i.next=l.next,t.pending=l.next=i)}}function Pf(e,t){var l=t.action,a=t.payload,n=e.state;if(t.isTransition){var i=T.T,c={};T.T=c;try{var f=l(n,a),r=T.S;r!==null&&r(c,f),eo(e,t,f)}catch(g){ac(e,t,g)}finally{i!==null&&c.types!==null&&(i.types=c.types),T.T=i}}else try{i=l(n,a),eo(e,t,i)}catch(g){ac(e,t,g)}}function eo(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(a){to(e,t,a)},function(a){return ac(e,t,a)}):to(e,t,l)}function to(e,t,l){t.status="fulfilled",t.value=l,lo(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Pf(e,l)))}function ac(e,t,l){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=l,lo(t),t=t.next;while(t!==a)}e.action=null}function lo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ao(e,t){return t}function no(e,t){if(re){var l=Oe.formState;if(l!==null){e:{var a=ee;if(re){if(De){t:{for(var n=De,i=At;n.nodeType!==8;){if(!i){n=null;break t}if(n=zt(n.nextSibling),n===null){n=null;break t}}i=n.data,n=i==="F!"||i==="F"?n:null}if(n){De=zt(n.nextSibling),a=n.data==="F!";break e}}il(a)}a=!1}a&&(t=l[0])}}return l=tt(),l.memoizedState=l.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ao,lastRenderedState:t},l.queue=a,l=Eo.bind(null,ee,a),a.dispatch=l,a=lc(!1),i=fc.bind(null,ee,!1,a.queue),a=tt(),n={state:t,dispatch:null,action:e,pending:null},a.queue=n,l=sm.bind(null,ee,n,i,l),n.dispatch=l,a.memoizedState=e,[t,l,!1]}function io(e){var t=Ye();return uo(t,Ee,e)}function uo(e,t,l){if(t=ec(e,t,ao)[0],e=si(Zt)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=en(t)}catch(c){throw c===oa?In:c}else a=t;t=Ye();var n=t.queue,i=n.dispatch;return l!==t.memoizedState&&(ee.flags|=2048,ya(9,{destroy:void 0},fm.bind(null,n,l),null)),[a,i,e]}function fm(e,t){e.action=t}function co(e){var t=Ye(),l=Ee;if(l!==null)return uo(t,l,e);Ye(),t=t.memoizedState,l=Ye();var a=l.queue.dispatch;return l.memoizedState=e,[t,a,!1]}function ya(e,t,l,a){return e={tag:e,create:l,deps:a,inst:t,next:null},t=ee.updateQueue,t===null&&(t=ui(),ee.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(a=l.next,l.next=e,e.next=a,t.lastEffect=e),e}function so(){return Ye().memoizedState}function fi(e,t,l,a){var n=tt();ee.flags|=e,n.memoizedState=ya(1|t,{destroy:void 0},l,a===void 0?null:a)}function oi(e,t,l,a){var n=Ye();a=a===void 0?null:a;var i=n.memoizedState.inst;Ee!==null&&a!==null&&ku(a,Ee.memoizedState.deps)?n.memoizedState=ya(t,i,l,a):(ee.flags|=e,n.memoizedState=ya(1|t,i,l,a))}function fo(e,t){fi(8390656,8,e,t)}function nc(e,t){oi(2048,8,e,t)}function om(e){ee.flags|=4;var t=ee.updateQueue;if(t===null)t=ui(),ee.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function oo(e){var t=Ye().memoizedState;return om({ref:t,nextImpl:e}),function(){if((ye&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function ro(e,t){return oi(4,2,e,t)}function ho(e,t){return oi(4,4,e,t)}function mo(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function yo(e,t,l){l=l!=null?l.concat([e]):null,oi(4,4,mo.bind(null,t,e),l)}function ic(){}function vo(e,t){var l=Ye();t=t===void 0?null:t;var a=l.memoizedState;return t!==null&&ku(t,a[1])?a[0]:(l.memoizedState=[e,t],e)}function go(e,t){var l=Ye();t=t===void 0?null:t;var a=l.memoizedState;if(t!==null&&ku(t,a[1]))return a[0];if(a=e(),Gl){el(!0);try{e()}finally{el(!1)}}return l.memoizedState=[a,t],a}function uc(e,t,l){return l===void 0||(Lt&1073741824)!==0&&(fe&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=pr(),ee.lanes|=e,ml|=e,l)}function po(e,t,l,a){return dt(l,t)?l:da.current!==null?(e=uc(e,l,a),dt(e,t)||(Qe=!0),e):(Lt&42)===0||(Lt&1073741824)!==0&&(fe&261930)===0?(Qe=!0,e.memoizedState=l):(e=pr(),ee.lanes|=e,ml|=e,t)}function bo(e,t,l,a,n){var i=N.p;N.p=i!==0&&8>i?i:8;var c=T.T,f={};T.T=f,fc(e,!1,t,l);try{var r=n(),g=T.S;if(g!==null&&g(f,r),r!==null&&typeof r=="object"&&typeof r.then=="function"){var E=im(r,a);tn(e,t,E,pt(e))}else tn(e,t,a,pt(e))}catch(D){tn(e,t,{then:function(){},status:"rejected",reason:D},pt())}finally{N.p=i,c!==null&&f.types!==null&&(c.types=f.types),T.T=c}}function rm(){}function cc(e,t,l,a){if(e.tag!==5)throw Error(o(476));var n=xo(e).queue;bo(e,n,t,w,l===null?rm:function(){return So(e),l(a)})}function xo(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:Zt,lastRenderedState:w},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zt,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function So(e){var t=xo(e);t.next===null&&(t=e.alternate.memoizedState),tn(e,t.next.queue,{},pt())}function sc(){return $e(bn)}function jo(){return Ye().memoizedState}function To(){return Ye().memoizedState}function dm(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=pt();e=sl(l);var a=fl(t,e,l);a!==null&&(st(a,t,l),$a(a,t,l)),t={cache:Bu()},e.payload=t;return}t=t.return}}function hm(e,t,l){var a=pt();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ri(e)?Ao(t,l):(l=_u(e,t,l,a),l!==null&&(st(l,e,a),_o(l,t,a)))}function Eo(e,t,l){var a=pt();tn(e,t,l,a)}function tn(e,t,l,a){var n={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(ri(e))Ao(t,n);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var c=t.lastRenderedState,f=i(c,l);if(n.hasEagerState=!0,n.eagerState=f,dt(f,c))return Vn(e,t,n,0),Oe===null&&Zn(),!1}catch{}finally{}if(l=_u(e,t,n,a),l!==null)return st(l,e,a),_o(l,t,a),!0}return!1}function fc(e,t,l,a){if(a={lane:2,revertLane:Xc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ri(e)){if(t)throw Error(o(479))}else t=_u(e,l,a,2),t!==null&&st(t,e,2)}function ri(e){var t=e.alternate;return e===ee||t!==null&&t===ee}function Ao(e,t){ha=ni=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function _o(e,t,l){if((l&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,Cs(e,l)}}var ln={readContext:$e,use:ci,useCallback:Ue,useContext:Ue,useEffect:Ue,useImperativeHandle:Ue,useLayoutEffect:Ue,useInsertionEffect:Ue,useMemo:Ue,useReducer:Ue,useRef:Ue,useState:Ue,useDebugValue:Ue,useDeferredValue:Ue,useTransition:Ue,useSyncExternalStore:Ue,useId:Ue,useHostTransitionStatus:Ue,useFormState:Ue,useActionState:Ue,useOptimistic:Ue,useMemoCache:Ue,useCacheRefresh:Ue};ln.useEffectEvent=Ue;var zo={readContext:$e,use:ci,useCallback:function(e,t){return tt().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:fo,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,fi(4194308,4,mo.bind(null,t,e),l)},useLayoutEffect:function(e,t){return fi(4194308,4,e,t)},useInsertionEffect:function(e,t){fi(4,2,e,t)},useMemo:function(e,t){var l=tt();t=t===void 0?null:t;var a=e();if(Gl){el(!0);try{e()}finally{el(!1)}}return l.memoizedState=[a,t],a},useReducer:function(e,t,l){var a=tt();if(l!==void 0){var n=l(t);if(Gl){el(!0);try{l(t)}finally{el(!1)}}}else n=t;return a.memoizedState=a.baseState=n,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=hm.bind(null,ee,e),[a.memoizedState,e]},useRef:function(e){var t=tt();return e={current:e},t.memoizedState=e},useState:function(e){e=lc(e);var t=e.queue,l=Eo.bind(null,ee,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:ic,useDeferredValue:function(e,t){var l=tt();return uc(l,e,t)},useTransition:function(){var e=lc(!1);return e=bo.bind(null,ee,e.queue,!0,!1),tt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var a=ee,n=tt();if(re){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),Oe===null)throw Error(o(349));(fe&127)!==0||Jf(a,t,l)}n.memoizedState=l;var i={value:l,getSnapshot:t};return n.queue=i,fo(Wf.bind(null,a,i,e),[e]),a.flags|=2048,ya(9,{destroy:void 0},kf.bind(null,a,i,l,t),null),l},useId:function(){var e=tt(),t=Oe.identifierPrefix;if(re){var l=Rt,a=Mt;l=(a&~(1<<32-rt(a)-1)).toString(32)+l,t="_"+t+"R_"+l,l=ii++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=um++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:sc,useFormState:no,useActionState:no,useOptimistic:function(e){var t=tt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=fc.bind(null,ee,!0,l),l.dispatch=t,[e,t]},useMemoCache:Pu,useCacheRefresh:function(){return tt().memoizedState=dm.bind(null,ee)},useEffectEvent:function(e){var t=tt(),l={impl:e};return t.memoizedState=l,function(){if((ye&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},oc={readContext:$e,use:ci,useCallback:vo,useContext:$e,useEffect:nc,useImperativeHandle:yo,useInsertionEffect:ro,useLayoutEffect:ho,useMemo:go,useReducer:si,useRef:so,useState:function(){return si(Zt)},useDebugValue:ic,useDeferredValue:function(e,t){var l=Ye();return po(l,Ee.memoizedState,e,t)},useTransition:function(){var e=si(Zt)[0],t=Ye().memoizedState;return[typeof e=="boolean"?e:en(e),t]},useSyncExternalStore:Kf,useId:jo,useHostTransitionStatus:sc,useFormState:io,useActionState:io,useOptimistic:function(e,t){var l=Ye();return If(l,Ee,e,t)},useMemoCache:Pu,useCacheRefresh:To};oc.useEffectEvent=oo;var Oo={readContext:$e,use:ci,useCallback:vo,useContext:$e,useEffect:nc,useImperativeHandle:yo,useInsertionEffect:ro,useLayoutEffect:ho,useMemo:go,useReducer:tc,useRef:so,useState:function(){return tc(Zt)},useDebugValue:ic,useDeferredValue:function(e,t){var l=Ye();return Ee===null?uc(l,e,t):po(l,Ee.memoizedState,e,t)},useTransition:function(){var e=tc(Zt)[0],t=Ye().memoizedState;return[typeof e=="boolean"?e:en(e),t]},useSyncExternalStore:Kf,useId:jo,useHostTransitionStatus:sc,useFormState:co,useActionState:co,useOptimistic:function(e,t){var l=Ye();return Ee!==null?If(l,Ee,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Pu,useCacheRefresh:To};Oo.useEffectEvent=oo;function rc(e,t,l,a){t=e.memoizedState,l=l(a,t),l=l==null?t:j({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var dc={enqueueSetState:function(e,t,l){e=e._reactInternals;var a=pt(),n=sl(a);n.payload=t,l!=null&&(n.callback=l),t=fl(e,n,a),t!==null&&(st(t,e,a),$a(t,e,a))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var a=pt(),n=sl(a);n.tag=1,n.payload=t,l!=null&&(n.callback=l),t=fl(e,n,a),t!==null&&(st(t,e,a),$a(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=pt(),a=sl(l);a.tag=2,t!=null&&(a.callback=t),t=fl(e,a,l),t!==null&&(st(t,e,l),$a(t,e,l))}};function Co(e,t,l,a,n,i,c){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,i,c):t.prototype&&t.prototype.isPureReactComponent?!Qa(l,a)||!Qa(n,i):!0}function No(e,t,l,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,a),t.state!==e&&dc.enqueueReplaceState(t,t.state,null)}function Xl(e,t){var l=t;if("ref"in t){l={};for(var a in t)a!=="ref"&&(l[a]=t[a])}if(e=e.defaultProps){l===t&&(l=j({},l));for(var n in e)l[n]===void 0&&(l[n]=e[n])}return l}function Do(e){Ln(e)}function Mo(e){console.error(e)}function Ro(e){Ln(e)}function di(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Uo(e,t,l){try{var a=e.onCaughtError;a(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(n){setTimeout(function(){throw n})}}function hc(e,t,l){return l=sl(l),l.tag=3,l.payload={element:null},l.callback=function(){di(e,t)},l}function qo(e){return e=sl(e),e.tag=3,e}function Ho(e,t,l,a){var n=l.type.getDerivedStateFromError;if(typeof n=="function"){var i=a.value;e.payload=function(){return n(i)},e.callback=function(){Uo(t,l,a)}}var c=l.stateNode;c!==null&&typeof c.componentDidCatch=="function"&&(e.callback=function(){Uo(t,l,a),typeof n!="function"&&(yl===null?yl=new Set([this]):yl.add(this));var f=a.stack;this.componentDidCatch(a.value,{componentStack:f!==null?f:""})})}function mm(e,t,l,a,n){if(l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=l.alternate,t!==null&&ca(t,l,n,!0),l=mt.current,l!==null){switch(l.tag){case 31:case 13:return _t===null?Ei():l.alternate===null&&qe===0&&(qe=3),l.flags&=-257,l.flags|=65536,l.lanes=n,a===Pn?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([a]):t.add(a),Yc(e,a,n)),!1;case 22:return l.flags|=65536,a===Pn?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([a]):l.add(a)),Yc(e,a,n)),!1}throw Error(o(435,l.tag))}return Yc(e,a,n),Ei(),!1}if(re)return t=mt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=n,a!==Mu&&(e=Error(o(422),{cause:a}),Va(jt(e,l)))):(a!==Mu&&(t=Error(o(423),{cause:a}),Va(jt(t,l))),e=e.current.alternate,e.flags|=65536,n&=-n,e.lanes|=n,a=jt(a,l),n=hc(e.stateNode,a,n),Lu(e,n),qe!==4&&(qe=2)),!1;var i=Error(o(520),{cause:a});if(i=jt(i,l),rn===null?rn=[i]:rn.push(i),qe!==4&&(qe=2),t===null)return!0;a=jt(a,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=n&-n,l.lanes|=e,e=hc(l.stateNode,a,e),Lu(l,e),!1;case 1:if(t=l.type,i=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(yl===null||!yl.has(i))))return l.flags|=65536,n&=-n,l.lanes|=n,n=qo(n),Ho(n,e,l,a),Lu(l,n),!1}l=l.return}while(l!==null);return!1}var mc=Error(o(461)),Qe=!1;function Fe(e,t,l,a){t.child=e===null?wf(t,null,l,a):wl(t,e.child,l,a)}function Bo(e,t,l,a,n){l=l.render;var i=t.ref;if("ref"in a){var c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}else c=a;return ql(t),a=Wu(e,t,l,c,i,n),f=$u(),e!==null&&!Qe?(Fu(e,t,n),Vt(e,t,n)):(re&&f&&Nu(t),t.flags|=1,Fe(e,t,a,n),t.child)}function Yo(e,t,l,a,n){if(e===null){var i=l.type;return typeof i=="function"&&!zu(i)&&i.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=i,wo(e,t,i,a,n)):(e=Jn(l.type,null,a,t,t.mode,n),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!jc(e,n)){var c=i.memoizedProps;if(l=l.compare,l=l!==null?l:Qa,l(c,a)&&e.ref===t.ref)return Vt(e,t,n)}return t.flags|=1,e=wt(i,a),e.ref=t.ref,e.return=t,t.child=e}function wo(e,t,l,a,n){if(e!==null){var i=e.memoizedProps;if(Qa(i,a)&&e.ref===t.ref)if(Qe=!1,t.pendingProps=a=i,jc(e,n))(e.flags&131072)!==0&&(Qe=!0);else return t.lanes=e.lanes,Vt(e,t,n)}return yc(e,t,l,a,n)}function Go(e,t,l,a){var n=a.children,i=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(i=i!==null?i.baseLanes|l:l,e!==null){for(a=t.child=e.child,n=0;a!==null;)n=n|a.lanes|a.childLanes,a=a.sibling;a=n&~i}else a=0,t.child=null;return Xo(e,t,i,l,a)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Fn(t,i!==null?i.cachePool:null),i!==null?Qf(t,i):Vu(),Lf(t);else return a=t.lanes=536870912,Xo(e,t,i!==null?i.baseLanes|l:l,l,a)}else i!==null?(Fn(t,i.cachePool),Qf(t,i),rl(),t.memoizedState=null):(e!==null&&Fn(t,null),Vu(),rl());return Fe(e,t,n,l),t.child}function an(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Xo(e,t,l,a,n){var i=wu();return i=i===null?null:{parent:Ge._currentValue,pool:i},t.memoizedState={baseLanes:l,cachePool:i},e!==null&&Fn(t,null),Vu(),Lf(t),e!==null&&ca(e,t,a,!0),t.childLanes=n,null}function hi(e,t){return t=yi({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Qo(e,t,l){return wl(t,e.child,null,l),e=hi(t,t.pendingProps),e.flags|=2,yt(t),t.memoizedState=null,e}function ym(e,t,l){var a=t.pendingProps,n=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(re){if(a.mode==="hidden")return e=hi(t,a),t.lanes=536870912,an(null,e);if(Ju(t),(e=De)?(e=ed(e,At),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:al!==null?{id:Mt,overflow:Rt}:null,retryLane:536870912,hydrationErrors:null},l=Ef(e),l.return=t,t.child=l,We=t,De=null)):e=null,e===null)throw il(t);return t.lanes=536870912,null}return hi(t,a)}var i=e.memoizedState;if(i!==null){var c=i.dehydrated;if(Ju(t),n)if(t.flags&256)t.flags&=-257,t=Qo(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Qe||ca(e,t,l,!1),n=(l&e.childLanes)!==0,Qe||n){if(a=Oe,a!==null&&(c=Ns(a,l),c!==0&&c!==i.retryLane))throw i.retryLane=c,Dl(e,c),st(a,e,c),mc;Ei(),t=Qo(e,t,l)}else e=i.treeContext,De=zt(c.nextSibling),We=t,re=!0,nl=null,At=!1,e!==null&&zf(t,e),t=hi(t,a),t.flags|=4096;return t}return e=wt(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function mi(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function yc(e,t,l,a,n){return ql(t),l=Wu(e,t,l,a,void 0,n),a=$u(),e!==null&&!Qe?(Fu(e,t,n),Vt(e,t,n)):(re&&a&&Nu(t),t.flags|=1,Fe(e,t,l,n),t.child)}function Lo(e,t,l,a,n,i){return ql(t),t.updateQueue=null,l=Vf(t,a,l,n),Zf(e),a=$u(),e!==null&&!Qe?(Fu(e,t,i),Vt(e,t,i)):(re&&a&&Nu(t),t.flags|=1,Fe(e,t,l,i),t.child)}function Zo(e,t,l,a,n){if(ql(t),t.stateNode===null){var i=aa,c=l.contextType;typeof c=="object"&&c!==null&&(i=$e(c)),i=new l(a,i),t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=dc,t.stateNode=i,i._reactInternals=t,i=t.stateNode,i.props=a,i.state=t.memoizedState,i.refs={},Xu(t),c=l.contextType,i.context=typeof c=="object"&&c!==null?$e(c):aa,i.state=t.memoizedState,c=l.getDerivedStateFromProps,typeof c=="function"&&(rc(t,l,c,a),i.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(c=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),c!==i.state&&dc.enqueueReplaceState(i,i.state,null),Ia(t,a,i,n),Fa(),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){i=t.stateNode;var f=t.memoizedProps,r=Xl(l,f);i.props=r;var g=i.context,E=l.contextType;c=aa,typeof E=="object"&&E!==null&&(c=$e(E));var D=l.getDerivedStateFromProps;E=typeof D=="function"||typeof i.getSnapshotBeforeUpdate=="function",f=t.pendingProps!==f,E||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(f||g!==c)&&No(t,i,a,c),cl=!1;var p=t.memoizedState;i.state=p,Ia(t,a,i,n),Fa(),g=t.memoizedState,f||p!==g||cl?(typeof D=="function"&&(rc(t,l,D,a),g=t.memoizedState),(r=cl||Co(t,l,r,a,p,g,c))?(E||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=g),i.props=a,i.state=g,i.context=c,a=r):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{i=t.stateNode,Qu(e,t),c=t.memoizedProps,E=Xl(l,c),i.props=E,D=t.pendingProps,p=i.context,g=l.contextType,r=aa,typeof g=="object"&&g!==null&&(r=$e(g)),f=l.getDerivedStateFromProps,(g=typeof f=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(c!==D||p!==r)&&No(t,i,a,r),cl=!1,p=t.memoizedState,i.state=p,Ia(t,a,i,n),Fa();var S=t.memoizedState;c!==D||p!==S||cl||e!==null&&e.dependencies!==null&&Wn(e.dependencies)?(typeof f=="function"&&(rc(t,l,f,a),S=t.memoizedState),(E=cl||Co(t,l,E,a,p,S,r)||e!==null&&e.dependencies!==null&&Wn(e.dependencies))?(g||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(a,S,r),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(a,S,r)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=S),i.props=a,i.state=S,i.context=r,a=E):(typeof i.componentDidUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),a=!1)}return i=a,mi(e,t),a=(t.flags&128)!==0,i||a?(i=t.stateNode,l=a&&typeof l.getDerivedStateFromError!="function"?null:i.render(),t.flags|=1,e!==null&&a?(t.child=wl(t,e.child,null,n),t.child=wl(t,null,l,n)):Fe(e,t,l,n),t.memoizedState=i.state,e=t.child):e=Vt(e,t,n),e}function Vo(e,t,l,a){return Rl(),t.flags|=256,Fe(e,t,l,a),t.child}var vc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gc(e){return{baseLanes:e,cachePool:Rf()}}function pc(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=gt),e}function Ko(e,t,l){var a=t.pendingProps,n=!1,i=(t.flags&128)!==0,c;if((c=i)||(c=e!==null&&e.memoizedState===null?!1:(Be.current&2)!==0),c&&(n=!0,t.flags&=-129),c=(t.flags&32)!==0,t.flags&=-33,e===null){if(re){if(n?ol(t):rl(),(e=De)?(e=ed(e,At),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:al!==null?{id:Mt,overflow:Rt}:null,retryLane:536870912,hydrationErrors:null},l=Ef(e),l.return=t,t.child=l,We=t,De=null)):e=null,e===null)throw il(t);return es(e)?t.lanes=32:t.lanes=536870912,null}var f=a.children;return a=a.fallback,n?(rl(),n=t.mode,f=yi({mode:"hidden",children:f},n),a=Ml(a,n,l,null),f.return=t,a.return=t,f.sibling=a,t.child=f,a=t.child,a.memoizedState=gc(l),a.childLanes=pc(e,c,l),t.memoizedState=vc,an(null,a)):(ol(t),bc(t,f))}var r=e.memoizedState;if(r!==null&&(f=r.dehydrated,f!==null)){if(i)t.flags&256?(ol(t),t.flags&=-257,t=xc(e,t,l)):t.memoizedState!==null?(rl(),t.child=e.child,t.flags|=128,t=null):(rl(),f=a.fallback,n=t.mode,a=yi({mode:"visible",children:a.children},n),f=Ml(f,n,l,null),f.flags|=2,a.return=t,f.return=t,a.sibling=f,t.child=a,wl(t,e.child,null,l),a=t.child,a.memoizedState=gc(l),a.childLanes=pc(e,c,l),t.memoizedState=vc,t=an(null,a));else if(ol(t),es(f)){if(c=f.nextSibling&&f.nextSibling.dataset,c)var g=c.dgst;c=g,a=Error(o(419)),a.stack="",a.digest=c,Va({value:a,source:null,stack:null}),t=xc(e,t,l)}else if(Qe||ca(e,t,l,!1),c=(l&e.childLanes)!==0,Qe||c){if(c=Oe,c!==null&&(a=Ns(c,l),a!==0&&a!==r.retryLane))throw r.retryLane=a,Dl(e,a),st(c,e,a),mc;Pc(f)||Ei(),t=xc(e,t,l)}else Pc(f)?(t.flags|=192,t.child=e.child,t=null):(e=r.treeContext,De=zt(f.nextSibling),We=t,re=!0,nl=null,At=!1,e!==null&&zf(t,e),t=bc(t,a.children),t.flags|=4096);return t}return n?(rl(),f=a.fallback,n=t.mode,r=e.child,g=r.sibling,a=wt(r,{mode:"hidden",children:a.children}),a.subtreeFlags=r.subtreeFlags&65011712,g!==null?f=wt(g,f):(f=Ml(f,n,l,null),f.flags|=2),f.return=t,a.return=t,a.sibling=f,t.child=a,an(null,a),a=t.child,f=e.child.memoizedState,f===null?f=gc(l):(n=f.cachePool,n!==null?(r=Ge._currentValue,n=n.parent!==r?{parent:r,pool:r}:n):n=Rf(),f={baseLanes:f.baseLanes|l,cachePool:n}),a.memoizedState=f,a.childLanes=pc(e,c,l),t.memoizedState=vc,an(e.child,a)):(ol(t),l=e.child,e=l.sibling,l=wt(l,{mode:"visible",children:a.children}),l.return=t,l.sibling=null,e!==null&&(c=t.deletions,c===null?(t.deletions=[e],t.flags|=16):c.push(e)),t.child=l,t.memoizedState=null,l)}function bc(e,t){return t=yi({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function yi(e,t){return e=ht(22,e,null,t),e.lanes=0,e}function xc(e,t,l){return wl(t,e.child,null,l),e=bc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Jo(e,t,l){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),qu(e.return,t,l)}function Sc(e,t,l,a,n,i){var c=e.memoizedState;c===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:l,tailMode:n,treeForkCount:i}:(c.isBackwards=t,c.rendering=null,c.renderingStartTime=0,c.last=a,c.tail=l,c.tailMode=n,c.treeForkCount=i)}function ko(e,t,l){var a=t.pendingProps,n=a.revealOrder,i=a.tail;a=a.children;var c=Be.current,f=(c&2)!==0;if(f?(c=c&1|2,t.flags|=128):c&=1,B(Be,c),Fe(e,t,a,l),a=re?Za:0,!f&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Jo(e,l,t);else if(e.tag===19)Jo(e,l,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(n){case"forwards":for(l=t.child,n=null;l!==null;)e=l.alternate,e!==null&&ai(e)===null&&(n=l),l=l.sibling;l=n,l===null?(n=t.child,t.child=null):(n=l.sibling,l.sibling=null),Sc(t,!1,n,l,i,a);break;case"backwards":case"unstable_legacy-backwards":for(l=null,n=t.child,t.child=null;n!==null;){if(e=n.alternate,e!==null&&ai(e)===null){t.child=n;break}e=n.sibling,n.sibling=l,l=n,n=e}Sc(t,!0,l,null,i,a);break;case"together":Sc(t,!1,null,null,void 0,a);break;default:t.memoizedState=null}return t.child}function Vt(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),ml|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(ca(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=wt(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=wt(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function jc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Wn(e)))}function vm(e,t,l){switch(t.tag){case 3:et(t,t.stateNode.containerInfo),ul(t,Ge,e.memoizedState.cache),Rl();break;case 27:case 5:Ca(t);break;case 4:et(t,t.stateNode.containerInfo);break;case 10:ul(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ju(t),null;break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(ol(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Ko(e,t,l):(ol(t),e=Vt(e,t,l),e!==null?e.sibling:null);ol(t);break;case 19:var n=(e.flags&128)!==0;if(a=(l&t.childLanes)!==0,a||(ca(e,t,l,!1),a=(l&t.childLanes)!==0),n){if(a)return ko(e,t,l);t.flags|=128}if(n=t.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),B(Be,Be.current),a)break;return null;case 22:return t.lanes=0,Go(e,t,l,t.pendingProps);case 24:ul(t,Ge,e.memoizedState.cache)}return Vt(e,t,l)}function Wo(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)Qe=!0;else{if(!jc(e,l)&&(t.flags&128)===0)return Qe=!1,vm(e,t,l);Qe=(e.flags&131072)!==0}else Qe=!1,re&&(t.flags&1048576)!==0&&_f(t,Za,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=Bl(t.elementType),t.type=e,typeof e=="function")zu(e)?(a=Xl(e,a),t.tag=1,t=Zo(null,t,e,a,l)):(t.tag=0,t=yc(null,t,e,a,l));else{if(e!=null){var n=e.$$typeof;if(n===ne){t.tag=11,t=Bo(null,t,e,a,l);break e}else if(n===V){t.tag=14,t=Yo(null,t,e,a,l);break e}}throw t=Ne(e)||e,Error(o(306,t,""))}}return t;case 0:return yc(e,t,t.type,t.pendingProps,l);case 1:return a=t.type,n=Xl(a,t.pendingProps),Zo(e,t,a,n,l);case 3:e:{if(et(t,t.stateNode.containerInfo),e===null)throw Error(o(387));a=t.pendingProps;var i=t.memoizedState;n=i.element,Qu(e,t),Ia(t,a,null,l);var c=t.memoizedState;if(a=c.cache,ul(t,Ge,a),a!==i.cache&&Hu(t,[Ge],l,!0),Fa(),a=c.element,i.isDehydrated)if(i={element:a,isDehydrated:!1,cache:c.cache},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){t=Vo(e,t,a,l);break e}else if(a!==n){n=jt(Error(o(424)),t),Va(n),t=Vo(e,t,a,l);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(De=zt(e.firstChild),We=t,re=!0,nl=null,At=!0,l=wf(t,null,a,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Rl(),a===n){t=Vt(e,t,l);break e}Fe(e,t,a,l)}t=t.child}return t;case 26:return mi(e,t),e===null?(l=ud(t.type,null,t.pendingProps,null))?t.memoizedState=l:re||(l=t.type,e=t.pendingProps,a=Di(ie.current).createElement(l),a[ke]=t,a[lt]=e,Ie(a,l,e),Ke(a),t.stateNode=a):t.memoizedState=ud(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ca(t),e===null&&re&&(a=t.stateNode=ad(t.type,t.pendingProps,ie.current),We=t,At=!0,n=De,bl(t.type)?(ts=n,De=zt(a.firstChild)):De=n),Fe(e,t,t.pendingProps.children,l),mi(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&re&&((n=a=De)&&(a=Km(a,t.type,t.pendingProps,At),a!==null?(t.stateNode=a,We=t,De=zt(a.firstChild),At=!1,n=!0):n=!1),n||il(t)),Ca(t),n=t.type,i=t.pendingProps,c=e!==null?e.memoizedProps:null,a=i.children,$c(n,i)?a=null:c!==null&&$c(n,c)&&(t.flags|=32),t.memoizedState!==null&&(n=Wu(e,t,cm,null,null,l),bn._currentValue=n),mi(e,t),Fe(e,t,a,l),t.child;case 6:return e===null&&re&&((e=l=De)&&(l=Jm(l,t.pendingProps,At),l!==null?(t.stateNode=l,We=t,De=null,e=!0):e=!1),e||il(t)),null;case 13:return Ko(e,t,l);case 4:return et(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=wl(t,null,a,l):Fe(e,t,a,l),t.child;case 11:return Bo(e,t,t.type,t.pendingProps,l);case 7:return Fe(e,t,t.pendingProps,l),t.child;case 8:return Fe(e,t,t.pendingProps.children,l),t.child;case 12:return Fe(e,t,t.pendingProps.children,l),t.child;case 10:return a=t.pendingProps,ul(t,t.type,a.value),Fe(e,t,a.children,l),t.child;case 9:return n=t.type._context,a=t.pendingProps.children,ql(t),n=$e(n),a=a(n),t.flags|=1,Fe(e,t,a,l),t.child;case 14:return Yo(e,t,t.type,t.pendingProps,l);case 15:return wo(e,t,t.type,t.pendingProps,l);case 19:return ko(e,t,l);case 31:return ym(e,t,l);case 22:return Go(e,t,l,t.pendingProps);case 24:return ql(t),a=$e(Ge),e===null?(n=wu(),n===null&&(n=Oe,i=Bu(),n.pooledCache=i,i.refCount++,i!==null&&(n.pooledCacheLanes|=l),n=i),t.memoizedState={parent:a,cache:n},Xu(t),ul(t,Ge,n)):((e.lanes&l)!==0&&(Qu(e,t),Ia(t,null,null,l),Fa()),n=e.memoizedState,i=t.memoizedState,n.parent!==a?(n={parent:a,cache:a},t.memoizedState=n,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=n),ul(t,Ge,a)):(a=i.cache,ul(t,Ge,a),a!==n.cache&&Hu(t,[Ge],l,!0))),Fe(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Kt(e){e.flags|=4}function Tc(e,t,l,a,n){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(n&335544128)===n)if(e.stateNode.complete)e.flags|=8192;else if(jr())e.flags|=8192;else throw Yl=Pn,Gu}else e.flags&=-16777217}function $o(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!rd(t))if(jr())e.flags|=8192;else throw Yl=Pn,Gu}function vi(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?zs():536870912,e.lanes|=t,ba|=t)}function nn(e,t){if(!re)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var a=null;l!==null;)l.alternate!==null&&(a=l),l=l.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function Me(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,a=0;if(t)for(var n=e.child;n!==null;)l|=n.lanes|n.childLanes,a|=n.subtreeFlags&65011712,a|=n.flags&65011712,n.return=e,n=n.sibling;else for(n=e.child;n!==null;)l|=n.lanes|n.childLanes,a|=n.subtreeFlags,a|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=a,e.childLanes=l,t}function gm(e,t,l){var a=t.pendingProps;switch(Du(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Me(t),null;case 1:return Me(t),null;case 3:return l=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Qt(Ge),He(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(ua(t)?Kt(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ru())),Me(t),null;case 26:var n=t.type,i=t.memoizedState;return e===null?(Kt(t),i!==null?(Me(t),$o(t,i)):(Me(t),Tc(t,n,null,a,l))):i?i!==e.memoizedState?(Kt(t),Me(t),$o(t,i)):(Me(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&Kt(t),Me(t),Tc(t,n,e,a,l)),null;case 27:if(zn(t),l=ie.current,n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Kt(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return Me(t),null}e=Q.current,ua(t)?Of(t):(e=ad(n,a,l),t.stateNode=e,Kt(t))}return Me(t),null;case 5:if(zn(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Kt(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return Me(t),null}if(i=Q.current,ua(t))Of(t);else{var c=Di(ie.current);switch(i){case 1:i=c.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:i=c.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":i=c.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":i=c.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":i=c.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof a.is=="string"?c.createElement("select",{is:a.is}):c.createElement("select"),a.multiple?i.multiple=!0:a.size&&(i.size=a.size);break;default:i=typeof a.is=="string"?c.createElement(n,{is:a.is}):c.createElement(n)}}i[ke]=t,i[lt]=a;e:for(c=t.child;c!==null;){if(c.tag===5||c.tag===6)i.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===t)break e;for(;c.sibling===null;){if(c.return===null||c.return===t)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}t.stateNode=i;e:switch(Ie(i,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Kt(t)}}return Me(t),Tc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Kt(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(o(166));if(e=ie.current,ua(t)){if(e=t.stateNode,l=t.memoizedProps,a=null,n=We,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}e[ke]=t,e=!!(e.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||Kr(e.nodeValue,l)),e||il(t,!0)}else e=Di(e).createTextNode(a),e[ke]=t,t.stateNode=e}return Me(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(a=ua(t),l!==null){if(e===null){if(!a)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[ke]=t}else Rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Me(t),e=!1}else l=Ru(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(yt(t),t):(yt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Me(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(n=ua(t),a!==null&&a.dehydrated!==null){if(e===null){if(!n)throw Error(o(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));n[ke]=t}else Rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Me(t),n=!1}else n=Ru(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),n=!0;if(!n)return t.flags&256?(yt(t),t):(yt(t),null)}return yt(t),(t.flags&128)!==0?(t.lanes=l,t):(l=a!==null,e=e!==null&&e.memoizedState!==null,l&&(a=t.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),i=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(i=a.memoizedState.cachePool.pool),i!==n&&(a.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),vi(t,t.updateQueue),Me(t),null);case 4:return He(),e===null&&Vc(t.stateNode.containerInfo),Me(t),null;case 10:return Qt(t.type),Me(t),null;case 19:if(M(Be),a=t.memoizedState,a===null)return Me(t),null;if(n=(t.flags&128)!==0,i=a.rendering,i===null)if(n)nn(a,!1);else{if(qe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(i=ai(e),i!==null){for(t.flags|=128,nn(a,!1),e=i.updateQueue,t.updateQueue=e,vi(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Tf(l,e),l=l.sibling;return B(Be,Be.current&1|2),re&&Gt(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&ft()>Si&&(t.flags|=128,n=!0,nn(a,!1),t.lanes=4194304)}else{if(!n)if(e=ai(i),e!==null){if(t.flags|=128,n=!0,e=e.updateQueue,t.updateQueue=e,vi(t,e),nn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!i.alternate&&!re)return Me(t),null}else 2*ft()-a.renderingStartTime>Si&&l!==536870912&&(t.flags|=128,n=!0,nn(a,!1),t.lanes=4194304);a.isBackwards?(i.sibling=t.child,t.child=i):(e=a.last,e!==null?e.sibling=i:t.child=i,a.last=i)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=ft(),e.sibling=null,l=Be.current,B(Be,n?l&1|2:l&1),re&&Gt(t,a.treeForkCount),e):(Me(t),null);case 22:case 23:return yt(t),Ku(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(l&536870912)!==0&&(t.flags&128)===0&&(Me(t),t.subtreeFlags&6&&(t.flags|=8192)):Me(t),l=t.updateQueue,l!==null&&vi(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==l&&(t.flags|=2048),e!==null&&M(Hl),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Qt(Ge),Me(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function pm(e,t){switch(Du(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qt(Ge),He(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return zn(t),null;case 31:if(t.memoizedState!==null){if(yt(t),t.alternate===null)throw Error(o(340));Rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(yt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(Be),null;case 4:return He(),null;case 10:return Qt(t.type),null;case 22:case 23:return yt(t),Ku(),e!==null&&M(Hl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Qt(Ge),null;case 25:return null;default:return null}}function Fo(e,t){switch(Du(t),t.tag){case 3:Qt(Ge),He();break;case 26:case 27:case 5:zn(t);break;case 4:He();break;case 31:t.memoizedState!==null&&yt(t);break;case 13:yt(t);break;case 19:M(Be);break;case 10:Qt(t.type);break;case 22:case 23:yt(t),Ku(),e!==null&&M(Hl);break;case 24:Qt(Ge)}}function un(e,t){try{var l=t.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var n=a.next;l=n;do{if((l.tag&e)===e){a=void 0;var i=l.create,c=l.inst;a=i(),c.destroy=a}l=l.next}while(l!==n)}}catch(f){pe(t,t.return,f)}}function dl(e,t,l){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var i=n.next;a=i;do{if((a.tag&e)===e){var c=a.inst,f=c.destroy;if(f!==void 0){c.destroy=void 0,n=t;var r=l,g=f;try{g()}catch(E){pe(n,r,E)}}}a=a.next}while(a!==i)}}catch(E){pe(t,t.return,E)}}function Io(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Xf(t,l)}catch(a){pe(e,e.return,a)}}}function Po(e,t,l){l.props=Xl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(a){pe(e,t,a)}}function cn(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof l=="function"?e.refCleanup=l(a):l.current=a}}catch(n){pe(e,t,n)}}function Ut(e,t){var l=e.ref,a=e.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(n){pe(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(n){pe(e,t,n)}else l.current=null}function er(e){var t=e.type,l=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&a.focus();break e;case"img":l.src?a.src=l.src:l.srcSet&&(a.srcset=l.srcSet)}}catch(n){pe(e,e.return,n)}}function Ec(e,t,l){try{var a=e.stateNode;Gm(a,e.type,l,t),a[lt]=t}catch(n){pe(e,e.return,n)}}function tr(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&bl(e.type)||e.tag===4}function Ac(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||tr(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&&bl(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 _c(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=Bt));else if(a!==4&&(a===27&&bl(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(_c(e,t,l),e=e.sibling;e!==null;)_c(e,t,l),e=e.sibling}function gi(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(a!==4&&(a===27&&bl(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(gi(e,t,l),e=e.sibling;e!==null;)gi(e,t,l),e=e.sibling}function lr(e){var t=e.stateNode,l=e.memoizedProps;try{for(var a=e.type,n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Ie(t,a,l),t[ke]=e,t[lt]=l}catch(i){pe(e,e.return,i)}}var Jt=!1,Le=!1,zc=!1,ar=typeof WeakSet=="function"?WeakSet:Set,Je=null;function bm(e,t){if(e=e.containerInfo,kc=Yi,e=mf(e),xu(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var a=l.getSelection&&l.getSelection();if(a&&a.rangeCount!==0){l=a.anchorNode;var n=a.anchorOffset,i=a.focusNode;a=a.focusOffset;try{l.nodeType,i.nodeType}catch{l=null;break e}var c=0,f=-1,r=-1,g=0,E=0,D=e,p=null;t:for(;;){for(var S;D!==l||n!==0&&D.nodeType!==3||(f=c+n),D!==i||a!==0&&D.nodeType!==3||(r=c+a),D.nodeType===3&&(c+=D.nodeValue.length),(S=D.firstChild)!==null;)p=D,D=S;for(;;){if(D===e)break t;if(p===l&&++g===n&&(f=c),p===i&&++E===a&&(r=c),(S=D.nextSibling)!==null)break;D=p,p=D.parentNode}D=S}l=f===-1||r===-1?null:{start:f,end:r}}else l=null}l=l||{start:0,end:0}}else l=null;for(Wc={focusedElem:e,selectionRange:l},Yi=!1,Je=t;Je!==null;)if(t=Je,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Je=e;else for(;Je!==null;){switch(t=Je,i=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(l=0;l<e.length;l++)n=e[l],n.ref.impl=n.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&i!==null){e=void 0,l=t,n=i.memoizedProps,i=i.memoizedState,a=l.stateNode;try{var X=Xl(l.type,n);e=a.getSnapshotBeforeUpdate(X,i),a.__reactInternalSnapshotBeforeUpdate=e}catch(J){pe(l,l.return,J)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Ic(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ic(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(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Je=e;break}Je=t.return}}function nr(e,t,l){var a=l.flags;switch(l.tag){case 0:case 11:case 15:Wt(e,l),a&4&&un(5,l);break;case 1:if(Wt(e,l),a&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(c){pe(l,l.return,c)}else{var n=Xl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(n,t,e.__reactInternalSnapshotBeforeUpdate)}catch(c){pe(l,l.return,c)}}a&64&&Io(l),a&512&&cn(l,l.return);break;case 3:if(Wt(e,l),a&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{Xf(e,t)}catch(c){pe(l,l.return,c)}}break;case 27:t===null&&a&4&&lr(l);case 26:case 5:Wt(e,l),t===null&&a&4&&er(l),a&512&&cn(l,l.return);break;case 12:Wt(e,l);break;case 31:Wt(e,l),a&4&&cr(e,l);break;case 13:Wt(e,l),a&4&&sr(e,l),a&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Om.bind(null,l),km(e,l))));break;case 22:if(a=l.memoizedState!==null||Jt,!a){t=t!==null&&t.memoizedState!==null||Le,n=Jt;var i=Le;Jt=a,(Le=t)&&!i?$t(e,l,(l.subtreeFlags&8772)!==0):Wt(e,l),Jt=n,Le=i}break;case 30:break;default:Wt(e,l)}}function ir(e){var t=e.alternate;t!==null&&(e.alternate=null,ir(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&au(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 Re=null,nt=!1;function kt(e,t,l){for(l=l.child;l!==null;)ur(e,t,l),l=l.sibling}function ur(e,t,l){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(Na,l)}catch{}switch(l.tag){case 26:Le||Ut(l,t),kt(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Le||Ut(l,t);var a=Re,n=nt;bl(l.type)&&(Re=l.stateNode,nt=!1),kt(e,t,l),vn(l.stateNode),Re=a,nt=n;break;case 5:Le||Ut(l,t);case 6:if(a=Re,n=nt,Re=null,kt(e,t,l),Re=a,nt=n,Re!==null)if(nt)try{(Re.nodeType===9?Re.body:Re.nodeName==="HTML"?Re.ownerDocument.body:Re).removeChild(l.stateNode)}catch(i){pe(l,t,i)}else try{Re.removeChild(l.stateNode)}catch(i){pe(l,t,i)}break;case 18:Re!==null&&(nt?(e=Re,Ir(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),za(e)):Ir(Re,l.stateNode));break;case 4:a=Re,n=nt,Re=l.stateNode.containerInfo,nt=!0,kt(e,t,l),Re=a,nt=n;break;case 0:case 11:case 14:case 15:dl(2,l,t),Le||dl(4,l,t),kt(e,t,l);break;case 1:Le||(Ut(l,t),a=l.stateNode,typeof a.componentWillUnmount=="function"&&Po(l,t,a)),kt(e,t,l);break;case 21:kt(e,t,l);break;case 22:Le=(a=Le)||l.memoizedState!==null,kt(e,t,l),Le=a;break;default:kt(e,t,l)}}function cr(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{za(e)}catch(l){pe(t,t.return,l)}}}function sr(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{za(e)}catch(l){pe(t,t.return,l)}}function xm(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ar),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ar),t;default:throw Error(o(435,e.tag))}}function pi(e,t){var l=xm(e);t.forEach(function(a){if(!l.has(a)){l.add(a);var n=Cm.bind(null,e,a);a.then(n,n)}})}function it(e,t){var l=t.deletions;if(l!==null)for(var a=0;a<l.length;a++){var n=l[a],i=e,c=t,f=c;e:for(;f!==null;){switch(f.tag){case 27:if(bl(f.type)){Re=f.stateNode,nt=!1;break e}break;case 5:Re=f.stateNode,nt=!1;break e;case 3:case 4:Re=f.stateNode.containerInfo,nt=!0;break e}f=f.return}if(Re===null)throw Error(o(160));ur(i,c,n),Re=null,nt=!1,i=n.alternate,i!==null&&(i.return=null),n.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)fr(t,e),t=t.sibling}var Nt=null;function fr(e,t){var l=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:it(t,e),ut(e),a&4&&(dl(3,e,e.return),un(3,e),dl(5,e,e.return));break;case 1:it(t,e),ut(e),a&512&&(Le||l===null||Ut(l,l.return)),a&64&&Jt&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?a:l.concat(a))));break;case 26:var n=Nt;if(it(t,e),ut(e),a&512&&(Le||l===null||Ut(l,l.return)),a&4){var i=l!==null?l.memoizedState:null;if(a=e.memoizedState,l===null)if(a===null)if(e.stateNode===null){e:{a=e.type,l=e.memoizedProps,n=n.ownerDocument||n;t:switch(a){case"title":i=n.getElementsByTagName("title")[0],(!i||i[Ra]||i[ke]||i.namespaceURI==="http://www.w3.org/2000/svg"||i.hasAttribute("itemprop"))&&(i=n.createElement(a),n.head.insertBefore(i,n.querySelector("head > title"))),Ie(i,a,l),i[ke]=e,Ke(i),a=i;break e;case"link":var c=fd("link","href",n).get(a+(l.href||""));if(c){for(var f=0;f<c.length;f++)if(i=c[f],i.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&i.getAttribute("rel")===(l.rel==null?null:l.rel)&&i.getAttribute("title")===(l.title==null?null:l.title)&&i.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){c.splice(f,1);break t}}i=n.createElement(a),Ie(i,a,l),n.head.appendChild(i);break;case"meta":if(c=fd("meta","content",n).get(a+(l.content||""))){for(f=0;f<c.length;f++)if(i=c[f],i.getAttribute("content")===(l.content==null?null:""+l.content)&&i.getAttribute("name")===(l.name==null?null:l.name)&&i.getAttribute("property")===(l.property==null?null:l.property)&&i.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&i.getAttribute("charset")===(l.charSet==null?null:l.charSet)){c.splice(f,1);break t}}i=n.createElement(a),Ie(i,a,l),n.head.appendChild(i);break;default:throw Error(o(468,a))}i[ke]=e,Ke(i),a=i}e.stateNode=a}else od(n,e.type,e.stateNode);else e.stateNode=sd(n,a,e.memoizedProps);else i!==a?(i===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):i.count--,a===null?od(n,e.type,e.stateNode):sd(n,a,e.memoizedProps)):a===null&&e.stateNode!==null&&Ec(e,e.memoizedProps,l.memoizedProps)}break;case 27:it(t,e),ut(e),a&512&&(Le||l===null||Ut(l,l.return)),l!==null&&a&4&&Ec(e,e.memoizedProps,l.memoizedProps);break;case 5:if(it(t,e),ut(e),a&512&&(Le||l===null||Ut(l,l.return)),e.flags&32){n=e.stateNode;try{$l(n,"")}catch(X){pe(e,e.return,X)}}a&4&&e.stateNode!=null&&(n=e.memoizedProps,Ec(e,n,l!==null?l.memoizedProps:n)),a&1024&&(zc=!0);break;case 6:if(it(t,e),ut(e),a&4){if(e.stateNode===null)throw Error(o(162));a=e.memoizedProps,l=e.stateNode;try{l.nodeValue=a}catch(X){pe(e,e.return,X)}}break;case 3:if(Ui=null,n=Nt,Nt=Mi(t.containerInfo),it(t,e),Nt=n,ut(e),a&4&&l!==null&&l.memoizedState.isDehydrated)try{za(t.containerInfo)}catch(X){pe(e,e.return,X)}zc&&(zc=!1,or(e));break;case 4:a=Nt,Nt=Mi(e.stateNode.containerInfo),it(t,e),ut(e),Nt=a;break;case 12:it(t,e),ut(e);break;case 31:it(t,e),ut(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,pi(e,a)));break;case 13:it(t,e),ut(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(xi=ft()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,pi(e,a)));break;case 22:n=e.memoizedState!==null;var r=l!==null&&l.memoizedState!==null,g=Jt,E=Le;if(Jt=g||n,Le=E||r,it(t,e),Le=E,Jt=g,ut(e),a&8192)e:for(t=e.stateNode,t._visibility=n?t._visibility&-2:t._visibility|1,n&&(l===null||r||Jt||Le||Ql(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){r=l=t;try{if(i=r.stateNode,n)c=i.style,typeof c.setProperty=="function"?c.setProperty("display","none","important"):c.display="none";else{f=r.stateNode;var D=r.memoizedProps.style,p=D!=null&&D.hasOwnProperty("display")?D.display:null;f.style.display=p==null||typeof p=="boolean"?"":(""+p).trim()}}catch(X){pe(r,r.return,X)}}}else if(t.tag===6){if(l===null){r=t;try{r.stateNode.nodeValue=n?"":r.memoizedProps}catch(X){pe(r,r.return,X)}}}else if(t.tag===18){if(l===null){r=t;try{var S=r.stateNode;n?Pr(S,!0):Pr(r.stateNode,!1)}catch(X){pe(r,r.return,X)}}}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;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}a&4&&(a=e.updateQueue,a!==null&&(l=a.retryQueue,l!==null&&(a.retryQueue=null,pi(e,l))));break;case 19:it(t,e),ut(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,pi(e,a)));break;case 30:break;case 21:break;default:it(t,e),ut(e)}}function ut(e){var t=e.flags;if(t&2){try{for(var l,a=e.return;a!==null;){if(tr(a)){l=a;break}a=a.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var n=l.stateNode,i=Ac(e);gi(e,i,n);break;case 5:var c=l.stateNode;l.flags&32&&($l(c,""),l.flags&=-33);var f=Ac(e);gi(e,f,c);break;case 3:case 4:var r=l.stateNode.containerInfo,g=Ac(e);_c(e,g,r);break;default:throw Error(o(161))}}catch(E){pe(e,e.return,E)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function or(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;or(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Wt(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)nr(e,t.alternate,t),t=t.sibling}function Ql(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:dl(4,t,t.return),Ql(t);break;case 1:Ut(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Po(t,t.return,l),Ql(t);break;case 27:vn(t.stateNode);case 26:case 5:Ut(t,t.return),Ql(t);break;case 22:t.memoizedState===null&&Ql(t);break;case 30:Ql(t);break;default:Ql(t)}e=e.sibling}}function $t(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,n=e,i=t,c=i.flags;switch(i.tag){case 0:case 11:case 15:$t(n,i,l),un(4,i);break;case 1:if($t(n,i,l),a=i,n=a.stateNode,typeof n.componentDidMount=="function")try{n.componentDidMount()}catch(g){pe(a,a.return,g)}if(a=i,n=a.updateQueue,n!==null){var f=a.stateNode;try{var r=n.shared.hiddenCallbacks;if(r!==null)for(n.shared.hiddenCallbacks=null,n=0;n<r.length;n++)Gf(r[n],f)}catch(g){pe(a,a.return,g)}}l&&c&64&&Io(i),cn(i,i.return);break;case 27:lr(i);case 26:case 5:$t(n,i,l),l&&a===null&&c&4&&er(i),cn(i,i.return);break;case 12:$t(n,i,l);break;case 31:$t(n,i,l),l&&c&4&&cr(n,i);break;case 13:$t(n,i,l),l&&c&4&&sr(n,i);break;case 22:i.memoizedState===null&&$t(n,i,l),cn(i,i.return);break;case 30:break;default:$t(n,i,l)}t=t.sibling}}function Oc(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&Ka(l))}function Cc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ka(e))}function Dt(e,t,l,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)rr(e,t,l,a),t=t.sibling}function rr(e,t,l,a){var n=t.flags;switch(t.tag){case 0:case 11:case 15:Dt(e,t,l,a),n&2048&&un(9,t);break;case 1:Dt(e,t,l,a);break;case 3:Dt(e,t,l,a),n&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ka(e)));break;case 12:if(n&2048){Dt(e,t,l,a),e=t.stateNode;try{var i=t.memoizedProps,c=i.id,f=i.onPostCommit;typeof f=="function"&&f(c,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(r){pe(t,t.return,r)}}else Dt(e,t,l,a);break;case 31:Dt(e,t,l,a);break;case 13:Dt(e,t,l,a);break;case 23:break;case 22:i=t.stateNode,c=t.alternate,t.memoizedState!==null?i._visibility&2?Dt(e,t,l,a):sn(e,t):i._visibility&2?Dt(e,t,l,a):(i._visibility|=2,va(e,t,l,a,(t.subtreeFlags&10256)!==0||!1)),n&2048&&Oc(c,t);break;case 24:Dt(e,t,l,a),n&2048&&Cc(t.alternate,t);break;default:Dt(e,t,l,a)}}function va(e,t,l,a,n){for(n=n&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var i=e,c=t,f=l,r=a,g=c.flags;switch(c.tag){case 0:case 11:case 15:va(i,c,f,r,n),un(8,c);break;case 23:break;case 22:var E=c.stateNode;c.memoizedState!==null?E._visibility&2?va(i,c,f,r,n):sn(i,c):(E._visibility|=2,va(i,c,f,r,n)),n&&g&2048&&Oc(c.alternate,c);break;case 24:va(i,c,f,r,n),n&&g&2048&&Cc(c.alternate,c);break;default:va(i,c,f,r,n)}t=t.sibling}}function sn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,a=t,n=a.flags;switch(a.tag){case 22:sn(l,a),n&2048&&Oc(a.alternate,a);break;case 24:sn(l,a),n&2048&&Cc(a.alternate,a);break;default:sn(l,a)}t=t.sibling}}var fn=8192;function ga(e,t,l){if(e.subtreeFlags&fn)for(e=e.child;e!==null;)dr(e,t,l),e=e.sibling}function dr(e,t,l){switch(e.tag){case 26:ga(e,t,l),e.flags&fn&&e.memoizedState!==null&&uy(l,Nt,e.memoizedState,e.memoizedProps);break;case 5:ga(e,t,l);break;case 3:case 4:var a=Nt;Nt=Mi(e.stateNode.containerInfo),ga(e,t,l),Nt=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=fn,fn=16777216,ga(e,t,l),fn=a):ga(e,t,l));break;default:ga(e,t,l)}}function hr(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 on(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var a=t[l];Je=a,yr(a,e)}hr(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)mr(e),e=e.sibling}function mr(e){switch(e.tag){case 0:case 11:case 15:on(e),e.flags&2048&&dl(9,e,e.return);break;case 3:on(e);break;case 12:on(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,bi(e)):on(e);break;default:on(e)}}function bi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var a=t[l];Je=a,yr(a,e)}hr(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:dl(8,t,t.return),bi(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,bi(t));break;default:bi(t)}e=e.sibling}}function yr(e,t){for(;Je!==null;){var l=Je;switch(l.tag){case 0:case 11:case 15:dl(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var a=l.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:Ka(l.memoizedState.cache)}if(a=l.child,a!==null)a.return=l,Je=a;else e:for(l=e;Je!==null;){a=Je;var n=a.sibling,i=a.return;if(ir(a),a===l){Je=null;break e}if(n!==null){n.return=i,Je=n;break e}Je=i}}}var Sm={getCacheForType:function(e){var t=$e(Ge),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return $e(Ge).controller.signal}},jm=typeof WeakMap=="function"?WeakMap:Map,ye=0,Oe=null,ue=null,fe=0,ge=0,vt=null,hl=!1,pa=!1,Nc=!1,Ft=0,qe=0,ml=0,Ll=0,Dc=0,gt=0,ba=0,rn=null,ct=null,Mc=!1,xi=0,vr=0,Si=1/0,ji=null,yl=null,Ve=0,vl=null,xa=null,It=0,Rc=0,Uc=null,gr=null,dn=0,qc=null;function pt(){return(ye&2)!==0&&fe!==0?fe&-fe:T.T!==null?Xc():Ds()}function pr(){if(gt===0)if((fe&536870912)===0||re){var e=Nn;Nn<<=1,(Nn&3932160)===0&&(Nn=262144),gt=e}else gt=536870912;return e=mt.current,e!==null&&(e.flags|=32),gt}function st(e,t,l){(e===Oe&&(ge===2||ge===9)||e.cancelPendingCommit!==null)&&(Sa(e,0),gl(e,fe,gt,!1)),Ma(e,l),((ye&2)===0||e!==Oe)&&(e===Oe&&((ye&2)===0&&(Ll|=l),qe===4&&gl(e,fe,gt,!1)),qt(e))}function br(e,t,l){if((ye&6)!==0)throw Error(o(327));var a=!l&&(t&127)===0&&(t&e.expiredLanes)===0||Da(e,t),n=a?Am(e,t):Bc(e,t,!0),i=a;do{if(n===0){pa&&!a&&gl(e,t,0,!1);break}else{if(l=e.current.alternate,i&&!Tm(l)){n=Bc(e,t,!1),i=!1;continue}if(n===2){if(i=t,e.errorRecoveryDisabledLanes&i)var c=0;else c=e.pendingLanes&-536870913,c=c!==0?c:c&536870912?536870912:0;if(c!==0){t=c;e:{var f=e;n=rn;var r=f.current.memoizedState.isDehydrated;if(r&&(Sa(f,c).flags|=256),c=Bc(f,c,!1),c!==2){if(Nc&&!r){f.errorRecoveryDisabledLanes|=i,Ll|=i,n=4;break e}i=ct,ct=n,i!==null&&(ct===null?ct=i:ct.push.apply(ct,i))}n=c}if(i=!1,n!==2)continue}}if(n===1){Sa(e,0),gl(e,t,0,!0);break}e:{switch(a=e,i=n,i){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:gl(a,t,gt,!hl);break e;case 2:ct=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(n=xi+300-ft(),10<n)){if(gl(a,t,gt,!hl),Mn(a,0,!0)!==0)break e;It=t,a.timeoutHandle=$r(xr.bind(null,a,l,ct,ji,Mc,t,gt,Ll,ba,hl,i,"Throttled",-0,0),n);break e}xr(a,l,ct,ji,Mc,t,gt,Ll,ba,hl,i,null,-0,0)}}break}while(!0);qt(e)}function xr(e,t,l,a,n,i,c,f,r,g,E,D,p,S){if(e.timeoutHandle=-1,D=t.subtreeFlags,D&8192||(D&16785408)===16785408){D={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bt},dr(t,i,D);var X=(i&62914560)===i?xi-ft():(i&4194048)===i?vr-ft():0;if(X=cy(D,X),X!==null){It=i,e.cancelPendingCommit=X(Or.bind(null,e,t,i,l,a,n,c,f,r,E,D,null,p,S)),gl(e,i,c,!g);return}}Or(e,t,i,l,a,n,c,f,r)}function Tm(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var a=0;a<l.length;a++){var n=l[a],i=n.getSnapshot;n=n.value;try{if(!dt(i(),n))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;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 gl(e,t,l,a){t&=~Dc,t&=~Ll,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var n=t;0<n;){var i=31-rt(n),c=1<<i;a[i]=-1,n&=~c}l!==0&&Os(e,l,t)}function Ti(){return(ye&6)===0?(hn(0),!1):!0}function Hc(){if(ue!==null){if(ge===0)var e=ue.return;else e=ue,Xt=Ul=null,Iu(e),ra=null,ka=0,e=ue;for(;e!==null;)Fo(e.alternate,e),e=e.return;ue=null}}function Sa(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,Lm(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),It=0,Hc(),Oe=e,ue=l=wt(e.current,null),fe=t,ge=0,vt=null,hl=!1,pa=Da(e,t),Nc=!1,ba=gt=Dc=Ll=ml=qe=0,ct=rn=null,Mc=!1,(t&8)!==0&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var n=31-rt(a),i=1<<n;t|=e[n],a&=~i}return Ft=t,Zn(),l}function Sr(e,t){ee=null,T.H=ln,t===oa||t===In?(t=Hf(),ge=3):t===Gu?(t=Hf(),ge=4):ge=t===mc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,vt=t,ue===null&&(qe=1,di(e,jt(t,e.current)))}function jr(){var e=mt.current;return e===null?!0:(fe&4194048)===fe?_t===null:(fe&62914560)===fe||(fe&536870912)!==0?e===_t:!1}function Tr(){var e=T.H;return T.H=ln,e===null?ln:e}function Er(){var e=T.A;return T.A=Sm,e}function Ei(){qe=4,hl||(fe&4194048)!==fe&&mt.current!==null||(pa=!0),(ml&134217727)===0&&(Ll&134217727)===0||Oe===null||gl(Oe,fe,gt,!1)}function Bc(e,t,l){var a=ye;ye|=2;var n=Tr(),i=Er();(Oe!==e||fe!==t)&&(ji=null,Sa(e,t)),t=!1;var c=qe;e:do try{if(ge!==0&&ue!==null){var f=ue,r=vt;switch(ge){case 8:Hc(),c=6;break e;case 3:case 2:case 9:case 6:mt.current===null&&(t=!0);var g=ge;if(ge=0,vt=null,ja(e,f,r,g),l&&pa){c=0;break e}break;default:g=ge,ge=0,vt=null,ja(e,f,r,g)}}Em(),c=qe;break}catch(E){Sr(e,E)}while(!0);return t&&e.shellSuspendCounter++,Xt=Ul=null,ye=a,T.H=n,T.A=i,ue===null&&(Oe=null,fe=0,Zn()),c}function Em(){for(;ue!==null;)Ar(ue)}function Am(e,t){var l=ye;ye|=2;var a=Tr(),n=Er();Oe!==e||fe!==t?(ji=null,Si=ft()+500,Sa(e,t)):pa=Da(e,t);e:do try{if(ge!==0&&ue!==null){t=ue;var i=vt;t:switch(ge){case 1:ge=0,vt=null,ja(e,t,i,1);break;case 2:case 9:if(Uf(i)){ge=0,vt=null,_r(t);break}t=function(){ge!==2&&ge!==9||Oe!==e||(ge=7),qt(e)},i.then(t,t);break e;case 3:ge=7;break e;case 4:ge=5;break e;case 7:Uf(i)?(ge=0,vt=null,_r(t)):(ge=0,vt=null,ja(e,t,i,7));break;case 5:var c=null;switch(ue.tag){case 26:c=ue.memoizedState;case 5:case 27:var f=ue;if(c?rd(c):f.stateNode.complete){ge=0,vt=null;var r=f.sibling;if(r!==null)ue=r;else{var g=f.return;g!==null?(ue=g,Ai(g)):ue=null}break t}}ge=0,vt=null,ja(e,t,i,5);break;case 6:ge=0,vt=null,ja(e,t,i,6);break;case 8:Hc(),qe=6;break e;default:throw Error(o(462))}}_m();break}catch(E){Sr(e,E)}while(!0);return Xt=Ul=null,T.H=a,T.A=n,ye=l,ue!==null?0:(Oe=null,fe=0,Zn(),qe)}function _m(){for(;ue!==null&&!Wd();)Ar(ue)}function Ar(e){var t=Wo(e.alternate,e,Ft);e.memoizedProps=e.pendingProps,t===null?Ai(e):ue=t}function _r(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Lo(l,t,t.pendingProps,t.type,void 0,fe);break;case 11:t=Lo(l,t,t.pendingProps,t.type.render,t.ref,fe);break;case 5:Iu(t);default:Fo(l,t),t=ue=Tf(t,Ft),t=Wo(l,t,Ft)}e.memoizedProps=e.pendingProps,t===null?Ai(e):ue=t}function ja(e,t,l,a){Xt=Ul=null,Iu(t),ra=null,ka=0;var n=t.return;try{if(mm(e,n,t,l,fe)){qe=1,di(e,jt(l,e.current)),ue=null;return}}catch(i){if(n!==null)throw ue=n,i;qe=1,di(e,jt(l,e.current)),ue=null;return}t.flags&32768?(re||a===1?e=!0:pa||(fe&536870912)!==0?e=!1:(hl=e=!0,(a===2||a===9||a===3||a===6)&&(a=mt.current,a!==null&&a.tag===13&&(a.flags|=16384))),zr(t,e)):Ai(t)}function Ai(e){var t=e;do{if((t.flags&32768)!==0){zr(t,hl);return}e=t.return;var l=gm(t.alternate,t,Ft);if(l!==null){ue=l;return}if(t=t.sibling,t!==null){ue=t;return}ue=t=e}while(t!==null);qe===0&&(qe=5)}function zr(e,t){do{var l=pm(e.alternate,e);if(l!==null){l.flags&=32767,ue=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){ue=e;return}ue=e=l}while(e!==null);qe=6,ue=null}function Or(e,t,l,a,n,i,c,f,r){e.cancelPendingCommit=null;do _i();while(Ve!==0);if((ye&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(i=t.lanes|t.childLanes,i|=Au,ih(e,l,i,c,f,r),e===Oe&&(ue=Oe=null,fe=0),xa=t,vl=e,It=l,Rc=i,Uc=n,gr=a,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Nm(On,function(){return Rr(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=T.T,T.T=null,n=N.p,N.p=2,c=ye,ye|=4;try{bm(e,t,l)}finally{ye=c,N.p=n,T.T=a}}Ve=1,Cr(),Nr(),Dr()}}function Cr(){if(Ve===1){Ve=0;var e=vl,t=xa,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=T.T,T.T=null;var a=N.p;N.p=2;var n=ye;ye|=4;try{fr(t,e);var i=Wc,c=mf(e.containerInfo),f=i.focusedElem,r=i.selectionRange;if(c!==f&&f&&f.ownerDocument&&hf(f.ownerDocument.documentElement,f)){if(r!==null&&xu(f)){var g=r.start,E=r.end;if(E===void 0&&(E=g),"selectionStart"in f)f.selectionStart=g,f.selectionEnd=Math.min(E,f.value.length);else{var D=f.ownerDocument||document,p=D&&D.defaultView||window;if(p.getSelection){var S=p.getSelection(),X=f.textContent.length,J=Math.min(r.start,X),_e=r.end===void 0?J:Math.min(r.end,X);!S.extend&&J>_e&&(c=_e,_e=J,J=c);var y=df(f,J),d=df(f,_e);if(y&&d&&(S.rangeCount!==1||S.anchorNode!==y.node||S.anchorOffset!==y.offset||S.focusNode!==d.node||S.focusOffset!==d.offset)){var v=D.createRange();v.setStart(y.node,y.offset),S.removeAllRanges(),J>_e?(S.addRange(v),S.extend(d.node,d.offset)):(v.setEnd(d.node,d.offset),S.addRange(v))}}}}for(D=[],S=f;S=S.parentNode;)S.nodeType===1&&D.push({element:S,left:S.scrollLeft,top:S.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;f<D.length;f++){var O=D[f];O.element.scrollLeft=O.left,O.element.scrollTop=O.top}}Yi=!!kc,Wc=kc=null}finally{ye=n,N.p=a,T.T=l}}e.current=t,Ve=2}}function Nr(){if(Ve===2){Ve=0;var e=vl,t=xa,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=T.T,T.T=null;var a=N.p;N.p=2;var n=ye;ye|=4;try{nr(e,t.alternate,t)}finally{ye=n,N.p=a,T.T=l}}Ve=3}}function Dr(){if(Ve===4||Ve===3){Ve=0,$d();var e=vl,t=xa,l=It,a=gr;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Ve=5:(Ve=0,xa=vl=null,Mr(e,e.pendingLanes));var n=e.pendingLanes;if(n===0&&(yl=null),tu(l),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(Na,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=T.T,n=N.p,N.p=2,T.T=null;try{for(var i=e.onRecoverableError,c=0;c<a.length;c++){var f=a[c];i(f.value,{componentStack:f.stack})}}finally{T.T=t,N.p=n}}(It&3)!==0&&_i(),qt(e),n=e.pendingLanes,(l&261930)!==0&&(n&42)!==0?e===qc?dn++:(dn=0,qc=e):dn=0,hn(0)}}function Mr(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ka(t)))}function _i(){return Cr(),Nr(),Dr(),Rr()}function Rr(){if(Ve!==5)return!1;var e=vl,t=Rc;Rc=0;var l=tu(It),a=T.T,n=N.p;try{N.p=32>l?32:l,T.T=null,l=Uc,Uc=null;var i=vl,c=It;if(Ve=0,xa=vl=null,It=0,(ye&6)!==0)throw Error(o(331));var f=ye;if(ye|=4,mr(i.current),rr(i,i.current,c,l),ye=f,hn(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(Na,i)}catch{}return!0}finally{N.p=n,T.T=a,Mr(e,t)}}function Ur(e,t,l){t=jt(l,t),t=hc(e.stateNode,t,2),e=fl(e,t,2),e!==null&&(Ma(e,2),qt(e))}function pe(e,t,l){if(e.tag===3)Ur(e,e,l);else for(;t!==null;){if(t.tag===3){Ur(t,e,l);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(yl===null||!yl.has(a))){e=jt(l,e),l=qo(2),a=fl(t,l,2),a!==null&&(Ho(l,a,t,e),Ma(a,2),qt(a));break}}t=t.return}}function Yc(e,t,l){var a=e.pingCache;if(a===null){a=e.pingCache=new jm;var n=new Set;a.set(t,n)}else n=a.get(t),n===void 0&&(n=new Set,a.set(t,n));n.has(l)||(Nc=!0,n.add(l),e=zm.bind(null,e,t,l),t.then(e,e))}function zm(e,t,l){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Oe===e&&(fe&l)===l&&(qe===4||qe===3&&(fe&62914560)===fe&&300>ft()-xi?(ye&2)===0&&Sa(e,0):Dc|=l,ba===fe&&(ba=0)),qt(e)}function qr(e,t){t===0&&(t=zs()),e=Dl(e,t),e!==null&&(Ma(e,t),qt(e))}function Om(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),qr(e,l)}function Cm(e,t){var l=0;switch(e.tag){case 31:case 13:var a=e.stateNode,n=e.memoizedState;n!==null&&(l=n.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(t),qr(e,l)}function Nm(e,t){return Fi(e,t)}var zi=null,Ta=null,wc=!1,Oi=!1,Gc=!1,pl=0;function qt(e){e!==Ta&&e.next===null&&(Ta===null?zi=Ta=e:Ta=Ta.next=e),Oi=!0,wc||(wc=!0,Mm())}function hn(e,t){if(!Gc&&Oi){Gc=!0;do for(var l=!1,a=zi;a!==null;){if(e!==0){var n=a.pendingLanes;if(n===0)var i=0;else{var c=a.suspendedLanes,f=a.pingedLanes;i=(1<<31-rt(42|e)+1)-1,i&=n&~(c&~f),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(l=!0,wr(a,i))}else i=fe,i=Mn(a,a===Oe?i:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(i&3)===0||Da(a,i)||(l=!0,wr(a,i));a=a.next}while(l);Gc=!1}}function Dm(){Hr()}function Hr(){Oi=wc=!1;var e=0;pl!==0&&Qm()&&(e=pl);for(var t=ft(),l=null,a=zi;a!==null;){var n=a.next,i=Br(a,t);i===0?(a.next=null,l===null?zi=n:l.next=n,n===null&&(Ta=l)):(l=a,(e!==0||(i&3)!==0)&&(Oi=!0)),a=n}Ve!==0&&Ve!==5||hn(e),pl!==0&&(pl=0)}function Br(e,t){for(var l=e.suspendedLanes,a=e.pingedLanes,n=e.expirationTimes,i=e.pendingLanes&-62914561;0<i;){var c=31-rt(i),f=1<<c,r=n[c];r===-1?((f&l)===0||(f&a)!==0)&&(n[c]=nh(f,t)):r<=t&&(e.expiredLanes|=f),i&=~f}if(t=Oe,l=fe,l=Mn(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,l===0||e===t&&(ge===2||ge===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Ii(a),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Da(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(a!==null&&Ii(a),tu(l)){case 2:case 8:l=As;break;case 32:l=On;break;case 268435456:l=_s;break;default:l=On}return a=Yr.bind(null,e),l=Fi(l,a),e.callbackPriority=t,e.callbackNode=l,t}return a!==null&&a!==null&&Ii(a),e.callbackPriority=2,e.callbackNode=null,2}function Yr(e,t){if(Ve!==0&&Ve!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(_i()&&e.callbackNode!==l)return null;var a=fe;return a=Mn(e,e===Oe?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(br(e,a,t),Br(e,ft()),e.callbackNode!=null&&e.callbackNode===l?Yr.bind(null,e):null)}function wr(e,t){if(_i())return null;br(e,t,!0)}function Mm(){Zm(function(){(ye&6)!==0?Fi(Es,Dm):Hr()})}function Xc(){if(pl===0){var e=sa;e===0&&(e=Cn,Cn<<=1,(Cn&261888)===0&&(Cn=256)),pl=e}return pl}function Gr(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Hn(""+e)}function Xr(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function Rm(e,t,l,a,n){if(t==="submit"&&l&&l.stateNode===n){var i=Gr((n[lt]||null).action),c=a.submitter;c&&(t=(t=c[lt]||null)?Gr(t.formAction):c.getAttribute("formAction"),t!==null&&(i=t,c=null));var f=new Gn("action","action",null,a,n);e.push({event:f,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(pl!==0){var r=c?Xr(n,c):new FormData(n);cc(l,{pending:!0,data:r,method:n.method,action:i},null,r)}}else typeof i=="function"&&(f.preventDefault(),r=c?Xr(n,c):new FormData(n),cc(l,{pending:!0,data:r,method:n.method,action:i},i,r))},currentTarget:n}]})}}for(var Qc=0;Qc<Eu.length;Qc++){var Lc=Eu[Qc],Um=Lc.toLowerCase(),qm=Lc[0].toUpperCase()+Lc.slice(1);Ct(Um,"on"+qm)}Ct(gf,"onAnimationEnd"),Ct(pf,"onAnimationIteration"),Ct(bf,"onAnimationStart"),Ct("dblclick","onDoubleClick"),Ct("focusin","onFocus"),Ct("focusout","onBlur"),Ct(Fh,"onTransitionRun"),Ct(Ih,"onTransitionStart"),Ct(Ph,"onTransitionCancel"),Ct(xf,"onTransitionEnd"),kl("onMouseEnter",["mouseout","mouseover"]),kl("onMouseLeave",["mouseout","mouseover"]),kl("onPointerEnter",["pointerout","pointerover"]),kl("onPointerLeave",["pointerout","pointerover"]),zl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),zl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),zl("onBeforeInput",["compositionend","keypress","textInput","paste"]),zl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),zl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),zl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var mn="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(" "),Hm=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(mn));function Qr(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var a=e[l],n=a.event;a=a.listeners;e:{var i=void 0;if(t)for(var c=a.length-1;0<=c;c--){var f=a[c],r=f.instance,g=f.currentTarget;if(f=f.listener,r!==i&&n.isPropagationStopped())break e;i=f,n.currentTarget=g;try{i(n)}catch(E){Ln(E)}n.currentTarget=null,i=r}else for(c=0;c<a.length;c++){if(f=a[c],r=f.instance,g=f.currentTarget,f=f.listener,r!==i&&n.isPropagationStopped())break e;i=f,n.currentTarget=g;try{i(n)}catch(E){Ln(E)}n.currentTarget=null,i=r}}}}function ce(e,t){var l=t[lu];l===void 0&&(l=t[lu]=new Set);var a=e+"__bubble";l.has(a)||(Lr(t,e,2,!1),l.add(a))}function Zc(e,t,l){var a=0;t&&(a|=4),Lr(l,e,a,t)}var Ci="_reactListening"+Math.random().toString(36).slice(2);function Vc(e){if(!e[Ci]){e[Ci]=!0,Us.forEach(function(l){l!=="selectionchange"&&(Hm.has(l)||Zc(l,!1,e),Zc(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ci]||(t[Ci]=!0,Zc("selectionchange",!1,t))}}function Lr(e,t,l,a){switch(pd(t)){case 2:var n=oy;break;case 8:n=ry;break;default:n=us}l=n.bind(null,t,l,e),n=void 0,!ru||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(n=!0),a?n!==void 0?e.addEventListener(t,l,{capture:!0,passive:n}):e.addEventListener(t,l,!0):n!==void 0?e.addEventListener(t,l,{passive:n}):e.addEventListener(t,l,!1)}function Kc(e,t,l,a,n){var i=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var c=a.tag;if(c===3||c===4){var f=a.stateNode.containerInfo;if(f===n)break;if(c===4)for(c=a.return;c!==null;){var r=c.tag;if((r===3||r===4)&&c.stateNode.containerInfo===n)return;c=c.return}for(;f!==null;){if(c=Vl(f),c===null)return;if(r=c.tag,r===5||r===6||r===26||r===27){a=i=c;continue e}f=f.parentNode}}a=a.return}Ks(function(){var g=i,E=fu(l),D=[];e:{var p=Sf.get(e);if(p!==void 0){var S=Gn,X=e;switch(e){case"keypress":if(Yn(l)===0)break e;case"keydown":case"keyup":S=Ch;break;case"focusin":X="focus",S=yu;break;case"focusout":X="blur",S=yu;break;case"beforeblur":case"afterblur":S=yu;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":S=Ws;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":S=gh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":S=Mh;break;case gf:case pf:case bf:S=xh;break;case xf:S=Uh;break;case"scroll":case"scrollend":S=yh;break;case"wheel":S=Hh;break;case"copy":case"cut":case"paste":S=jh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":S=Fs;break;case"toggle":case"beforetoggle":S=Yh}var J=(t&4)!==0,_e=!J&&(e==="scroll"||e==="scrollend"),y=J?p!==null?p+"Capture":null:p;J=[];for(var d=g,v;d!==null;){var O=d;if(v=O.stateNode,O=O.tag,O!==5&&O!==26&&O!==27||v===null||y===null||(O=qa(d,y),O!=null&&J.push(yn(d,O,v))),_e)break;d=d.return}0<J.length&&(p=new S(p,X,null,l,E),D.push({event:p,listeners:J}))}}if((t&7)===0){e:{if(p=e==="mouseover"||e==="pointerover",S=e==="mouseout"||e==="pointerout",p&&l!==su&&(X=l.relatedTarget||l.fromElement)&&(Vl(X)||X[Zl]))break e;if((S||p)&&(p=E.window===E?E:(p=E.ownerDocument)?p.defaultView||p.parentWindow:window,S?(X=l.relatedTarget||l.toElement,S=g,X=X?Vl(X):null,X!==null&&(_e=z(X),J=X.tag,X!==_e||J!==5&&J!==27&&J!==6)&&(X=null)):(S=null,X=g),S!==X)){if(J=Ws,O="onMouseLeave",y="onMouseEnter",d="mouse",(e==="pointerout"||e==="pointerover")&&(J=Fs,O="onPointerLeave",y="onPointerEnter",d="pointer"),_e=S==null?p:Ua(S),v=X==null?p:Ua(X),p=new J(O,d+"leave",S,l,E),p.target=_e,p.relatedTarget=v,O=null,Vl(E)===g&&(J=new J(y,d+"enter",X,l,E),J.target=v,J.relatedTarget=_e,O=J),_e=O,S&&X)t:{for(J=Bm,y=S,d=X,v=0,O=y;O;O=J(O))v++;O=0;for(var K=d;K;K=J(K))O++;for(;0<v-O;)y=J(y),v--;for(;0<O-v;)d=J(d),O--;for(;v--;){if(y===d||d!==null&&y===d.alternate){J=y;break t}y=J(y),d=J(d)}J=null}else J=null;S!==null&&Zr(D,p,S,J,!1),X!==null&&_e!==null&&Zr(D,_e,X,J,!0)}}e:{if(p=g?Ua(g):window,S=p.nodeName&&p.nodeName.toLowerCase(),S==="select"||S==="input"&&p.type==="file")var he=uf;else if(af(p))if(cf)he=kh;else{he=Kh;var L=Vh}else S=p.nodeName,!S||S.toLowerCase()!=="input"||p.type!=="checkbox"&&p.type!=="radio"?g&&cu(g.elementType)&&(he=uf):he=Jh;if(he&&(he=he(e,g))){nf(D,he,l,E);break e}L&&L(e,p,g),e==="focusout"&&g&&p.type==="number"&&g.memoizedProps.value!=null&&uu(p,"number",p.value)}switch(L=g?Ua(g):window,e){case"focusin":(af(L)||L.contentEditable==="true")&&(ea=L,Su=g,La=null);break;case"focusout":La=Su=ea=null;break;case"mousedown":ju=!0;break;case"contextmenu":case"mouseup":case"dragend":ju=!1,yf(D,l,E);break;case"selectionchange":if($h)break;case"keydown":case"keyup":yf(D,l,E)}var te;if(gu)e:{switch(e){case"compositionstart":var oe="onCompositionStart";break e;case"compositionend":oe="onCompositionEnd";break e;case"compositionupdate":oe="onCompositionUpdate";break e}oe=void 0}else Pl?tf(e,l)&&(oe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(oe="onCompositionStart");oe&&(Is&&l.locale!=="ko"&&(Pl||oe!=="onCompositionStart"?oe==="onCompositionEnd"&&Pl&&(te=Js()):(ll=E,du="value"in ll?ll.value:ll.textContent,Pl=!0)),L=Ni(g,oe),0<L.length&&(oe=new $s(oe,e,null,l,E),D.push({event:oe,listeners:L}),te?oe.data=te:(te=lf(l),te!==null&&(oe.data=te)))),(te=Gh?Xh(e,l):Qh(e,l))&&(oe=Ni(g,"onBeforeInput"),0<oe.length&&(L=new $s("onBeforeInput","beforeinput",null,l,E),D.push({event:L,listeners:oe}),L.data=te)),Rm(D,e,g,l,E)}Qr(D,t)})}function yn(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Ni(e,t){for(var l=t+"Capture",a=[];e!==null;){var n=e,i=n.stateNode;if(n=n.tag,n!==5&&n!==26&&n!==27||i===null||(n=qa(e,l),n!=null&&a.unshift(yn(e,n,i)),n=qa(e,t),n!=null&&a.push(yn(e,n,i))),e.tag===3)return a;e=e.return}return[]}function Bm(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Zr(e,t,l,a,n){for(var i=t._reactName,c=[];l!==null&&l!==a;){var f=l,r=f.alternate,g=f.stateNode;if(f=f.tag,r!==null&&r===a)break;f!==5&&f!==26&&f!==27||g===null||(r=g,n?(g=qa(l,i),g!=null&&c.unshift(yn(l,g,r))):n||(g=qa(l,i),g!=null&&c.push(yn(l,g,r)))),l=l.return}c.length!==0&&e.push({event:t,listeners:c})}var Ym=/\r\n?/g,wm=/\u0000|\uFFFD/g;function Vr(e){return(typeof e=="string"?e:""+e).replace(Ym,`
+`).replace(wm,"")}function Kr(e,t){return t=Vr(t),Vr(e)===t}function Ae(e,t,l,a,n,i){switch(l){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||$l(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&$l(e,""+a);break;case"className":Un(e,"class",a);break;case"tabIndex":Un(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Un(e,l,a);break;case"style":Zs(e,a,i);break;case"data":if(t!=="object"){Un(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=Hn(""+a),e.setAttribute(l,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(l,"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 i=="function"&&(l==="formAction"?(t!=="input"&&Ae(e,t,"name",n.name,n,null),Ae(e,t,"formEncType",n.formEncType,n,null),Ae(e,t,"formMethod",n.formMethod,n,null),Ae(e,t,"formTarget",n.formTarget,n,null)):(Ae(e,t,"encType",n.encType,n,null),Ae(e,t,"method",n.method,n,null),Ae(e,t,"target",n.target,n,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=Hn(""+a),e.setAttribute(l,a);break;case"onClick":a!=null&&(e.onclick=Bt);break;case"onScroll":a!=null&&ce("scroll",e);break;case"onScrollEnd":a!=null&&ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(l=a.__html,l!=null){if(n.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}l=Hn(""+a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""+a):e.removeAttribute(l);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":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":a===!0?e.setAttribute(l,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,a):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(l,a):e.removeAttribute(l);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(l):e.setAttribute(l,a);break;case"popover":ce("beforetoggle",e),ce("toggle",e),Rn(e,"popover",a);break;case"xlinkActuate":Ht(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Ht(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Ht(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Ht(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Ht(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Ht(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Ht(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Ht(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Ht(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Rn(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=hh.get(l)||l,Rn(e,l,a))}}function Jc(e,t,l,a,n,i){switch(l){case"style":Zs(e,a,i);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(l=a.__html,l!=null){if(n.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof a=="string"?$l(e,a):(typeof a=="number"||typeof a=="bigint")&&$l(e,""+a);break;case"onScroll":a!=null&&ce("scroll",e);break;case"onScrollEnd":a!=null&&ce("scrollend",e);break;case"onClick":a!=null&&(e.onclick=Bt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!qs.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(n=l.endsWith("Capture"),t=l.slice(2,n?l.length-7:void 0),i=e[lt]||null,i=i!=null?i[l]:null,typeof i=="function"&&e.removeEventListener(t,i,n),typeof a=="function")){typeof i!="function"&&i!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,a,n);break e}l in e?e[l]=a:a===!0?e.setAttribute(l,""):Rn(e,l,a)}}}function Ie(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ce("error",e),ce("load",e);var a=!1,n=!1,i;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];if(c!=null)switch(i){case"src":a=!0;break;case"srcSet":n=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Ae(e,t,i,c,l,null)}}n&&Ae(e,t,"srcSet",l.srcSet,l,null),a&&Ae(e,t,"src",l.src,l,null);return;case"input":ce("invalid",e);var f=i=c=n=null,r=null,g=null;for(a in l)if(l.hasOwnProperty(a)){var E=l[a];if(E!=null)switch(a){case"name":n=E;break;case"type":c=E;break;case"checked":r=E;break;case"defaultChecked":g=E;break;case"value":i=E;break;case"defaultValue":f=E;break;case"children":case"dangerouslySetInnerHTML":if(E!=null)throw Error(o(137,t));break;default:Ae(e,t,a,E,l,null)}}Gs(e,i,f,r,g,c,n,!1);return;case"select":ce("invalid",e),a=c=i=null;for(n in l)if(l.hasOwnProperty(n)&&(f=l[n],f!=null))switch(n){case"value":i=f;break;case"defaultValue":c=f;break;case"multiple":a=f;default:Ae(e,t,n,f,l,null)}t=i,l=c,e.multiple=!!a,t!=null?Wl(e,!!a,t,!1):l!=null&&Wl(e,!!a,l,!0);return;case"textarea":ce("invalid",e),i=n=a=null;for(c in l)if(l.hasOwnProperty(c)&&(f=l[c],f!=null))switch(c){case"value":a=f;break;case"defaultValue":n=f;break;case"children":i=f;break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(o(91));break;default:Ae(e,t,c,f,l,null)}Qs(e,a,n,i);return;case"option":for(r in l)if(l.hasOwnProperty(r)&&(a=l[r],a!=null))switch(r){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:Ae(e,t,r,a,l,null)}return;case"dialog":ce("beforetoggle",e),ce("toggle",e),ce("cancel",e),ce("close",e);break;case"iframe":case"object":ce("load",e);break;case"video":case"audio":for(a=0;a<mn.length;a++)ce(mn[a],e);break;case"image":ce("error",e),ce("load",e);break;case"details":ce("toggle",e);break;case"embed":case"source":case"link":ce("error",e),ce("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(g in l)if(l.hasOwnProperty(g)&&(a=l[g],a!=null))switch(g){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Ae(e,t,g,a,l,null)}return;default:if(cu(t)){for(E in l)l.hasOwnProperty(E)&&(a=l[E],a!==void 0&&Jc(e,t,E,a,l,void 0));return}}for(f in l)l.hasOwnProperty(f)&&(a=l[f],a!=null&&Ae(e,t,f,a,l,null))}function Gm(e,t,l,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var n=null,i=null,c=null,f=null,r=null,g=null,E=null;for(S in l){var D=l[S];if(l.hasOwnProperty(S)&&D!=null)switch(S){case"checked":break;case"value":break;case"defaultValue":r=D;default:a.hasOwnProperty(S)||Ae(e,t,S,null,a,D)}}for(var p in a){var S=a[p];if(D=l[p],a.hasOwnProperty(p)&&(S!=null||D!=null))switch(p){case"type":i=S;break;case"name":n=S;break;case"checked":g=S;break;case"defaultChecked":E=S;break;case"value":c=S;break;case"defaultValue":f=S;break;case"children":case"dangerouslySetInnerHTML":if(S!=null)throw Error(o(137,t));break;default:S!==D&&Ae(e,t,p,S,a,D)}}iu(e,c,f,r,g,E,i,n);return;case"select":S=c=f=p=null;for(i in l)if(r=l[i],l.hasOwnProperty(i)&&r!=null)switch(i){case"value":break;case"multiple":S=r;default:a.hasOwnProperty(i)||Ae(e,t,i,null,a,r)}for(n in a)if(i=a[n],r=l[n],a.hasOwnProperty(n)&&(i!=null||r!=null))switch(n){case"value":p=i;break;case"defaultValue":f=i;break;case"multiple":c=i;default:i!==r&&Ae(e,t,n,i,a,r)}t=f,l=c,a=S,p!=null?Wl(e,!!l,p,!1):!!a!=!!l&&(t!=null?Wl(e,!!l,t,!0):Wl(e,!!l,l?[]:"",!1));return;case"textarea":S=p=null;for(f in l)if(n=l[f],l.hasOwnProperty(f)&&n!=null&&!a.hasOwnProperty(f))switch(f){case"value":break;case"children":break;default:Ae(e,t,f,null,a,n)}for(c in a)if(n=a[c],i=l[c],a.hasOwnProperty(c)&&(n!=null||i!=null))switch(c){case"value":p=n;break;case"defaultValue":S=n;break;case"children":break;case"dangerouslySetInnerHTML":if(n!=null)throw Error(o(91));break;default:n!==i&&Ae(e,t,c,n,a,i)}Xs(e,p,S);return;case"option":for(var X in l)if(p=l[X],l.hasOwnProperty(X)&&p!=null&&!a.hasOwnProperty(X))switch(X){case"selected":e.selected=!1;break;default:Ae(e,t,X,null,a,p)}for(r in a)if(p=a[r],S=l[r],a.hasOwnProperty(r)&&p!==S&&(p!=null||S!=null))switch(r){case"selected":e.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:Ae(e,t,r,p,a,S)}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 J in l)p=l[J],l.hasOwnProperty(J)&&p!=null&&!a.hasOwnProperty(J)&&Ae(e,t,J,null,a,p);for(g in a)if(p=a[g],S=l[g],a.hasOwnProperty(g)&&p!==S&&(p!=null||S!=null))switch(g){case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(o(137,t));break;default:Ae(e,t,g,p,a,S)}return;default:if(cu(t)){for(var _e in l)p=l[_e],l.hasOwnProperty(_e)&&p!==void 0&&!a.hasOwnProperty(_e)&&Jc(e,t,_e,void 0,a,p);for(E in a)p=a[E],S=l[E],!a.hasOwnProperty(E)||p===S||p===void 0&&S===void 0||Jc(e,t,E,p,a,S);return}}for(var y in l)p=l[y],l.hasOwnProperty(y)&&p!=null&&!a.hasOwnProperty(y)&&Ae(e,t,y,null,a,p);for(D in a)p=a[D],S=l[D],!a.hasOwnProperty(D)||p===S||p==null&&S==null||Ae(e,t,D,p,a,S)}function Jr(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Xm(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),a=0;a<l.length;a++){var n=l[a],i=n.transferSize,c=n.initiatorType,f=n.duration;if(i&&f&&Jr(c)){for(c=0,f=n.responseEnd,a+=1;a<l.length;a++){var r=l[a],g=r.startTime;if(g>f)break;var E=r.transferSize,D=r.initiatorType;E&&Jr(D)&&(r=r.responseEnd,c+=E*(r<f?1:(f-g)/(r-g)))}if(--a,t+=8*(i+c)/(n.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 kc=null,Wc=null;function Di(e){return e.nodeType===9?e:e.ownerDocument}function kr(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 Wr(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 $c(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 Fc=null;function Qm(){var e=window.event;return e&&e.type==="popstate"?e===Fc?!1:(Fc=e,!0):(Fc=null,!1)}var $r=typeof setTimeout=="function"?setTimeout:void 0,Lm=typeof clearTimeout=="function"?clearTimeout:void 0,Fr=typeof Promise=="function"?Promise:void 0,Zm=typeof queueMicrotask=="function"?queueMicrotask:typeof Fr<"u"?function(e){return Fr.resolve(null).then(e).catch(Vm)}:$r;function Vm(e){setTimeout(function(){throw e})}function bl(e){return e==="head"}function Ir(e,t){var l=t,a=0;do{var n=l.nextSibling;if(e.removeChild(l),n&&n.nodeType===8)if(l=n.data,l==="/$"||l==="/&"){if(a===0){e.removeChild(n),za(t);return}a--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")a++;else if(l==="html")vn(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,vn(l);for(var i=l.firstChild;i;){var c=i.nextSibling,f=i.nodeName;i[Ra]||f==="SCRIPT"||f==="STYLE"||f==="LINK"&&i.rel.toLowerCase()==="stylesheet"||l.removeChild(i),i=c}}else l==="body"&&vn(e.ownerDocument.body);l=n}while(l);za(t)}function Pr(e,t){var l=e;e=0;do{var a=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),a&&a.nodeType===8)if(l=a.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=a}while(l)}function Ic(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Ic(l),au(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function Km(e,t,l,a){for(;e.nodeType===1;){var n=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[Ra])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(i=e.getAttribute("rel"),i==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(i!==n.rel||e.getAttribute("href")!==(n.href==null||n.href===""?null:n.href)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin)||e.getAttribute("title")!==(n.title==null?null:n.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(i=e.getAttribute("src"),(i!==(n.src==null?null:n.src)||e.getAttribute("type")!==(n.type==null?null:n.type)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin))&&i&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var i=n.name==null?null:""+n.name;if(n.type==="hidden"&&e.getAttribute("name")===i)return e}else return e;if(e=zt(e.nextSibling),e===null)break}return null}function Jm(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=zt(e.nextSibling),e===null))return null;return e}function ed(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=zt(e.nextSibling),e===null))return null;return e}function Pc(e){return e.data==="$?"||e.data==="$~"}function es(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function km(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var a=function(){t(),l.removeEventListener("DOMContentLoaded",a)};l.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function zt(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 ts=null;function td(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return zt(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function ld(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function ad(e,t,l){switch(t=Di(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function vn(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);au(e)}var Ot=new Map,nd=new Set;function Mi(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Pt=N.d;N.d={f:Wm,r:$m,D:Fm,C:Im,L:Pm,m:ey,X:ly,S:ty,M:ay};function Wm(){var e=Pt.f(),t=Ti();return e||t}function $m(e){var t=Kl(e);t!==null&&t.tag===5&&t.type==="form"?So(t):Pt.r(e)}var Ea=typeof document>"u"?null:document;function id(e,t,l){var a=Ea;if(a&&typeof t=="string"&&t){var n=xt(t);n='link[rel="'+e+'"][href="'+n+'"]',typeof l=="string"&&(n+='[crossorigin="'+l+'"]'),nd.has(n)||(nd.add(n),e={rel:e,crossOrigin:l,href:t},a.querySelector(n)===null&&(t=a.createElement("link"),Ie(t,"link",e),Ke(t),a.head.appendChild(t)))}}function Fm(e){Pt.D(e),id("dns-prefetch",e,null)}function Im(e,t){Pt.C(e,t),id("preconnect",e,t)}function Pm(e,t,l){Pt.L(e,t,l);var a=Ea;if(a&&e&&t){var n='link[rel="preload"][as="'+xt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(n+='[imagesrcset="'+xt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(n+='[imagesizes="'+xt(l.imageSizes)+'"]')):n+='[href="'+xt(e)+'"]';var i=n;switch(t){case"style":i=Aa(e);break;case"script":i=_a(e)}Ot.has(i)||(e=j({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Ot.set(i,e),a.querySelector(n)!==null||t==="style"&&a.querySelector(gn(i))||t==="script"&&a.querySelector(pn(i))||(t=a.createElement("link"),Ie(t,"link",e),Ke(t),a.head.appendChild(t)))}}function ey(e,t){Pt.m(e,t);var l=Ea;if(l&&e){var a=t&&typeof t.as=="string"?t.as:"script",n='link[rel="modulepreload"][as="'+xt(a)+'"][href="'+xt(e)+'"]',i=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=_a(e)}if(!Ot.has(i)&&(e=j({rel:"modulepreload",href:e},t),Ot.set(i,e),l.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(pn(i)))return}a=l.createElement("link"),Ie(a,"link",e),Ke(a),l.head.appendChild(a)}}}function ty(e,t,l){Pt.S(e,t,l);var a=Ea;if(a&&e){var n=Jl(a).hoistableStyles,i=Aa(e);t=t||"default";var c=n.get(i);if(!c){var f={loading:0,preload:null};if(c=a.querySelector(gn(i)))f.loading=5;else{e=j({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Ot.get(i))&&ls(e,l);var r=c=a.createElement("link");Ke(r),Ie(r,"link",e),r._p=new Promise(function(g,E){r.onload=g,r.onerror=E}),r.addEventListener("load",function(){f.loading|=1}),r.addEventListener("error",function(){f.loading|=2}),f.loading|=4,Ri(c,t,a)}c={type:"stylesheet",instance:c,count:1,state:f},n.set(i,c)}}}function ly(e,t){Pt.X(e,t);var l=Ea;if(l&&e){var a=Jl(l).hoistableScripts,n=_a(e),i=a.get(n);i||(i=l.querySelector(pn(n)),i||(e=j({src:e,async:!0},t),(t=Ot.get(n))&&as(e,t),i=l.createElement("script"),Ke(i),Ie(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(n,i))}}function ay(e,t){Pt.M(e,t);var l=Ea;if(l&&e){var a=Jl(l).hoistableScripts,n=_a(e),i=a.get(n);i||(i=l.querySelector(pn(n)),i||(e=j({src:e,async:!0,type:"module"},t),(t=Ot.get(n))&&as(e,t),i=l.createElement("script"),Ke(i),Ie(i,"link",e),l.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},a.set(n,i))}}function ud(e,t,l,a){var n=(n=ie.current)?Mi(n):null;if(!n)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=Aa(l.href),l=Jl(n).hoistableStyles,a=l.get(t),a||(a={type:"style",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=Aa(l.href);var i=Jl(n).hoistableStyles,c=i.get(e);if(c||(n=n.ownerDocument||n,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(e,c),(i=n.querySelector(gn(e)))&&!i._p&&(c.instance=i,c.state.loading=5),Ot.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ot.set(e,l),i||ny(n,e,l,c.state))),t&&a===null)throw Error(o(528,""));return c}if(t&&a!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=_a(l),l=Jl(n).hoistableScripts,a=l.get(t),a||(a={type:"script",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Aa(e){return'href="'+xt(e)+'"'}function gn(e){return'link[rel="stylesheet"]['+e+"]"}function cd(e){return j({},e,{"data-precedence":e.precedence,precedence:null})}function ny(e,t,l,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),Ie(t,"link",l),Ke(t),e.head.appendChild(t))}function _a(e){return'[src="'+xt(e)+'"]'}function pn(e){return"script[async]"+e}function sd(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+xt(l.href)+'"]');if(a)return t.instance=a,Ke(a),a;var n=j({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Ke(a),Ie(a,"style",n),Ri(a,l.precedence,e),t.instance=a;case"stylesheet":n=Aa(l.href);var i=e.querySelector(gn(n));if(i)return t.state.loading|=4,t.instance=i,Ke(i),i;a=cd(l),(n=Ot.get(n))&&ls(a,n),i=(e.ownerDocument||e).createElement("link"),Ke(i);var c=i;return c._p=new Promise(function(f,r){c.onload=f,c.onerror=r}),Ie(i,"link",a),t.state.loading|=4,Ri(i,l.precedence,e),t.instance=i;case"script":return i=_a(l.src),(n=e.querySelector(pn(i)))?(t.instance=n,Ke(n),n):(a=l,(n=Ot.get(i))&&(a=j({},l),as(a,n)),e=e.ownerDocument||e,n=e.createElement("script"),Ke(n),Ie(n,"link",a),e.head.appendChild(n),t.instance=n);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Ri(a,l.precedence,e));return t.instance}function Ri(e,t,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,i=n,c=0;c<a.length;c++){var f=a[c];if(f.dataset.precedence===t)i=f;else if(i!==n)break}i?i.parentNode.insertBefore(e,i.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function ls(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function as(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Ui=null;function fd(e,t,l){if(Ui===null){var a=new Map,n=Ui=new Map;n.set(l,a)}else n=Ui,a=n.get(l),a||(a=new Map,n.set(l,a));if(a.has(e))return a;for(a.set(e,null),l=l.getElementsByTagName(e),n=0;n<l.length;n++){var i=l[n];if(!(i[Ra]||i[ke]||e==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var c=i.getAttribute(t)||"";c=e+c;var f=a.get(c);f?f.push(i):a.set(c,[i])}}return a}function od(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function iy(e,t,l){if(l===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 rd(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function uy(e,t,l,a){if(l.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var n=Aa(a.href),i=t.querySelector(gn(n));if(i){t=i._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=qi.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=i,Ke(i);return}i=t.ownerDocument||t,a=cd(a),(n=Ot.get(n))&&ls(a,n),i=i.createElement("link"),Ke(i);var c=i;c._p=new Promise(function(f,r){c.onload=f,c.onerror=r}),Ie(i,"link",a),l.instance=i}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=qi.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var ns=0;function cy(e,t){return e.stylesheets&&e.count===0&&Bi(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var a=setTimeout(function(){if(e.stylesheets&&Bi(e,e.stylesheets),e.unsuspend){var i=e.unsuspend;e.unsuspend=null,i()}},6e4+t);0<e.imgBytes&&ns===0&&(ns=62500*Xm());var n=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Bi(e,e.stylesheets),e.unsuspend)){var i=e.unsuspend;e.unsuspend=null,i()}},(e.imgBytes>ns?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function qi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Hi=null;function Bi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Hi=new Map,t.forEach(sy,e),Hi=null,qi.call(e))}function sy(e,t){if(!(t.state.loading&4)){var l=Hi.get(e);if(l)var a=l.get(null);else{l=new Map,Hi.set(e,l);for(var n=e.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<n.length;i++){var c=n[i];(c.nodeName==="LINK"||c.getAttribute("media")!=="not all")&&(l.set(c.dataset.precedence,c),a=c)}a&&l.set(null,a)}n=t.instance,c=n.getAttribute("data-precedence"),i=l.get(c)||a,i===a&&l.set(null,n),l.set(c,n),this.count++,a=qi.bind(this),n.addEventListener("load",a),n.addEventListener("error",a),i?i.parentNode.insertBefore(n,i.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(n,e.firstChild)),t.state.loading|=4}}var bn={$$typeof:le,Provider:null,Consumer:null,_currentValue:w,_currentValue2:w,_threadCount:0};function fy(e,t,l,a,n,i,c,f,r){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=Pi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pi(0),this.hiddenUpdates=Pi(null),this.identifierPrefix=a,this.onUncaughtError=n,this.onCaughtError=i,this.onRecoverableError=c,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=r,this.incompleteTransitions=new Map}function dd(e,t,l,a,n,i,c,f,r,g,E,D){return e=new fy(e,t,l,c,r,g,E,D,f),t=1,i===!0&&(t|=24),i=ht(3,null,null,t),e.current=i,i.stateNode=e,t=Bu(),t.refCount++,e.pooledCache=t,t.refCount++,i.memoizedState={element:a,isDehydrated:l,cache:t},Xu(i),e}function hd(e){return e?(e=aa,e):aa}function md(e,t,l,a,n,i){n=hd(n),a.context===null?a.context=n:a.pendingContext=n,a=sl(t),a.payload={element:l},i=i===void 0?null:i,i!==null&&(a.callback=i),l=fl(e,a,t),l!==null&&(st(l,e,t),$a(l,e,t))}function yd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function is(e,t){yd(e,t),(e=e.alternate)&&yd(e,t)}function vd(e){if(e.tag===13||e.tag===31){var t=Dl(e,67108864);t!==null&&st(t,e,67108864),is(e,67108864)}}function gd(e){if(e.tag===13||e.tag===31){var t=pt();t=eu(t);var l=Dl(e,t);l!==null&&st(l,e,t),is(e,t)}}var Yi=!0;function oy(e,t,l,a){var n=T.T;T.T=null;var i=N.p;try{N.p=2,us(e,t,l,a)}finally{N.p=i,T.T=n}}function ry(e,t,l,a){var n=T.T;T.T=null;var i=N.p;try{N.p=8,us(e,t,l,a)}finally{N.p=i,T.T=n}}function us(e,t,l,a){if(Yi){var n=cs(a);if(n===null)Kc(e,t,a,wi,l),bd(e,a);else if(hy(n,e,t,l,a))a.stopPropagation();else if(bd(e,a),t&4&&-1<dy.indexOf(e)){for(;n!==null;){var i=Kl(n);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var c=_l(i.pendingLanes);if(c!==0){var f=i;for(f.pendingLanes|=2,f.entangledLanes|=2;c;){var r=1<<31-rt(c);f.entanglements[1]|=r,c&=~r}qt(i),(ye&6)===0&&(Si=ft()+500,hn(0))}}break;case 31:case 13:f=Dl(i,2),f!==null&&st(f,i,2),Ti(),is(i,2)}if(i=cs(a),i===null&&Kc(e,t,a,wi,l),i===n)break;n=i}n!==null&&a.stopPropagation()}else Kc(e,t,a,null,l)}}function cs(e){return e=fu(e),ss(e)}var wi=null;function ss(e){if(wi=null,e=Vl(e),e!==null){var t=z(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=q(t),e!==null)return e;e=null}else if(l===31){if(e=H(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return wi=e,null}function pd(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(Fd()){case Es:return 2;case As:return 8;case On:case Id:return 32;case _s:return 268435456;default:return 32}default:return 32}}var fs=!1,xl=null,Sl=null,jl=null,xn=new Map,Sn=new Map,Tl=[],dy="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 bd(e,t){switch(e){case"focusin":case"focusout":xl=null;break;case"dragenter":case"dragleave":Sl=null;break;case"mouseover":case"mouseout":jl=null;break;case"pointerover":case"pointerout":xn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sn.delete(t.pointerId)}}function jn(e,t,l,a,n,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:l,eventSystemFlags:a,nativeEvent:i,targetContainers:[n]},t!==null&&(t=Kl(t),t!==null&&vd(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function hy(e,t,l,a,n){switch(t){case"focusin":return xl=jn(xl,e,t,l,a,n),!0;case"dragenter":return Sl=jn(Sl,e,t,l,a,n),!0;case"mouseover":return jl=jn(jl,e,t,l,a,n),!0;case"pointerover":var i=n.pointerId;return xn.set(i,jn(xn.get(i)||null,e,t,l,a,n)),!0;case"gotpointercapture":return i=n.pointerId,Sn.set(i,jn(Sn.get(i)||null,e,t,l,a,n)),!0}return!1}function xd(e){var t=Vl(e.target);if(t!==null){var l=z(t);if(l!==null){if(t=l.tag,t===13){if(t=q(l),t!==null){e.blockedOn=t,Ms(e.priority,function(){gd(l)});return}}else if(t===31){if(t=H(l),t!==null){e.blockedOn=t,Ms(e.priority,function(){gd(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Gi(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=cs(e.nativeEvent);if(l===null){l=e.nativeEvent;var a=new l.constructor(l.type,l);su=a,l.target.dispatchEvent(a),su=null}else return t=Kl(l),t!==null&&vd(t),e.blockedOn=l,!1;t.shift()}return!0}function Sd(e,t,l){Gi(e)&&l.delete(t)}function my(){fs=!1,xl!==null&&Gi(xl)&&(xl=null),Sl!==null&&Gi(Sl)&&(Sl=null),jl!==null&&Gi(jl)&&(jl=null),xn.forEach(Sd),Sn.forEach(Sd)}function Xi(e,t){e.blockedOn===t&&(e.blockedOn=null,fs||(fs=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,my)))}var Qi=null;function jd(e){Qi!==e&&(Qi=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){Qi===e&&(Qi=null);for(var t=0;t<e.length;t+=3){var l=e[t],a=e[t+1],n=e[t+2];if(typeof a!="function"){if(ss(a||l)===null)continue;break}var i=Kl(l);i!==null&&(e.splice(t,3),t-=3,cc(i,{pending:!0,data:n,method:l.method,action:a},a,n))}}))}function za(e){function t(r){return Xi(r,e)}xl!==null&&Xi(xl,e),Sl!==null&&Xi(Sl,e),jl!==null&&Xi(jl,e),xn.forEach(t),Sn.forEach(t);for(var l=0;l<Tl.length;l++){var a=Tl[l];a.blockedOn===e&&(a.blockedOn=null)}for(;0<Tl.length&&(l=Tl[0],l.blockedOn===null);)xd(l),l.blockedOn===null&&Tl.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(a=0;a<l.length;a+=3){var n=l[a],i=l[a+1],c=n[lt]||null;if(typeof i=="function")c||jd(l);else if(c){var f=null;if(i&&i.hasAttribute("formAction")){if(n=i,c=i[lt]||null)f=c.formAction;else if(ss(n)!==null)continue}else f=c.action;typeof f=="function"?l[a+1]=f:(l.splice(a,3),a-=3),jd(l)}}}function Td(){function e(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(c){return n=c})},focusReset:"manual",scroll:"manual"})}function t(){n!==null&&(n(),n=null),a||setTimeout(l,20)}function l(){if(!a&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,n=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),n!==null&&(n(),n=null)}}}function os(e){this._internalRoot=e}Li.prototype.render=os.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,a=pt();md(l,a,e,t,null,null)},Li.prototype.unmount=os.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;md(e.current,2,null,e,null,null),Ti(),t[Zl]=null}};function Li(e){this._internalRoot=e}Li.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ds();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Tl.length&&t!==0&&t<Tl[l].priority;l++);Tl.splice(l,0,e),l===0&&xd(e)}};var Ed=x.version;if(Ed!=="19.2.5")throw Error(o(527,Ed,"19.2.5"));N.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=h(t),e=e!==null?U(e):null,e=e===null?null:e.stateNode,e};var yy={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:T,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zi.isDisabled&&Zi.supportsFiber)try{Na=Zi.inject(yy),ot=Zi}catch{}}return En.createRoot=function(e,t){if(!A(e))throw Error(o(299));var l=!1,a="",n=Do,i=Mo,c=Ro;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(n=t.onUncaughtError),t.onCaughtError!==void 0&&(i=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=dd(e,1,!1,null,null,l,a,null,n,i,c,Td),e[Zl]=t.current,Vc(e),new os(t)},En.hydrateRoot=function(e,t,l){if(!A(e))throw Error(o(299));var a=!1,n="",i=Do,c=Mo,f=Ro,r=null;return l!=null&&(l.unstable_strictMode===!0&&(a=!0),l.identifierPrefix!==void 0&&(n=l.identifierPrefix),l.onUncaughtError!==void 0&&(i=l.onUncaughtError),l.onCaughtError!==void 0&&(c=l.onCaughtError),l.onRecoverableError!==void 0&&(f=l.onRecoverableError),l.formState!==void 0&&(r=l.formState)),t=dd(e,1,!0,t,l??null,a,n,r,i,c,f,Td),t.context=hd(null),l=t.current,a=pt(),a=eu(a),n=sl(a),n.callback=null,fl(l,n,a),l=a,t.current.lanes=l,Ma(t,l),qt(t),e[Zl]=t.current,Vc(e),new Li(t)},En.version="19.2.5",En}var Ud;function Ay(){if(Ud)return hs.exports;Ud=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(x){console.error(x)}}return s(),hs.exports=Ey(),hs.exports}var _y=Ay();const zy=Gd(_y),Qd="";class An extends Error{constructor(x,b,o){super(x),this.status=b,this.outcome=o}}function Ss(s){return s instanceof An?s.outcome?s.outcome==="unknown":s.status>=500||s.status===408:!0}async function Ce(s,x){const b=await fetch(`${Qd}${s}`,{...x,credentials:"same-origin",headers:{"Content-Type":"application/json",...x==null?void 0:x.headers}});if(!b.ok){const o=await b.json().catch(()=>null);b.status===401&&(window.location.hash="#login");const A=b.status===429?` Wait ${b.headers.get("retry-after")||"60"} seconds before retrying.`:"",z=typeof(o==null?void 0:o.message)=="string"?o.message:typeof(o==null?void 0:o.error)=="string"?o.error:`HTTP ${b.status}`,q=typeof(o==null?void 0:o.next_action)=="string"?` ${o.next_action}`:"",H=(o==null?void 0:o.outcome)==="unknown"||(o==null?void 0:o.outcome)==="failed"?o.outcome:void 0;throw new An(z+q+A,b.status,H)}return b.json()}async function Oy(s){const x=await fetch(`${Qd}${s}`,{credentials:"same-origin"});if(x.status===401)throw window.location.hash="#login",new Error("Unauthorized");if(!x.ok)throw new Error(`HTTP ${x.status}`);return x.text()}const be={oauthRequest:s=>Ce(`/admin/api/oauth-requests/${encodeURIComponent(s)}`),decideOAuthRequest:(s,x,b,o)=>Ce(`/admin/api/oauth-requests/${encodeURIComponent(s)}`,{method:"POST",body:JSON.stringify(o===void 0?{decision:x,csrf:b}:{decision:x,csrf:b,source_id:o})}),login:s=>Ce("/admin/login",{method:"POST",body:JSON.stringify({token:s})}),signOutEverywhere:()=>Ce("/admin/api/sign-out-everywhere",{method:"POST"}),stats:()=>Ce("/admin/api/stats"),health:()=>Ce("/admin/api/health-indicators"),agents:()=>Ce("/admin/api/agents"),agentsSpend:()=>Ce("/admin/api/agents/spend"),sources:()=>Ce("/admin/api/sources"),grantCatalog:()=>Ce("/admin/api/grant-catalog"),clientGrant:s=>Ce(`/admin/api/grants/${encodeURIComponent(s)}`),clientDetails:s=>Ce(`/admin/api/clients/${encodeURIComponent(s)}`),clientSetup:(s,x,b)=>{const o=new URLSearchParams({harness:x});return b&&o.set("flow",b),Ce(`/admin/api/clients/${encodeURIComponent(s)}/setup?${o}`)},clientLifecycle:(s,x)=>Ce(`/admin/api/clients/${encodeURIComponent(s)}/lifecycle`,{method:"POST",body:JSON.stringify(x)}),registerClient:s=>Ce("/admin/api/register-client",{method:"POST",body:JSON.stringify(s)}),recoverClient:(s,x,b)=>Ce("/admin/api/recover-client",{method:"POST",body:JSON.stringify({clientId:s,harness:x,flow:b})}),updateClientGrant:(s,x)=>Ce("/admin/api/rescope-client",{method:"POST",body:JSON.stringify({...x,clientId:s})}),requests:(s=1,x="")=>Ce(`/admin/api/requests?page=${s}${x}`),apiKeys:()=>Ce("/admin/api/api-keys"),createApiKey(s,x){return Ce("/admin/api/api-keys",{method:"POST",body:JSON.stringify({name:s,scopes:x})})},revokeApiKey(s){return Ce("/admin/api/api-keys/revoke",{method:"POST",body:JSON.stringify({id:s})})},updateClientTtl:(s,x)=>Ce("/admin/api/update-client-ttl",{method:"POST",body:JSON.stringify({clientId:s,tokenTtl:x})}),rescopeClient:(s,x,b)=>Ce("/admin/api/rescope-client",{method:"POST",body:JSON.stringify({clientId:s,sourceId:x,federatedRead:b})}),revokeClient:s=>Ce("/admin/api/revoke-client",{method:"POST",body:JSON.stringify({clientId:s})}),calibrationProfile:s=>Ce(`/admin/api/calibration/profile${s?`?holder=${encodeURIComponent(s)}`:""}`),calibrationChart:(s,x)=>Oy(`/admin/api/calibration/charts/${encodeURIComponent(s)}${x?`?holder=${encodeURIComponent(x)}`:""}`),jobsWatch:()=>Ce("/admin/api/jobs/watch")},ps="gbrain.pending-oauth-request",qd=s=>s!==null&&/^[a-f0-9]{64}$/.test(s);function Ki(){const s=new URL(window.location.href).searchParams.get("oauth_request");if(qd(s)){try{window.sessionStorage.setItem(ps,s)}catch{}return s}try{const x=window.sessionStorage.getItem(ps);if(qd(x))return x}catch{}}function Hd(){try{window.sessionStorage.removeItem(ps)}catch{}const s=new URL(window.location.href);s.searchParams.delete("oauth_request"),window.history.replaceState(null,"",s)}function Cy(s,x){const b=x?` --oauth-request ${x}`:"";return`Give me an owner admin login link for ${s}. On the brain host, run gbrain mcp admin login-link --url ${s}${b} using its protected owner credential. Deliver the single-use link privately and do not open it before I do.`}function Ny({onLogin:s}){const[x,b]=R.useState(""),[o,A]=R.useState(""),[z,q]=R.useState(!1),[H,_]=R.useState(!1),[h,U]=R.useState(""),[j,C]=R.useState(),[Y,G]=R.useState(""),[Z,W]=R.useState(0),ae=Ki(),$=j?Cy(j,ae):void 0;R.useEffect(()=>{let ne=!0;const xe=new AbortController,k=setTimeout(()=>xe.abort(),1e4);return C(void 0),G(""),_(!1),fetch("/.well-known/gbrain",{credentials:"omit",redirect:"error",cache:"no-store",signal:xe.signal}).then(async V=>{if(!V.ok)throw new Error("Server discovery is unavailable.");const Se=await V.json();if(typeof(Se==null?void 0:Se.endpoint)!="string")throw new Error("Server discovery has no MCP endpoint.");const je=new URL(Se.endpoint);if(!["https:","http:"].includes(je.protocol)||je.username||je.password||je.search||je.hash||je.pathname!=="/mcp")throw new Error("Server discovery returned an invalid MCP endpoint.");ne&&C(je.toString())}).catch(()=>{ne&&G("The configured MCP endpoint could not be discovered. Ask the brain host administrator to check the server’s configured public URL. You can still sign in with the owner credential below.")}).finally(()=>clearTimeout(k)),()=>{ne=!1,clearTimeout(k),xe.abort()}},[Z]);const le=async ne=>{ne.preventDefault(),A(""),q(!0);try{await be.login(x),b(""),s()}catch(xe){A(xe instanceof An&&xe.status===401?"The owner bootstrap credential was not accepted. An OAuth access token or client secret cannot log into this dashboard. Ask the brain host administrator for a fresh login link.":xe instanceof Error?xe.message:"Could not reach the owner login service. Check the server and retry.")}finally{q(!1)}};return u.jsx("div",{className:"login-page",children:u.jsxs("section",{className:"login-box","aria-labelledby":"owner-login-title",style:{maxWidth:560},children:[u.jsx("h1",{id:"owner-login-title",className:"login-logo",children:"GBrain owner login"}),u.jsx("p",{style:{marginBottom:16},children:"Ask the agent that administers the brain host for a login link. Ordinary MCP clients cannot create owner login links, even with an admin scope."}),ae&&u.jsx("p",{role:"status",style:{marginBottom:16},children:"A client connection is waiting for owner approval. The prompt below preserves that request when you open the login link in another browser or tab."}),$&&u.jsxs(u.Fragment,{children:[u.jsx("label",{htmlFor:"owner-login-prompt",children:"Prompt for the host administrator"}),u.jsx("textarea",{id:"owner-login-prompt",rows:7,readOnly:!0,value:$,style:{fontFamily:"var(--font-mono)",fontSize:12}}),u.jsx("button",{type:"button",className:"btn btn-secondary",style:{marginTop:8},onClick:()=>{U(""),navigator.clipboard.writeText($).then(()=>_(!0)).catch(()=>U("Clipboard unavailable. Select and copy the prompt above."))},children:H?"Prompt copied":"Copy owner login prompt"})]}),!$&&!Y&&u.jsx("p",{role:"status",children:"Discovering the server’s configured MCP endpoint…"}),Y&&u.jsxs("p",{role:"alert",children:[Y," ",u.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>W(ne=>ne+1),children:"Retry server discovery"})]}),h&&u.jsx("p",{role:"alert",children:h}),u.jsx("p",{className:"grant-help",style:{margin:"12px 0 20px"},children:"Login links expire after five minutes and can be used once. A client’s PKCE sign-in requests access to memory; owner login approves that request."}),u.jsxs("details",{children:[u.jsx("summary",{style:{cursor:"pointer"},children:"Sign in with the owner bootstrap credential"}),u.jsxs("form",{onSubmit:le,style:{marginTop:12},children:[u.jsx("label",{htmlFor:"owner-bootstrap-token",children:"Owner bootstrap credential"}),u.jsx("input",{id:"owner-bootstrap-token",type:"password",autoComplete:"off",value:x,disabled:z,onChange:ne=>b(ne.target.value)}),u.jsx("button",{type:"submit",className:"btn btn-primary",style:{width:"100%",marginTop:12},disabled:z||!x.trim(),children:z?"Signing in…":"Sign in as owner"}),o&&u.jsx("p",{role:"alert",className:"login-error",children:o})]})]})]})})}function Dy(){const[s,x]=R.useState({connected_agents:0,requests_today:0,active_tokens:0}),[b,o]=R.useState({expiring_soon:0,error_rate:"0%"}),[A,z]=R.useState([]),[q,H]=R.useState("connecting"),_=R.useRef(null);R.useEffect(()=>{be.stats().then(x).catch(()=>{}),be.health().then(o).catch(()=>{});const U=new EventSource("/admin/events",{withCredentials:!0});_.current=U,U.onopen=()=>H("connected"),U.onmessage=C=>{try{const Y=JSON.parse(C.data);z(G=>[Y,...G].slice(0,50))}catch{}},U.onerror=()=>{H("disconnected"),setTimeout(()=>{H("connecting"),U.close()},3e3)};const j=setInterval(()=>{be.stats().then(x).catch(()=>{}),be.health().then(o).catch(()=>{})},3e4);return()=>{U.close(),clearInterval(j)}},[]);const h=U=>{const j=Date.now()-new Date(U).getTime();return j<6e4?`${Math.floor(j/1e3)}s ago`:j<36e5?`${Math.floor(j/6e4)} min ago`:`${Math.floor(j/36e5)}h ago`};return u.jsxs(u.Fragment,{children:[u.jsx("h1",{className:"page-title",children:"Dashboard"}),u.jsxs("div",{style:{display:"flex",gap:24},children:[u.jsxs("div",{style:{flex:1},children:[u.jsxs("div",{className:"metrics",children:[u.jsxs("div",{className:"metric",children:[u.jsx("div",{className:"metric-value",children:s.connected_agents}),u.jsx("div",{className:"metric-label",children:"Connected Agents"})]}),u.jsxs("div",{className:"metric",children:[u.jsx("div",{className:"metric-value",children:s.requests_today}),u.jsx("div",{className:"metric-label",children:"Requests Today"})]}),u.jsxs("div",{className:"metric",children:[u.jsx("div",{className:"metric-value",children:s.active_tokens}),u.jsx("div",{className:"metric-label",children:"Active Tokens"})]})]}),u.jsxs("h2",{className:"section-title",children:["Live Activity",u.jsx("span",{style:{marginLeft:8,fontSize:10,color:q==="connected"?"var(--success)":q==="connecting"?"var(--warning)":"var(--error)"},children:q==="connected"?"● connected":q==="connecting"?"● connecting...":"● disconnected"})]}),u.jsx("div",{className:"feed",children:A.length===0?u.jsx("div",{className:"feed-empty",children:q==="connected"?"No requests yet. Agents will appear when they connect.":"Connecting..."}):u.jsxs("table",{children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:"Agent"}),u.jsx("th",{children:"Operation"}),u.jsx("th",{children:"Scopes"}),u.jsx("th",{children:"Latency"}),u.jsx("th",{children:"Status"}),u.jsx("th",{children:"Time"})]})}),u.jsx("tbody",{children:A.map((U,j)=>u.jsxs("tr",{children:[u.jsx("td",{className:"mono",children:U.agent}),u.jsx("td",{className:"mono",children:U.operation}),u.jsx("td",{children:U.scopes.split(",").map(C=>u.jsx("span",{className:`badge badge-${C.trim()}`,style:{marginRight:4},children:C.trim()},C))}),u.jsxs("td",{className:"mono",children:[U.latency_ms," ms"]}),u.jsx("td",{children:u.jsx("span",{className:`badge badge-${U.status}`,children:U.status})}),u.jsx("td",{style:{color:"var(--text-secondary)"},children:h(U.timestamp)})]},j))})]})})]}),u.jsxs("div",{style:{width:220},children:[u.jsx("h2",{className:"section-title",children:"Token Health"}),u.jsxs("div",{className:"health-panel",children:[u.jsxs("div",{className:"health-row",children:[u.jsx("span",{style:{color:"var(--warning)"},children:"Expiring Soon"}),u.jsx("span",{className:"mono",children:b.expiring_soon})]}),u.jsxs("div",{className:"health-row",children:[u.jsx("span",{style:{color:"var(--error)"},children:"Error Rate"}),u.jsx("span",{className:"mono",children:b.error_rate})]})]})]})]})]})}const Oa=s=>s.split(/[\s,]+/).filter(Boolean);function bs(s){var x,b,o;return{profile:(s==null?void 0:s.profile)??"memory-writer",applyProfile:!s,source:(s==null?void 0:s.sourceId)??"default",reads:(s==null?void 0:s.federatedRead)??["default"],scopes:(s==null?void 0:s.scopes.join(" "))??"",directPrefixes:((x=s==null?void 0:s.boundSlugPrefixes)==null?void 0:x.join(`
+`))??"",tools:(s==null?void 0:s.boundTools)??[],namespace:(s==null?void 0:s.delegatedNamespace)??"job",delegatedPrefixes:((b=s==null?void 0:s.delegatedSlugPrefixes)==null?void 0:b.join(`
+`))??"",concurrency:String((s==null?void 0:s.boundMaxConcurrent)??1),budget:(s==null?void 0:s.budgetUsdPerDay)??"unlimited",ttl:s?String(s.tokenTtlSeconds??0):"3600",surface:(s==null?void 0:s.surface)??"starter",operationSnapshot:((o=s==null?void 0:s.allowedOperations)==null?void 0:o.join(`
+`))??"",editOperations:!1}}function Ld(s){const x=s.scopes?Oa(s.scopes).includes("agent"):["full","delegating-agent"].includes(s.profile);return{...s.applyProfile?{profile:s.profile}:{},sourceId:s.source,federatedRead:s.reads,boundSlugPrefixes:s.directPrefixes.trim()?Oa(s.directPrefixes):null,...s.scopes.trim()?{scopes:Oa(s.scopes)}:{},...s.editOperations?{allowedOperations:Oa(s.operationSnapshot)}:{},...x?{boundTools:s.tools,boundSourceId:s.source,delegatedNamespace:s.namespace,delegatedSlugPrefixes:s.namespace==="job"?null:Oa(s.delegatedPrefixes)}:{},boundMaxConcurrent:Number(s.concurrency),budgetUsdPerDay:s.budget==="unlimited"?null:s.budget,tokenTtl:s.ttl==="0"?null:Number(s.ttl),surface:s.surface==="default"?null:s.surface}}function Zd(s){return{...s.profile?{profile:s.profile}:{},scopes:s.scopes,sourceId:s.sourceId,federatedRead:s.federatedRead,boundSlugPrefixes:s.boundSlugPrefixes,allowedOperations:s.allowedOperations,boundTools:s.boundTools,boundSourceId:s.boundSourceId,boundBrainId:s.boundBrainId,delegatedNamespace:s.delegatedNamespace,delegatedSlugPrefixes:s.delegatedSlugPrefixes,boundMaxConcurrent:s.boundMaxConcurrent,budgetUsdPerDay:s.budgetUsdPerDay,tokenTtlSeconds:s.tokenTtlSeconds,surface:s.surface}}function Vd({draft:s,setDraft:x,sources:b,catalog:o,existing:A=!1}){const z=(h,U)=>x({...s,[h]:U}),q=new Set(b.map(h=>h.id)),H=s.scopes?Oa(s.scopes).includes("agent"):["full","delegating-agent"].includes(s.profile),_={marginBottom:14};return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:_,children:[u.jsx("label",{htmlFor:"grant-profile",children:"Permission profile"}),u.jsx("select",{id:"grant-profile",value:s.profile,onChange:h=>x({...s,profile:h.target.value,applyProfile:!0,scopes:"",editOperations:!1,surface:["operator","full"].includes(h.target.value)?"full":"starter"}),children:o.profiles.map(h=>u.jsx("option",{children:h},h))}),u.jsx("p",{className:"grant-help",children:"Memory writer lets this agent recall, save, correct, and withdraw memory. Delegating profiles also allow selected server tools to run jobs."}),A&&u.jsxs("label",{className:"checkbox-label",children:[u.jsx("input",{type:"checkbox",checked:s.applyProfile,onChange:h=>z("applyProfile",h.target.checked)}),"Apply this profile's current operation snapshot"]})]}),u.jsxs("div",{style:_,children:[u.jsx("label",{htmlFor:"grant-source",children:"Primary / write source"}),u.jsxs("select",{id:"grant-source",value:s.source,onChange:h=>z("source",h.target.value),children:[!q.has(s.source)&&u.jsxs("option",{value:s.source,children:[s.source," · unavailable"]}),b.map(h=>u.jsxs("option",{value:h.id,children:[h.name," (",h.id,")"]},h.id))]})]}),u.jsxs("fieldset",{style:{border:0,padding:0,margin:"0 0 14px"},children:[u.jsx("legend",{children:"Readable sources"}),[...b,...s.reads.filter(h=>!q.has(h)).map(h=>({id:h,name:`${h} · unavailable`}))].map(h=>u.jsxs("label",{className:"checkbox-label",children:[u.jsx("input",{type:"checkbox",checked:s.reads.includes(h.id),onChange:U=>z("reads",U.target.checked?[...s.reads,h.id]:s.reads.filter(j=>j!==h.id))}),h.name]},h.id))]}),u.jsxs("div",{style:_,children:[u.jsx("label",{htmlFor:"grant-direct-prefixes",children:"Direct write prefixes (one per line)"}),u.jsx("textarea",{id:"grant-direct-prefixes",rows:2,value:s.directPrefixes,onChange:h=>z("directPrefixes",h.target.value),placeholder:"work-example/"}),u.jsx("p",{className:"grant-help",children:"Blank grants the whole primary source. Coding agent requires an explicit prefix."})]}),H&&u.jsxs("fieldset",{style:{border:"1px solid var(--border)",padding:12,marginBottom:14},children:[u.jsx("legend",{children:"Delegated jobs"}),u.jsx("p",{className:"grant-help",children:"Choose every tool explicitly. Jobs stay in the primary source; existing jobs retain their original limits."}),u.jsx("div",{className:"checkbox-group",style:{maxHeight:180,overflowY:"auto"},children:[...new Set([...o.delegatedTools,...s.tools])].map(h=>u.jsxs("label",{className:"checkbox-label",children:[u.jsx("input",{type:"checkbox",checked:s.tools.includes(h),onChange:U=>z("tools",U.target.checked?[...s.tools,h]:s.tools.filter(j=>j!==h))}),h,o.delegatedTools.includes(h)?"":" · unavailable"]},h))}),u.jsx("label",{htmlFor:"grant-namespace",children:"Delegated write namespace"}),u.jsxs("select",{id:"grant-namespace",value:s.namespace,onChange:h=>z("namespace",h.target.value),children:[u.jsx("option",{value:"job",children:"Each job's own wiki/agents/ directory"}),u.jsx("option",{value:"prefixes",children:"Explicit prefixes"})]}),s.namespace==="prefixes"&&u.jsx("textarea",{"aria-label":"Delegated prefixes",rows:2,value:s.delegatedPrefixes,onChange:h=>z("delegatedPrefixes",h.target.value),placeholder:"work-example/"})]}),u.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,..._},children:[u.jsxs("div",{children:[u.jsx("label",{htmlFor:"grant-concurrency",children:"Concurrent jobs"}),u.jsx("input",{id:"grant-concurrency",type:"number",min:1,step:1,value:s.concurrency,onChange:h=>z("concurrency",h.target.value)})]}),u.jsxs("div",{children:[u.jsx("label",{htmlFor:"grant-budget",children:"Daily delegated spend (USD)"}),u.jsx("input",{id:"grant-budget",value:s.budget,onChange:h=>z("budget",h.target.value),placeholder:"unlimited"}),u.jsx("p",{className:"grant-help",children:"Use unlimited for no spending cap, or an amount such as 2.50."})]})]}),u.jsxs("div",{style:_,children:[u.jsx("label",{htmlFor:"grant-ttl",children:"Future access token lifetime (seconds)"}),u.jsx("input",{id:"grant-ttl",type:"number",min:0,max:7776e3,step:1,value:s.ttl,onChange:h=>z("ttl",h.target.value)}),u.jsx("p",{className:"grant-help",children:"Renewable: 3600 (1 hour). Static bearer: 2592000 (30 days). 0 uses the server default. Existing tokens keep their expiry."})]}),u.jsxs("details",{style:_,children:[u.jsx("summary",{children:"Advanced permissions"}),u.jsx("label",{htmlFor:"grant-scopes",children:"Scope override"}),u.jsx("input",{id:"grant-scopes",value:s.scopes,onChange:h=>z("scopes",h.target.value),placeholder:"Use profile scopes"}),u.jsx("p",{className:"grant-help",children:"Scopes allow eligible brain operations. Admin does not grant owner dashboard access or delegation."}),u.jsx("label",{htmlFor:"grant-surface",children:"Visible tool catalog"}),u.jsx("select",{id:"grant-surface",value:s.surface,onChange:h=>z("surface",h.target.value),children:["verbs","starter","full","default"].map(h=>u.jsx("option",{children:h},h))}),u.jsx("p",{className:"grant-help",children:"Full shows all eligible tools; it does not grant additional authority."}),u.jsxs("label",{className:"checkbox-label",children:[u.jsx("input",{type:"checkbox",checked:s.editOperations,onChange:h=>z("editOperations",h.target.checked)}),"Replace operation authority snapshot"]}),s.editOperations&&u.jsxs(u.Fragment,{children:[u.jsx("textarea",{"aria-label":"Allowed operations",rows:5,value:s.operationSnapshot,onChange:h=>z("operationSnapshot",h.target.value)}),u.jsx("p",{className:"grant-help",children:"One operation name per line. An empty list denies every operation, including delegated tools."})]})]})]})}const My=[["Profile","profile"],["Scopes","scopes"],["Write source","sourceId"],["Readable sources","federatedRead"],["Direct prefixes","boundSlugPrefixes"],["Visible catalog","surface"],["Operation authority","allowedOperations"],["Delegated tools","boundTools"],["Delegated source","boundSourceId"],["Delegated brain","boundBrainId"],["Delegated namespace","delegatedNamespace"],["Delegated prefixes","delegatedSlugPrefixes"],["Concurrent jobs","boundMaxConcurrent"],["Daily USD cap","budgetUsdPerDay"],["Future token TTL","tokenTtlSeconds"]];function Ry(s,x){return s===null?x==="budgetUsdPerDay"?"Unlimited":x==="allowedOperations"?"Legacy scope-based catalog":"Unset":Array.isArray(s)?s.join(", ")||"(none)":String(s)}function Bd({grant:s,field:x}){const b=s[x];return x==="allowedOperations"&&Array.isArray(b)&&b.length>8?u.jsxs("details",{children:[u.jsxs("summary",{children:[b.length," operations · inspect list"]}),u.jsx("div",{style:{maxHeight:160,overflowY:"auto",marginTop:8},children:b.join(", ")})]}):u.jsx(u.Fragment,{children:Ry(b,x)})}function Kd({preview:s}){return u.jsxs("div",{"aria-live":"polite",style:{margin:"16px 0"},children:[u.jsx("h3",{children:"Review permissions"}),u.jsx("div",{style:{overflowX:"auto"},children:u.jsxs("table",{children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:"Permission"}),s.before&&u.jsx("th",{children:"Current"}),u.jsx("th",{children:"Proposed"})]})}),u.jsx("tbody",{children:My.filter(([,x])=>!s.before||JSON.stringify(s.before[x])!==JSON.stringify(s.after[x])).map(([x,b])=>u.jsxs("tr",{children:[u.jsx("th",{children:x}),s.before&&u.jsx("td",{style:{overflowWrap:"anywhere",maxWidth:200},children:u.jsx(Bd,{grant:s.before,field:b})}),u.jsx("td",{style:{overflowWrap:"anywhere",maxWidth:280},children:u.jsx(Bd,{grant:s.after,field:b})})]},b))})]})}),u.jsx("p",{className:"grant-help",children:s.tokenImplications})]})}function Uy({clientId:s,sources:x,sourcesReady:b=!0,onRescoped:o}){const[A,z]=R.useState(),[q,H]=R.useState(),[_,h]=R.useState(),[U,j]=R.useState(),[C,Y]=R.useState(""),[G,Z]=R.useState(!1),[W,ae]=R.useState(!1),[$,le]=R.useState(!1),ne=async(k=!1)=>{Z(!0),ae(!1);try{const[V,Se]=await Promise.all([be.clientGrant(s),be.grantCatalog()]);z(V.grant),H(bs(V.grant)),h(Se),j(void 0),Y(""),le(!1),k&&o(V.grant)}finally{Z(!1)}};R.useEffect(()=>{ne().catch(k=>Y(k.message))},[s]);const xe=async()=>{if(!(!q||!A||!b||$)){Z(!0),Y(""),ae(!1);try{const k=await be.updateClientGrant(s,{...U?Zd(U.after):Ld(q),expectedRevision:A.revision,dryRun:!U});U?(z(k.after),H(bs(k.after)),j(void 0),ae(!0),o(k.after)):j(k)}catch(k){const V=!!U&&Ss(k);le(V||k instanceof An&&k.status===409),j(void 0),Y(`${k instanceof Error?k.message:"Grant update failed."}${V?" The change may have completed. Reload the current grant before editing permissions again.":""}`)}finally{Z(!1)}}};return u.jsxs("section",{children:[u.jsx("div",{className:"section-title",children:"Permissions"}),A&&u.jsxs("p",{className:"grant-help",children:["Revision ",A.revision,". Review source access, direct tools, and delegated work independently."]}),A&&u.jsx(qy,{clientId:s,revision:A.revision}),!!(A!=null&&A.repairReasons.length)&&u.jsxs("p",{role:"status",style:{color:"var(--warning)"},children:["Delegation needs repair: ",A.repairReasons.join(", "),". Review and explicitly grant the missing bindings below."]}),!b&&u.jsx("p",{role:"alert",children:"Current sources are unavailable. Retry sources before editing permissions."}),u.jsx("fieldset",{disabled:G||!b||$,style:{border:0,padding:0},children:q&&_&&u.jsx(Vd,{draft:q,catalog:_,sources:x,existing:!0,setDraft:k=>{H(k),j(void 0),ae(!1)}})}),C&&u.jsxs("p",{role:"alert",style:{color:"var(--error)"},children:[C," ",u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:G,onClick:()=>void ne(!0).catch(k=>Y(k.message)),children:"Reload current grant"})]}),U&&u.jsx(Kd,{preview:U}),W&&u.jsx("p",{role:"status",children:"Permissions saved. Credentials are unchanged."}),u.jsx("button",{type:"button",className:"btn btn-primary",disabled:G||!q||!_||!b||$,onClick:()=>void xe(),children:G?"Checking…":U?"Apply reviewed changes":"Preview changes"})]})}function qy({clientId:s,revision:x}){const[b,o]=R.useState(),[A,z]=R.useState(!1);return R.useEffect(()=>{let q=!0;const H=()=>void be.agentsSpend().then(h=>{q&&(o(h.find(U=>U.client_id===s)),z(!1))}).catch(()=>{q&&z(!0)});H();const _=setInterval(H,2e4);return()=>{q=!1,clearInterval(_)}},[s,x]),A?u.jsx("p",{role:"status",children:"Delegated spend is unavailable. Reload to check before starting more work."}):b?u.jsxs("div",{style:{border:"1px solid var(--border)",padding:12,marginBottom:14},children:[u.jsx("strong",{children:"Delegated work"}),u.jsxs("p",{children:[b.inflight_count," unfinished jobs · Daily cap: ",b.cap_usd_per_day===null?"Unlimited":`$${b.cap_usd_per_day.toFixed(2)}`]}),u.jsxs("p",{className:"grant-help",children:["Recorded today: $",(b.spent_cents_today/100).toFixed(2),". Known outstanding reservations: $",(b.pending_cents/100).toFixed(2),", including overdue calls from earlier days."]}),b.unknown_count>0&&u.jsxs("p",{role:"status",style:{color:"var(--warning)"},children:[b.unknown_count," unresolved calls have an unknown cost. The known amounts above do not bound total liability; a finite cap refuses further calls until reconciliation."]})]}):null}function Hy(s,x){const b=URL.createObjectURL(new Blob([JSON.stringify(s,null,2)],{type:"application/json"})),o=document.createElement("a");o.href=b,o.download=x,o.click(),URL.revokeObjectURL(b)}function Jd({clientId:s,grantTypes:x,revoked:b=!1,grantRevision:o}){const[A,z]=R.useState("generic"),q=x.includes("authorization_code")&&x.includes("client_credentials"),[H,_]=R.useState(q?"":x.includes("authorization_code")?"authorization-code":"client-credentials"),[h,U]=R.useState(),[j,C]=R.useState(),[Y,G]=R.useState([]),[Z,W]=R.useState(""),[ae,$]=R.useState(!1),[le,ne]=R.useState(!1),[xe,k]=R.useState(!1),[V,Se]=R.useState(0);R.useEffect(()=>{if(b)return;let se=!0;if(C(void 0),G([]),W(""),ne(!1),k(!1),!!H)return Promise.all([be.clientSetup(s,A,H),be.grantCatalog()]).then(([F,de])=>{se&&(C(F.setup),G(F.instructions),U(de))}).catch(F=>{se&&W(F instanceof Error?F.message:"Setup instructions are unavailable.")}),()=>{se=!1}},[s,A,H,b,o,V]);const je=async()=>{if(j){$(!0),W("");try{const se=await be.recoverClient(s,A,H),F=H==="authorization-code"?se.oauthSetup:se.credentials;if(!F)throw new Error("No matching setup file was returned. Ask the host administrator to inspect this client’s credential delivery.");Hy(F,`${s}-${H==="authorization-code"?"oauth-setup":"credentials"}.json`),ne(!0)}catch(se){W(se instanceof Error?se.message:"Download failed. Existing permissions are unchanged.")}finally{$(!1)}}};return u.jsxs("section",{"aria-labelledby":"client-setup-title",children:[u.jsx("h3",{id:"client-setup-title",className:"section-title",children:"Set up this client"}),b?u.jsx("p",{children:"This client is revoked. Register a new client to connect another harness."}):u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"grant-help",children:"Registration grants access. Configure the intended harness, then verify an actual memory round trip there."}),u.jsx("label",{htmlFor:"setup-harness",children:"Harness"}),u.jsxs("select",{id:"setup-harness",value:A,onChange:se=>z(se.target.value),disabled:ae,children:[!h&&u.jsx("option",{value:"generic",children:"Generic MCP client"}),h==null?void 0:h.harnesses.map(se=>u.jsx("option",{value:se.id,children:se.label},se.id))]}),q&&u.jsxs(u.Fragment,{children:[u.jsx("label",{htmlFor:"setup-flow",children:"Connection flow"}),u.jsxs("select",{id:"setup-flow",value:H,onChange:se=>_(se.target.value),disabled:ae,children:[u.jsx("option",{value:"",children:"Choose the flow supported by your harness"}),u.jsx("option",{value:"authorization-code",children:"Browser sign-in with PKCE"}),u.jsx("option",{value:"client-credentials",children:"Machine credentials"})]})]}),j&&u.jsxs(u.Fragment,{children:[u.jsxs("dl",{className:"oauth-consent-details",style:{marginTop:16},children:[u.jsx("dt",{children:"MCP URL"}),u.jsx("dd",{children:u.jsx("code",{children:j.mcp_url})}),u.jsx("dt",{children:"OAuth issuer"}),u.jsx("dd",{children:u.jsx("code",{children:j.issuer_url})}),u.jsx("dt",{children:"Client ID"}),u.jsx("dd",{children:u.jsx("code",{children:j.client.client_id})}),u.jsx("dt",{children:"Scopes"}),u.jsx("dd",{children:j.scopes.join(" ")||"None"}),u.jsx("dt",{children:"Authentication"}),u.jsx("dd",{children:j.client.token_endpoint_auth_method==="none"?"Public client — PKCE, no client secret":j.client.token_endpoint_auth_method}),j.flow==="authorization-code"&&u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:"Redirect URIs"}),u.jsx("dd",{children:j.client.redirect_uris.map(se=>u.jsx("div",{children:u.jsx("code",{children:se})},se))})]})]}),u.jsx("ol",{children:Y.map((se,F)=>u.jsx("li",{style:{marginBottom:8,overflowWrap:"anywhere"},children:se},F))}),u.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:16},children:[u.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>{navigator.clipboard.writeText(Y.join(`
+`)).then(()=>k(!0)).catch(()=>W("Clipboard unavailable. Select and copy the instructions above."))},children:xe?"Instructions copied":"Copy setup instructions"}),u.jsx("button",{type:"button",className:"btn btn-primary",disabled:ae,onClick:()=>void je(),children:ae?"Preparing download…":j.flow==="authorization-code"?"Download OAuth setup":"Download credentials"})]}),u.jsx("p",{className:"grant-help",children:"Keep downloaded files private. Set permissions to 0600 on the target computer. A setup download does not verify the harness."})]}),!H&&u.jsx("p",{role:"status",children:"This client supports both flows. Choose one before requesting setup instructions."}),H&&!j&&!Z&&u.jsx("p",{role:"status",children:"Loading setup instructions…"}),le&&u.jsx("p",{role:"status",children:"Setup file delivered to your browser. Harness verification is still required."}),Z&&u.jsxs("p",{role:"alert",style:{color:"var(--error)"},children:[Z," ",u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:ae,onClick:()=>Se(se=>se+1),children:"Retry setup"})]})]})]})}const gs={"invalidate-tokens":"Invalidate tokens",revoke:"Revoke client",delete:"Delete client"};function By({clientId:s,name:x,revoked:b,onChanged:o,onBusyChange:A}){const[z,q]=R.useState(),[H,_]=R.useState(!1),[h,U]=R.useState(""),[j,C]=R.useState(!1),Y=async Z=>{_(!0),U(""),q(void 0);try{q(await be.clientLifecycle(s,{action:Z,dryRun:!0}))}catch(W){U(W instanceof Error?W.message:"Could not preview this action. Retry after checking the client.")}finally{_(!1)}},G=async()=>{if(z){_(!0),A==null||A(!0),U("");try{await be.clientLifecycle(s,{action:z.action,dryRun:!1,yes:!0,expectedRevision:z.before.revision}),o()}catch(Z){const W=Ss(Z);U(`${Z instanceof Error?Z.message:"Request failed."} ${W?"The action may have completed. Reload the client and inspect its current state before requesting another action.":"The request was refused. Review a fresh preview before applying an action."}`),C(W),q(void 0)}finally{_(!1),A==null||A(!1)}}};return u.jsxs("section",{"aria-labelledby":"client-lifecycle-title",style:{marginTop:28},children:[u.jsx("h3",{id:"client-lifecycle-title",className:"section-title",children:"Client access"}),u.jsx("p",{className:"grant-help",children:"Invalidating tokens keeps the client and its secret. Revoking ends access and keeps a visible registration. Deleting removes the registration. Memory and audit history remain."}),!z&&u.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["invalidate-tokens","revoke","delete"].filter(Z=>!b||Z==="delete").map(Z=>u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:H||j,onClick:()=>void Y(Z),children:gs[Z]},Z))}),z&&u.jsxs("div",{"aria-live":"polite",style:{border:"1px solid var(--border)",padding:16},children:[u.jsxs("h4",{style:{margin:"0 0 12px"},children:[gs[z.action],": ",x]}),u.jsxs("p",{children:[u.jsx("code",{children:s})," · Revision ",z.before.revision]}),u.jsx("ul",{children:(Array.isArray(z.consequences)?z.consequences:[z.consequences]).map((Z,W)=>u.jsx("li",{children:Z},W))}),u.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:16},children:[u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:H,onClick:()=>q(void 0),children:"Cancel"}),u.jsx("button",{type:"button",className:"btn btn-danger",disabled:H,onClick:()=>void G(),children:H?"Applying…":`Confirm ${gs[z.action].toLowerCase()}`})]})]}),h&&u.jsxs("p",{role:"alert",style:{color:"var(--error)"},children:[h," ",j&&u.jsx("button",{type:"button",className:"btn btn-secondary",onClick:o,children:"Reload client list"})]})]})}function _n({title:s,titleId:x,children:b,onClose:o,busy:A=!1,drawer:z=!1}){const q=R.useRef(null),H=R.useRef(o);H.current=o;const _=R.useRef(A);_.current=A;const[h]=R.useState(()=>document.activeElement instanceof HTMLElement?document.activeElement:null);return R.useEffect(()=>{const U=q.current;if(!U)return;(U.querySelector("[data-autofocus]")??U).focus();const j=C=>{if(C.key==="Escape"&&(C.preventDefault(),_.current||H.current()),C.key!=="Tab")return;const Y=[...U.querySelectorAll('button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), a[href], summary, [tabindex="0"]')].filter(W=>W.getClientRects().length>0&&!W.closest("fieldset:disabled")),G=Y[0],Z=Y[Y.length-1];if(!G){C.preventDefault(),U.focus();return}C.shiftKey&&(document.activeElement===G||document.activeElement===U)?(C.preventDefault(),Z.focus()):!C.shiftKey&&(document.activeElement===Z||document.activeElement===U)&&(C.preventDefault(),G.focus())};return U.addEventListener("keydown",j),()=>{U.removeEventListener("keydown",j),h!=null&&h.isConnected&&h.focus()}},[h]),u.jsx("div",{className:z?"drawer-overlay":"modal-overlay",onClick:()=>{A||o()},children:u.jsxs("div",{ref:q,role:"dialog","aria-modal":"true","aria-labelledby":x,"aria-busy":A,tabIndex:-1,className:z?"drawer":"modal",onClick:U=>U.stopPropagation(),style:z?{width:"min(640px, 95vw)"}:{maxWidth:760,width:"92vw",minWidth:0,maxHeight:"90vh",overflowY:"auto"},children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,alignItems:"start",marginBottom:20},children:[u.jsx("h2",{id:x,className:"modal-title",style:{margin:0},children:s}),u.jsx("button",{type:"button",className:"btn btn-secondary","aria-label":`Close ${s}`,disabled:A,onClick:o,children:"Close"})]}),b]})})}function Yy(s){const x=s.kind!=="machine",b=x?s.redirectUris.split(`
+`).map(o=>o.trim()).filter(Boolean):[];if(x&&!b.length)throw new Error("Enter the exact redirect URI from your MCP client settings, one per line.");for(const o of b)try{new URL(o)}catch{throw new Error("Each redirect URI must be a complete URI. Copy it exactly from your MCP client settings.")}return{grantTypes:x?["authorization_code","refresh_token"]:["client_credentials"],redirectUris:b,tokenEndpointAuthMethod:s.kind==="public-pkce"?"none":s.kind==="machine"?"client_secret_post":s.confidentialMethod}}function wy(s){const x=Math.floor((Date.now()-s.getTime())/1e3);return x<60?"just now":x<3600?Math.floor(x/60)+"m ago":x<86400?Math.floor(x/3600)+"h ago":Math.floor(x/86400)+"d ago"}function Gy(){const[s,x]=R.useState([]),[b,o]=R.useState([]),[A,z]=R.useState(!1),[q,H]=R.useState(!1),[_,h]=R.useState(""),[U,j]=R.useState(""),[C,Y]=R.useState(!0),[G,Z]=R.useState(!0),[W,ae]=R.useState(!1),[$,le]=R.useState(!1),[ne,xe]=R.useState(),[k,V]=R.useState(),[Se,je]=R.useState(!1),[se,F]=R.useState(),de=R.useRef(0),we=R.useRef(0),Ne=async()=>{const N=++de.current;Y(!0);try{const w=await be.agents();if(N!==de.current)return;x(w),z(!0),h("")}catch(w){N===de.current&&h(w instanceof Error?w.message:"Clients are unavailable.")}finally{N===de.current&&Y(!1)}},Ze=async()=>{const N=++we.current;Z(!0);try{const w=await be.sources();if(N!==we.current)return;o(w),H(!0),j("")}catch(w){N===we.current&&(H(!1),j(w instanceof Error?w.message:"Sources are unavailable."))}finally{N===we.current&&Z(!1)}};R.useEffect(()=>(Ne(),Ze(),()=>{de.current++,we.current++}),[]);const T=s.filter(N=>!W||N.status!=="revoked");return u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,flexWrap:"wrap",alignItems:"center",marginBottom:24},children:[u.jsx("h1",{className:"page-title",style:{marginBottom:0},children:"Agents"}),u.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[u.jsxs("label",{className:"checkbox-label",children:[u.jsx("input",{type:"checkbox",checked:W,onChange:N=>ae(N.target.checked)}),"Hide revoked"]}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:C,onClick:()=>void Ne(),children:"Refresh clients"}),u.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>je(!0),children:"+ API Key"}),u.jsx("button",{type:"button",className:"btn btn-primary",disabled:!q||!b.length||G,onClick:()=>le(!0),children:"+ OAuth Client"})]})]}),u.jsx("p",{className:"grant-help",style:{marginBottom:16},children:"Owner administration uses this dashboard’s login. An OAuth client’s admin scope allows eligible brain operations; it does not open this dashboard."}),_&&u.jsxs("p",{role:"alert",style:{marginBottom:16,color:"var(--error)"},children:[A?"Showing previously loaded clients. ":"Could not load clients. ",_," ",u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:C,onClick:()=>void Ne(),children:"Retry clients"})]}),U&&u.jsxs("p",{role:"alert",style:{marginBottom:16,color:"var(--error)"},children:["Could not load current sources. Registration and permission changes are unavailable. ",U," ",u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:G,onClick:()=>void Ze(),children:"Retry sources"})]}),!U&&!q&&u.jsx("p",{role:"status",children:"Loading sources before registration…"}),q&&!b.length&&u.jsx("p",{role:"status",children:"No active sources are available. Add or unarchive a source on the host before registering a client."}),!A&&!_&&u.jsx("p",{role:"status",children:"Loading clients…"}),A&&!s.length&&u.jsx("p",{style:{textAlign:"center",padding:48},children:"No clients registered. Register a client to grant access to a harness."}),A&&s.length>0&&!T.length&&u.jsx("p",{style:{textAlign:"center",padding:48},children:"All clients are revoked. Uncheck “Hide revoked” to view them."}),T.length>0&&u.jsxs("div",{style:{overflowX:"auto"},children:[u.jsxs("table",{children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:"Name"}),u.jsx("th",{children:"Type"}),u.jsx("th",{children:"Scopes"}),u.jsx("th",{children:"Sources"}),u.jsx("th",{children:"Status"}),u.jsx("th",{children:"Requests"}),u.jsx("th",{children:"Last used"})]})}),u.jsx("tbody",{children:T.map(N=>u.jsxs("tr",{onClick:()=>V(N),style:{cursor:"pointer"},children:[u.jsx("td",{children:u.jsx("button",{type:"button",className:"client-name-button",onClick:w=>{w.stopPropagation(),V(N)},children:N.name||N.client_name})}),u.jsx("td",{children:u.jsx("span",{className:"badge "+(N.auth_type==="oauth"?"badge-read":"badge-write"),children:N.auth_type==="oauth"?"OAuth":"API key"})}),u.jsx("td",{children:(N.scope||"").split(" ").filter(Boolean).map(w=>u.jsx("span",{className:"badge badge-"+w,style:{marginRight:4},children:w},w))}),u.jsx("td",{children:N.auth_type==="oauth"?(N.source_id||"none")+" · "+(N.federated_read||[]).length+" readable":"Unscoped"}),u.jsx("td",{children:u.jsx("span",{className:"badge "+(N.status==="active"?"badge-success":"badge-danger"),children:N.status})}),u.jsxs("td",{children:[N.requests_today||0,u.jsxs("span",{style:{color:"var(--text-muted)"},children:[" / ",N.total_requests||0]})]}),u.jsx("td",{children:N.last_used_at?wy(new Date(N.last_used_at)):"Never"})]},N.auth_type+":"+N.id))})]}),u.jsxs("p",{className:"grant-help",style:{marginTop:12},children:[s.filter(N=>N.status==="active").length," active / ",s.length," total"]})]}),$&&u.jsx(Xy,{sources:b,sourcesReady:q,onClose:()=>le(!1),onRegistered:N=>{le(!1),xe(N),Ne()}}),ne&&u.jsxs(_n,{title:"Client registered",titleId:"registered-client-title",onClose:()=>xe(void 0),children:[u.jsxs("p",{role:"status",style:{marginBottom:16},children:[ne.name," is registered. Its harness connection has not been verified."]}),u.jsx(Jd,{clientId:ne.clientId,grantTypes:ne.grantTypes})]}),k&&u.jsx(Qy,{agent:k,sources:b,sourcesReady:q,onClose:()=>V(void 0),onChanged:()=>{V(void 0),Ne()},onRescoped:N=>{V(w=>w&&{...w,source_id:N.sourceId,federated_read:N.federatedRead,scope:N.scopes.join(" "),token_ttl:N.tokenTtlSeconds}),Ne()}},k.id),Se&&u.jsx(Zy,{onClose:()=>je(!1),onCreated:N=>{je(!1),F(N),Ne()}}),se&&u.jsx(Vy,{token:se,onClose:()=>F(void 0)})]})}function Xy({sources:s,sourcesReady:x,onClose:b,onRegistered:o}){const[A,z]=R.useState(""),[q,H]=R.useState(()=>bs()),[_,h]=R.useState({kind:"machine",redirectUris:"",confidentialMethod:"client_secret_post"}),[U,j]=R.useState(),[C,Y]=R.useState(""),[G,Z]=R.useState(),[W,ae]=R.useState(!1),[$,le]=R.useState(""),[ne,xe]=R.useState(),[k,V]=R.useState(!1),Se=()=>{Y(""),be.grantCatalog().then(j).catch(F=>Y(F instanceof Error?F.message:"Permission catalog unavailable."))};R.useEffect(Se,[]);const je=F=>{h(F),Z(void 0)},se=async F=>{if(F.preventDefault(),!(!x||!U||k)){if(!A.trim()){le("Enter a client name.");return}ae(!0),le("");try{const de=(G==null?void 0:G.oauth)??Yy(_),we=(G==null?void 0:G.name)??A.trim(),Ne=await be.registerClient({...G?Zd(G.grant.after):Ld(q),...de,name:we,dryRun:!G});G?o({clientId:Ne.clientId,name:we,grantTypes:de.grantTypes}):Z({grant:Ne,oauth:de,name:we})}catch(de){le(de instanceof Error?de.message:"Registration failed.");const we=!!G&&Ss(de);if(V(we),G&&(we||de instanceof An&&de.status===409))try{const Ne=(await be.agents()).filter(Ze=>Ze.auth_type==="oauth"&&Ze.status==="active"&&(Ze.name||Ze.client_name)===G.name);Ne.length===1&&(xe({clientId:Ne[0].id||Ne[0].client_id,name:G.name,grantTypes:Ne[0].grant_types}),V(!0))}catch{}Z(void 0)}finally{ae(!1)}}};return u.jsx(_n,{title:"Register OAuth client",titleId:"register-client-title",onClose:b,busy:W,children:u.jsxs("form",{onSubmit:se,children:[u.jsxs("fieldset",{disabled:W||k,style:{border:0,padding:0},children:[u.jsx("label",{htmlFor:"agent-name",children:"Client name"}),u.jsx("input",{id:"agent-name","data-autofocus":!0,value:A,placeholder:"agent-example",onChange:F=>{z(F.target.value),Z(void 0)}}),u.jsx("label",{htmlFor:"oauth-connection-kind",style:{marginTop:16},children:"Connection type"}),u.jsxs("select",{id:"oauth-connection-kind",value:_.kind,onChange:F=>je({..._,kind:F.target.value}),children:[u.jsx("option",{value:"machine",children:"Machine credentials"}),u.jsx("option",{value:"public-pkce",children:"Browser sign-in: public client with PKCE"}),u.jsx("option",{value:"confidential-pkce",children:"Browser sign-in: confidential client with PKCE"})]}),u.jsx("p",{className:"grant-help",children:"Choose the method required by your MCP client. Browser sign-in requires the owner’s approval. Public clients use PKCE without a client secret."}),_.kind!=="machine"&&u.jsxs(u.Fragment,{children:[u.jsx("label",{htmlFor:"oauth-redirect-uris",children:"Exact redirect URIs (one per line)"}),u.jsx("textarea",{id:"oauth-redirect-uris",rows:3,value:_.redirectUris,onChange:F=>je({..._,redirectUris:F.target.value}),placeholder:"https://client.example.com/oauth/callback"}),u.jsx("p",{className:"grant-help",children:"Copy these from the client’s OAuth settings. Keep the complete path and query. GBrain uses S256 PKCE."})]}),_.kind==="confidential-pkce"&&u.jsxs(u.Fragment,{children:[u.jsx("label",{htmlFor:"oauth-client-auth",children:"Client secret authentication"}),u.jsxs("select",{id:"oauth-client-auth",value:_.confidentialMethod,onChange:F=>je({..._,confidentialMethod:F.target.value}),children:[u.jsx("option",{value:"client_secret_post",children:"client_secret_post (request body)"}),u.jsx("option",{value:"client_secret_basic",children:"client_secret_basic (HTTP Basic)"})]})]}),_.kind==="machine"&&u.jsx("p",{className:"grant-help",children:"Machine handoffs use client_secret_post to renew their access tokens."}),u.jsx("div",{style:{marginTop:24},children:U&&u.jsx(Vd,{draft:q,setDraft:F=>{H(F),Z(void 0)},catalog:U,sources:s})})]}),C&&u.jsxs("p",{role:"alert",style:{color:"var(--error)"},children:[C," ",u.jsx("button",{type:"button",className:"btn btn-secondary",onClick:Se,children:"Retry permissions"})]}),!x&&u.jsx("p",{role:"alert",children:"Current sources are unavailable. Close this form and retry sources before registration."}),G&&u.jsxs(u.Fragment,{children:[u.jsx(Kd,{preview:G.grant}),u.jsxs("div",{"aria-live":"polite",children:[u.jsx("h3",{children:"Review connection"}),u.jsxs("dl",{className:"oauth-consent-details",children:[u.jsx("dt",{children:"Client name"}),u.jsx("dd",{children:G.name}),u.jsx("dt",{children:"Grant types"}),u.jsx("dd",{children:G.oauth.grantTypes.join(", ")}),u.jsx("dt",{children:"Authentication"}),u.jsx("dd",{children:G.oauth.tokenEndpointAuthMethod}),G.oauth.redirectUris.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:"Exact redirect URIs"}),u.jsx("dd",{children:G.oauth.redirectUris.map(F=>u.jsx("div",{children:u.jsx("code",{children:F})},F))})]})]})]})]}),$&&u.jsx("p",{role:"alert",style:{color:"var(--error)",margin:"16px 0"},children:$}),ne&&u.jsxs("div",{role:"status",children:[u.jsxs("p",{children:["A client named ",ne.name," is registered. Open its setup instructions and recover its existing download."]}),u.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>o(ne),children:"Open existing client setup"})]}),k&&!ne&&u.jsx("p",{role:"status",children:"Registration may have completed. Close this form and refresh clients before trying again. No automatic retry was made."}),u.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"flex-end",marginTop:20},children:[u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:W,onClick:b,children:"Cancel"}),u.jsx("button",{type:"submit",className:"btn btn-primary",disabled:W||!U||!x||k,children:W?"Checking…":G?"Register with reviewed permissions":"Preview permissions"})]})]})})}function Qy({agent:s,sources:x,sourcesReady:b,onClose:o,onChanged:A,onRescoped:z}){const q=s.id||s.client_id||"",H=s.name||s.client_name||q,[_,h]=R.useState(),[U,j]=R.useState(""),[C,Y]=R.useState(0),[G,Z]=R.useState(!1),[W,ae]=R.useState(!1);return R.useEffect(()=>{if(s.auth_type!=="oauth")return;let $=!0;return j(""),be.clientDetails(q).then(le=>{$&&h(le)}).catch(le=>{$&&j(le instanceof Error?le.message:"Client details unavailable.")}),()=>{$=!1}},[q,s.auth_type,C]),u.jsxs(_n,{title:H,titleId:"client-details-title",onClose:o,drawer:!0,busy:W,children:[u.jsx("span",{className:"badge "+(s.status==="active"?"badge-success":"badge-danger"),children:s.status}),u.jsxs("dl",{className:"oauth-consent-details",style:{marginTop:16},children:[u.jsx("dt",{children:"Client ID"}),u.jsx("dd",{children:u.jsx("code",{children:q})}),u.jsx("dt",{children:"Scopes"}),u.jsx("dd",{children:s.scope||"None"}),u.jsx("dt",{children:"Registered"}),u.jsx("dd",{children:new Date(s.created_at).toLocaleString()}),u.jsx("dt",{children:"Token lifetime"}),u.jsx("dd",{children:s.token_ttl?s.token_ttl+" seconds":"Server default (future tokens)"}),_&&u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:"Grant types"}),u.jsx("dd",{children:_.client.grant_types.join(", ")}),u.jsx("dt",{children:"Authentication"}),u.jsx("dd",{children:_.client.token_endpoint_auth_method})]})]}),s.auth_type==="oauth"?u.jsxs(u.Fragment,{children:[U&&u.jsxs("p",{role:"alert",style:{color:"var(--error)"},children:[U," ",u.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>Y($=>$+1),children:"Retry client details"})]}),!_&&!U&&u.jsx("p",{role:"status",children:"Loading client details…"}),_&&u.jsxs(u.Fragment,{children:[u.jsx(Jd,{clientId:q,grantTypes:_.client.grant_types,revoked:s.status==="revoked",grantRevision:_.grant.revision}),s.status==="active"&&u.jsxs("details",{style:{marginTop:24},children:[u.jsx("summary",{style:{cursor:"pointer",fontWeight:600},children:"Edit access levels"}),u.jsx(Uy,{clientId:q,sources:x,sourcesReady:b,onRescoped:$=>{h(le=>le&&{...le,grant:$}),z($)}})]}),u.jsx(By,{clientId:q,name:H,revoked:s.status==="revoked",onChanged:A,onBusyChange:ae})]})]}):u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"section-title",children:"API key"}),u.jsx("p",{children:"Use this key as a bearer token in a client that supports static authentication. Its value is available only in the original private handoff."}),s.status==="active"&&u.jsxs("div",{style:{marginTop:20},children:[G?u.jsxs(u.Fragment,{children:[u.jsxs("p",{children:["Revoke the API key ",H," (",q,")? Only this key stops working. Memory remains."]}),u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:W,onClick:()=>Z(!1),children:"Cancel"})," ",u.jsx("button",{type:"button",className:"btn btn-danger",disabled:W,onClick:()=>{ae(!0),be.revokeApiKey(q).then(A).catch($=>j($ instanceof Error?$.message:"Revoke failed. Refresh the client list before retrying.")).finally(()=>ae(!1))},children:"Confirm revoke"})]}):u.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>Z(!0),children:"Revoke API key"}),U&&u.jsx("p",{role:"alert",children:U})]})]})]})}const Ly=[{id:"read",label:"Read",help:"Search and read memory."},{id:"write",label:"Write",help:"Add and edit memory."},{id:"admin",label:"Admin",help:"Brain administration operations. Grant only to fully trusted clients."}];function Zy({onClose:s,onCreated:x}){const[b,o]=R.useState(""),[A,z]=R.useState(!1),[q,H]=R.useState(""),[_,h]=R.useState(["read","write"]),U=async j=>{if(j.preventDefault(),!b.trim()){H("Enter a key name.");return}if(_.length===0){H("Choose at least one access level.");return}z(!0),H("");try{const C=await be.createApiKey(b.trim(),_);x({name:C.name,token:C.token})}catch(C){H(C instanceof Error?C.message:"Key creation failed. Inspect the clients list before retrying.")}finally{z(!1)}};return u.jsx(_n,{title:"Create API key",titleId:"create-api-key-title",onClose:s,busy:A,children:u.jsxs("form",{onSubmit:U,children:[u.jsx("p",{className:"grant-help",children:"API keys default to read and write. Admin is granted only when you check it. Choose an OAuth client for per-source or per-operation access. This key cannot log into the owner dashboard."}),u.jsx("label",{htmlFor:"api-key-name",children:"Key name"}),u.jsx("input",{id:"api-key-name","data-autofocus":!0,value:b,maxLength:128,disabled:A,onChange:j=>o(j.target.value)}),u.jsxs("fieldset",{style:{marginTop:16},children:[u.jsx("legend",{children:"Access levels"}),Ly.map(j=>u.jsxs("label",{style:{display:"block"},children:[u.jsx("input",{type:"checkbox",checked:_.includes(j.id),disabled:A,onChange:C=>h(Y=>C.target.checked?[...Y,j.id]:Y.filter(G=>G!==j.id))})," ",j.label," ",u.jsx("span",{className:"grant-help",children:j.help})]},j.id))]}),q&&u.jsx("p",{role:"alert",children:q}),u.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,marginTop:20},children:[u.jsx("button",{type:"button",className:"btn btn-secondary",disabled:A,onClick:s,children:"Cancel"}),u.jsx("button",{type:"submit",className:"btn btn-primary",disabled:A,children:A?"Creating…":"Create key"})]})]})})}function Vy({token:s,onClose:x}){const[b,o]=R.useState(!1),[A,z]=R.useState("");return u.jsxs(_n,{title:"API key created",titleId:"api-key-created-title",onClose:x,children:[u.jsx("p",{children:s.name}),u.jsx("label",{htmlFor:"new-api-key",children:"Bearer token"}),u.jsx("textarea",{id:"new-api-key",rows:3,readOnly:!0,value:s.token}),u.jsx("p",{className:"grant-help",children:"Save this token privately now. It will not be shown again. A key’s creation does not verify your harness connection."}),u.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>{navigator.clipboard.writeText(s.token).then(()=>o(!0)).catch(()=>z("Clipboard unavailable. Select and copy the token above."))},children:b?"Copied":"Copy token"}),A&&u.jsx("p",{role:"alert",children:A}),u.jsx("button",{type:"button",className:"btn btn-primary",style:{marginLeft:12},onClick:x,children:"Done"})]})}function Ky(){const[s,x]=R.useState({rows:[],total:0,page:1,pages:1}),[b,o]=R.useState(1),[A,z]=R.useState("all"),[q,H]=R.useState(null);R.useEffect(()=>{_(b)},[b,A]);const _=C=>{const Y=A!=="all"?`&agent=${encodeURIComponent(A)}`:"";be.requests(C,Y).then(x).catch(()=>{})},h=C=>{const Y=Date.now()-new Date(C).getTime();return Y<6e4?`${Math.floor(Y/1e3)}s ago`:Y<36e5?`${Math.floor(Y/6e4)} min ago`:Y<864e5?`${Math.floor(Y/36e5)}h ago`:new Date(C).toLocaleDateString()},U=C=>{if(!C)return null;const{query:Y,slug:G,partial:Z,limit:W,...ae}=C,$=[];return Y&&$.push(`"${Y}"`),G&&$.push(G),Z&&$.push(`~${Z}`),W&&$.push(`limit=${W}`),Object.keys(ae).length>0&&$.push(`+${Object.keys(ae).length} params`),$.join(" ")},j=new Map;return s.rows.forEach(C=>{C.token_name&&j.set(C.token_name,C.agent_name||C.token_name)}),u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[u.jsx("h1",{className:"page-title",style:{marginBottom:0},children:"Request Log"}),u.jsxs("select",{value:A,onChange:C=>{z(C.target.value),o(1)},style:{background:"var(--bg-secondary)",color:"var(--text-primary)",border:"1px solid var(--border)",borderRadius:6,padding:"4px 8px",fontSize:13},children:[u.jsx("option",{value:"all",children:"All agents"}),[...j.entries()].map(([C,Y])=>u.jsx("option",{value:C,children:Y},C))]})]}),s.rows.length===0?u.jsx("div",{style:{textAlign:"center",padding:48,color:"var(--text-muted)"},children:"No requests yet."}):u.jsxs(u.Fragment,{children:[u.jsxs("table",{children:[u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:"Time"}),u.jsx("th",{children:"Agent"}),u.jsx("th",{children:"Operation"}),u.jsx("th",{children:"Params"}),u.jsx("th",{children:"Latency"}),u.jsx("th",{children:"Status"})]})}),u.jsx("tbody",{children:s.rows.map(C=>u.jsxs(Xd.Fragment,{children:[u.jsxs("tr",{onClick:()=>H(q===C.id?null:C.id),style:{cursor:"pointer"},children:[u.jsx("td",{style:{color:"var(--text-secondary)",whiteSpace:"nowrap"},children:h(C.created_at)}),u.jsx("td",{children:u.jsx("a",{style:{color:"var(--text-link, #88aaff)",cursor:"pointer",textDecoration:"none",fontWeight:500},onClick:Y=>{Y.stopPropagation(),z(C.token_name),o(1)},children:C.agent_name||C.token_name})}),u.jsx("td",{className:"mono",children:C.operation}),u.jsx("td",{style:{color:"var(--text-secondary)",fontSize:12,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:U(C.params)}),u.jsxs("td",{className:"mono",children:[C.latency_ms,"ms"]}),u.jsx("td",{children:u.jsx("span",{className:`badge badge-${C.status}`,children:C.status})})]}),q===C.id&&u.jsx("tr",{children:u.jsx("td",{colSpan:6,style:{background:"var(--bg-secondary, #0f0f1a)",padding:16},children:u.jsxs("div",{style:{display:"grid",gridTemplateColumns:"100px 1fr",gap:"6px 12px",fontSize:13},children:[u.jsx("span",{style:{color:"var(--text-muted)"},children:"Time"}),u.jsx("span",{children:new Date(C.created_at).toLocaleString()}),u.jsx("span",{style:{color:"var(--text-muted)"},children:"Agent"}),u.jsx("span",{className:"mono",children:C.token_name}),u.jsx("span",{style:{color:"var(--text-muted)"},children:"Operation"}),u.jsx("span",{className:"mono",children:C.operation}),u.jsx("span",{style:{color:"var(--text-muted)"},children:"Latency"}),u.jsxs("span",{children:[C.latency_ms,"ms"]}),C.params&&u.jsxs(u.Fragment,{children:[u.jsx("span",{style:{color:"var(--text-muted)"},children:"Params"}),u.jsx("pre",{className:"mono",style:{margin:0,whiteSpace:"pre-wrap",fontSize:12},children:JSON.stringify(C.params,null,2)})]}),C.error_message&&u.jsxs(u.Fragment,{children:[u.jsx("span",{style:{color:"var(--error, #ff6b6b)"},children:"Error"}),u.jsx("span",{style:{color:"var(--error, #ff6b6b)"},children:C.error_message})]})]})})})]},C.id))})]}),u.jsxs("div",{className:"pagination",children:[u.jsxs("span",{children:["Page ",s.page," of ",s.pages," (",s.total," total)"]}),u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{disabled:s.page<=1,onClick:()=>o(C=>C-1),children:"Previous"}),u.jsx("button",{disabled:s.page>=s.pages,onClick:()=>o(C=>C+1),children:"Next"})]})]})]})]})}function Jy({markup:s}){return u.jsx("div",{style:{width:"100%",overflow:"auto"},dangerouslySetInnerHTML:{__html:s}})}function Vi({type:s,ariaLabel:x}){const[b,o]=R.useState(""),[A,z]=R.useState("");return R.useEffect(()=>{let q=!1;return be.calibrationChart(s).then(H=>{q||o(H)}).catch(H=>{q||z(H.message??"fetch failed")}),()=>{q=!0}},[s]),A?u.jsxs("div",{style:{padding:16,color:"var(--error)"},role:"alert",children:[x,": ",A]}):b?u.jsx(Jy,{markup:b}):u.jsxs("div",{style:{padding:16,color:"var(--text-muted)"},children:[x," loading..."]})}function ky(){const[s,x]=R.useState(null),[b,o]=R.useState(!0),[A,z]=R.useState("");if(R.useEffect(()=>{be.calibrationProfile().then(_=>{x(_),o(!1)}).catch(_=>{z(_.message??"fetch failed"),o(!1)})},[]),b)return u.jsx("div",{style:{padding:24,color:"var(--text-secondary)"},children:"Loading calibration profile…"});if(A)return u.jsxs("div",{style:{padding:24,color:"var(--error)"},role:"alert",children:["Could not load calibration profile: ",A]});if(!s)return u.jsxs("div",{style:{padding:24,maxWidth:700},children:[u.jsx("h1",{style:{marginBottom:16},children:"Calibration"}),u.jsx("p",{style:{color:"var(--text-secondary)"},children:"No calibration profile yet. Builds after 5+ resolved takes."}),u.jsx("pre",{style:{background:"var(--bg-secondary)",padding:12,borderRadius:4,color:"var(--text-primary)",marginTop:12,fontFamily:"var(--font-mono)"},children:"gbrain dream --phase calibration_profile"})]});const q=new Date(s.generated_at),H=Math.floor((Date.now()-q.getTime())/(1e3*60*60*24));return u.jsxs("div",{style:{padding:32,maxWidth:720},children:[u.jsx("h1",{style:{marginBottom:8},children:"Calibration"}),u.jsxs("div",{style:{color:"var(--text-muted)",fontSize:13,marginBottom:24},children:["Holder: ",s.holder," · ","Updated ",H===0?"today":`${H}d ago`,s.published&&" · published",s.grade_completion<.9&&` · ~${Math.round(s.grade_completion*100)}% graded`,!s.voice_gate_passed&&" · voice gate fell back to template"]}),u.jsx("section",{style:{marginBottom:32},children:u.jsx(Vi,{type:"brier-trend",ariaLabel:"Brier trend"})}),u.jsxs("section",{style:{marginBottom:32},children:[u.jsx("h2",{style:{fontSize:14,color:"var(--text-secondary)",marginBottom:12,fontWeight:400},children:"Pattern statements"}),u.jsx(Vi,{type:"pattern-statements",ariaLabel:"Pattern statements"})]}),u.jsx("section",{style:{marginBottom:32},children:u.jsx(Vi,{type:"domain-bars",ariaLabel:"Per-domain accuracy"})}),u.jsx("section",{style:{marginBottom:32},children:u.jsx(Vi,{type:"abandoned-threads",ariaLabel:"Abandoned threads"})}),s.active_bias_tags.length>0&&u.jsxs("section",{style:{marginBottom:32,color:"var(--text-muted)",fontSize:13},children:["Active bias tags: ",s.active_bias_tags.join(", ")]})]})}function Wy(s){return s===0?"var(--accent-success, #2ea043)":s>=100?"var(--accent-danger, #f85149)":"var(--accent-warn, #d29922)"}function Yd(s){return`$${(s/100).toFixed(2)}`}function $y(){const[s,x]=R.useState(null),[b,o]=R.useState(null);if(R.useEffect(()=>{let z=!0,q=null;const H=async()=>{try{const _=await be.jobsWatch();z&&(x(_),o(null))}catch(_){z&&o(_ instanceof Error?_.message:String(_))}z&&(q=setTimeout(H,1e3))};return H(),()=>{z=!1,q&&clearTimeout(q)}},[]),b)return u.jsxs("div",{style:{padding:24,color:"var(--accent-danger, #f85149)"},children:[u.jsx("h2",{children:"Jobs Watch — error"}),u.jsx("pre",{style:{whiteSpace:"pre-wrap"},children:b})]});if(!s)return u.jsx("div",{style:{padding:24,color:"var(--text-muted, #777)"},children:"Loading jobs watch…"});const A=new Date(s.ts_ms).toLocaleTimeString();return u.jsxs("div",{style:{padding:24,fontFamily:'var(--font-mono, "JetBrains Mono", monospace)'},children:[u.jsxs("h1",{style:{fontSize:18,marginBottom:4},children:["Jobs Watch",u.jsxs("span",{style:{marginLeft:12,color:"var(--text-muted, #777)",fontSize:12,fontWeight:"normal"},children:["updated ",A]})]}),u.jsxs("section",{style:{marginTop:24},children:[u.jsx("h2",{style:{fontSize:14,marginBottom:8},children:"Queue"}),u.jsxs("div",{children:["waiting=",u.jsx("b",{children:s.queue_health.waiting})," ","active=",u.jsx("b",{children:s.queue_health.active})," ","stalled=",u.jsx("b",{style:{color:s.queue_health.stalled>0?"var(--accent-warn, #d29922)":void 0},children:s.queue_health.stalled})]})]}),s.by_type.length>0&&u.jsxs("section",{style:{marginTop:24},children:[u.jsx("h2",{style:{fontSize:14,marginBottom:8},children:"By type (24h)"}),u.jsxs("table",{style:{borderCollapse:"collapse"},children:[u.jsx("thead",{children:u.jsxs("tr",{style:{color:"var(--text-muted, #777)",fontSize:12},children:[u.jsx("th",{style:{textAlign:"left",padding:"4px 12px 4px 0"},children:"name"}),u.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"total"}),u.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"done"}),u.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"fail"}),u.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"dead"})]})}),u.jsx("tbody",{children:s.by_type.slice(0,6).map(z=>u.jsxs("tr",{children:[u.jsx("td",{style:{padding:"4px 12px 4px 0"},children:z.name}),u.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:z.total}),u.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:z.completed}),u.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:z.failed}),u.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:z.dead})]},z.name))})]})]}),u.jsxs("section",{style:{marginTop:24},children:[u.jsx("h2",{style:{fontSize:14,marginBottom:8},children:"Lease pressure (1h)"}),u.jsxs("div",{style:{color:Wy(s.lease_pressure_1h)},children:[s.lease_pressure_1h," bounce",s.lease_pressure_1h===1?"":"s"]})]}),s.top_errors.length>0&&u.jsxs("section",{style:{marginTop:24},children:[u.jsx("h2",{style:{fontSize:14,marginBottom:8},children:"Top errors (24h)"}),u.jsx("table",{style:{borderCollapse:"collapse"},children:u.jsx("tbody",{children:s.top_errors.slice(0,5).map(z=>u.jsxs("tr",{children:[u.jsxs("td",{style:{textAlign:"right",padding:"4px 12px 4px 0",color:"var(--text-muted, #777)"},children:[z.count,"×"]}),u.jsx("td",{style:{padding:"4px 12px 4px 0"},children:z.cluster})]},z.cluster))})})]}),s.budget_owners.length>0&&u.jsxs("section",{style:{marginTop:24},children:[u.jsx("h2",{style:{fontSize:14,marginBottom:8},children:"Budget owners"}),u.jsxs("table",{style:{borderCollapse:"collapse"},children:[u.jsx("thead",{children:u.jsxs("tr",{style:{color:"var(--text-muted, #777)",fontSize:12},children:[u.jsx("th",{style:{textAlign:"left",padding:"4px 12px 4px 0"},children:"owner"}),u.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"spent"}),u.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"remaining"})]})}),u.jsx("tbody",{children:s.budget_owners.slice(0,5).map(z=>u.jsxs("tr",{children:[u.jsx("td",{style:{padding:"4px 12px 4px 0"},children:z.owner_id}),u.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:Yd(z.total_spent_cents)}),u.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:Yd(z.remaining_cents)})]},z.owner_id))})]})]})]})}function Fy(){var h,U;const[s,x]=R.useState(),[b,o]=R.useState(""),[A,z]=R.useState(!1),[q,H]=R.useState("");R.useEffect(()=>{let j=!0;const C=Ki();if(!C){o("No pending authorization request. Restart the connection from your client.");return}return be.oauthRequest(C).then(Y=>{j&&(x(Y),H(Y.sourceId??""))}).catch(Y=>{j&&o(Y.message)}),()=>{j=!1}},[]);const _=async j=>{if(!(!s||A)){z(!0),o("");try{const C=j==="approve"&&s.sourceChoice.editable&&q!==s.sourceId?q:void 0,Y=await be.decideOAuthRequest(s.id,j,s.csrf,C);Hd(),window.location.assign(Y.redirectUrl)}catch(C){o(C instanceof Error?C.message:"Approval failed. Restart the connection from your client."),x(void 0),z(!1)}}};return u.jsxs("section",{"aria-labelledby":"consent-title",style:{maxWidth:760},children:[u.jsx("h1",{id:"consent-title",children:"Approve client access"}),u.jsx("p",{style:{color:"var(--text-secondary)",margin:"16px 0"},children:"Only approve a connection you initiated. These permissions let the client act on your brain."}),b&&u.jsx("div",{role:"alert",className:"login-error",style:{marginBottom:16},children:b}),!s&&!b&&u.jsx("p",{role:"status",children:"Loading authorization request…"}),s&&u.jsxs(u.Fragment,{children:[u.jsxs("dl",{className:"oauth-consent-details",children:[u.jsx("dt",{children:"Client"}),u.jsx("dd",{children:s.clientName}),u.jsx("dt",{children:"Client ID"}),u.jsx("dd",{children:u.jsx("code",{children:s.clientId})}),u.jsx("dt",{children:"Redirect destination"}),u.jsx("dd",{children:u.jsx("code",{children:s.redirectUri})}),u.jsx("dt",{children:"Permissions"}),u.jsx("dd",{children:s.scopes.length?s.scopes.map(j=>u.jsx("span",{className:`badge ${j.includes("admin")?"badge-error":""}`,style:{marginRight:8},children:j},j)):"No permissions"}),u.jsx("dt",{children:"Administrative brain operations"}),u.jsx("dd",{children:s.scopes.some(j=>j==="admin")?"Eligible operations within the grant below. This does not grant owner dashboard access.":s.scopes.some(j=>j.endsWith("_admin"))?"The named administrative brain operations. This does not grant owner dashboard access.":"None"}),u.jsx("dt",{children:"Allowed operations"}),u.jsx("dd",{children:s.allowedOperations===null?"All operations permitted by these scopes and the server policy":s.allowedOperations.join(", ")||"None"}),u.jsx("dt",{children:"Write paths"}),u.jsx("dd",{children:s.boundSlugPrefixes===null?"Within the granted source":s.boundSlugPrefixes.join(", ")||"None"}),s.scopes.includes("agent")&&u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:"Delegated tools"}),u.jsx("dd",{children:((h=s.delegatedTools)==null?void 0:h.join(", "))||"None"}),u.jsx("dt",{children:"Delegated write paths"}),u.jsx("dd",{children:s.delegatedNamespace==="job"?"A separate namespace for each job":((U=s.delegatedSlugPrefixes)==null?void 0:U.join(", "))||"None"})]}),s.sourceChoice.editable?u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:u.jsx("label",{htmlFor:"consent-source",children:"Write source"})}),u.jsxs("dd",{children:[u.jsx("select",{id:"consent-source",value:q,disabled:A,onChange:j=>H(j.target.value),children:s.sourceChoice.options.map(j=>u.jsx("option",{value:j.id,children:j.name===j.id?j.id:`${j.name} (${j.id})`},j.id))}),u.jsxs("div",{style:{color:"var(--text-secondary)",marginTop:4},children:["This client reads and writes only this source. Change it later on the Agents page or with ",u.jsx("code",{children:"gbrain auth rescope --client"}),"."]})]}),u.jsx("dt",{children:"Read sources"}),u.jsx("dd",{children:q})]}):u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:"Write source"}),u.jsx("dd",{children:s.sourceId??"Not configured"}),u.jsx("dt",{children:"Read sources"}),u.jsx("dd",{children:s.allowedSources.length?s.allowedSources.join(", "):s.sourceId??"Not configured"})]}),u.jsx("dt",{children:"Resource"}),u.jsx("dd",{children:u.jsx("code",{children:s.resource??"No resource binding requested"})}),u.jsx("dt",{children:"Request expires"}),u.jsx("dd",{children:new Date(s.expiresAt).toLocaleTimeString()})]}),u.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,marginTop:24},children:[u.jsx("button",{className:"btn",disabled:A,onClick:()=>_("deny"),children:"Deny"}),u.jsx("button",{className:"btn btn-primary",disabled:A,onClick:()=>_("approve"),children:A?"Completing request…":"Approve access"})]})]}),b&&u.jsx("button",{className:"btn",onClick:()=>{Hd(),window.location.hash="agents"},children:"Return to agents"})]})}function wd(){const s=window.location.hash.replace("#","")||"dashboard";return Ki()&&s==="dashboard"?"oauth-consent":["login","dashboard","agents","log","calibration","jobs","oauth-consent"].includes(s)?s:"dashboard"}function Iy(){const[s,x]=R.useState(wd);R.useEffect(()=>{const A=()=>x(wd());return window.addEventListener("hashchange",A),()=>window.removeEventListener("hashchange",A)},[]);const b=A=>{window.location.hash=A,x(A)};if(s==="login")return u.jsx(Ny,{onLogin:()=>b(Ki()?"oauth-consent":"dashboard")});const o=async()=>{if(confirm("Sign out every active admin session, including other browsers and tabs? Each one will need to re-authenticate via a fresh magic link.")){try{await be.signOutEverywhere()}catch{}b("login")}};return u.jsxs("div",{className:"app",children:[u.jsxs("nav",{className:"sidebar",children:[u.jsx("div",{className:"sidebar-logo",children:"GBrain"}),u.jsxs("div",{className:"sidebar-nav",children:[u.jsx("a",{className:`nav-item ${s==="dashboard"?"active":""}`,onClick:()=>b("dashboard"),children:"Dashboard"}),u.jsx("a",{className:`nav-item ${s==="agents"?"active":""}`,onClick:()=>b("agents"),children:"Agents"}),u.jsx("a",{className:`nav-item ${s==="log"?"active":""}`,onClick:()=>b("log"),children:"Request Log"}),u.jsx("a",{className:`nav-item ${s==="calibration"?"active":""}`,onClick:()=>b("calibration"),children:"Calibration"}),u.jsx("a",{className:`nav-item ${s==="jobs"?"active":""}`,onClick:()=>b("jobs"),children:"Jobs Watch"})]}),u.jsx("div",{style:{marginTop:"auto",padding:"16px 12px",borderTop:"1px solid var(--border)"},children:u.jsx("button",{onClick:o,style:{background:"transparent",border:"1px solid var(--border)",color:"var(--text-secondary)",padding:"6px 10px",borderRadius:6,fontSize:12,cursor:"pointer",width:"100%"},title:"Revoke every active admin session — every browser, every tab",children:"Sign out everywhere"})})]}),u.jsxs("main",{className:"main",children:[s==="dashboard"&&u.jsx(Dy,{}),s==="agents"&&u.jsx(Gy,{}),s==="log"&&u.jsx(Ky,{}),s==="calibration"&&u.jsx(ky,{}),s==="jobs"&&u.jsx($y,{}),s==="oauth-consent"&&u.jsx(Fy,{})]})]})}zy.createRoot(document.getElementById("root")).render(u.jsx(Xd.StrictMode,{children:u.jsx(Iy,{})}));
diff --git a/admin/dist/assets/index-KW-GcSja.js b/admin/dist/assets/index-KW-GcSja.js
deleted file mode 100644
index 3bf461abaf..0000000000
--- a/admin/dist/assets/index-KW-GcSja.js
+++ /dev/null
@@ -1,54 +0,0 @@
-(function(){const x=document.createElement("link").relList;if(x&&x.supports&&x.supports("modulepreload"))return;for(const E of document.querySelectorAll('link[rel="modulepreload"]'))o(E);new MutationObserver(E=>{for(const _ of E)if(_.type==="childList")for(const q of _.addedNodes)q.tagName==="LINK"&&q.rel==="modulepreload"&&o(q)}).observe(document,{childList:!0,subtree:!0});function b(E){const _={};return E.integrity&&(_.integrity=E.integrity),E.referrerPolicy&&(_.referrerPolicy=E.referrerPolicy),E.crossOrigin==="use-credentials"?_.credentials="include":E.crossOrigin==="anonymous"?_.credentials="omit":_.credentials="same-origin",_}function o(E){if(E.ep)return;E.ep=!0;const _=b(E);fetch(E.href,_)}})();function wd(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var rs={exports:{}},Tn={};/**
- * @license React
- * react-jsx-runtime.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var Ad;function gy(){if(Ad)return Tn;Ad=1;var s=Symbol.for("react.transitional.element"),x=Symbol.for("react.fragment");function b(o,E,_){var q=null;if(_!==void 0&&(q=""+_),E.key!==void 0&&(q=""+E.key),"key"in E){_={};for(var H in E)H!=="key"&&(_[H]=E[H])}else _=E;return E=_.ref,{$$typeof:s,type:o,key:q,ref:E!==void 0?E:null,props:_}}return Tn.Fragment=x,Tn.jsx=b,Tn.jsxs=b,Tn}var _d;function py(){return _d||(_d=1,rs.exports=gy()),rs.exports}var i=py(),ds={exports:{}},I={};/**
- * @license React
- * react.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var zd;function by(){if(zd)return I;zd=1;var s=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),q=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),R=Symbol.iterator;function Q(m){return m===null||typeof m!="object"?null:(m=R&&m[R]||m["@@iterator"],typeof m=="function"?m:null)}var G={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Z=Object.assign,W={};function ae(m,M,B){this.props=m,this.context=M,this.refs=W,this.updater=B||G}ae.prototype.isReactComponent={},ae.prototype.setState=function(m,M){if(typeof m!="object"&&typeof m!="function"&&m!=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,m,M,"setState")},ae.prototype.forceUpdate=function(m){this.updater.enqueueForceUpdate(this,m,"forceUpdate")};function $(){}$.prototype=ae.prototype;function le(m,M,B){this.props=m,this.context=M,this.refs=W,this.updater=B||G}var ne=le.prototype=new $;ne.constructor=le,Z(ne,ae.prototype),ne.isPureReactComponent=!0;var xe=Array.isArray;function k(){}var V={H:null,A:null,T:null,S:null},Se=Object.prototype.hasOwnProperty;function je(m,M,B){var X=B.ref;return{$$typeof:s,type:m,key:M,ref:X!==void 0?X:null,props:B}}function se(m,M){return je(m.type,M,m.props)}function F(m){return typeof m=="object"&&m!==null&&m.$$typeof===s}function de(m){var M={"=":"=0",":":"=2"};return"$"+m.replace(/[=:]/g,function(B){return M[B]})}var Ge=/\/+/g;function Ce(m,M){return typeof m=="object"&&m!==null&&m.key!=null?de(""+m.key):M.toString(36)}function Ze(m){switch(m.status){case"fulfilled":return m.value;case"rejected":throw m.reason;default:switch(typeof m.status=="string"?m.then(k,k):(m.status="pending",m.then(function(M){m.status==="pending"&&(m.status="fulfilled",m.value=M)},function(M){m.status==="pending"&&(m.status="rejected",m.reason=M)})),m.status){case"fulfilled":return m.value;case"rejected":throw m.reason}}throw m}function j(m,M,B,X,P){var ue=typeof m;(ue==="undefined"||ue==="boolean")&&(m=null);var ve=!1;if(m===null)ve=!0;else switch(ue){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(m.$$typeof){case s:case x:ve=!0;break;case D:return ve=m._init,j(ve(m._payload),M,B,X,P)}}if(ve)return P=P(m),ve=X===""?"."+Ce(m,0):X,xe(P)?(B="",ve!=null&&(B=ve.replace(Ge,"$&/")+"/"),j(P,M,B,"",function(Na){return Na})):P!=null&&(F(P)&&(P=se(P,B+(P.key==null||m&&m.key===P.key?"":(""+P.key).replace(Ge,"$&/")+"/")+ve)),M.push(P)),1;ve=0;var et=X===""?".":X+":";if(xe(m))for(var He=0;He<m.length;He++)X=m[He],ue=et+Ce(X,He),ve+=j(X,M,B,ue,P);else if(He=Q(m),typeof He=="function")for(m=He.call(m),He=0;!(X=m.next()).done;)X=X.value,ue=et+Ce(X,He++),ve+=j(X,M,B,ue,P);else if(ue==="object"){if(typeof m.then=="function")return j(Ze(m),M,B,X,P);throw M=String(m),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(m).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return ve}function N(m,M,B){if(m==null)return m;var X=[],P=0;return j(m,X,"","",function(ue){return M.call(B,ue,P++)}),X}function Y(m){if(m._status===-1){var M=m._result;M=M(),M.then(function(B){(m._status===0||m._status===-1)&&(m._status=1,m._result=B)},function(B){(m._status===0||m._status===-1)&&(m._status=2,m._result=B)}),m._status===-1&&(m._status=0,m._result=M)}if(m._status===1)return m._result.default;throw m._result}var Te=typeof reportError=="function"?reportError:function(m){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof m=="object"&&m!==null&&typeof m.message=="string"?String(m.message):String(m),error:m});if(!window.dispatchEvent(M))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",m);return}console.error(m)},ze={map:N,forEach:function(m,M,B){N(m,function(){M.apply(this,arguments)},B)},count:function(m){var M=0;return N(m,function(){M++}),M},toArray:function(m){return N(m,function(M){return M})||[]},only:function(m){if(!F(m))throw Error("React.Children.only expected to receive a single React element child.");return m}};return I.Activity=O,I.Children=ze,I.Component=ae,I.Fragment=b,I.Profiler=E,I.PureComponent=le,I.StrictMode=o,I.Suspense=A,I.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,I.__COMPILER_RUNTIME={__proto__:null,c:function(m){return V.H.useMemoCache(m)}},I.cache=function(m){return function(){return m.apply(null,arguments)}},I.cacheSignal=function(){return null},I.cloneElement=function(m,M,B){if(m==null)throw Error("The argument must be a React element, but you passed "+m+".");var X=Z({},m.props),P=m.key;if(M!=null)for(ue in M.key!==void 0&&(P=""+M.key),M)!Se.call(M,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&M.ref===void 0||(X[ue]=M[ue]);var ue=arguments.length-2;if(ue===1)X.children=B;else if(1<ue){for(var ve=Array(ue),et=0;et<ue;et++)ve[et]=arguments[et+2];X.children=ve}return je(m.type,P,X)},I.createContext=function(m){return m={$$typeof:q,_currentValue:m,_currentValue2:m,_threadCount:0,Provider:null,Consumer:null},m.Provider=m,m.Consumer={$$typeof:_,_context:m},m},I.createElement=function(m,M,B){var X,P={},ue=null;if(M!=null)for(X in M.key!==void 0&&(ue=""+M.key),M)Se.call(M,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(P[X]=M[X]);var ve=arguments.length-2;if(ve===1)P.children=B;else if(1<ve){for(var et=Array(ve),He=0;He<ve;He++)et[He]=arguments[He+2];P.children=et}if(m&&m.defaultProps)for(X in ve=m.defaultProps,ve)P[X]===void 0&&(P[X]=ve[X]);return je(m,ue,P)},I.createRef=function(){return{current:null}},I.forwardRef=function(m){return{$$typeof:H,render:m}},I.isValidElement=F,I.lazy=function(m){return{$$typeof:D,_payload:{_status:-1,_result:m},_init:Y}},I.memo=function(m,M){return{$$typeof:d,type:m,compare:M===void 0?null:M}},I.startTransition=function(m){var M=V.T,B={};V.T=B;try{var X=m(),P=V.S;P!==null&&P(B,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(k,Te)}catch(ue){Te(ue)}finally{M!==null&&B.types!==null&&(M.types=B.types),V.T=M}},I.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},I.use=function(m){return V.H.use(m)},I.useActionState=function(m,M,B){return V.H.useActionState(m,M,B)},I.useCallback=function(m,M){return V.H.useCallback(m,M)},I.useContext=function(m){return V.H.useContext(m)},I.useDebugValue=function(){},I.useDeferredValue=function(m,M){return V.H.useDeferredValue(m,M)},I.useEffect=function(m,M){return V.H.useEffect(m,M)},I.useEffectEvent=function(m){return V.H.useEffectEvent(m)},I.useId=function(){return V.H.useId()},I.useImperativeHandle=function(m,M,B){return V.H.useImperativeHandle(m,M,B)},I.useInsertionEffect=function(m,M){return V.H.useInsertionEffect(m,M)},I.useLayoutEffect=function(m,M){return V.H.useLayoutEffect(m,M)},I.useMemo=function(m,M){return V.H.useMemo(m,M)},I.useOptimistic=function(m,M){return V.H.useOptimistic(m,M)},I.useReducer=function(m,M,B){return V.H.useReducer(m,M,B)},I.useRef=function(m){return V.H.useRef(m)},I.useState=function(m){return V.H.useState(m)},I.useSyncExternalStore=function(m,M,B){return V.H.useSyncExternalStore(m,M,B)},I.useTransition=function(){return V.H.useTransition()},I.version="19.2.5",I}var Od;function xs(){return Od||(Od=1,ds.exports=by()),ds.exports}var U=xs();const Xd=wd(U);var hs={exports:{}},En={},ms={exports:{}},ys={};/**
- * @license React
- * scheduler.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var Nd;function xy(){return Nd||(Nd=1,(function(s){function x(j,N){var Y=j.length;j.push(N);e:for(;0<Y;){var Te=Y-1>>>1,ze=j[Te];if(0<E(ze,N))j[Te]=N,j[Y]=ze,Y=Te;else break e}}function b(j){return j.length===0?null:j[0]}function o(j){if(j.length===0)return null;var N=j[0],Y=j.pop();if(Y!==N){j[0]=Y;e:for(var Te=0,ze=j.length,m=ze>>>1;Te<m;){var M=2*(Te+1)-1,B=j[M],X=M+1,P=j[X];if(0>E(B,Y))X<ze&&0>E(P,B)?(j[Te]=P,j[X]=Y,Te=X):(j[Te]=B,j[M]=Y,Te=M);else if(X<ze&&0>E(P,Y))j[Te]=P,j[X]=Y,Te=X;else break e}}return N}function E(j,N){var Y=j.sortIndex-N.sortIndex;return Y!==0?Y:j.id-N.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var _=performance;s.unstable_now=function(){return _.now()}}else{var q=Date,H=q.now();s.unstable_now=function(){return q.now()-H}}var A=[],d=[],D=1,O=null,R=3,Q=!1,G=!1,Z=!1,W=!1,ae=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,le=typeof setImmediate<"u"?setImmediate:null;function ne(j){for(var N=b(d);N!==null;){if(N.callback===null)o(d);else if(N.startTime<=j)o(d),N.sortIndex=N.expirationTime,x(A,N);else break;N=b(d)}}function xe(j){if(Z=!1,ne(j),!G)if(b(A)!==null)G=!0,k||(k=!0,de());else{var N=b(d);N!==null&&Ze(xe,N.startTime-j)}}var k=!1,V=-1,Se=5,je=-1;function se(){return W?!0:!(s.unstable_now()-je<Se)}function F(){if(W=!1,k){var j=s.unstable_now();je=j;var N=!0;try{e:{G=!1,Z&&(Z=!1,$(V),V=-1),Q=!0;var Y=R;try{t:{for(ne(j),O=b(A);O!==null&&!(O.expirationTime>j&&se());){var Te=O.callback;if(typeof Te=="function"){O.callback=null,R=O.priorityLevel;var ze=Te(O.expirationTime<=j);if(j=s.unstable_now(),typeof ze=="function"){O.callback=ze,ne(j),N=!0;break t}O===b(A)&&o(A),ne(j)}else o(A);O=b(A)}if(O!==null)N=!0;else{var m=b(d);m!==null&&Ze(xe,m.startTime-j),N=!1}}break e}finally{O=null,R=Y,Q=!1}N=void 0}}finally{N?de():k=!1}}}var de;if(typeof le=="function")de=function(){le(F)};else if(typeof MessageChannel<"u"){var Ge=new MessageChannel,Ce=Ge.port2;Ge.port1.onmessage=F,de=function(){Ce.postMessage(null)}}else de=function(){ae(F,0)};function Ze(j,N){V=ae(function(){j(s.unstable_now())},N)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(j){j.callback=null},s.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Se=0<j?Math.floor(1e3/j):5},s.unstable_getCurrentPriorityLevel=function(){return R},s.unstable_next=function(j){switch(R){case 1:case 2:case 3:var N=3;break;default:N=R}var Y=R;R=N;try{return j()}finally{R=Y}},s.unstable_requestPaint=function(){W=!0},s.unstable_runWithPriority=function(j,N){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var Y=R;R=j;try{return N()}finally{R=Y}},s.unstable_scheduleCallback=function(j,N,Y){var Te=s.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?Te+Y:Te):Y=Te,j){case 1:var ze=-1;break;case 2:ze=250;break;case 5:ze=1073741823;break;case 4:ze=1e4;break;default:ze=5e3}return ze=Y+ze,j={id:D++,callback:N,priorityLevel:j,startTime:Y,expirationTime:ze,sortIndex:-1},Y>Te?(j.sortIndex=Y,x(d,j),b(A)===null&&j===b(d)&&(Z?($(V),V=-1):Z=!0,Ze(xe,Y-Te))):(j.sortIndex=ze,x(A,j),G||Q||(G=!0,k||(k=!0,de()))),j},s.unstable_shouldYield=se,s.unstable_wrapCallback=function(j){var N=R;return function(){var Y=R;R=N;try{return j.apply(this,arguments)}finally{R=Y}}}})(ys)),ys}var Cd;function Sy(){return Cd||(Cd=1,ms.exports=xy()),ms.exports}var vs={exports:{}},Pe={};/**
- * @license React
- * react-dom.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var Dd;function jy(){if(Dd)return Pe;Dd=1;var s=xs();function x(A){var d="https://react.dev/errors/"+A;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var D=2;D<arguments.length;D++)d+="&args[]="+encodeURIComponent(arguments[D])}return"Minified React error #"+A+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function b(){}var o={d:{f:b,r:function(){throw Error(x(522))},D:b,C:b,L:b,m:b,X:b,S:b,M:b},p:0,findDOMNode:null},E=Symbol.for("react.portal");function _(A,d,D){var O=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:E,key:O==null?null:""+O,children:A,containerInfo:d,implementation:D}}var q=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function H(A,d){if(A==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Pe.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Pe.createPortal=function(A,d){var D=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(x(299));return _(A,d,null,D)},Pe.flushSync=function(A){var d=q.T,D=o.p;try{if(q.T=null,o.p=2,A)return A()}finally{q.T=d,o.p=D,o.d.f()}},Pe.preconnect=function(A,d){typeof A=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,o.d.C(A,d))},Pe.prefetchDNS=function(A){typeof A=="string"&&o.d.D(A)},Pe.preinit=function(A,d){if(typeof A=="string"&&d&&typeof d.as=="string"){var D=d.as,O=H(D,d.crossOrigin),R=typeof d.integrity=="string"?d.integrity:void 0,Q=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;D==="style"?o.d.S(A,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:O,integrity:R,fetchPriority:Q}):D==="script"&&o.d.X(A,{crossOrigin:O,integrity:R,fetchPriority:Q,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Pe.preinitModule=function(A,d){if(typeof A=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var D=H(d.as,d.crossOrigin);o.d.M(A,{crossOrigin:D,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&o.d.M(A)},Pe.preload=function(A,d){if(typeof A=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var D=d.as,O=H(D,d.crossOrigin);o.d.L(A,D,{crossOrigin:O,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Pe.preloadModule=function(A,d){if(typeof A=="string")if(d){var D=H(d.as,d.crossOrigin);o.d.m(A,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:D,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else o.d.m(A)},Pe.requestFormReset=function(A){o.d.r(A)},Pe.unstable_batchedUpdates=function(A,d){return A(d)},Pe.useFormState=function(A,d,D){return q.H.useFormState(A,d,D)},Pe.useFormStatus=function(){return q.H.useHostTransitionStatus()},Pe.version="19.2.5",Pe}var Md;function Ty(){if(Md)return vs.exports;Md=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(x){console.error(x)}}return s(),vs.exports=jy(),vs.exports}/**
- * @license React
- * react-dom-client.production.js
- *
- * Copyright (c) Meta Platforms, Inc. and affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */var Rd;function Ey(){if(Rd)return En;Rd=1;var s=Sy(),x=xs(),b=Ty();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}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 E(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function q(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 H(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 A(e){if(_(e)!==e)throw Error(o(188))}function d(e){var t=e.alternate;if(!t){if(t=_(e),t===null)throw Error(o(188));return t!==e?null:e}for(var l=e,a=t;;){var n=l.return;if(n===null)break;var u=n.alternate;if(u===null){if(a=n.return,a!==null){l=a;continue}break}if(n.child===u.child){for(u=n.child;u;){if(u===l)return A(n),e;if(u===a)return A(n),t;u=u.sibling}throw Error(o(188))}if(l.return!==a.return)l=n,a=u;else{for(var c=!1,f=n.child;f;){if(f===l){c=!0,l=n,a=u;break}if(f===a){c=!0,a=n,l=u;break}f=f.sibling}if(!c){for(f=u.child;f;){if(f===l){c=!0,l=u,a=n;break}if(f===a){c=!0,a=u,l=n;break}f=f.sibling}if(!c)throw Error(o(189))}}if(l.alternate!==a)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function D(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=D(e),t!==null)return t;e=e.sibling}return null}var O=Object.assign,R=Symbol.for("react.element"),Q=Symbol.for("react.transitional.element"),G=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),W=Symbol.for("react.strict_mode"),ae=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),le=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),xe=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),Se=Symbol.for("react.lazy"),je=Symbol.for("react.activity"),se=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function de(e){return e===null||typeof e!="object"?null:(e=F&&e[F]||e["@@iterator"],typeof e=="function"?e:null)}var Ge=Symbol.for("react.client.reference");function Ce(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 Z:return"Fragment";case ae:return"Profiler";case W:return"StrictMode";case xe:return"Suspense";case k:return"SuspenseList";case je:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case G:return"Portal";case le:return e.displayName||"Context";case $:return(e._context.displayName||"Context")+".Consumer";case ne:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case V:return t=e.displayName||null,t!==null?t:Ce(e.type)||"Memo";case Se:t=e._payload,e=e._init;try{return Ce(e(t))}catch{}}return null}var Ze=Array.isArray,j=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=b.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},Te=[],ze=-1;function m(e){return{current:e}}function M(e){0>ze||(e.current=Te[ze],Te[ze]=null,ze--)}function B(e,t){ze++,Te[ze]=e.current,e.current=t}var X=m(null),P=m(null),ue=m(null),ve=m(null);function et(e,t){switch(B(ue,t),B(P,e),B(X,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?kr(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=kr(t),e=Wr(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}M(X),B(X,e)}function He(){M(X),M(P),M(ue)}function Na(e){e.memoizedState!==null&&B(ve,e);var t=X.current,l=Wr(t,e.type);t!==l&&(B(P,e),B(X,l))}function zn(e){P.current===e&&(M(X),M(P)),ve.current===e&&(M(ve),bn._currentValue=Y)}var Ju,js;function Al(e){if(Ju===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);Ju=t&&t[1]||"",js=-1<l.stack.indexOf(`
- at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
-`+Ju+e+js}var ku=!1;function Wu(e,t){if(!e||ku)return"";ku=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(t){var C=function(){throw Error()};if(Object.defineProperty(C.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(C,[])}catch(S){var p=S}Reflect.construct(e,[],C)}else{try{C.call()}catch(S){p=S}e.call(C.prototype)}}else{try{throw Error()}catch(S){p=S}(C=e())&&typeof C.catch=="function"&&C.catch(function(){})}}catch(S){if(S&&p&&typeof S.stack=="string")return[S.stack,p.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=a.DetermineComponentFrameRoot(),c=u[0],f=u[1];if(c&&f){var r=c.split(`
-`),g=f.split(`
-`);for(n=a=0;a<r.length&&!r[a].includes("DetermineComponentFrameRoot");)a++;for(;n<g.length&&!g[n].includes("DetermineComponentFrameRoot");)n++;if(a===r.length||n===g.length)for(a=r.length-1,n=g.length-1;1<=a&&0<=n&&r[a]!==g[n];)n--;for(;1<=a&&0<=n;a--,n--)if(r[a]!==g[n]){if(a!==1||n!==1)do if(a--,n--,0>n||r[a]!==g[n]){var T=`
-`+r[a].replace(" at new "," at ");return e.displayName&&T.includes("<anonymous>")&&(T=T.replace("<anonymous>",e.displayName)),T}while(1<=a&&0<=n);break}}}finally{ku=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?Al(l):""}function kd(e,t){switch(e.tag){case 26:case 27:case 5:return Al(e.type);case 16:return Al("Lazy");case 13:return e.child!==t&&t!==null?Al("Suspense Fallback"):Al("Suspense");case 19:return Al("SuspenseList");case 0:case 15:return Wu(e.type,!1);case 11:return Wu(e.type.render,!1);case 1:return Wu(e.type,!0);case 31:return Al("Activity");default:return""}}function Ts(e){try{var t="",l=null;do t+=kd(e,l),l=e,e=e.return;while(e);return t}catch(a){return`
-Error generating stack: `+a.message+`
-`+a.stack}}var $u=Object.prototype.hasOwnProperty,Fu=s.unstable_scheduleCallback,Iu=s.unstable_cancelCallback,Wd=s.unstable_shouldYield,$d=s.unstable_requestPaint,ft=s.unstable_now,Fd=s.unstable_getCurrentPriorityLevel,Es=s.unstable_ImmediatePriority,As=s.unstable_UserBlockingPriority,On=s.unstable_NormalPriority,Id=s.unstable_LowPriority,_s=s.unstable_IdlePriority,Pd=s.log,eh=s.unstable_setDisableYieldValue,Ca=null,ot=null;function el(e){if(typeof Pd=="function"&&eh(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(Ca,e)}catch{}}var rt=Math.clz32?Math.clz32:ah,th=Math.log,lh=Math.LN2;function ah(e){return e>>>=0,e===0?32:31-(th(e)/lh|0)|0}var Nn=256,Cn=262144,Dn=4194304;function _l(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 Mn(e,t,l){var a=e.pendingLanes;if(a===0)return 0;var n=0,u=e.suspendedLanes,c=e.pingedLanes;e=e.warmLanes;var f=a&134217727;return f!==0?(a=f&~u,a!==0?n=_l(a):(c&=f,c!==0?n=_l(c):l||(l=f&~e,l!==0&&(n=_l(l))))):(f=a&~u,f!==0?n=_l(f):c!==0?n=_l(c):l||(l=a&~e,l!==0&&(n=_l(l)))),n===0?0:t!==0&&t!==n&&(t&u)===0&&(u=n&-n,l=t&-t,u>=l||u===32&&(l&4194048)!==0)?t:n}function Da(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function nh(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 zs(){var e=Dn;return Dn<<=1,(Dn&62914560)===0&&(Dn=4194304),e}function Pu(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function Ma(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function uh(e,t,l,a,n,u){var c=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var f=e.entanglements,r=e.expirationTimes,g=e.hiddenUpdates;for(l=c&~l;0<l;){var T=31-rt(l),C=1<<T;f[T]=0,r[T]=-1;var p=g[T];if(p!==null)for(g[T]=null,T=0;T<p.length;T++){var S=p[T];S!==null&&(S.lane&=-536870913)}l&=~C}a!==0&&Os(e,a,0),u!==0&&n===0&&e.tag!==0&&(e.suspendedLanes|=u&~(c&~t))}function Os(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var a=31-rt(t);e.entangledLanes|=t,e.entanglements[a]=e.entanglements[a]|1073741824|l&261930}function Ns(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var a=31-rt(l),n=1<<a;n&t|e[a]&t&&(e[a]|=t),l&=~n}}function Cs(e,t){var l=t&-t;return l=(l&42)!==0?1:ei(l),(l&(e.suspendedLanes|t))!==0?0:l}function ei(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 ti(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Ds(){var e=N.p;return e!==0?e:(e=window.event,e===void 0?32:pd(e.type))}function Ms(e,t){var l=N.p;try{return N.p=e,t()}finally{N.p=l}}var tl=Math.random().toString(36).slice(2),ke="__reactFiber$"+tl,lt="__reactProps$"+tl,Zl="__reactContainer$"+tl,li="__reactEvents$"+tl,ih="__reactListeners$"+tl,ch="__reactHandles$"+tl,Rs="__reactResources$"+tl,Ra="__reactMarker$"+tl;function ai(e){delete e[ke],delete e[lt],delete e[li],delete e[ih],delete e[ch]}function Vl(e){var t=e[ke];if(t)return t;for(var l=e.parentNode;l;){if(t=l[Zl]||l[ke]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=ld(e);e!==null;){if(l=e[ke])return l;e=ld(e)}return t}e=l,l=e.parentNode}return null}function Kl(e){if(e=e[ke]||e[Zl]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ua(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Jl(e){var t=e[Rs];return t||(t=e[Rs]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Ke(e){e[Ra]=!0}var Us=new Set,qs={};function zl(e,t){kl(e,t),kl(e+"Capture",t)}function kl(e,t){for(qs[e]=t,e=0;e<t.length;e++)Us.add(t[e])}var sh=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]*$"),Hs={},Bs={};function fh(e){return $u.call(Bs,e)?!0:$u.call(Hs,e)?!1:sh.test(e)?Bs[e]=!0:(Hs[e]=!0,!1)}function Rn(e,t,l){if(fh(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var a=t.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function Un(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function Ht(e,t,l,a){if(a===null)e.removeAttribute(l);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+a)}}function bt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ys(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function oh(e,t,l){var a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var n=a.get,u=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return n.call(this)},set:function(c){l=""+c,u.call(this,c)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(c){l=""+c},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ni(e){if(!e._valueTracker){var t=Ys(e)?"checked":"value";e._valueTracker=oh(e,t,""+e[t])}}function Gs(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),a="";return e&&(a=Ys(e)?e.checked?"true":"false":e.value),e=a,e!==l?(t.setValue(e),!0):!1}function qn(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 rh=/[\n"\\]/g;function xt(e){return e.replace(rh,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ui(e,t,l,a,n,u,c,f){e.name="",c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?e.type=c:e.removeAttribute("type"),t!=null?c==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+bt(t)):e.value!==""+bt(t)&&(e.value=""+bt(t)):c!=="submit"&&c!=="reset"||e.removeAttribute("value"),t!=null?ii(e,c,bt(t)):l!=null?ii(e,c,bt(l)):a!=null&&e.removeAttribute("value"),n==null&&u!=null&&(e.defaultChecked=!!u),n!=null&&(e.checked=n&&typeof n!="function"&&typeof n!="symbol"),f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.name=""+bt(f):e.removeAttribute("name")}function ws(e,t,l,a,n,u,c,f){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||l!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){ni(e);return}l=l!=null?""+bt(l):"",t=t!=null?""+bt(t):l,f||t===e.value||(e.value=t),e.defaultValue=t}a=a??n,a=typeof a!="function"&&typeof a!="symbol"&&!!a,e.checked=f?e.checked:!!a,e.defaultChecked=!!a,c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.name=c),ni(e)}function ii(e,t,l){t==="number"&&qn(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Wl(e,t,l,a){if(e=e.options,t){t={};for(var n=0;n<l.length;n++)t["$"+l[n]]=!0;for(l=0;l<e.length;l++)n=t.hasOwnProperty("$"+e[l].value),e[l].selected!==n&&(e[l].selected=n),n&&a&&(e[l].defaultSelected=!0)}else{for(l=""+bt(l),t=null,n=0;n<e.length;n++){if(e[n].value===l){e[n].selected=!0,a&&(e[n].defaultSelected=!0);return}t!==null||e[n].disabled||(t=e[n])}t!==null&&(t.selected=!0)}}function Xs(e,t,l){if(t!=null&&(t=""+bt(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+bt(l):""}function Qs(e,t,l,a){if(t==null){if(a!=null){if(l!=null)throw Error(o(92));if(Ze(a)){if(1<a.length)throw Error(o(93));a=a[0]}l=a}l==null&&(l=""),t=l}l=bt(t),e.defaultValue=l,a=e.textContent,a===l&&a!==""&&a!==null&&(e.value=a),ni(e)}function $l(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var dh=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 Ls(e,t,l){var a=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?a?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":a?e.setProperty(t,l):typeof l!="number"||l===0||dh.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function Zs(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var a in l)!l.hasOwnProperty(a)||t!=null&&t.hasOwnProperty(a)||(a.indexOf("--")===0?e.setProperty(a,""):a==="float"?e.cssFloat="":e[a]="");for(var n in t)a=t[n],t.hasOwnProperty(n)&&l[n]!==a&&Ls(e,n,a)}else for(var u in t)t.hasOwnProperty(u)&&Ls(e,u,t[u])}function ci(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 hh=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"]]),mh=/^[\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 Hn(e){return mh.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Bt(){}var si=null;function fi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fl=null,Il=null;function Vs(e){var t=Kl(e);if(t&&(e=t.stateNode)){var l=e[lt]||null;e:switch(e=t.stateNode,t.type){case"input":if(ui(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+xt(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var a=l[t];if(a!==e&&a.form===e.form){var n=a[lt]||null;if(!n)throw Error(o(90));ui(a,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name)}}for(t=0;t<l.length;t++)a=l[t],a.form===e.form&&Gs(a)}break e;case"textarea":Xs(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Wl(e,!!l.multiple,t,!1)}}}var oi=!1;function Ks(e,t,l){if(oi)return e(t,l);oi=!0;try{var a=e(t);return a}finally{if(oi=!1,(Fl!==null||Il!==null)&&(Tu(),Fl&&(t=Fl,e=Il,Il=Fl=null,Vs(t),e)))for(t=0;t<e.length;t++)Vs(e[t])}}function qa(e,t){var l=e.stateNode;if(l===null)return null;var a=l[lt]||null;if(a===null)return null;l=a[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":(a=!a.disabled)||(e=e.type,a=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!a;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var Yt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ri=!1;if(Yt)try{var Ha={};Object.defineProperty(Ha,"passive",{get:function(){ri=!0}}),window.addEventListener("test",Ha,Ha),window.removeEventListener("test",Ha,Ha)}catch{ri=!1}var ll=null,di=null,Bn=null;function Js(){if(Bn)return Bn;var e,t=di,l=t.length,a,n="value"in ll?ll.value:ll.textContent,u=n.length;for(e=0;e<l&&t[e]===n[e];e++);var c=l-e;for(a=1;a<=c&&t[l-a]===n[u-a];a++);return Bn=n.slice(e,1<a?1-a:void 0)}function Yn(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 Gn(){return!0}function ks(){return!1}function at(e){function t(l,a,n,u,c){this._reactName=l,this._targetInst=n,this.type=a,this.nativeEvent=u,this.target=c,this.currentTarget=null;for(var f in e)e.hasOwnProperty(f)&&(l=e[f],this[f]=l?l(u):u[f]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Gn:ks,this.isPropagationStopped=ks,this}return O(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Gn)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Gn)},persist:function(){},isPersistent:Gn}),t}var Ol={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wn=at(Ol),Ba=O({},Ol,{view:0,detail:0}),yh=at(Ba),hi,mi,Ya,Xn=O({},Ba,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vi,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!==Ya&&(Ya&&e.type==="mousemove"?(hi=e.screenX-Ya.screenX,mi=e.screenY-Ya.screenY):mi=hi=0,Ya=e),hi)},movementY:function(e){return"movementY"in e?e.movementY:mi}}),Ws=at(Xn),vh=O({},Xn,{dataTransfer:0}),gh=at(vh),ph=O({},Ba,{relatedTarget:0}),yi=at(ph),bh=O({},Ol,{animationName:0,elapsedTime:0,pseudoElement:0}),xh=at(bh),Sh=O({},Ol,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),jh=at(Sh),Th=O({},Ol,{data:0}),$s=at(Th),Eh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ah={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"},_h={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function zh(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=_h[e])?!!t[e]:!1}function vi(){return zh}var Oh=O({},Ba,{key:function(e){if(e.key){var t=Eh[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Yn(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Ah[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vi,charCode:function(e){return e.type==="keypress"?Yn(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Yn(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Nh=at(Oh),Ch=O({},Xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Fs=at(Ch),Dh=O({},Ba,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vi}),Mh=at(Dh),Rh=O({},Ol,{propertyName:0,elapsedTime:0,pseudoElement:0}),Uh=at(Rh),qh=O({},Xn,{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}),Hh=at(qh),Bh=O({},Ol,{newState:0,oldState:0}),Yh=at(Bh),Gh=[9,13,27,32],gi=Yt&&"CompositionEvent"in window,Ga=null;Yt&&"documentMode"in document&&(Ga=document.documentMode);var wh=Yt&&"TextEvent"in window&&!Ga,Is=Yt&&(!gi||Ga&&8<Ga&&11>=Ga),Ps=" ",ef=!1;function tf(e,t){switch(e){case"keyup":return Gh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function lf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Pl=!1;function Xh(e,t){switch(e){case"compositionend":return lf(t);case"keypress":return t.which!==32?null:(ef=!0,Ps);case"textInput":return e=t.data,e===Ps&&ef?null:e;default:return null}}function Qh(e,t){if(Pl)return e==="compositionend"||!gi&&tf(e,t)?(e=Js(),Bn=di=ll=null,Pl=!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 Is&&t.locale!=="ko"?null:t.data;default:return null}}var Lh={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 af(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Lh[e.type]:t==="textarea"}function nf(e,t,l,a){Fl?Il?Il.push(a):Il=[a]:Fl=a,t=Cu(t,"onChange"),0<t.length&&(l=new wn("onChange","change",null,l,a),e.push({event:l,listeners:t}))}var wa=null,Xa=null;function Zh(e){Qr(e,0)}function Qn(e){var t=Ua(e);if(Gs(t))return e}function uf(e,t){if(e==="change")return t}var cf=!1;if(Yt){var pi;if(Yt){var bi="oninput"in document;if(!bi){var sf=document.createElement("div");sf.setAttribute("oninput","return;"),bi=typeof sf.oninput=="function"}pi=bi}else pi=!1;cf=pi&&(!document.documentMode||9<document.documentMode)}function ff(){wa&&(wa.detachEvent("onpropertychange",of),Xa=wa=null)}function of(e){if(e.propertyName==="value"&&Qn(Xa)){var t=[];nf(t,Xa,e,fi(e)),Ks(Zh,t)}}function Vh(e,t,l){e==="focusin"?(ff(),wa=t,Xa=l,wa.attachEvent("onpropertychange",of)):e==="focusout"&&ff()}function Kh(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Qn(Xa)}function Jh(e,t){if(e==="click")return Qn(t)}function kh(e,t){if(e==="input"||e==="change")return Qn(t)}function Wh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var dt=typeof Object.is=="function"?Object.is:Wh;function Qa(e,t){if(dt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),a=Object.keys(t);if(l.length!==a.length)return!1;for(a=0;a<l.length;a++){var n=l[a];if(!$u.call(t,n)||!dt(e[n],t[n]))return!1}return!0}function rf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function df(e,t){var l=rf(e);e=0;for(var a;l;){if(l.nodeType===3){if(a=e+l.textContent.length,e<=t&&a>=t)return{node:l,offset:t-e};e=a}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=rf(l)}}function hf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?hf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function mf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=qn(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=qn(e.document)}return t}function xi(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 $h=Yt&&"documentMode"in document&&11>=document.documentMode,ea=null,Si=null,La=null,ji=!1;function yf(e,t,l){var a=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ji||ea==null||ea!==qn(a)||(a=ea,"selectionStart"in a&&xi(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),La&&Qa(La,a)||(La=a,a=Cu(Si,"onSelect"),0<a.length&&(t=new wn("onSelect","select",null,t,l),e.push({event:t,listeners:a}),t.target=ea)))}function Nl(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var ta={animationend:Nl("Animation","AnimationEnd"),animationiteration:Nl("Animation","AnimationIteration"),animationstart:Nl("Animation","AnimationStart"),transitionrun:Nl("Transition","TransitionRun"),transitionstart:Nl("Transition","TransitionStart"),transitioncancel:Nl("Transition","TransitionCancel"),transitionend:Nl("Transition","TransitionEnd")},Ti={},vf={};Yt&&(vf=document.createElement("div").style,"AnimationEvent"in window||(delete ta.animationend.animation,delete ta.animationiteration.animation,delete ta.animationstart.animation),"TransitionEvent"in window||delete ta.transitionend.transition);function Cl(e){if(Ti[e])return Ti[e];if(!ta[e])return e;var t=ta[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in vf)return Ti[e]=t[l];return e}var gf=Cl("animationend"),pf=Cl("animationiteration"),bf=Cl("animationstart"),Fh=Cl("transitionrun"),Ih=Cl("transitionstart"),Ph=Cl("transitioncancel"),xf=Cl("transitionend"),Sf=new Map,Ei="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(" ");Ei.push("scrollEnd");function Nt(e,t){Sf.set(e,t),zl(t,[e])}var Ln=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)},St=[],la=0,Ai=0;function Zn(){for(var e=la,t=Ai=la=0;t<e;){var l=St[t];St[t++]=null;var a=St[t];St[t++]=null;var n=St[t];St[t++]=null;var u=St[t];if(St[t++]=null,a!==null&&n!==null){var c=a.pending;c===null?n.next=n:(n.next=c.next,c.next=n),a.pending=n}u!==0&&jf(l,n,u)}}function Vn(e,t,l,a){St[la++]=e,St[la++]=t,St[la++]=l,St[la++]=a,Ai|=a,e.lanes|=a,e=e.alternate,e!==null&&(e.lanes|=a)}function _i(e,t,l,a){return Vn(e,t,l,a),Kn(e)}function Dl(e,t){return Vn(e,null,null,t),Kn(e)}function jf(e,t,l){e.lanes|=l;var a=e.alternate;a!==null&&(a.lanes|=l);for(var n=!1,u=e.return;u!==null;)u.childLanes|=l,a=u.alternate,a!==null&&(a.childLanes|=l),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(n=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,n&&t!==null&&(n=31-rt(l),e=u.hiddenUpdates,a=e[n],a===null?e[n]=[t]:a.push(t),t.lane=l|536870912),u):null}function Kn(e){if(50<dn)throw dn=0,qc=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var aa={};function em(e,t,l,a){this.tag=e,this.key=l,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=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ht(e,t,l,a){return new em(e,t,l,a)}function zi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Gt(e,t){var l=e.alternate;return l===null?(l=ht(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function Tf(e,t){e.flags&=65011714;var l=e.alternate;return l===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=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Jn(e,t,l,a,n,u){var c=0;if(a=e,typeof e=="function")zi(e)&&(c=1);else if(typeof e=="string")c=uy(e,l,X.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case je:return e=ht(31,l,t,n),e.elementType=je,e.lanes=u,e;case Z:return Ml(l.children,n,u,t);case W:c=8,n|=24;break;case ae:return e=ht(12,l,t,n|2),e.elementType=ae,e.lanes=u,e;case xe:return e=ht(13,l,t,n),e.elementType=xe,e.lanes=u,e;case k:return e=ht(19,l,t,n),e.elementType=k,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case le:c=10;break e;case $:c=9;break e;case ne:c=11;break e;case V:c=14;break e;case Se:c=16,a=null;break e}c=29,l=Error(o(130,e===null?"null":typeof e,"")),a=null}return t=ht(c,l,t,n),t.elementType=e,t.type=a,t.lanes=u,t}function Ml(e,t,l,a){return e=ht(7,e,a,t),e.lanes=l,e}function Oi(e,t,l){return e=ht(6,e,null,t),e.lanes=l,e}function Ef(e){var t=ht(18,null,null,0);return t.stateNode=e,t}function Ni(e,t,l){return t=ht(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Af=new WeakMap;function jt(e,t){if(typeof e=="object"&&e!==null){var l=Af.get(e);return l!==void 0?l:(t={value:e,source:t,stack:Ts(t)},Af.set(e,t),t)}return{value:e,source:t,stack:Ts(t)}}var na=[],ua=0,kn=null,Za=0,Tt=[],Et=0,al=null,Mt=1,Rt="";function wt(e,t){na[ua++]=Za,na[ua++]=kn,kn=e,Za=t}function _f(e,t,l){Tt[Et++]=Mt,Tt[Et++]=Rt,Tt[Et++]=al,al=e;var a=Mt;e=Rt;var n=32-rt(a)-1;a&=~(1<<n),l+=1;var u=32-rt(t)+n;if(30<u){var c=n-n%5;u=(a&(1<<c)-1).toString(32),a>>=c,n-=c,Mt=1<<32-rt(t)+n|l<<n|a,Rt=u+e}else Mt=1<<u|l<<n|a,Rt=e}function Ci(e){e.return!==null&&(wt(e,1),_f(e,1,0))}function Di(e){for(;e===kn;)kn=na[--ua],na[ua]=null,Za=na[--ua],na[ua]=null;for(;e===al;)al=Tt[--Et],Tt[Et]=null,Rt=Tt[--Et],Tt[Et]=null,Mt=Tt[--Et],Tt[Et]=null}function zf(e,t){Tt[Et++]=Mt,Tt[Et++]=Rt,Tt[Et++]=al,Mt=t.id,Rt=t.overflow,al=e}var We=null,De=null,re=!1,nl=null,At=!1,Mi=Error(o(519));function ul(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Va(jt(t,e)),Mi}function Of(e){var t=e.stateNode,l=e.type,a=e.memoizedProps;switch(t[ke]=e,t[lt]=a,l){case"dialog":ce("cancel",t),ce("close",t);break;case"iframe":case"object":case"embed":ce("load",t);break;case"video":case"audio":for(l=0;l<mn.length;l++)ce(mn[l],t);break;case"source":ce("error",t);break;case"img":case"image":case"link":ce("error",t),ce("load",t);break;case"details":ce("toggle",t);break;case"input":ce("invalid",t),ws(t,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":ce("invalid",t);break;case"textarea":ce("invalid",t),Qs(t,a.value,a.defaultValue,a.children)}l=a.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||a.suppressHydrationWarning===!0||Kr(t.textContent,l)?(a.popover!=null&&(ce("beforetoggle",t),ce("toggle",t)),a.onScroll!=null&&ce("scroll",t),a.onScrollEnd!=null&&ce("scrollend",t),a.onClick!=null&&(t.onclick=Bt),t=!0):t=!1,t||ul(e,!0)}function Nf(e){for(We=e.return;We;)switch(We.tag){case 5:case 31:case 13:At=!1;return;case 27:case 3:At=!0;return;default:We=We.return}}function ia(e){if(e!==We)return!1;if(!re)return Nf(e),re=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||$c(e.type,e.memoizedProps)),l=!l),l&&De&&ul(e),Nf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));De=td(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));De=td(e)}else t===27?(t=De,bl(e.type)?(e=ts,ts=null,De=e):De=t):De=We?zt(e.stateNode.nextSibling):null;return!0}function Rl(){De=We=null,re=!1}function Ri(){var e=nl;return e!==null&&(ct===null?ct=e:ct.push.apply(ct,e),nl=null),e}function Va(e){nl===null?nl=[e]:nl.push(e)}var Ui=m(null),Ul=null,Xt=null;function il(e,t,l){B(Ui,t._currentValue),t._currentValue=l}function Qt(e){e._currentValue=Ui.current,M(Ui)}function qi(e,t,l){for(;e!==null;){var a=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,a!==null&&(a.childLanes|=t)):a!==null&&(a.childLanes&t)!==t&&(a.childLanes|=t),e===l)break;e=e.return}}function Hi(e,t,l,a){var n=e.child;for(n!==null&&(n.return=e);n!==null;){var u=n.dependencies;if(u!==null){var c=n.child;u=u.firstContext;e:for(;u!==null;){var f=u;u=n;for(var r=0;r<t.length;r++)if(f.context===t[r]){u.lanes|=l,f=u.alternate,f!==null&&(f.lanes|=l),qi(u.return,l,e),a||(c=null);break e}u=f.next}}else if(n.tag===18){if(c=n.return,c===null)throw Error(o(341));c.lanes|=l,u=c.alternate,u!==null&&(u.lanes|=l),qi(c,l,e),c=null}else c=n.child;if(c!==null)c.return=n;else for(c=n;c!==null;){if(c===e){c=null;break}if(n=c.sibling,n!==null){n.return=c.return,c=n;break}c=c.return}n=c}}function ca(e,t,l,a){e=null;for(var n=t,u=!1;n!==null;){if(!u){if((n.flags&524288)!==0)u=!0;else if((n.flags&262144)!==0)break}if(n.tag===10){var c=n.alternate;if(c===null)throw Error(o(387));if(c=c.memoizedProps,c!==null){var f=n.type;dt(n.pendingProps.value,c.value)||(e!==null?e.push(f):e=[f])}}else if(n===ve.current){if(c=n.alternate,c===null)throw Error(o(387));c.memoizedState.memoizedState!==n.memoizedState.memoizedState&&(e!==null?e.push(bn):e=[bn])}n=n.return}e!==null&&Hi(t,e,l,a),t.flags|=262144}function Wn(e){for(e=e.firstContext;e!==null;){if(!dt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ql(e){Ul=e,Xt=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function $e(e){return Cf(Ul,e)}function $n(e,t){return Ul===null&&ql(e),Cf(e,t)}function Cf(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},Xt===null){if(e===null)throw Error(o(308));Xt=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xt=Xt.next=t;return l}var tm=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,a){e.push(a)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},lm=s.unstable_scheduleCallback,am=s.unstable_NormalPriority,we={$$typeof:le,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Bi(){return{controller:new tm,data:new Map,refCount:0}}function Ka(e){e.refCount--,e.refCount===0&&lm(am,function(){e.controller.abort()})}var Ja=null,Yi=0,sa=0,fa=null;function nm(e,t){if(Ja===null){var l=Ja=[];Yi=0,sa=Xc(),fa={status:"pending",value:void 0,then:function(a){l.push(a)}}}return Yi++,t.then(Df,Df),t}function Df(){if(--Yi===0&&Ja!==null){fa!==null&&(fa.status="fulfilled");var e=Ja;Ja=null,sa=0,fa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function um(e,t){var l=[],a={status:"pending",value:null,reason:null,then:function(n){l.push(n)}};return e.then(function(){a.status="fulfilled",a.value=t;for(var n=0;n<l.length;n++)(0,l[n])(t)},function(n){for(a.status="rejected",a.reason=n,n=0;n<l.length;n++)(0,l[n])(void 0)}),a}var Mf=j.S;j.S=function(e,t){vr=ft(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&nm(e,t),Mf!==null&&Mf(e,t)};var Hl=m(null);function Gi(){var e=Hl.current;return e!==null?e:Oe.pooledCache}function Fn(e,t){t===null?B(Hl,Hl.current):B(Hl,t.pool)}function Rf(){var e=Gi();return e===null?null:{parent:we._currentValue,pool:e}}var oa=Error(o(460)),wi=Error(o(474)),In=Error(o(542)),Pn={then:function(){}};function Uf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function qf(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(Bt,Bt),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Bf(e),e;default:if(typeof t.status=="string")t.then(Bt,Bt);else{if(e=Oe,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(a){if(t.status==="pending"){var n=t;n.status="fulfilled",n.value=a}},function(a){if(t.status==="pending"){var n=t;n.status="rejected",n.reason=a}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Bf(e),e}throw Yl=t,oa}}function Bl(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Yl=l,oa):l}}var Yl=null;function Hf(){if(Yl===null)throw Error(o(459));var e=Yl;return Yl=null,e}function Bf(e){if(e===oa||e===In)throw Error(o(483))}var ra=null,ka=0;function eu(e){var t=ka;return ka+=1,ra===null&&(ra=[]),qf(ra,e,t)}function Wa(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function tu(e,t){throw t.$$typeof===R?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Yf(e){function t(y,h){if(e){var v=y.deletions;v===null?(y.deletions=[h],y.flags|=16):v.push(h)}}function l(y,h){if(!e)return null;for(;h!==null;)t(y,h),h=h.sibling;return null}function a(y){for(var h=new Map;y!==null;)y.key!==null?h.set(y.key,y):h.set(y.index,y),y=y.sibling;return h}function n(y,h){return y=Gt(y,h),y.index=0,y.sibling=null,y}function u(y,h,v){return y.index=v,e?(v=y.alternate,v!==null?(v=v.index,v<h?(y.flags|=67108866,h):v):(y.flags|=67108866,h)):(y.flags|=1048576,h)}function c(y){return e&&y.alternate===null&&(y.flags|=67108866),y}function f(y,h,v,z){return h===null||h.tag!==6?(h=Oi(v,y.mode,z),h.return=y,h):(h=n(h,v),h.return=y,h)}function r(y,h,v,z){var K=v.type;return K===Z?T(y,h,v.props.children,z,v.key):h!==null&&(h.elementType===K||typeof K=="object"&&K!==null&&K.$$typeof===Se&&Bl(K)===h.type)?(h=n(h,v.props),Wa(h,v),h.return=y,h):(h=Jn(v.type,v.key,v.props,null,y.mode,z),Wa(h,v),h.return=y,h)}function g(y,h,v,z){return h===null||h.tag!==4||h.stateNode.containerInfo!==v.containerInfo||h.stateNode.implementation!==v.implementation?(h=Ni(v,y.mode,z),h.return=y,h):(h=n(h,v.children||[]),h.return=y,h)}function T(y,h,v,z,K){return h===null||h.tag!==7?(h=Ml(v,y.mode,z,K),h.return=y,h):(h=n(h,v),h.return=y,h)}function C(y,h,v){if(typeof h=="string"&&h!==""||typeof h=="number"||typeof h=="bigint")return h=Oi(""+h,y.mode,v),h.return=y,h;if(typeof h=="object"&&h!==null){switch(h.$$typeof){case Q:return v=Jn(h.type,h.key,h.props,null,y.mode,v),Wa(v,h),v.return=y,v;case G:return h=Ni(h,y.mode,v),h.return=y,h;case Se:return h=Bl(h),C(y,h,v)}if(Ze(h)||de(h))return h=Ml(h,y.mode,v,null),h.return=y,h;if(typeof h.then=="function")return C(y,eu(h),v);if(h.$$typeof===le)return C(y,$n(y,h),v);tu(y,h)}return null}function p(y,h,v,z){var K=h!==null?h.key:null;if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return K!==null?null:f(y,h,""+v,z);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Q:return v.key===K?r(y,h,v,z):null;case G:return v.key===K?g(y,h,v,z):null;case Se:return v=Bl(v),p(y,h,v,z)}if(Ze(v)||de(v))return K!==null?null:T(y,h,v,z,null);if(typeof v.then=="function")return p(y,h,eu(v),z);if(v.$$typeof===le)return p(y,h,$n(y,v),z);tu(y,v)}return null}function S(y,h,v,z,K){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return y=y.get(v)||null,f(h,y,""+z,K);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case Q:return y=y.get(z.key===null?v:z.key)||null,r(h,y,z,K);case G:return y=y.get(z.key===null?v:z.key)||null,g(h,y,z,K);case Se:return z=Bl(z),S(y,h,v,z,K)}if(Ze(z)||de(z))return y=y.get(v)||null,T(h,y,z,K,null);if(typeof z.then=="function")return S(y,h,v,eu(z),K);if(z.$$typeof===le)return S(y,h,v,$n(h,z),K);tu(h,z)}return null}function w(y,h,v,z){for(var K=null,he=null,L=h,te=h=0,oe=null;L!==null&&te<v.length;te++){L.index>te?(oe=L,L=null):oe=L.sibling;var me=p(y,L,v[te],z);if(me===null){L===null&&(L=oe);break}e&&L&&me.alternate===null&&t(y,L),h=u(me,h,te),he===null?K=me:he.sibling=me,he=me,L=oe}if(te===v.length)return l(y,L),re&&wt(y,te),K;if(L===null){for(;te<v.length;te++)L=C(y,v[te],z),L!==null&&(h=u(L,h,te),he===null?K=L:he.sibling=L,he=L);return re&&wt(y,te),K}for(L=a(L);te<v.length;te++)oe=S(L,y,te,v[te],z),oe!==null&&(e&&oe.alternate!==null&&L.delete(oe.key===null?te:oe.key),h=u(oe,h,te),he===null?K=oe:he.sibling=oe,he=oe);return e&&L.forEach(function(El){return t(y,El)}),re&&wt(y,te),K}function J(y,h,v,z){if(v==null)throw Error(o(151));for(var K=null,he=null,L=h,te=h=0,oe=null,me=v.next();L!==null&&!me.done;te++,me=v.next()){L.index>te?(oe=L,L=null):oe=L.sibling;var El=p(y,L,me.value,z);if(El===null){L===null&&(L=oe);break}e&&L&&El.alternate===null&&t(y,L),h=u(El,h,te),he===null?K=El:he.sibling=El,he=El,L=oe}if(me.done)return l(y,L),re&&wt(y,te),K;if(L===null){for(;!me.done;te++,me=v.next())me=C(y,me.value,z),me!==null&&(h=u(me,h,te),he===null?K=me:he.sibling=me,he=me);return re&&wt(y,te),K}for(L=a(L);!me.done;te++,me=v.next())me=S(L,y,te,me.value,z),me!==null&&(e&&me.alternate!==null&&L.delete(me.key===null?te:me.key),h=u(me,h,te),he===null?K=me:he.sibling=me,he=me);return e&&L.forEach(function(vy){return t(y,vy)}),re&&wt(y,te),K}function _e(y,h,v,z){if(typeof v=="object"&&v!==null&&v.type===Z&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Q:e:{for(var K=v.key;h!==null;){if(h.key===K){if(K=v.type,K===Z){if(h.tag===7){l(y,h.sibling),z=n(h,v.props.children),z.return=y,y=z;break e}}else if(h.elementType===K||typeof K=="object"&&K!==null&&K.$$typeof===Se&&Bl(K)===h.type){l(y,h.sibling),z=n(h,v.props),Wa(z,v),z.return=y,y=z;break e}l(y,h);break}else t(y,h);h=h.sibling}v.type===Z?(z=Ml(v.props.children,y.mode,z,v.key),z.return=y,y=z):(z=Jn(v.type,v.key,v.props,null,y.mode,z),Wa(z,v),z.return=y,y=z)}return c(y);case G:e:{for(K=v.key;h!==null;){if(h.key===K)if(h.tag===4&&h.stateNode.containerInfo===v.containerInfo&&h.stateNode.implementation===v.implementation){l(y,h.sibling),z=n(h,v.children||[]),z.return=y,y=z;break e}else{l(y,h);break}else t(y,h);h=h.sibling}z=Ni(v,y.mode,z),z.return=y,y=z}return c(y);case Se:return v=Bl(v),_e(y,h,v,z)}if(Ze(v))return w(y,h,v,z);if(de(v)){if(K=de(v),typeof K!="function")throw Error(o(150));return v=K.call(v),J(y,h,v,z)}if(typeof v.then=="function")return _e(y,h,eu(v),z);if(v.$$typeof===le)return _e(y,h,$n(y,v),z);tu(y,v)}return typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint"?(v=""+v,h!==null&&h.tag===6?(l(y,h.sibling),z=n(h,v),z.return=y,y=z):(l(y,h),z=Oi(v,y.mode,z),z.return=y,y=z),c(y)):l(y,h)}return function(y,h,v,z){try{ka=0;var K=_e(y,h,v,z);return ra=null,K}catch(L){if(L===oa||L===In)throw L;var he=ht(29,L,null,y.mode);return he.lanes=z,he.return=y,he}finally{}}}var Gl=Yf(!0),Gf=Yf(!1),cl=!1;function Xi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Qi(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 sl(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function fl(e,t,l){var a=e.updateQueue;if(a===null)return null;if(a=a.shared,(ye&2)!==0){var n=a.pending;return n===null?t.next=t:(t.next=n.next,n.next=t),a.pending=t,t=Kn(e),jf(e,null,l),t}return Vn(e,a,t,l),Kn(e)}function $a(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,Ns(e,l)}}function Li(e,t){var l=e.updateQueue,a=e.alternate;if(a!==null&&(a=a.updateQueue,l===a)){var n=null,u=null;if(l=l.firstBaseUpdate,l!==null){do{var c={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};u===null?n=u=c:u=u.next=c,l=l.next}while(l!==null);u===null?n=u=t:u=u.next=t}else n=u=t;l={baseState:a.baseState,firstBaseUpdate:n,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var Zi=!1;function Fa(){if(Zi){var e=fa;if(e!==null)throw e}}function Ia(e,t,l,a){Zi=!1;var n=e.updateQueue;cl=!1;var u=n.firstBaseUpdate,c=n.lastBaseUpdate,f=n.shared.pending;if(f!==null){n.shared.pending=null;var r=f,g=r.next;r.next=null,c===null?u=g:c.next=g,c=r;var T=e.alternate;T!==null&&(T=T.updateQueue,f=T.lastBaseUpdate,f!==c&&(f===null?T.firstBaseUpdate=g:f.next=g,T.lastBaseUpdate=r))}if(u!==null){var C=n.baseState;c=0,T=g=r=null,f=u;do{var p=f.lane&-536870913,S=p!==f.lane;if(S?(fe&p)===p:(a&p)===p){p!==0&&p===sa&&(Zi=!0),T!==null&&(T=T.next={lane:0,tag:f.tag,payload:f.payload,callback:null,next:null});e:{var w=e,J=f;p=t;var _e=l;switch(J.tag){case 1:if(w=J.payload,typeof w=="function"){C=w.call(_e,C,p);break e}C=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=J.payload,p=typeof w=="function"?w.call(_e,C,p):w,p==null)break e;C=O({},C,p);break e;case 2:cl=!0}}p=f.callback,p!==null&&(e.flags|=64,S&&(e.flags|=8192),S=n.callbacks,S===null?n.callbacks=[p]:S.push(p))}else S={lane:p,tag:f.tag,payload:f.payload,callback:f.callback,next:null},T===null?(g=T=S,r=C):T=T.next=S,c|=p;if(f=f.next,f===null){if(f=n.shared.pending,f===null)break;S=f,f=S.next,S.next=null,n.lastBaseUpdate=S,n.shared.pending=null}}while(!0);T===null&&(r=C),n.baseState=r,n.firstBaseUpdate=g,n.lastBaseUpdate=T,u===null&&(n.shared.lanes=0),ml|=c,e.lanes=c,e.memoizedState=C}}function wf(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Xf(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)wf(l[e],t)}var da=m(null),lu=m(0);function Qf(e,t){e=Ft,B(lu,e),B(da,t),Ft=e|t.baseLanes}function Vi(){B(lu,Ft),B(da,da.current)}function Ki(){Ft=lu.current,M(da),M(lu)}var mt=m(null),_t=null;function ol(e){var t=e.alternate;B(Be,Be.current&1),B(mt,e),_t===null&&(t===null||da.current!==null||t.memoizedState!==null)&&(_t=e)}function Ji(e){B(Be,Be.current),B(mt,e),_t===null&&(_t=e)}function Lf(e){e.tag===22?(B(Be,Be.current),B(mt,e),_t===null&&(_t=e)):rl()}function rl(){B(Be,Be.current),B(mt,mt.current)}function yt(e){M(mt),_t===e&&(_t=null),M(Be)}var Be=m(0);function au(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Pc(l)||es(l)))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 Lt=0,ee=null,Ee=null,Xe=null,nu=!1,ha=!1,wl=!1,uu=0,Pa=0,ma=null,im=0;function Ue(){throw Error(o(321))}function ki(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!dt(e[l],t[l]))return!1;return!0}function Wi(e,t,l,a,n,u){return Lt=u,ee=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?zo:oc,wl=!1,u=l(a,n),wl=!1,ha&&(u=Vf(t,l,a,n)),Zf(e),u}function Zf(e){j.H=ln;var t=Ee!==null&&Ee.next!==null;if(Lt=0,Xe=Ee=ee=null,nu=!1,Pa=0,ma=null,t)throw Error(o(300));e===null||Qe||(e=e.dependencies,e!==null&&Wn(e)&&(Qe=!0))}function Vf(e,t,l,a){ee=e;var n=0;do{if(ha&&(ma=null),Pa=0,ha=!1,25<=n)throw Error(o(301));if(n+=1,Xe=Ee=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}j.H=Oo,u=t(l,a)}while(ha);return u}function cm(){var e=j.H,t=e.useState()[0];return t=typeof t.then=="function"?en(t):t,e=e.useState()[0],(Ee!==null?Ee.memoizedState:null)!==e&&(ee.flags|=1024),t}function $i(){var e=uu!==0;return uu=0,e}function Fi(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Ii(e){if(nu){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}nu=!1}Lt=0,Xe=Ee=ee=null,ha=!1,Pa=uu=0,ma=null}function tt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Xe===null?ee.memoizedState=Xe=e:Xe=Xe.next=e,Xe}function Ye(){if(Ee===null){var e=ee.alternate;e=e!==null?e.memoizedState:null}else e=Ee.next;var t=Xe===null?ee.memoizedState:Xe.next;if(t!==null)Xe=t,Ee=e;else{if(e===null)throw ee.alternate===null?Error(o(467)):Error(o(310));Ee=e,e={memoizedState:Ee.memoizedState,baseState:Ee.baseState,baseQueue:Ee.baseQueue,queue:Ee.queue,next:null},Xe===null?ee.memoizedState=Xe=e:Xe=Xe.next=e}return Xe}function iu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function en(e){var t=Pa;return Pa+=1,ma===null&&(ma=[]),e=qf(ma,e,t),t=ee,(Xe===null?t.memoizedState:Xe.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?zo:oc),e}function cu(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return en(e);if(e.$$typeof===le)return $e(e)}throw Error(o(438,String(e)))}function Pi(e){var t=null,l=ee.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var a=ee.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(t={data:a.data.map(function(n){return n.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=iu(),ee.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),a=0;a<e;a++)l[a]=se;return t.index++,l}function Zt(e,t){return typeof t=="function"?t(e):t}function su(e){var t=Ye();return ec(t,Ee,e)}function ec(e,t,l){var a=e.queue;if(a===null)throw Error(o(311));a.lastRenderedReducer=l;var n=e.baseQueue,u=a.pending;if(u!==null){if(n!==null){var c=n.next;n.next=u.next,u.next=c}t.baseQueue=n=u,a.pending=null}if(u=e.baseState,n===null)e.memoizedState=u;else{t=n.next;var f=c=null,r=null,g=t,T=!1;do{var C=g.lane&-536870913;if(C!==g.lane?(fe&C)===C:(Lt&C)===C){var p=g.revertLane;if(p===0)r!==null&&(r=r.next={lane:0,revertLane:0,gesture:null,action:g.action,hasEagerState:g.hasEagerState,eagerState:g.eagerState,next:null}),C===sa&&(T=!0);else if((Lt&p)===p){g=g.next,p===sa&&(T=!0);continue}else C={lane:0,revertLane:g.revertLane,gesture:null,action:g.action,hasEagerState:g.hasEagerState,eagerState:g.eagerState,next:null},r===null?(f=r=C,c=u):r=r.next=C,ee.lanes|=p,ml|=p;C=g.action,wl&&l(u,C),u=g.hasEagerState?g.eagerState:l(u,C)}else p={lane:C,revertLane:g.revertLane,gesture:g.gesture,action:g.action,hasEagerState:g.hasEagerState,eagerState:g.eagerState,next:null},r===null?(f=r=p,c=u):r=r.next=p,ee.lanes|=C,ml|=C;g=g.next}while(g!==null&&g!==t);if(r===null?c=u:r.next=f,!dt(u,e.memoizedState)&&(Qe=!0,T&&(l=fa,l!==null)))throw l;e.memoizedState=u,e.baseState=c,e.baseQueue=r,a.lastRenderedState=u}return n===null&&(a.lanes=0),[e.memoizedState,a.dispatch]}function tc(e){var t=Ye(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var a=l.dispatch,n=l.pending,u=t.memoizedState;if(n!==null){l.pending=null;var c=n=n.next;do u=e(u,c.action),c=c.next;while(c!==n);dt(u,t.memoizedState)||(Qe=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),l.lastRenderedState=u}return[u,a]}function Kf(e,t,l){var a=ee,n=Ye(),u=re;if(u){if(l===void 0)throw Error(o(407));l=l()}else l=t();var c=!dt((Ee||n).memoizedState,l);if(c&&(n.memoizedState=l,Qe=!0),n=n.queue,nc(Wf.bind(null,a,n,e),[e]),n.getSnapshot!==t||c||Xe!==null&&Xe.memoizedState.tag&1){if(a.flags|=2048,ya(9,{destroy:void 0},kf.bind(null,a,n,l,t),null),Oe===null)throw Error(o(349));u||(Lt&127)!==0||Jf(a,t,l)}return l}function Jf(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=ee.updateQueue,t===null?(t=iu(),ee.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function kf(e,t,l,a){t.value=l,t.getSnapshot=a,$f(t)&&Ff(e)}function Wf(e,t,l){return l(function(){$f(t)&&Ff(e)})}function $f(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!dt(e,l)}catch{return!0}}function Ff(e){var t=Dl(e,2);t!==null&&st(t,e,2)}function lc(e){var t=tt();if(typeof e=="function"){var l=e;if(e=l(),wl){el(!0);try{l()}finally{el(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zt,lastRenderedState:e},t}function If(e,t,l,a){return e.baseState=l,ec(e,Ee,typeof a=="function"?a:Zt)}function sm(e,t,l,a,n){if(ru(e))throw Error(o(485));if(e=t.action,e!==null){var u={payload:n,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(c){u.listeners.push(c)}};j.T!==null?l(!0):u.isTransition=!1,a(u),l=t.pending,l===null?(u.next=t.pending=u,Pf(t,u)):(u.next=l.next,t.pending=l.next=u)}}function Pf(e,t){var l=t.action,a=t.payload,n=e.state;if(t.isTransition){var u=j.T,c={};j.T=c;try{var f=l(n,a),r=j.S;r!==null&&r(c,f),eo(e,t,f)}catch(g){ac(e,t,g)}finally{u!==null&&c.types!==null&&(u.types=c.types),j.T=u}}else try{u=l(n,a),eo(e,t,u)}catch(g){ac(e,t,g)}}function eo(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(a){to(e,t,a)},function(a){return ac(e,t,a)}):to(e,t,l)}function to(e,t,l){t.status="fulfilled",t.value=l,lo(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Pf(e,l)))}function ac(e,t,l){var a=e.pending;if(e.pending=null,a!==null){a=a.next;do t.status="rejected",t.reason=l,lo(t),t=t.next;while(t!==a)}e.action=null}function lo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ao(e,t){return t}function no(e,t){if(re){var l=Oe.formState;if(l!==null){e:{var a=ee;if(re){if(De){t:{for(var n=De,u=At;n.nodeType!==8;){if(!u){n=null;break t}if(n=zt(n.nextSibling),n===null){n=null;break t}}u=n.data,n=u==="F!"||u==="F"?n:null}if(n){De=zt(n.nextSibling),a=n.data==="F!";break e}}ul(a)}a=!1}a&&(t=l[0])}}return l=tt(),l.memoizedState=l.baseState=t,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ao,lastRenderedState:t},l.queue=a,l=Eo.bind(null,ee,a),a.dispatch=l,a=lc(!1),u=fc.bind(null,ee,!1,a.queue),a=tt(),n={state:t,dispatch:null,action:e,pending:null},a.queue=n,l=sm.bind(null,ee,n,u,l),n.dispatch=l,a.memoizedState=e,[t,l,!1]}function uo(e){var t=Ye();return io(t,Ee,e)}function io(e,t,l){if(t=ec(e,t,ao)[0],e=su(Zt)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var a=en(t)}catch(c){throw c===oa?In:c}else a=t;t=Ye();var n=t.queue,u=n.dispatch;return l!==t.memoizedState&&(ee.flags|=2048,ya(9,{destroy:void 0},fm.bind(null,n,l),null)),[a,u,e]}function fm(e,t){e.action=t}function co(e){var t=Ye(),l=Ee;if(l!==null)return io(t,l,e);Ye(),t=t.memoizedState,l=Ye();var a=l.queue.dispatch;return l.memoizedState=e,[t,a,!1]}function ya(e,t,l,a){return e={tag:e,create:l,deps:a,inst:t,next:null},t=ee.updateQueue,t===null&&(t=iu(),ee.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(a=l.next,l.next=e,e.next=a,t.lastEffect=e),e}function so(){return Ye().memoizedState}function fu(e,t,l,a){var n=tt();ee.flags|=e,n.memoizedState=ya(1|t,{destroy:void 0},l,a===void 0?null:a)}function ou(e,t,l,a){var n=Ye();a=a===void 0?null:a;var u=n.memoizedState.inst;Ee!==null&&a!==null&&ki(a,Ee.memoizedState.deps)?n.memoizedState=ya(t,u,l,a):(ee.flags|=e,n.memoizedState=ya(1|t,u,l,a))}function fo(e,t){fu(8390656,8,e,t)}function nc(e,t){ou(2048,8,e,t)}function om(e){ee.flags|=4;var t=ee.updateQueue;if(t===null)t=iu(),ee.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function oo(e){var t=Ye().memoizedState;return om({ref:t,nextImpl:e}),function(){if((ye&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function ro(e,t){return ou(4,2,e,t)}function ho(e,t){return ou(4,4,e,t)}function mo(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function yo(e,t,l){l=l!=null?l.concat([e]):null,ou(4,4,mo.bind(null,t,e),l)}function uc(){}function vo(e,t){var l=Ye();t=t===void 0?null:t;var a=l.memoizedState;return t!==null&&ki(t,a[1])?a[0]:(l.memoizedState=[e,t],e)}function go(e,t){var l=Ye();t=t===void 0?null:t;var a=l.memoizedState;if(t!==null&&ki(t,a[1]))return a[0];if(a=e(),wl){el(!0);try{e()}finally{el(!1)}}return l.memoizedState=[a,t],a}function ic(e,t,l){return l===void 0||(Lt&1073741824)!==0&&(fe&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=pr(),ee.lanes|=e,ml|=e,l)}function po(e,t,l,a){return dt(l,t)?l:da.current!==null?(e=ic(e,l,a),dt(e,t)||(Qe=!0),e):(Lt&42)===0||(Lt&1073741824)!==0&&(fe&261930)===0?(Qe=!0,e.memoizedState=l):(e=pr(),ee.lanes|=e,ml|=e,t)}function bo(e,t,l,a,n){var u=N.p;N.p=u!==0&&8>u?u:8;var c=j.T,f={};j.T=f,fc(e,!1,t,l);try{var r=n(),g=j.S;if(g!==null&&g(f,r),r!==null&&typeof r=="object"&&typeof r.then=="function"){var T=um(r,a);tn(e,t,T,pt(e))}else tn(e,t,a,pt(e))}catch(C){tn(e,t,{then:function(){},status:"rejected",reason:C},pt())}finally{N.p=u,c!==null&&f.types!==null&&(c.types=f.types),j.T=c}}function rm(){}function cc(e,t,l,a){if(e.tag!==5)throw Error(o(476));var n=xo(e).queue;bo(e,n,t,Y,l===null?rm:function(){return So(e),l(a)})}function xo(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zt,lastRenderedState:Y},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zt,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function So(e){var t=xo(e);t.next===null&&(t=e.alternate.memoizedState),tn(e,t.next.queue,{},pt())}function sc(){return $e(bn)}function jo(){return Ye().memoizedState}function To(){return Ye().memoizedState}function dm(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=pt();e=sl(l);var a=fl(t,e,l);a!==null&&(st(a,t,l),$a(a,t,l)),t={cache:Bi()},e.payload=t;return}t=t.return}}function hm(e,t,l){var a=pt();l={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ru(e)?Ao(t,l):(l=_i(e,t,l,a),l!==null&&(st(l,e,a),_o(l,t,a)))}function Eo(e,t,l){var a=pt();tn(e,t,l,a)}function tn(e,t,l,a){var n={lane:a,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(ru(e))Ao(t,n);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var c=t.lastRenderedState,f=u(c,l);if(n.hasEagerState=!0,n.eagerState=f,dt(f,c))return Vn(e,t,n,0),Oe===null&&Zn(),!1}catch{}finally{}if(l=_i(e,t,n,a),l!==null)return st(l,e,a),_o(l,t,a),!0}return!1}function fc(e,t,l,a){if(a={lane:2,revertLane:Xc(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ru(e)){if(t)throw Error(o(479))}else t=_i(e,l,a,2),t!==null&&st(t,e,2)}function ru(e){var t=e.alternate;return e===ee||t!==null&&t===ee}function Ao(e,t){ha=nu=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function _o(e,t,l){if((l&4194048)!==0){var a=t.lanes;a&=e.pendingLanes,l|=a,t.lanes=l,Ns(e,l)}}var ln={readContext:$e,use:cu,useCallback:Ue,useContext:Ue,useEffect:Ue,useImperativeHandle:Ue,useLayoutEffect:Ue,useInsertionEffect:Ue,useMemo:Ue,useReducer:Ue,useRef:Ue,useState:Ue,useDebugValue:Ue,useDeferredValue:Ue,useTransition:Ue,useSyncExternalStore:Ue,useId:Ue,useHostTransitionStatus:Ue,useFormState:Ue,useActionState:Ue,useOptimistic:Ue,useMemoCache:Ue,useCacheRefresh:Ue};ln.useEffectEvent=Ue;var zo={readContext:$e,use:cu,useCallback:function(e,t){return tt().memoizedState=[e,t===void 0?null:t],e},useContext:$e,useEffect:fo,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,fu(4194308,4,mo.bind(null,t,e),l)},useLayoutEffect:function(e,t){return fu(4194308,4,e,t)},useInsertionEffect:function(e,t){fu(4,2,e,t)},useMemo:function(e,t){var l=tt();t=t===void 0?null:t;var a=e();if(wl){el(!0);try{e()}finally{el(!1)}}return l.memoizedState=[a,t],a},useReducer:function(e,t,l){var a=tt();if(l!==void 0){var n=l(t);if(wl){el(!0);try{l(t)}finally{el(!1)}}}else n=t;return a.memoizedState=a.baseState=n,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},a.queue=e,e=e.dispatch=hm.bind(null,ee,e),[a.memoizedState,e]},useRef:function(e){var t=tt();return e={current:e},t.memoizedState=e},useState:function(e){e=lc(e);var t=e.queue,l=Eo.bind(null,ee,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:uc,useDeferredValue:function(e,t){var l=tt();return ic(l,e,t)},useTransition:function(){var e=lc(!1);return e=bo.bind(null,ee,e.queue,!0,!1),tt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var a=ee,n=tt();if(re){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),Oe===null)throw Error(o(349));(fe&127)!==0||Jf(a,t,l)}n.memoizedState=l;var u={value:l,getSnapshot:t};return n.queue=u,fo(Wf.bind(null,a,u,e),[e]),a.flags|=2048,ya(9,{destroy:void 0},kf.bind(null,a,u,l,t),null),l},useId:function(){var e=tt(),t=Oe.identifierPrefix;if(re){var l=Rt,a=Mt;l=(a&~(1<<32-rt(a)-1)).toString(32)+l,t="_"+t+"R_"+l,l=uu++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=im++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:sc,useFormState:no,useActionState:no,useOptimistic:function(e){var t=tt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=fc.bind(null,ee,!0,l),l.dispatch=t,[e,t]},useMemoCache:Pi,useCacheRefresh:function(){return tt().memoizedState=dm.bind(null,ee)},useEffectEvent:function(e){var t=tt(),l={impl:e};return t.memoizedState=l,function(){if((ye&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},oc={readContext:$e,use:cu,useCallback:vo,useContext:$e,useEffect:nc,useImperativeHandle:yo,useInsertionEffect:ro,useLayoutEffect:ho,useMemo:go,useReducer:su,useRef:so,useState:function(){return su(Zt)},useDebugValue:uc,useDeferredValue:function(e,t){var l=Ye();return po(l,Ee.memoizedState,e,t)},useTransition:function(){var e=su(Zt)[0],t=Ye().memoizedState;return[typeof e=="boolean"?e:en(e),t]},useSyncExternalStore:Kf,useId:jo,useHostTransitionStatus:sc,useFormState:uo,useActionState:uo,useOptimistic:function(e,t){var l=Ye();return If(l,Ee,e,t)},useMemoCache:Pi,useCacheRefresh:To};oc.useEffectEvent=oo;var Oo={readContext:$e,use:cu,useCallback:vo,useContext:$e,useEffect:nc,useImperativeHandle:yo,useInsertionEffect:ro,useLayoutEffect:ho,useMemo:go,useReducer:tc,useRef:so,useState:function(){return tc(Zt)},useDebugValue:uc,useDeferredValue:function(e,t){var l=Ye();return Ee===null?ic(l,e,t):po(l,Ee.memoizedState,e,t)},useTransition:function(){var e=tc(Zt)[0],t=Ye().memoizedState;return[typeof e=="boolean"?e:en(e),t]},useSyncExternalStore:Kf,useId:jo,useHostTransitionStatus:sc,useFormState:co,useActionState:co,useOptimistic:function(e,t){var l=Ye();return Ee!==null?If(l,Ee,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Pi,useCacheRefresh:To};Oo.useEffectEvent=oo;function rc(e,t,l,a){t=e.memoizedState,l=l(a,t),l=l==null?t:O({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var dc={enqueueSetState:function(e,t,l){e=e._reactInternals;var a=pt(),n=sl(a);n.payload=t,l!=null&&(n.callback=l),t=fl(e,n,a),t!==null&&(st(t,e,a),$a(t,e,a))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var a=pt(),n=sl(a);n.tag=1,n.payload=t,l!=null&&(n.callback=l),t=fl(e,n,a),t!==null&&(st(t,e,a),$a(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=pt(),a=sl(l);a.tag=2,t!=null&&(a.callback=t),t=fl(e,a,l),t!==null&&(st(t,e,l),$a(t,e,l))}};function No(e,t,l,a,n,u,c){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(a,u,c):t.prototype&&t.prototype.isPureReactComponent?!Qa(l,a)||!Qa(n,u):!0}function Co(e,t,l,a){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,a),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,a),t.state!==e&&dc.enqueueReplaceState(t,t.state,null)}function Xl(e,t){var l=t;if("ref"in t){l={};for(var a in t)a!=="ref"&&(l[a]=t[a])}if(e=e.defaultProps){l===t&&(l=O({},l));for(var n in e)l[n]===void 0&&(l[n]=e[n])}return l}function Do(e){Ln(e)}function Mo(e){console.error(e)}function Ro(e){Ln(e)}function du(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(a){setTimeout(function(){throw a})}}function Uo(e,t,l){try{var a=e.onCaughtError;a(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(n){setTimeout(function(){throw n})}}function hc(e,t,l){return l=sl(l),l.tag=3,l.payload={element:null},l.callback=function(){du(e,t)},l}function qo(e){return e=sl(e),e.tag=3,e}function Ho(e,t,l,a){var n=l.type.getDerivedStateFromError;if(typeof n=="function"){var u=a.value;e.payload=function(){return n(u)},e.callback=function(){Uo(t,l,a)}}var c=l.stateNode;c!==null&&typeof c.componentDidCatch=="function"&&(e.callback=function(){Uo(t,l,a),typeof n!="function"&&(yl===null?yl=new Set([this]):yl.add(this));var f=a.stack;this.componentDidCatch(a.value,{componentStack:f!==null?f:""})})}function mm(e,t,l,a,n){if(l.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(t=l.alternate,t!==null&&ca(t,l,n,!0),l=mt.current,l!==null){switch(l.tag){case 31:case 13:return _t===null?Eu():l.alternate===null&&qe===0&&(qe=3),l.flags&=-257,l.flags|=65536,l.lanes=n,a===Pn?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([a]):t.add(a),Yc(e,a,n)),!1;case 22:return l.flags|=65536,a===Pn?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([a]):l.add(a)),Yc(e,a,n)),!1}throw Error(o(435,l.tag))}return Yc(e,a,n),Eu(),!1}if(re)return t=mt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=n,a!==Mi&&(e=Error(o(422),{cause:a}),Va(jt(e,l)))):(a!==Mi&&(t=Error(o(423),{cause:a}),Va(jt(t,l))),e=e.current.alternate,e.flags|=65536,n&=-n,e.lanes|=n,a=jt(a,l),n=hc(e.stateNode,a,n),Li(e,n),qe!==4&&(qe=2)),!1;var u=Error(o(520),{cause:a});if(u=jt(u,l),rn===null?rn=[u]:rn.push(u),qe!==4&&(qe=2),t===null)return!0;a=jt(a,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=n&-n,l.lanes|=e,e=hc(l.stateNode,a,e),Li(l,e),!1;case 1:if(t=l.type,u=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(yl===null||!yl.has(u))))return l.flags|=65536,n&=-n,l.lanes|=n,n=qo(n),Ho(n,e,l,a),Li(l,n),!1}l=l.return}while(l!==null);return!1}var mc=Error(o(461)),Qe=!1;function Fe(e,t,l,a){t.child=e===null?Gf(t,null,l,a):Gl(t,e.child,l,a)}function Bo(e,t,l,a,n){l=l.render;var u=t.ref;if("ref"in a){var c={};for(var f in a)f!=="ref"&&(c[f]=a[f])}else c=a;return ql(t),a=Wi(e,t,l,c,u,n),f=$i(),e!==null&&!Qe?(Fi(e,t,n),Vt(e,t,n)):(re&&f&&Ci(t),t.flags|=1,Fe(e,t,a,n),t.child)}function Yo(e,t,l,a,n){if(e===null){var u=l.type;return typeof u=="function"&&!zi(u)&&u.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=u,Go(e,t,u,a,n)):(e=Jn(l.type,null,a,t,t.mode,n),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!jc(e,n)){var c=u.memoizedProps;if(l=l.compare,l=l!==null?l:Qa,l(c,a)&&e.ref===t.ref)return Vt(e,t,n)}return t.flags|=1,e=Gt(u,a),e.ref=t.ref,e.return=t,t.child=e}function Go(e,t,l,a,n){if(e!==null){var u=e.memoizedProps;if(Qa(u,a)&&e.ref===t.ref)if(Qe=!1,t.pendingProps=a=u,jc(e,n))(e.flags&131072)!==0&&(Qe=!0);else return t.lanes=e.lanes,Vt(e,t,n)}return yc(e,t,l,a,n)}function wo(e,t,l,a){var n=a.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|l:l,e!==null){for(a=t.child=e.child,n=0;a!==null;)n=n|a.lanes|a.childLanes,a=a.sibling;a=n&~u}else a=0,t.child=null;return Xo(e,t,u,l,a)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Fn(t,u!==null?u.cachePool:null),u!==null?Qf(t,u):Vi(),Lf(t);else return a=t.lanes=536870912,Xo(e,t,u!==null?u.baseLanes|l:l,l,a)}else u!==null?(Fn(t,u.cachePool),Qf(t,u),rl(),t.memoizedState=null):(e!==null&&Fn(t,null),Vi(),rl());return Fe(e,t,n,l),t.child}function an(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Xo(e,t,l,a,n){var u=Gi();return u=u===null?null:{parent:we._currentValue,pool:u},t.memoizedState={baseLanes:l,cachePool:u},e!==null&&Fn(t,null),Vi(),Lf(t),e!==null&&ca(e,t,a,!0),t.childLanes=n,null}function hu(e,t){return t=yu({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Qo(e,t,l){return Gl(t,e.child,null,l),e=hu(t,t.pendingProps),e.flags|=2,yt(t),t.memoizedState=null,e}function ym(e,t,l){var a=t.pendingProps,n=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(re){if(a.mode==="hidden")return e=hu(t,a),t.lanes=536870912,an(null,e);if(Ji(t),(e=De)?(e=ed(e,At),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:al!==null?{id:Mt,overflow:Rt}:null,retryLane:536870912,hydrationErrors:null},l=Ef(e),l.return=t,t.child=l,We=t,De=null)):e=null,e===null)throw ul(t);return t.lanes=536870912,null}return hu(t,a)}var u=e.memoizedState;if(u!==null){var c=u.dehydrated;if(Ji(t),n)if(t.flags&256)t.flags&=-257,t=Qo(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Qe||ca(e,t,l,!1),n=(l&e.childLanes)!==0,Qe||n){if(a=Oe,a!==null&&(c=Cs(a,l),c!==0&&c!==u.retryLane))throw u.retryLane=c,Dl(e,c),st(a,e,c),mc;Eu(),t=Qo(e,t,l)}else e=u.treeContext,De=zt(c.nextSibling),We=t,re=!0,nl=null,At=!1,e!==null&&zf(t,e),t=hu(t,a),t.flags|=4096;return t}return e=Gt(e.child,{mode:a.mode,children:a.children}),e.ref=t.ref,t.child=e,e.return=t,e}function mu(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function yc(e,t,l,a,n){return ql(t),l=Wi(e,t,l,a,void 0,n),a=$i(),e!==null&&!Qe?(Fi(e,t,n),Vt(e,t,n)):(re&&a&&Ci(t),t.flags|=1,Fe(e,t,l,n),t.child)}function Lo(e,t,l,a,n,u){return ql(t),t.updateQueue=null,l=Vf(t,a,l,n),Zf(e),a=$i(),e!==null&&!Qe?(Fi(e,t,u),Vt(e,t,u)):(re&&a&&Ci(t),t.flags|=1,Fe(e,t,l,u),t.child)}function Zo(e,t,l,a,n){if(ql(t),t.stateNode===null){var u=aa,c=l.contextType;typeof c=="object"&&c!==null&&(u=$e(c)),u=new l(a,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=dc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=a,u.state=t.memoizedState,u.refs={},Xi(t),c=l.contextType,u.context=typeof c=="object"&&c!==null?$e(c):aa,u.state=t.memoizedState,c=l.getDerivedStateFromProps,typeof c=="function"&&(rc(t,l,c,a),u.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(c=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),c!==u.state&&dc.enqueueReplaceState(u,u.state,null),Ia(t,a,u,n),Fa(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),a=!0}else if(e===null){u=t.stateNode;var f=t.memoizedProps,r=Xl(l,f);u.props=r;var g=u.context,T=l.contextType;c=aa,typeof T=="object"&&T!==null&&(c=$e(T));var C=l.getDerivedStateFromProps;T=typeof C=="function"||typeof u.getSnapshotBeforeUpdate=="function",f=t.pendingProps!==f,T||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(f||g!==c)&&Co(t,u,a,c),cl=!1;var p=t.memoizedState;u.state=p,Ia(t,a,u,n),Fa(),g=t.memoizedState,f||p!==g||cl?(typeof C=="function"&&(rc(t,l,C,a),g=t.memoizedState),(r=cl||No(t,l,r,a,p,g,c))?(T||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=a,t.memoizedState=g),u.props=a,u.state=g,u.context=c,a=r):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{u=t.stateNode,Qi(e,t),c=t.memoizedProps,T=Xl(l,c),u.props=T,C=t.pendingProps,p=u.context,g=l.contextType,r=aa,typeof g=="object"&&g!==null&&(r=$e(g)),f=l.getDerivedStateFromProps,(g=typeof f=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(c!==C||p!==r)&&Co(t,u,a,r),cl=!1,p=t.memoizedState,u.state=p,Ia(t,a,u,n),Fa();var S=t.memoizedState;c!==C||p!==S||cl||e!==null&&e.dependencies!==null&&Wn(e.dependencies)?(typeof f=="function"&&(rc(t,l,f,a),S=t.memoizedState),(T=cl||No(t,l,T,a,p,S,r)||e!==null&&e.dependencies!==null&&Wn(e.dependencies))?(g||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(a,S,r),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(a,S,r)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=a,t.memoizedState=S),u.props=a,u.state=S,u.context=r,a=T):(typeof u.componentDidUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||c===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),a=!1)}return u=a,mu(e,t),a=(t.flags&128)!==0,u||a?(u=t.stateNode,l=a&&typeof l.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&a?(t.child=Gl(t,e.child,null,n),t.child=Gl(t,null,l,n)):Fe(e,t,l,n),t.memoizedState=u.state,e=t.child):e=Vt(e,t,n),e}function Vo(e,t,l,a){return Rl(),t.flags|=256,Fe(e,t,l,a),t.child}var vc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function gc(e){return{baseLanes:e,cachePool:Rf()}}function pc(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=gt),e}function Ko(e,t,l){var a=t.pendingProps,n=!1,u=(t.flags&128)!==0,c;if((c=u)||(c=e!==null&&e.memoizedState===null?!1:(Be.current&2)!==0),c&&(n=!0,t.flags&=-129),c=(t.flags&32)!==0,t.flags&=-33,e===null){if(re){if(n?ol(t):rl(),(e=De)?(e=ed(e,At),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:al!==null?{id:Mt,overflow:Rt}:null,retryLane:536870912,hydrationErrors:null},l=Ef(e),l.return=t,t.child=l,We=t,De=null)):e=null,e===null)throw ul(t);return es(e)?t.lanes=32:t.lanes=536870912,null}var f=a.children;return a=a.fallback,n?(rl(),n=t.mode,f=yu({mode:"hidden",children:f},n),a=Ml(a,n,l,null),f.return=t,a.return=t,f.sibling=a,t.child=f,a=t.child,a.memoizedState=gc(l),a.childLanes=pc(e,c,l),t.memoizedState=vc,an(null,a)):(ol(t),bc(t,f))}var r=e.memoizedState;if(r!==null&&(f=r.dehydrated,f!==null)){if(u)t.flags&256?(ol(t),t.flags&=-257,t=xc(e,t,l)):t.memoizedState!==null?(rl(),t.child=e.child,t.flags|=128,t=null):(rl(),f=a.fallback,n=t.mode,a=yu({mode:"visible",children:a.children},n),f=Ml(f,n,l,null),f.flags|=2,a.return=t,f.return=t,a.sibling=f,t.child=a,Gl(t,e.child,null,l),a=t.child,a.memoizedState=gc(l),a.childLanes=pc(e,c,l),t.memoizedState=vc,t=an(null,a));else if(ol(t),es(f)){if(c=f.nextSibling&&f.nextSibling.dataset,c)var g=c.dgst;c=g,a=Error(o(419)),a.stack="",a.digest=c,Va({value:a,source:null,stack:null}),t=xc(e,t,l)}else if(Qe||ca(e,t,l,!1),c=(l&e.childLanes)!==0,Qe||c){if(c=Oe,c!==null&&(a=Cs(c,l),a!==0&&a!==r.retryLane))throw r.retryLane=a,Dl(e,a),st(c,e,a),mc;Pc(f)||Eu(),t=xc(e,t,l)}else Pc(f)?(t.flags|=192,t.child=e.child,t=null):(e=r.treeContext,De=zt(f.nextSibling),We=t,re=!0,nl=null,At=!1,e!==null&&zf(t,e),t=bc(t,a.children),t.flags|=4096);return t}return n?(rl(),f=a.fallback,n=t.mode,r=e.child,g=r.sibling,a=Gt(r,{mode:"hidden",children:a.children}),a.subtreeFlags=r.subtreeFlags&65011712,g!==null?f=Gt(g,f):(f=Ml(f,n,l,null),f.flags|=2),f.return=t,a.return=t,a.sibling=f,t.child=a,an(null,a),a=t.child,f=e.child.memoizedState,f===null?f=gc(l):(n=f.cachePool,n!==null?(r=we._currentValue,n=n.parent!==r?{parent:r,pool:r}:n):n=Rf(),f={baseLanes:f.baseLanes|l,cachePool:n}),a.memoizedState=f,a.childLanes=pc(e,c,l),t.memoizedState=vc,an(e.child,a)):(ol(t),l=e.child,e=l.sibling,l=Gt(l,{mode:"visible",children:a.children}),l.return=t,l.sibling=null,e!==null&&(c=t.deletions,c===null?(t.deletions=[e],t.flags|=16):c.push(e)),t.child=l,t.memoizedState=null,l)}function bc(e,t){return t=yu({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function yu(e,t){return e=ht(22,e,null,t),e.lanes=0,e}function xc(e,t,l){return Gl(t,e.child,null,l),e=bc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Jo(e,t,l){e.lanes|=t;var a=e.alternate;a!==null&&(a.lanes|=t),qi(e.return,t,l)}function Sc(e,t,l,a,n,u){var c=e.memoizedState;c===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:a,tail:l,tailMode:n,treeForkCount:u}:(c.isBackwards=t,c.rendering=null,c.renderingStartTime=0,c.last=a,c.tail=l,c.tailMode=n,c.treeForkCount=u)}function ko(e,t,l){var a=t.pendingProps,n=a.revealOrder,u=a.tail;a=a.children;var c=Be.current,f=(c&2)!==0;if(f?(c=c&1|2,t.flags|=128):c&=1,B(Be,c),Fe(e,t,a,l),a=re?Za:0,!f&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Jo(e,l,t);else if(e.tag===19)Jo(e,l,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(n){case"forwards":for(l=t.child,n=null;l!==null;)e=l.alternate,e!==null&&au(e)===null&&(n=l),l=l.sibling;l=n,l===null?(n=t.child,t.child=null):(n=l.sibling,l.sibling=null),Sc(t,!1,n,l,u,a);break;case"backwards":case"unstable_legacy-backwards":for(l=null,n=t.child,t.child=null;n!==null;){if(e=n.alternate,e!==null&&au(e)===null){t.child=n;break}e=n.sibling,n.sibling=l,l=n,n=e}Sc(t,!0,l,null,u,a);break;case"together":Sc(t,!1,null,null,void 0,a);break;default:t.memoizedState=null}return t.child}function Vt(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),ml|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(ca(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=Gt(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=Gt(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function jc(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Wn(e)))}function vm(e,t,l){switch(t.tag){case 3:et(t,t.stateNode.containerInfo),il(t,we,e.memoizedState.cache),Rl();break;case 27:case 5:Na(t);break;case 4:et(t,t.stateNode.containerInfo);break;case 10:il(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ji(t),null;break;case 13:var a=t.memoizedState;if(a!==null)return a.dehydrated!==null?(ol(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Ko(e,t,l):(ol(t),e=Vt(e,t,l),e!==null?e.sibling:null);ol(t);break;case 19:var n=(e.flags&128)!==0;if(a=(l&t.childLanes)!==0,a||(ca(e,t,l,!1),a=(l&t.childLanes)!==0),n){if(a)return ko(e,t,l);t.flags|=128}if(n=t.memoizedState,n!==null&&(n.rendering=null,n.tail=null,n.lastEffect=null),B(Be,Be.current),a)break;return null;case 22:return t.lanes=0,wo(e,t,l,t.pendingProps);case 24:il(t,we,e.memoizedState.cache)}return Vt(e,t,l)}function Wo(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)Qe=!0;else{if(!jc(e,l)&&(t.flags&128)===0)return Qe=!1,vm(e,t,l);Qe=(e.flags&131072)!==0}else Qe=!1,re&&(t.flags&1048576)!==0&&_f(t,Za,t.index);switch(t.lanes=0,t.tag){case 16:e:{var a=t.pendingProps;if(e=Bl(t.elementType),t.type=e,typeof e=="function")zi(e)?(a=Xl(e,a),t.tag=1,t=Zo(null,t,e,a,l)):(t.tag=0,t=yc(null,t,e,a,l));else{if(e!=null){var n=e.$$typeof;if(n===ne){t.tag=11,t=Bo(null,t,e,a,l);break e}else if(n===V){t.tag=14,t=Yo(null,t,e,a,l);break e}}throw t=Ce(e)||e,Error(o(306,t,""))}}return t;case 0:return yc(e,t,t.type,t.pendingProps,l);case 1:return a=t.type,n=Xl(a,t.pendingProps),Zo(e,t,a,n,l);case 3:e:{if(et(t,t.stateNode.containerInfo),e===null)throw Error(o(387));a=t.pendingProps;var u=t.memoizedState;n=u.element,Qi(e,t),Ia(t,a,null,l);var c=t.memoizedState;if(a=c.cache,il(t,we,a),a!==u.cache&&Hi(t,[we],l,!0),Fa(),a=c.element,u.isDehydrated)if(u={element:a,isDehydrated:!1,cache:c.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=Vo(e,t,a,l);break e}else if(a!==n){n=jt(Error(o(424)),t),Va(n),t=Vo(e,t,a,l);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(De=zt(e.firstChild),We=t,re=!0,nl=null,At=!0,l=Gf(t,null,a,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Rl(),a===n){t=Vt(e,t,l);break e}Fe(e,t,a,l)}t=t.child}return t;case 26:return mu(e,t),e===null?(l=id(t.type,null,t.pendingProps,null))?t.memoizedState=l:re||(l=t.type,e=t.pendingProps,a=Du(ue.current).createElement(l),a[ke]=t,a[lt]=e,Ie(a,l,e),Ke(a),t.stateNode=a):t.memoizedState=id(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Na(t),e===null&&re&&(a=t.stateNode=ad(t.type,t.pendingProps,ue.current),We=t,At=!0,n=De,bl(t.type)?(ts=n,De=zt(a.firstChild)):De=n),Fe(e,t,t.pendingProps.children,l),mu(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&re&&((n=a=De)&&(a=Km(a,t.type,t.pendingProps,At),a!==null?(t.stateNode=a,We=t,De=zt(a.firstChild),At=!1,n=!0):n=!1),n||ul(t)),Na(t),n=t.type,u=t.pendingProps,c=e!==null?e.memoizedProps:null,a=u.children,$c(n,u)?a=null:c!==null&&$c(n,c)&&(t.flags|=32),t.memoizedState!==null&&(n=Wi(e,t,cm,null,null,l),bn._currentValue=n),mu(e,t),Fe(e,t,a,l),t.child;case 6:return e===null&&re&&((e=l=De)&&(l=Jm(l,t.pendingProps,At),l!==null?(t.stateNode=l,We=t,De=null,e=!0):e=!1),e||ul(t)),null;case 13:return Ko(e,t,l);case 4:return et(t,t.stateNode.containerInfo),a=t.pendingProps,e===null?t.child=Gl(t,null,a,l):Fe(e,t,a,l),t.child;case 11:return Bo(e,t,t.type,t.pendingProps,l);case 7:return Fe(e,t,t.pendingProps,l),t.child;case 8:return Fe(e,t,t.pendingProps.children,l),t.child;case 12:return Fe(e,t,t.pendingProps.children,l),t.child;case 10:return a=t.pendingProps,il(t,t.type,a.value),Fe(e,t,a.children,l),t.child;case 9:return n=t.type._context,a=t.pendingProps.children,ql(t),n=$e(n),a=a(n),t.flags|=1,Fe(e,t,a,l),t.child;case 14:return Yo(e,t,t.type,t.pendingProps,l);case 15:return Go(e,t,t.type,t.pendingProps,l);case 19:return ko(e,t,l);case 31:return ym(e,t,l);case 22:return wo(e,t,l,t.pendingProps);case 24:return ql(t),a=$e(we),e===null?(n=Gi(),n===null&&(n=Oe,u=Bi(),n.pooledCache=u,u.refCount++,u!==null&&(n.pooledCacheLanes|=l),n=u),t.memoizedState={parent:a,cache:n},Xi(t),il(t,we,n)):((e.lanes&l)!==0&&(Qi(e,t),Ia(t,null,null,l),Fa()),n=e.memoizedState,u=t.memoizedState,n.parent!==a?(n={parent:a,cache:a},t.memoizedState=n,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=n),il(t,we,a)):(a=u.cache,il(t,we,a),a!==n.cache&&Hi(t,[we],l,!0))),Fe(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Kt(e){e.flags|=4}function Tc(e,t,l,a,n){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(n&335544128)===n)if(e.stateNode.complete)e.flags|=8192;else if(jr())e.flags|=8192;else throw Yl=Pn,wi}else e.flags&=-16777217}function $o(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!rd(t))if(jr())e.flags|=8192;else throw Yl=Pn,wi}function vu(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?zs():536870912,e.lanes|=t,ba|=t)}function nn(e,t){if(!re)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var a=null;l!==null;)l.alternate!==null&&(a=l),l=l.sibling;a===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:a.sibling=null}}function Me(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,a=0;if(t)for(var n=e.child;n!==null;)l|=n.lanes|n.childLanes,a|=n.subtreeFlags&65011712,a|=n.flags&65011712,n.return=e,n=n.sibling;else for(n=e.child;n!==null;)l|=n.lanes|n.childLanes,a|=n.subtreeFlags,a|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=a,e.childLanes=l,t}function gm(e,t,l){var a=t.pendingProps;switch(Di(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Me(t),null;case 1:return Me(t),null;case 3:return l=t.stateNode,a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Qt(we),He(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(ia(t)?Kt(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ri())),Me(t),null;case 26:var n=t.type,u=t.memoizedState;return e===null?(Kt(t),u!==null?(Me(t),$o(t,u)):(Me(t),Tc(t,n,null,a,l))):u?u!==e.memoizedState?(Kt(t),Me(t),$o(t,u)):(Me(t),t.flags&=-16777217):(e=e.memoizedProps,e!==a&&Kt(t),Me(t),Tc(t,n,e,a,l)),null;case 27:if(zn(t),l=ue.current,n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Kt(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return Me(t),null}e=X.current,ia(t)?Of(t):(e=ad(n,a,l),t.stateNode=e,Kt(t))}return Me(t),null;case 5:if(zn(t),n=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==a&&Kt(t);else{if(!a){if(t.stateNode===null)throw Error(o(166));return Me(t),null}if(u=X.current,ia(t))Of(t);else{var c=Du(ue.current);switch(u){case 1:u=c.createElementNS("http://www.w3.org/2000/svg",n);break;case 2:u=c.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;default:switch(n){case"svg":u=c.createElementNS("http://www.w3.org/2000/svg",n);break;case"math":u=c.createElementNS("http://www.w3.org/1998/Math/MathML",n);break;case"script":u=c.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?c.createElement("select",{is:a.is}):c.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?c.createElement(n,{is:a.is}):c.createElement(n)}}u[ke]=t,u[lt]=a;e:for(c=t.child;c!==null;){if(c.tag===5||c.tag===6)u.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===t)break e;for(;c.sibling===null;){if(c.return===null||c.return===t)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}t.stateNode=u;e:switch(Ie(u,n,a),n){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Kt(t)}}return Me(t),Tc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==a&&Kt(t);else{if(typeof a!="string"&&t.stateNode===null)throw Error(o(166));if(e=ue.current,ia(t)){if(e=t.stateNode,l=t.memoizedProps,a=null,n=We,n!==null)switch(n.tag){case 27:case 5:a=n.memoizedProps}e[ke]=t,e=!!(e.nodeValue===l||a!==null&&a.suppressHydrationWarning===!0||Kr(e.nodeValue,l)),e||ul(t,!0)}else e=Du(e).createTextNode(a),e[ke]=t,t.stateNode=e}return Me(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(a=ia(t),l!==null){if(e===null){if(!a)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[ke]=t}else Rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Me(t),e=!1}else l=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(yt(t),t):(yt(t),null);if((t.flags&128)!==0)throw Error(o(558))}return Me(t),null;case 13:if(a=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(n=ia(t),a!==null&&a.dehydrated!==null){if(e===null){if(!n)throw Error(o(318));if(n=t.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));n[ke]=t}else Rl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Me(t),n=!1}else n=Ri(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),n=!0;if(!n)return t.flags&256?(yt(t),t):(yt(t),null)}return yt(t),(t.flags&128)!==0?(t.lanes=l,t):(l=a!==null,e=e!==null&&e.memoizedState!==null,l&&(a=t.child,n=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(n=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==n&&(a.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),vu(t,t.updateQueue),Me(t),null);case 4:return He(),e===null&&Vc(t.stateNode.containerInfo),Me(t),null;case 10:return Qt(t.type),Me(t),null;case 19:if(M(Be),a=t.memoizedState,a===null)return Me(t),null;if(n=(t.flags&128)!==0,u=a.rendering,u===null)if(n)nn(a,!1);else{if(qe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=au(e),u!==null){for(t.flags|=128,nn(a,!1),e=u.updateQueue,t.updateQueue=e,vu(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Tf(l,e),l=l.sibling;return B(Be,Be.current&1|2),re&&wt(t,a.treeForkCount),t.child}e=e.sibling}a.tail!==null&&ft()>Su&&(t.flags|=128,n=!0,nn(a,!1),t.lanes=4194304)}else{if(!n)if(e=au(u),e!==null){if(t.flags|=128,n=!0,e=e.updateQueue,t.updateQueue=e,vu(t,e),nn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!re)return Me(t),null}else 2*ft()-a.renderingStartTime>Su&&l!==536870912&&(t.flags|=128,n=!0,nn(a,!1),t.lanes=4194304);a.isBackwards?(u.sibling=t.child,t.child=u):(e=a.last,e!==null?e.sibling=u:t.child=u,a.last=u)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=ft(),e.sibling=null,l=Be.current,B(Be,n?l&1|2:l&1),re&&wt(t,a.treeForkCount),e):(Me(t),null);case 22:case 23:return yt(t),Ki(),a=t.memoizedState!==null,e!==null?e.memoizedState!==null!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(l&536870912)!==0&&(t.flags&128)===0&&(Me(t),t.subtreeFlags&6&&(t.flags|=8192)):Me(t),l=t.updateQueue,l!==null&&vu(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),a=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),a!==l&&(t.flags|=2048),e!==null&&M(Hl),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Qt(we),Me(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function pm(e,t){switch(Di(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qt(we),He(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return zn(t),null;case 31:if(t.memoizedState!==null){if(yt(t),t.alternate===null)throw Error(o(340));Rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(yt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Rl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(Be),null;case 4:return He(),null;case 10:return Qt(t.type),null;case 22:case 23:return yt(t),Ki(),e!==null&&M(Hl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Qt(we),null;case 25:return null;default:return null}}function Fo(e,t){switch(Di(t),t.tag){case 3:Qt(we),He();break;case 26:case 27:case 5:zn(t);break;case 4:He();break;case 31:t.memoizedState!==null&&yt(t);break;case 13:yt(t);break;case 19:M(Be);break;case 10:Qt(t.type);break;case 22:case 23:yt(t),Ki(),e!==null&&M(Hl);break;case 24:Qt(we)}}function un(e,t){try{var l=t.updateQueue,a=l!==null?l.lastEffect:null;if(a!==null){var n=a.next;l=n;do{if((l.tag&e)===e){a=void 0;var u=l.create,c=l.inst;a=u(),c.destroy=a}l=l.next}while(l!==n)}}catch(f){pe(t,t.return,f)}}function dl(e,t,l){try{var a=t.updateQueue,n=a!==null?a.lastEffect:null;if(n!==null){var u=n.next;a=u;do{if((a.tag&e)===e){var c=a.inst,f=c.destroy;if(f!==void 0){c.destroy=void 0,n=t;var r=l,g=f;try{g()}catch(T){pe(n,r,T)}}}a=a.next}while(a!==u)}}catch(T){pe(t,t.return,T)}}function Io(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Xf(t,l)}catch(a){pe(e,e.return,a)}}}function Po(e,t,l){l.props=Xl(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(a){pe(e,t,a)}}function cn(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var a=e.stateNode;break;case 30:a=e.stateNode;break;default:a=e.stateNode}typeof l=="function"?e.refCleanup=l(a):l.current=a}}catch(n){pe(e,t,n)}}function Ut(e,t){var l=e.ref,a=e.refCleanup;if(l!==null)if(typeof a=="function")try{a()}catch(n){pe(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(n){pe(e,t,n)}else l.current=null}function er(e){var t=e.type,l=e.memoizedProps,a=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&a.focus();break e;case"img":l.src?a.src=l.src:l.srcSet&&(a.srcset=l.srcSet)}}catch(n){pe(e,e.return,n)}}function Ec(e,t,l){try{var a=e.stateNode;wm(a,e.type,l,t),a[lt]=t}catch(n){pe(e,e.return,n)}}function tr(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&bl(e.type)||e.tag===4}function Ac(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||tr(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&&bl(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 _c(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=Bt));else if(a!==4&&(a===27&&bl(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(_c(e,t,l),e=e.sibling;e!==null;)_c(e,t,l),e=e.sibling}function gu(e,t,l){var a=e.tag;if(a===5||a===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(a!==4&&(a===27&&bl(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(gu(e,t,l),e=e.sibling;e!==null;)gu(e,t,l),e=e.sibling}function lr(e){var t=e.stateNode,l=e.memoizedProps;try{for(var a=e.type,n=t.attributes;n.length;)t.removeAttributeNode(n[0]);Ie(t,a,l),t[ke]=e,t[lt]=l}catch(u){pe(e,e.return,u)}}var Jt=!1,Le=!1,zc=!1,ar=typeof WeakSet=="function"?WeakSet:Set,Je=null;function bm(e,t){if(e=e.containerInfo,kc=Yu,e=mf(e),xi(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var a=l.getSelection&&l.getSelection();if(a&&a.rangeCount!==0){l=a.anchorNode;var n=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{l.nodeType,u.nodeType}catch{l=null;break e}var c=0,f=-1,r=-1,g=0,T=0,C=e,p=null;t:for(;;){for(var S;C!==l||n!==0&&C.nodeType!==3||(f=c+n),C!==u||a!==0&&C.nodeType!==3||(r=c+a),C.nodeType===3&&(c+=C.nodeValue.length),(S=C.firstChild)!==null;)p=C,C=S;for(;;){if(C===e)break t;if(p===l&&++g===n&&(f=c),p===u&&++T===a&&(r=c),(S=C.nextSibling)!==null)break;C=p,p=C.parentNode}C=S}l=f===-1||r===-1?null:{start:f,end:r}}else l=null}l=l||{start:0,end:0}}else l=null;for(Wc={focusedElem:e,selectionRange:l},Yu=!1,Je=t;Je!==null;)if(t=Je,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Je=e;else for(;Je!==null;){switch(t=Je,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(l=0;l<e.length;l++)n=e[l],n.ref.impl=n.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,l=t,n=u.memoizedProps,u=u.memoizedState,a=l.stateNode;try{var w=Xl(l.type,n);e=a.getSnapshotBeforeUpdate(w,u),a.__reactInternalSnapshotBeforeUpdate=e}catch(J){pe(l,l.return,J)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Ic(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Ic(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(o(163))}if(e=t.sibling,e!==null){e.return=t.return,Je=e;break}Je=t.return}}function nr(e,t,l){var a=l.flags;switch(l.tag){case 0:case 11:case 15:Wt(e,l),a&4&&un(5,l);break;case 1:if(Wt(e,l),a&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(c){pe(l,l.return,c)}else{var n=Xl(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(n,t,e.__reactInternalSnapshotBeforeUpdate)}catch(c){pe(l,l.return,c)}}a&64&&Io(l),a&512&&cn(l,l.return);break;case 3:if(Wt(e,l),a&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{Xf(e,t)}catch(c){pe(l,l.return,c)}}break;case 27:t===null&&a&4&&lr(l);case 26:case 5:Wt(e,l),t===null&&a&4&&er(l),a&512&&cn(l,l.return);break;case 12:Wt(e,l);break;case 31:Wt(e,l),a&4&&cr(e,l);break;case 13:Wt(e,l),a&4&&sr(e,l),a&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Om.bind(null,l),km(e,l))));break;case 22:if(a=l.memoizedState!==null||Jt,!a){t=t!==null&&t.memoizedState!==null||Le,n=Jt;var u=Le;Jt=a,(Le=t)&&!u?$t(e,l,(l.subtreeFlags&8772)!==0):Wt(e,l),Jt=n,Le=u}break;case 30:break;default:Wt(e,l)}}function ur(e){var t=e.alternate;t!==null&&(e.alternate=null,ur(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ai(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 Re=null,nt=!1;function kt(e,t,l){for(l=l.child;l!==null;)ir(e,t,l),l=l.sibling}function ir(e,t,l){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(Ca,l)}catch{}switch(l.tag){case 26:Le||Ut(l,t),kt(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Le||Ut(l,t);var a=Re,n=nt;bl(l.type)&&(Re=l.stateNode,nt=!1),kt(e,t,l),vn(l.stateNode),Re=a,nt=n;break;case 5:Le||Ut(l,t);case 6:if(a=Re,n=nt,Re=null,kt(e,t,l),Re=a,nt=n,Re!==null)if(nt)try{(Re.nodeType===9?Re.body:Re.nodeName==="HTML"?Re.ownerDocument.body:Re).removeChild(l.stateNode)}catch(u){pe(l,t,u)}else try{Re.removeChild(l.stateNode)}catch(u){pe(l,t,u)}break;case 18:Re!==null&&(nt?(e=Re,Ir(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),za(e)):Ir(Re,l.stateNode));break;case 4:a=Re,n=nt,Re=l.stateNode.containerInfo,nt=!0,kt(e,t,l),Re=a,nt=n;break;case 0:case 11:case 14:case 15:dl(2,l,t),Le||dl(4,l,t),kt(e,t,l);break;case 1:Le||(Ut(l,t),a=l.stateNode,typeof a.componentWillUnmount=="function"&&Po(l,t,a)),kt(e,t,l);break;case 21:kt(e,t,l);break;case 22:Le=(a=Le)||l.memoizedState!==null,kt(e,t,l),Le=a;break;default:kt(e,t,l)}}function cr(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{za(e)}catch(l){pe(t,t.return,l)}}}function sr(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{za(e)}catch(l){pe(t,t.return,l)}}function xm(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ar),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ar),t;default:throw Error(o(435,e.tag))}}function pu(e,t){var l=xm(e);t.forEach(function(a){if(!l.has(a)){l.add(a);var n=Nm.bind(null,e,a);a.then(n,n)}})}function ut(e,t){var l=t.deletions;if(l!==null)for(var a=0;a<l.length;a++){var n=l[a],u=e,c=t,f=c;e:for(;f!==null;){switch(f.tag){case 27:if(bl(f.type)){Re=f.stateNode,nt=!1;break e}break;case 5:Re=f.stateNode,nt=!1;break e;case 3:case 4:Re=f.stateNode.containerInfo,nt=!0;break e}f=f.return}if(Re===null)throw Error(o(160));ir(u,c,n),Re=null,nt=!1,u=n.alternate,u!==null&&(u.return=null),n.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)fr(t,e),t=t.sibling}var Ct=null;function fr(e,t){var l=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ut(t,e),it(e),a&4&&(dl(3,e,e.return),un(3,e),dl(5,e,e.return));break;case 1:ut(t,e),it(e),a&512&&(Le||l===null||Ut(l,l.return)),a&64&&Jt&&(e=e.updateQueue,e!==null&&(a=e.callbacks,a!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?a:l.concat(a))));break;case 26:var n=Ct;if(ut(t,e),it(e),a&512&&(Le||l===null||Ut(l,l.return)),a&4){var u=l!==null?l.memoizedState:null;if(a=e.memoizedState,l===null)if(a===null)if(e.stateNode===null){e:{a=e.type,l=e.memoizedProps,n=n.ownerDocument||n;t:switch(a){case"title":u=n.getElementsByTagName("title")[0],(!u||u[Ra]||u[ke]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=n.createElement(a),n.head.insertBefore(u,n.querySelector("head > title"))),Ie(u,a,l),u[ke]=e,Ke(u),a=u;break e;case"link":var c=fd("link","href",n).get(a+(l.href||""));if(c){for(var f=0;f<c.length;f++)if(u=c[f],u.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&u.getAttribute("rel")===(l.rel==null?null:l.rel)&&u.getAttribute("title")===(l.title==null?null:l.title)&&u.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){c.splice(f,1);break t}}u=n.createElement(a),Ie(u,a,l),n.head.appendChild(u);break;case"meta":if(c=fd("meta","content",n).get(a+(l.content||""))){for(f=0;f<c.length;f++)if(u=c[f],u.getAttribute("content")===(l.content==null?null:""+l.content)&&u.getAttribute("name")===(l.name==null?null:l.name)&&u.getAttribute("property")===(l.property==null?null:l.property)&&u.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&u.getAttribute("charset")===(l.charSet==null?null:l.charSet)){c.splice(f,1);break t}}u=n.createElement(a),Ie(u,a,l),n.head.appendChild(u);break;default:throw Error(o(468,a))}u[ke]=e,Ke(u),a=u}e.stateNode=a}else od(n,e.type,e.stateNode);else e.stateNode=sd(n,a,e.memoizedProps);else u!==a?(u===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):u.count--,a===null?od(n,e.type,e.stateNode):sd(n,a,e.memoizedProps)):a===null&&e.stateNode!==null&&Ec(e,e.memoizedProps,l.memoizedProps)}break;case 27:ut(t,e),it(e),a&512&&(Le||l===null||Ut(l,l.return)),l!==null&&a&4&&Ec(e,e.memoizedProps,l.memoizedProps);break;case 5:if(ut(t,e),it(e),a&512&&(Le||l===null||Ut(l,l.return)),e.flags&32){n=e.stateNode;try{$l(n,"")}catch(w){pe(e,e.return,w)}}a&4&&e.stateNode!=null&&(n=e.memoizedProps,Ec(e,n,l!==null?l.memoizedProps:n)),a&1024&&(zc=!0);break;case 6:if(ut(t,e),it(e),a&4){if(e.stateNode===null)throw Error(o(162));a=e.memoizedProps,l=e.stateNode;try{l.nodeValue=a}catch(w){pe(e,e.return,w)}}break;case 3:if(Uu=null,n=Ct,Ct=Mu(t.containerInfo),ut(t,e),Ct=n,it(e),a&4&&l!==null&&l.memoizedState.isDehydrated)try{za(t.containerInfo)}catch(w){pe(e,e.return,w)}zc&&(zc=!1,or(e));break;case 4:a=Ct,Ct=Mu(e.stateNode.containerInfo),ut(t,e),it(e),Ct=a;break;case 12:ut(t,e),it(e);break;case 31:ut(t,e),it(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,pu(e,a)));break;case 13:ut(t,e),it(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(xu=ft()),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,pu(e,a)));break;case 22:n=e.memoizedState!==null;var r=l!==null&&l.memoizedState!==null,g=Jt,T=Le;if(Jt=g||n,Le=T||r,ut(t,e),Le=T,Jt=g,it(e),a&8192)e:for(t=e.stateNode,t._visibility=n?t._visibility&-2:t._visibility|1,n&&(l===null||r||Jt||Le||Ql(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){r=l=t;try{if(u=r.stateNode,n)c=u.style,typeof c.setProperty=="function"?c.setProperty("display","none","important"):c.display="none";else{f=r.stateNode;var C=r.memoizedProps.style,p=C!=null&&C.hasOwnProperty("display")?C.display:null;f.style.display=p==null||typeof p=="boolean"?"":(""+p).trim()}}catch(w){pe(r,r.return,w)}}}else if(t.tag===6){if(l===null){r=t;try{r.stateNode.nodeValue=n?"":r.memoizedProps}catch(w){pe(r,r.return,w)}}}else if(t.tag===18){if(l===null){r=t;try{var S=r.stateNode;n?Pr(S,!0):Pr(r.stateNode,!1)}catch(w){pe(r,r.return,w)}}}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;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}a&4&&(a=e.updateQueue,a!==null&&(l=a.retryQueue,l!==null&&(a.retryQueue=null,pu(e,l))));break;case 19:ut(t,e),it(e),a&4&&(a=e.updateQueue,a!==null&&(e.updateQueue=null,pu(e,a)));break;case 30:break;case 21:break;default:ut(t,e),it(e)}}function it(e){var t=e.flags;if(t&2){try{for(var l,a=e.return;a!==null;){if(tr(a)){l=a;break}a=a.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var n=l.stateNode,u=Ac(e);gu(e,u,n);break;case 5:var c=l.stateNode;l.flags&32&&($l(c,""),l.flags&=-33);var f=Ac(e);gu(e,f,c);break;case 3:case 4:var r=l.stateNode.containerInfo,g=Ac(e);_c(e,g,r);break;default:throw Error(o(161))}}catch(T){pe(e,e.return,T)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function or(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;or(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Wt(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)nr(e,t.alternate,t),t=t.sibling}function Ql(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:dl(4,t,t.return),Ql(t);break;case 1:Ut(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Po(t,t.return,l),Ql(t);break;case 27:vn(t.stateNode);case 26:case 5:Ut(t,t.return),Ql(t);break;case 22:t.memoizedState===null&&Ql(t);break;case 30:Ql(t);break;default:Ql(t)}e=e.sibling}}function $t(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var a=t.alternate,n=e,u=t,c=u.flags;switch(u.tag){case 0:case 11:case 15:$t(n,u,l),un(4,u);break;case 1:if($t(n,u,l),a=u,n=a.stateNode,typeof n.componentDidMount=="function")try{n.componentDidMount()}catch(g){pe(a,a.return,g)}if(a=u,n=a.updateQueue,n!==null){var f=a.stateNode;try{var r=n.shared.hiddenCallbacks;if(r!==null)for(n.shared.hiddenCallbacks=null,n=0;n<r.length;n++)wf(r[n],f)}catch(g){pe(a,a.return,g)}}l&&c&64&&Io(u),cn(u,u.return);break;case 27:lr(u);case 26:case 5:$t(n,u,l),l&&a===null&&c&4&&er(u),cn(u,u.return);break;case 12:$t(n,u,l);break;case 31:$t(n,u,l),l&&c&4&&cr(n,u);break;case 13:$t(n,u,l),l&&c&4&&sr(n,u);break;case 22:u.memoizedState===null&&$t(n,u,l),cn(u,u.return);break;case 30:break;default:$t(n,u,l)}t=t.sibling}}function Oc(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&Ka(l))}function Nc(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ka(e))}function Dt(e,t,l,a){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)rr(e,t,l,a),t=t.sibling}function rr(e,t,l,a){var n=t.flags;switch(t.tag){case 0:case 11:case 15:Dt(e,t,l,a),n&2048&&un(9,t);break;case 1:Dt(e,t,l,a);break;case 3:Dt(e,t,l,a),n&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ka(e)));break;case 12:if(n&2048){Dt(e,t,l,a),e=t.stateNode;try{var u=t.memoizedProps,c=u.id,f=u.onPostCommit;typeof f=="function"&&f(c,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(r){pe(t,t.return,r)}}else Dt(e,t,l,a);break;case 31:Dt(e,t,l,a);break;case 13:Dt(e,t,l,a);break;case 23:break;case 22:u=t.stateNode,c=t.alternate,t.memoizedState!==null?u._visibility&2?Dt(e,t,l,a):sn(e,t):u._visibility&2?Dt(e,t,l,a):(u._visibility|=2,va(e,t,l,a,(t.subtreeFlags&10256)!==0||!1)),n&2048&&Oc(c,t);break;case 24:Dt(e,t,l,a),n&2048&&Nc(t.alternate,t);break;default:Dt(e,t,l,a)}}function va(e,t,l,a,n){for(n=n&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,c=t,f=l,r=a,g=c.flags;switch(c.tag){case 0:case 11:case 15:va(u,c,f,r,n),un(8,c);break;case 23:break;case 22:var T=c.stateNode;c.memoizedState!==null?T._visibility&2?va(u,c,f,r,n):sn(u,c):(T._visibility|=2,va(u,c,f,r,n)),n&&g&2048&&Oc(c.alternate,c);break;case 24:va(u,c,f,r,n),n&&g&2048&&Nc(c.alternate,c);break;default:va(u,c,f,r,n)}t=t.sibling}}function sn(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,a=t,n=a.flags;switch(a.tag){case 22:sn(l,a),n&2048&&Oc(a.alternate,a);break;case 24:sn(l,a),n&2048&&Nc(a.alternate,a);break;default:sn(l,a)}t=t.sibling}}var fn=8192;function ga(e,t,l){if(e.subtreeFlags&fn)for(e=e.child;e!==null;)dr(e,t,l),e=e.sibling}function dr(e,t,l){switch(e.tag){case 26:ga(e,t,l),e.flags&fn&&e.memoizedState!==null&&iy(l,Ct,e.memoizedState,e.memoizedProps);break;case 5:ga(e,t,l);break;case 3:case 4:var a=Ct;Ct=Mu(e.stateNode.containerInfo),ga(e,t,l),Ct=a;break;case 22:e.memoizedState===null&&(a=e.alternate,a!==null&&a.memoizedState!==null?(a=fn,fn=16777216,ga(e,t,l),fn=a):ga(e,t,l));break;default:ga(e,t,l)}}function hr(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 on(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var a=t[l];Je=a,yr(a,e)}hr(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)mr(e),e=e.sibling}function mr(e){switch(e.tag){case 0:case 11:case 15:on(e),e.flags&2048&&dl(9,e,e.return);break;case 3:on(e);break;case 12:on(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,bu(e)):on(e);break;default:on(e)}}function bu(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var a=t[l];Je=a,yr(a,e)}hr(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:dl(8,t,t.return),bu(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,bu(t));break;default:bu(t)}e=e.sibling}}function yr(e,t){for(;Je!==null;){var l=Je;switch(l.tag){case 0:case 11:case 15:dl(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var a=l.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:Ka(l.memoizedState.cache)}if(a=l.child,a!==null)a.return=l,Je=a;else e:for(l=e;Je!==null;){a=Je;var n=a.sibling,u=a.return;if(ur(a),a===l){Je=null;break e}if(n!==null){n.return=u,Je=n;break e}Je=u}}}var Sm={getCacheForType:function(e){var t=$e(we),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return $e(we).controller.signal}},jm=typeof WeakMap=="function"?WeakMap:Map,ye=0,Oe=null,ie=null,fe=0,ge=0,vt=null,hl=!1,pa=!1,Cc=!1,Ft=0,qe=0,ml=0,Ll=0,Dc=0,gt=0,ba=0,rn=null,ct=null,Mc=!1,xu=0,vr=0,Su=1/0,ju=null,yl=null,Ve=0,vl=null,xa=null,It=0,Rc=0,Uc=null,gr=null,dn=0,qc=null;function pt(){return(ye&2)!==0&&fe!==0?fe&-fe:j.T!==null?Xc():Ds()}function pr(){if(gt===0)if((fe&536870912)===0||re){var e=Cn;Cn<<=1,(Cn&3932160)===0&&(Cn=262144),gt=e}else gt=536870912;return e=mt.current,e!==null&&(e.flags|=32),gt}function st(e,t,l){(e===Oe&&(ge===2||ge===9)||e.cancelPendingCommit!==null)&&(Sa(e,0),gl(e,fe,gt,!1)),Ma(e,l),((ye&2)===0||e!==Oe)&&(e===Oe&&((ye&2)===0&&(Ll|=l),qe===4&&gl(e,fe,gt,!1)),qt(e))}function br(e,t,l){if((ye&6)!==0)throw Error(o(327));var a=!l&&(t&127)===0&&(t&e.expiredLanes)===0||Da(e,t),n=a?Am(e,t):Bc(e,t,!0),u=a;do{if(n===0){pa&&!a&&gl(e,t,0,!1);break}else{if(l=e.current.alternate,u&&!Tm(l)){n=Bc(e,t,!1),u=!1;continue}if(n===2){if(u=t,e.errorRecoveryDisabledLanes&u)var c=0;else c=e.pendingLanes&-536870913,c=c!==0?c:c&536870912?536870912:0;if(c!==0){t=c;e:{var f=e;n=rn;var r=f.current.memoizedState.isDehydrated;if(r&&(Sa(f,c).flags|=256),c=Bc(f,c,!1),c!==2){if(Cc&&!r){f.errorRecoveryDisabledLanes|=u,Ll|=u,n=4;break e}u=ct,ct=n,u!==null&&(ct===null?ct=u:ct.push.apply(ct,u))}n=c}if(u=!1,n!==2)continue}}if(n===1){Sa(e,0),gl(e,t,0,!0);break}e:{switch(a=e,u=n,u){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:gl(a,t,gt,!hl);break e;case 2:ct=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(n=xu+300-ft(),10<n)){if(gl(a,t,gt,!hl),Mn(a,0,!0)!==0)break e;It=t,a.timeoutHandle=$r(xr.bind(null,a,l,ct,ju,Mc,t,gt,Ll,ba,hl,u,"Throttled",-0,0),n);break e}xr(a,l,ct,ju,Mc,t,gt,Ll,ba,hl,u,null,-0,0)}}break}while(!0);qt(e)}function xr(e,t,l,a,n,u,c,f,r,g,T,C,p,S){if(e.timeoutHandle=-1,C=t.subtreeFlags,C&8192||(C&16785408)===16785408){C={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Bt},dr(t,u,C);var w=(u&62914560)===u?xu-ft():(u&4194048)===u?vr-ft():0;if(w=cy(C,w),w!==null){It=u,e.cancelPendingCommit=w(Or.bind(null,e,t,u,l,a,n,c,f,r,T,C,null,p,S)),gl(e,u,c,!g);return}}Or(e,t,u,l,a,n,c,f,r)}function Tm(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var a=0;a<l.length;a++){var n=l[a],u=n.getSnapshot;n=n.value;try{if(!dt(u(),n))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;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 gl(e,t,l,a){t&=~Dc,t&=~Ll,e.suspendedLanes|=t,e.pingedLanes&=~t,a&&(e.warmLanes|=t),a=e.expirationTimes;for(var n=t;0<n;){var u=31-rt(n),c=1<<u;a[u]=-1,n&=~c}l!==0&&Os(e,l,t)}function Tu(){return(ye&6)===0?(hn(0),!1):!0}function Hc(){if(ie!==null){if(ge===0)var e=ie.return;else e=ie,Xt=Ul=null,Ii(e),ra=null,ka=0,e=ie;for(;e!==null;)Fo(e.alternate,e),e=e.return;ie=null}}function Sa(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,Lm(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),It=0,Hc(),Oe=e,ie=l=Gt(e.current,null),fe=t,ge=0,vt=null,hl=!1,pa=Da(e,t),Cc=!1,ba=gt=Dc=Ll=ml=qe=0,ct=rn=null,Mc=!1,(t&8)!==0&&(t|=t&32);var a=e.entangledLanes;if(a!==0)for(e=e.entanglements,a&=t;0<a;){var n=31-rt(a),u=1<<n;t|=e[n],a&=~u}return Ft=t,Zn(),l}function Sr(e,t){ee=null,j.H=ln,t===oa||t===In?(t=Hf(),ge=3):t===wi?(t=Hf(),ge=4):ge=t===mc?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,vt=t,ie===null&&(qe=1,du(e,jt(t,e.current)))}function jr(){var e=mt.current;return e===null?!0:(fe&4194048)===fe?_t===null:(fe&62914560)===fe||(fe&536870912)!==0?e===_t:!1}function Tr(){var e=j.H;return j.H=ln,e===null?ln:e}function Er(){var e=j.A;return j.A=Sm,e}function Eu(){qe=4,hl||(fe&4194048)!==fe&&mt.current!==null||(pa=!0),(ml&134217727)===0&&(Ll&134217727)===0||Oe===null||gl(Oe,fe,gt,!1)}function Bc(e,t,l){var a=ye;ye|=2;var n=Tr(),u=Er();(Oe!==e||fe!==t)&&(ju=null,Sa(e,t)),t=!1;var c=qe;e:do try{if(ge!==0&&ie!==null){var f=ie,r=vt;switch(ge){case 8:Hc(),c=6;break e;case 3:case 2:case 9:case 6:mt.current===null&&(t=!0);var g=ge;if(ge=0,vt=null,ja(e,f,r,g),l&&pa){c=0;break e}break;default:g=ge,ge=0,vt=null,ja(e,f,r,g)}}Em(),c=qe;break}catch(T){Sr(e,T)}while(!0);return t&&e.shellSuspendCounter++,Xt=Ul=null,ye=a,j.H=n,j.A=u,ie===null&&(Oe=null,fe=0,Zn()),c}function Em(){for(;ie!==null;)Ar(ie)}function Am(e,t){var l=ye;ye|=2;var a=Tr(),n=Er();Oe!==e||fe!==t?(ju=null,Su=ft()+500,Sa(e,t)):pa=Da(e,t);e:do try{if(ge!==0&&ie!==null){t=ie;var u=vt;t:switch(ge){case 1:ge=0,vt=null,ja(e,t,u,1);break;case 2:case 9:if(Uf(u)){ge=0,vt=null,_r(t);break}t=function(){ge!==2&&ge!==9||Oe!==e||(ge=7),qt(e)},u.then(t,t);break e;case 3:ge=7;break e;case 4:ge=5;break e;case 7:Uf(u)?(ge=0,vt=null,_r(t)):(ge=0,vt=null,ja(e,t,u,7));break;case 5:var c=null;switch(ie.tag){case 26:c=ie.memoizedState;case 5:case 27:var f=ie;if(c?rd(c):f.stateNode.complete){ge=0,vt=null;var r=f.sibling;if(r!==null)ie=r;else{var g=f.return;g!==null?(ie=g,Au(g)):ie=null}break t}}ge=0,vt=null,ja(e,t,u,5);break;case 6:ge=0,vt=null,ja(e,t,u,6);break;case 8:Hc(),qe=6;break e;default:throw Error(o(462))}}_m();break}catch(T){Sr(e,T)}while(!0);return Xt=Ul=null,j.H=a,j.A=n,ye=l,ie!==null?0:(Oe=null,fe=0,Zn(),qe)}function _m(){for(;ie!==null&&!Wd();)Ar(ie)}function Ar(e){var t=Wo(e.alternate,e,Ft);e.memoizedProps=e.pendingProps,t===null?Au(e):ie=t}function _r(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Lo(l,t,t.pendingProps,t.type,void 0,fe);break;case 11:t=Lo(l,t,t.pendingProps,t.type.render,t.ref,fe);break;case 5:Ii(t);default:Fo(l,t),t=ie=Tf(t,Ft),t=Wo(l,t,Ft)}e.memoizedProps=e.pendingProps,t===null?Au(e):ie=t}function ja(e,t,l,a){Xt=Ul=null,Ii(t),ra=null,ka=0;var n=t.return;try{if(mm(e,n,t,l,fe)){qe=1,du(e,jt(l,e.current)),ie=null;return}}catch(u){if(n!==null)throw ie=n,u;qe=1,du(e,jt(l,e.current)),ie=null;return}t.flags&32768?(re||a===1?e=!0:pa||(fe&536870912)!==0?e=!1:(hl=e=!0,(a===2||a===9||a===3||a===6)&&(a=mt.current,a!==null&&a.tag===13&&(a.flags|=16384))),zr(t,e)):Au(t)}function Au(e){var t=e;do{if((t.flags&32768)!==0){zr(t,hl);return}e=t.return;var l=gm(t.alternate,t,Ft);if(l!==null){ie=l;return}if(t=t.sibling,t!==null){ie=t;return}ie=t=e}while(t!==null);qe===0&&(qe=5)}function zr(e,t){do{var l=pm(e.alternate,e);if(l!==null){l.flags&=32767,ie=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){ie=e;return}ie=e=l}while(e!==null);qe=6,ie=null}function Or(e,t,l,a,n,u,c,f,r){e.cancelPendingCommit=null;do _u();while(Ve!==0);if((ye&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(u=t.lanes|t.childLanes,u|=Ai,uh(e,l,u,c,f,r),e===Oe&&(ie=Oe=null,fe=0),xa=t,vl=e,It=l,Rc=u,Uc=n,gr=a,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Cm(On,function(){return Rr(),null})):(e.callbackNode=null,e.callbackPriority=0),a=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||a){a=j.T,j.T=null,n=N.p,N.p=2,c=ye,ye|=4;try{bm(e,t,l)}finally{ye=c,N.p=n,j.T=a}}Ve=1,Nr(),Cr(),Dr()}}function Nr(){if(Ve===1){Ve=0;var e=vl,t=xa,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=j.T,j.T=null;var a=N.p;N.p=2;var n=ye;ye|=4;try{fr(t,e);var u=Wc,c=mf(e.containerInfo),f=u.focusedElem,r=u.selectionRange;if(c!==f&&f&&f.ownerDocument&&hf(f.ownerDocument.documentElement,f)){if(r!==null&&xi(f)){var g=r.start,T=r.end;if(T===void 0&&(T=g),"selectionStart"in f)f.selectionStart=g,f.selectionEnd=Math.min(T,f.value.length);else{var C=f.ownerDocument||document,p=C&&C.defaultView||window;if(p.getSelection){var S=p.getSelection(),w=f.textContent.length,J=Math.min(r.start,w),_e=r.end===void 0?J:Math.min(r.end,w);!S.extend&&J>_e&&(c=_e,_e=J,J=c);var y=df(f,J),h=df(f,_e);if(y&&h&&(S.rangeCount!==1||S.anchorNode!==y.node||S.anchorOffset!==y.offset||S.focusNode!==h.node||S.focusOffset!==h.offset)){var v=C.createRange();v.setStart(y.node,y.offset),S.removeAllRanges(),J>_e?(S.addRange(v),S.extend(h.node,h.offset)):(v.setEnd(h.node,h.offset),S.addRange(v))}}}}for(C=[],S=f;S=S.parentNode;)S.nodeType===1&&C.push({element:S,left:S.scrollLeft,top:S.scrollTop});for(typeof f.focus=="function"&&f.focus(),f=0;f<C.length;f++){var z=C[f];z.element.scrollLeft=z.left,z.element.scrollTop=z.top}}Yu=!!kc,Wc=kc=null}finally{ye=n,N.p=a,j.T=l}}e.current=t,Ve=2}}function Cr(){if(Ve===2){Ve=0;var e=vl,t=xa,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=j.T,j.T=null;var a=N.p;N.p=2;var n=ye;ye|=4;try{nr(e,t.alternate,t)}finally{ye=n,N.p=a,j.T=l}}Ve=3}}function Dr(){if(Ve===4||Ve===3){Ve=0,$d();var e=vl,t=xa,l=It,a=gr;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Ve=5:(Ve=0,xa=vl=null,Mr(e,e.pendingLanes));var n=e.pendingLanes;if(n===0&&(yl=null),ti(l),t=t.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(Ca,t,void 0,(t.current.flags&128)===128)}catch{}if(a!==null){t=j.T,n=N.p,N.p=2,j.T=null;try{for(var u=e.onRecoverableError,c=0;c<a.length;c++){var f=a[c];u(f.value,{componentStack:f.stack})}}finally{j.T=t,N.p=n}}(It&3)!==0&&_u(),qt(e),n=e.pendingLanes,(l&261930)!==0&&(n&42)!==0?e===qc?dn++:(dn=0,qc=e):dn=0,hn(0)}}function Mr(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ka(t)))}function _u(){return Nr(),Cr(),Dr(),Rr()}function Rr(){if(Ve!==5)return!1;var e=vl,t=Rc;Rc=0;var l=ti(It),a=j.T,n=N.p;try{N.p=32>l?32:l,j.T=null,l=Uc,Uc=null;var u=vl,c=It;if(Ve=0,xa=vl=null,It=0,(ye&6)!==0)throw Error(o(331));var f=ye;if(ye|=4,mr(u.current),rr(u,u.current,c,l),ye=f,hn(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(Ca,u)}catch{}return!0}finally{N.p=n,j.T=a,Mr(e,t)}}function Ur(e,t,l){t=jt(l,t),t=hc(e.stateNode,t,2),e=fl(e,t,2),e!==null&&(Ma(e,2),qt(e))}function pe(e,t,l){if(e.tag===3)Ur(e,e,l);else for(;t!==null;){if(t.tag===3){Ur(t,e,l);break}else if(t.tag===1){var a=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(yl===null||!yl.has(a))){e=jt(l,e),l=qo(2),a=fl(t,l,2),a!==null&&(Ho(l,a,t,e),Ma(a,2),qt(a));break}}t=t.return}}function Yc(e,t,l){var a=e.pingCache;if(a===null){a=e.pingCache=new jm;var n=new Set;a.set(t,n)}else n=a.get(t),n===void 0&&(n=new Set,a.set(t,n));n.has(l)||(Cc=!0,n.add(l),e=zm.bind(null,e,t,l),t.then(e,e))}function zm(e,t,l){var a=e.pingCache;a!==null&&a.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Oe===e&&(fe&l)===l&&(qe===4||qe===3&&(fe&62914560)===fe&&300>ft()-xu?(ye&2)===0&&Sa(e,0):Dc|=l,ba===fe&&(ba=0)),qt(e)}function qr(e,t){t===0&&(t=zs()),e=Dl(e,t),e!==null&&(Ma(e,t),qt(e))}function Om(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),qr(e,l)}function Nm(e,t){var l=0;switch(e.tag){case 31:case 13:var a=e.stateNode,n=e.memoizedState;n!==null&&(l=n.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(o(314))}a!==null&&a.delete(t),qr(e,l)}function Cm(e,t){return Fu(e,t)}var zu=null,Ta=null,Gc=!1,Ou=!1,wc=!1,pl=0;function qt(e){e!==Ta&&e.next===null&&(Ta===null?zu=Ta=e:Ta=Ta.next=e),Ou=!0,Gc||(Gc=!0,Mm())}function hn(e,t){if(!wc&&Ou){wc=!0;do for(var l=!1,a=zu;a!==null;){if(e!==0){var n=a.pendingLanes;if(n===0)var u=0;else{var c=a.suspendedLanes,f=a.pingedLanes;u=(1<<31-rt(42|e)+1)-1,u&=n&~(c&~f),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,Gr(a,u))}else u=fe,u=Mn(a,a===Oe?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||Da(a,u)||(l=!0,Gr(a,u));a=a.next}while(l);wc=!1}}function Dm(){Hr()}function Hr(){Ou=Gc=!1;var e=0;pl!==0&&Qm()&&(e=pl);for(var t=ft(),l=null,a=zu;a!==null;){var n=a.next,u=Br(a,t);u===0?(a.next=null,l===null?zu=n:l.next=n,n===null&&(Ta=l)):(l=a,(e!==0||(u&3)!==0)&&(Ou=!0)),a=n}Ve!==0&&Ve!==5||hn(e),pl!==0&&(pl=0)}function Br(e,t){for(var l=e.suspendedLanes,a=e.pingedLanes,n=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var c=31-rt(u),f=1<<c,r=n[c];r===-1?((f&l)===0||(f&a)!==0)&&(n[c]=nh(f,t)):r<=t&&(e.expiredLanes|=f),u&=~f}if(t=Oe,l=fe,l=Mn(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a=e.callbackNode,l===0||e===t&&(ge===2||ge===9)||e.cancelPendingCommit!==null)return a!==null&&a!==null&&Iu(a),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||Da(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(a!==null&&Iu(a),ti(l)){case 2:case 8:l=As;break;case 32:l=On;break;case 268435456:l=_s;break;default:l=On}return a=Yr.bind(null,e),l=Fu(l,a),e.callbackPriority=t,e.callbackNode=l,t}return a!==null&&a!==null&&Iu(a),e.callbackPriority=2,e.callbackNode=null,2}function Yr(e,t){if(Ve!==0&&Ve!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(_u()&&e.callbackNode!==l)return null;var a=fe;return a=Mn(e,e===Oe?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),a===0?null:(br(e,a,t),Br(e,ft()),e.callbackNode!=null&&e.callbackNode===l?Yr.bind(null,e):null)}function Gr(e,t){if(_u())return null;br(e,t,!0)}function Mm(){Zm(function(){(ye&6)!==0?Fu(Es,Dm):Hr()})}function Xc(){if(pl===0){var e=sa;e===0&&(e=Nn,Nn<<=1,(Nn&261888)===0&&(Nn=256)),pl=e}return pl}function wr(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Hn(""+e)}function Xr(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function Rm(e,t,l,a,n){if(t==="submit"&&l&&l.stateNode===n){var u=wr((n[lt]||null).action),c=a.submitter;c&&(t=(t=c[lt]||null)?wr(t.formAction):c.getAttribute("formAction"),t!==null&&(u=t,c=null));var f=new wn("action","action",null,a,n);e.push({event:f,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(pl!==0){var r=c?Xr(n,c):new FormData(n);cc(l,{pending:!0,data:r,method:n.method,action:u},null,r)}}else typeof u=="function"&&(f.preventDefault(),r=c?Xr(n,c):new FormData(n),cc(l,{pending:!0,data:r,method:n.method,action:u},u,r))},currentTarget:n}]})}}for(var Qc=0;Qc<Ei.length;Qc++){var Lc=Ei[Qc],Um=Lc.toLowerCase(),qm=Lc[0].toUpperCase()+Lc.slice(1);Nt(Um,"on"+qm)}Nt(gf,"onAnimationEnd"),Nt(pf,"onAnimationIteration"),Nt(bf,"onAnimationStart"),Nt("dblclick","onDoubleClick"),Nt("focusin","onFocus"),Nt("focusout","onBlur"),Nt(Fh,"onTransitionRun"),Nt(Ih,"onTransitionStart"),Nt(Ph,"onTransitionCancel"),Nt(xf,"onTransitionEnd"),kl("onMouseEnter",["mouseout","mouseover"]),kl("onMouseLeave",["mouseout","mouseover"]),kl("onPointerEnter",["pointerout","pointerover"]),kl("onPointerLeave",["pointerout","pointerover"]),zl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),zl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),zl("onBeforeInput",["compositionend","keypress","textInput","paste"]),zl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),zl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),zl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var mn="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(" "),Hm=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(mn));function Qr(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var a=e[l],n=a.event;a=a.listeners;e:{var u=void 0;if(t)for(var c=a.length-1;0<=c;c--){var f=a[c],r=f.instance,g=f.currentTarget;if(f=f.listener,r!==u&&n.isPropagationStopped())break e;u=f,n.currentTarget=g;try{u(n)}catch(T){Ln(T)}n.currentTarget=null,u=r}else for(c=0;c<a.length;c++){if(f=a[c],r=f.instance,g=f.currentTarget,f=f.listener,r!==u&&n.isPropagationStopped())break e;u=f,n.currentTarget=g;try{u(n)}catch(T){Ln(T)}n.currentTarget=null,u=r}}}}function ce(e,t){var l=t[li];l===void 0&&(l=t[li]=new Set);var a=e+"__bubble";l.has(a)||(Lr(t,e,2,!1),l.add(a))}function Zc(e,t,l){var a=0;t&&(a|=4),Lr(l,e,a,t)}var Nu="_reactListening"+Math.random().toString(36).slice(2);function Vc(e){if(!e[Nu]){e[Nu]=!0,Us.forEach(function(l){l!=="selectionchange"&&(Hm.has(l)||Zc(l,!1,e),Zc(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Nu]||(t[Nu]=!0,Zc("selectionchange",!1,t))}}function Lr(e,t,l,a){switch(pd(t)){case 2:var n=oy;break;case 8:n=ry;break;default:n=is}l=n.bind(null,t,l,e),n=void 0,!ri||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(n=!0),a?n!==void 0?e.addEventListener(t,l,{capture:!0,passive:n}):e.addEventListener(t,l,!0):n!==void 0?e.addEventListener(t,l,{passive:n}):e.addEventListener(t,l,!1)}function Kc(e,t,l,a,n){var u=a;if((t&1)===0&&(t&2)===0&&a!==null)e:for(;;){if(a===null)return;var c=a.tag;if(c===3||c===4){var f=a.stateNode.containerInfo;if(f===n)break;if(c===4)for(c=a.return;c!==null;){var r=c.tag;if((r===3||r===4)&&c.stateNode.containerInfo===n)return;c=c.return}for(;f!==null;){if(c=Vl(f),c===null)return;if(r=c.tag,r===5||r===6||r===26||r===27){a=u=c;continue e}f=f.parentNode}}a=a.return}Ks(function(){var g=u,T=fi(l),C=[];e:{var p=Sf.get(e);if(p!==void 0){var S=wn,w=e;switch(e){case"keypress":if(Yn(l)===0)break e;case"keydown":case"keyup":S=Nh;break;case"focusin":w="focus",S=yi;break;case"focusout":w="blur",S=yi;break;case"beforeblur":case"afterblur":S=yi;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":S=Ws;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":S=gh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":S=Mh;break;case gf:case pf:case bf:S=xh;break;case xf:S=Uh;break;case"scroll":case"scrollend":S=yh;break;case"wheel":S=Hh;break;case"copy":case"cut":case"paste":S=jh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":S=Fs;break;case"toggle":case"beforetoggle":S=Yh}var J=(t&4)!==0,_e=!J&&(e==="scroll"||e==="scrollend"),y=J?p!==null?p+"Capture":null:p;J=[];for(var h=g,v;h!==null;){var z=h;if(v=z.stateNode,z=z.tag,z!==5&&z!==26&&z!==27||v===null||y===null||(z=qa(h,y),z!=null&&J.push(yn(h,z,v))),_e)break;h=h.return}0<J.length&&(p=new S(p,w,null,l,T),C.push({event:p,listeners:J}))}}if((t&7)===0){e:{if(p=e==="mouseover"||e==="pointerover",S=e==="mouseout"||e==="pointerout",p&&l!==si&&(w=l.relatedTarget||l.fromElement)&&(Vl(w)||w[Zl]))break e;if((S||p)&&(p=T.window===T?T:(p=T.ownerDocument)?p.defaultView||p.parentWindow:window,S?(w=l.relatedTarget||l.toElement,S=g,w=w?Vl(w):null,w!==null&&(_e=_(w),J=w.tag,w!==_e||J!==5&&J!==27&&J!==6)&&(w=null)):(S=null,w=g),S!==w)){if(J=Ws,z="onMouseLeave",y="onMouseEnter",h="mouse",(e==="pointerout"||e==="pointerover")&&(J=Fs,z="onPointerLeave",y="onPointerEnter",h="pointer"),_e=S==null?p:Ua(S),v=w==null?p:Ua(w),p=new J(z,h+"leave",S,l,T),p.target=_e,p.relatedTarget=v,z=null,Vl(T)===g&&(J=new J(y,h+"enter",w,l,T),J.target=v,J.relatedTarget=_e,z=J),_e=z,S&&w)t:{for(J=Bm,y=S,h=w,v=0,z=y;z;z=J(z))v++;z=0;for(var K=h;K;K=J(K))z++;for(;0<v-z;)y=J(y),v--;for(;0<z-v;)h=J(h),z--;for(;v--;){if(y===h||h!==null&&y===h.alternate){J=y;break t}y=J(y),h=J(h)}J=null}else J=null;S!==null&&Zr(C,p,S,J,!1),w!==null&&_e!==null&&Zr(C,_e,w,J,!0)}}e:{if(p=g?Ua(g):window,S=p.nodeName&&p.nodeName.toLowerCase(),S==="select"||S==="input"&&p.type==="file")var he=uf;else if(af(p))if(cf)he=kh;else{he=Kh;var L=Vh}else S=p.nodeName,!S||S.toLowerCase()!=="input"||p.type!=="checkbox"&&p.type!=="radio"?g&&ci(g.elementType)&&(he=uf):he=Jh;if(he&&(he=he(e,g))){nf(C,he,l,T);break e}L&&L(e,p,g),e==="focusout"&&g&&p.type==="number"&&g.memoizedProps.value!=null&&ii(p,"number",p.value)}switch(L=g?Ua(g):window,e){case"focusin":(af(L)||L.contentEditable==="true")&&(ea=L,Si=g,La=null);break;case"focusout":La=Si=ea=null;break;case"mousedown":ji=!0;break;case"contextmenu":case"mouseup":case"dragend":ji=!1,yf(C,l,T);break;case"selectionchange":if($h)break;case"keydown":case"keyup":yf(C,l,T)}var te;if(gi)e:{switch(e){case"compositionstart":var oe="onCompositionStart";break e;case"compositionend":oe="onCompositionEnd";break e;case"compositionupdate":oe="onCompositionUpdate";break e}oe=void 0}else Pl?tf(e,l)&&(oe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(oe="onCompositionStart");oe&&(Is&&l.locale!=="ko"&&(Pl||oe!=="onCompositionStart"?oe==="onCompositionEnd"&&Pl&&(te=Js()):(ll=T,di="value"in ll?ll.value:ll.textContent,Pl=!0)),L=Cu(g,oe),0<L.length&&(oe=new $s(oe,e,null,l,T),C.push({event:oe,listeners:L}),te?oe.data=te:(te=lf(l),te!==null&&(oe.data=te)))),(te=wh?Xh(e,l):Qh(e,l))&&(oe=Cu(g,"onBeforeInput"),0<oe.length&&(L=new $s("onBeforeInput","beforeinput",null,l,T),C.push({event:L,listeners:oe}),L.data=te)),Rm(C,e,g,l,T)}Qr(C,t)})}function yn(e,t,l){return{instance:e,listener:t,currentTarget:l}}function Cu(e,t){for(var l=t+"Capture",a=[];e!==null;){var n=e,u=n.stateNode;if(n=n.tag,n!==5&&n!==26&&n!==27||u===null||(n=qa(e,l),n!=null&&a.unshift(yn(e,n,u)),n=qa(e,t),n!=null&&a.push(yn(e,n,u))),e.tag===3)return a;e=e.return}return[]}function Bm(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Zr(e,t,l,a,n){for(var u=t._reactName,c=[];l!==null&&l!==a;){var f=l,r=f.alternate,g=f.stateNode;if(f=f.tag,r!==null&&r===a)break;f!==5&&f!==26&&f!==27||g===null||(r=g,n?(g=qa(l,u),g!=null&&c.unshift(yn(l,g,r))):n||(g=qa(l,u),g!=null&&c.push(yn(l,g,r)))),l=l.return}c.length!==0&&e.push({event:t,listeners:c})}var Ym=/\r\n?/g,Gm=/\u0000|\uFFFD/g;function Vr(e){return(typeof e=="string"?e:""+e).replace(Ym,`
-`).replace(Gm,"")}function Kr(e,t){return t=Vr(t),Vr(e)===t}function Ae(e,t,l,a,n,u){switch(l){case"children":typeof a=="string"?t==="body"||t==="textarea"&&a===""||$l(e,a):(typeof a=="number"||typeof a=="bigint")&&t!=="body"&&$l(e,""+a);break;case"className":Un(e,"class",a);break;case"tabIndex":Un(e,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Un(e,l,a);break;case"style":Zs(e,a,u);break;case"data":if(t!=="object"){Un(e,"data",a);break}case"src":case"href":if(a===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=Hn(""+a),e.setAttribute(l,a);break;case"action":case"formAction":if(typeof a=="function"){e.setAttribute(l,"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"&&(l==="formAction"?(t!=="input"&&Ae(e,t,"name",n.name,n,null),Ae(e,t,"formEncType",n.formEncType,n,null),Ae(e,t,"formMethod",n.formMethod,n,null),Ae(e,t,"formTarget",n.formTarget,n,null)):(Ae(e,t,"encType",n.encType,n,null),Ae(e,t,"method",n.method,n,null),Ae(e,t,"target",n.target,n,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){e.removeAttribute(l);break}a=Hn(""+a),e.setAttribute(l,a);break;case"onClick":a!=null&&(e.onclick=Bt);break;case"onScroll":a!=null&&ce("scroll",e);break;case"onScrollEnd":a!=null&&ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(l=a.__html,l!=null){if(n.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":e.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){e.removeAttribute("xlink:href");break}l=Hn(""+a),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""+a):e.removeAttribute(l);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":a&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":a===!0?e.setAttribute(l,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?e.setAttribute(l,a):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?e.setAttribute(l,a):e.removeAttribute(l);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?e.removeAttribute(l):e.setAttribute(l,a);break;case"popover":ce("beforetoggle",e),ce("toggle",e),Rn(e,"popover",a);break;case"xlinkActuate":Ht(e,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Ht(e,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Ht(e,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Ht(e,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Ht(e,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Ht(e,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Ht(e,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Ht(e,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Ht(e,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Rn(e,"is",a);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=hh.get(l)||l,Rn(e,l,a))}}function Jc(e,t,l,a,n,u){switch(l){case"style":Zs(e,a,u);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(o(61));if(l=a.__html,l!=null){if(n.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof a=="string"?$l(e,a):(typeof a=="number"||typeof a=="bigint")&&$l(e,""+a);break;case"onScroll":a!=null&&ce("scroll",e);break;case"onScrollEnd":a!=null&&ce("scrollend",e);break;case"onClick":a!=null&&(e.onclick=Bt);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!qs.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(n=l.endsWith("Capture"),t=l.slice(2,n?l.length-7:void 0),u=e[lt]||null,u=u!=null?u[l]:null,typeof u=="function"&&e.removeEventListener(t,u,n),typeof a=="function")){typeof u!="function"&&u!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,a,n);break e}l in e?e[l]=a:a===!0?e.setAttribute(l,""):Rn(e,l,a)}}}function Ie(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ce("error",e),ce("load",e);var a=!1,n=!1,u;for(u in l)if(l.hasOwnProperty(u)){var c=l[u];if(c!=null)switch(u){case"src":a=!0;break;case"srcSet":n=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Ae(e,t,u,c,l,null)}}n&&Ae(e,t,"srcSet",l.srcSet,l,null),a&&Ae(e,t,"src",l.src,l,null);return;case"input":ce("invalid",e);var f=u=c=n=null,r=null,g=null;for(a in l)if(l.hasOwnProperty(a)){var T=l[a];if(T!=null)switch(a){case"name":n=T;break;case"type":c=T;break;case"checked":r=T;break;case"defaultChecked":g=T;break;case"value":u=T;break;case"defaultValue":f=T;break;case"children":case"dangerouslySetInnerHTML":if(T!=null)throw Error(o(137,t));break;default:Ae(e,t,a,T,l,null)}}ws(e,u,f,r,g,c,n,!1);return;case"select":ce("invalid",e),a=c=u=null;for(n in l)if(l.hasOwnProperty(n)&&(f=l[n],f!=null))switch(n){case"value":u=f;break;case"defaultValue":c=f;break;case"multiple":a=f;default:Ae(e,t,n,f,l,null)}t=u,l=c,e.multiple=!!a,t!=null?Wl(e,!!a,t,!1):l!=null&&Wl(e,!!a,l,!0);return;case"textarea":ce("invalid",e),u=n=a=null;for(c in l)if(l.hasOwnProperty(c)&&(f=l[c],f!=null))switch(c){case"value":a=f;break;case"defaultValue":n=f;break;case"children":u=f;break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(o(91));break;default:Ae(e,t,c,f,l,null)}Qs(e,a,n,u);return;case"option":for(r in l)if(l.hasOwnProperty(r)&&(a=l[r],a!=null))switch(r){case"selected":e.selected=a&&typeof a!="function"&&typeof a!="symbol";break;default:Ae(e,t,r,a,l,null)}return;case"dialog":ce("beforetoggle",e),ce("toggle",e),ce("cancel",e),ce("close",e);break;case"iframe":case"object":ce("load",e);break;case"video":case"audio":for(a=0;a<mn.length;a++)ce(mn[a],e);break;case"image":ce("error",e),ce("load",e);break;case"details":ce("toggle",e);break;case"embed":case"source":case"link":ce("error",e),ce("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(g in l)if(l.hasOwnProperty(g)&&(a=l[g],a!=null))switch(g){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Ae(e,t,g,a,l,null)}return;default:if(ci(t)){for(T in l)l.hasOwnProperty(T)&&(a=l[T],a!==void 0&&Jc(e,t,T,a,l,void 0));return}}for(f in l)l.hasOwnProperty(f)&&(a=l[f],a!=null&&Ae(e,t,f,a,l,null))}function wm(e,t,l,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var n=null,u=null,c=null,f=null,r=null,g=null,T=null;for(S in l){var C=l[S];if(l.hasOwnProperty(S)&&C!=null)switch(S){case"checked":break;case"value":break;case"defaultValue":r=C;default:a.hasOwnProperty(S)||Ae(e,t,S,null,a,C)}}for(var p in a){var S=a[p];if(C=l[p],a.hasOwnProperty(p)&&(S!=null||C!=null))switch(p){case"type":u=S;break;case"name":n=S;break;case"checked":g=S;break;case"defaultChecked":T=S;break;case"value":c=S;break;case"defaultValue":f=S;break;case"children":case"dangerouslySetInnerHTML":if(S!=null)throw Error(o(137,t));break;default:S!==C&&Ae(e,t,p,S,a,C)}}ui(e,c,f,r,g,T,u,n);return;case"select":S=c=f=p=null;for(u in l)if(r=l[u],l.hasOwnProperty(u)&&r!=null)switch(u){case"value":break;case"multiple":S=r;default:a.hasOwnProperty(u)||Ae(e,t,u,null,a,r)}for(n in a)if(u=a[n],r=l[n],a.hasOwnProperty(n)&&(u!=null||r!=null))switch(n){case"value":p=u;break;case"defaultValue":f=u;break;case"multiple":c=u;default:u!==r&&Ae(e,t,n,u,a,r)}t=f,l=c,a=S,p!=null?Wl(e,!!l,p,!1):!!a!=!!l&&(t!=null?Wl(e,!!l,t,!0):Wl(e,!!l,l?[]:"",!1));return;case"textarea":S=p=null;for(f in l)if(n=l[f],l.hasOwnProperty(f)&&n!=null&&!a.hasOwnProperty(f))switch(f){case"value":break;case"children":break;default:Ae(e,t,f,null,a,n)}for(c in a)if(n=a[c],u=l[c],a.hasOwnProperty(c)&&(n!=null||u!=null))switch(c){case"value":p=n;break;case"defaultValue":S=n;break;case"children":break;case"dangerouslySetInnerHTML":if(n!=null)throw Error(o(91));break;default:n!==u&&Ae(e,t,c,n,a,u)}Xs(e,p,S);return;case"option":for(var w in l)if(p=l[w],l.hasOwnProperty(w)&&p!=null&&!a.hasOwnProperty(w))switch(w){case"selected":e.selected=!1;break;default:Ae(e,t,w,null,a,p)}for(r in a)if(p=a[r],S=l[r],a.hasOwnProperty(r)&&p!==S&&(p!=null||S!=null))switch(r){case"selected":e.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:Ae(e,t,r,p,a,S)}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 J in l)p=l[J],l.hasOwnProperty(J)&&p!=null&&!a.hasOwnProperty(J)&&Ae(e,t,J,null,a,p);for(g in a)if(p=a[g],S=l[g],a.hasOwnProperty(g)&&p!==S&&(p!=null||S!=null))switch(g){case"children":case"dangerouslySetInnerHTML":if(p!=null)throw Error(o(137,t));break;default:Ae(e,t,g,p,a,S)}return;default:if(ci(t)){for(var _e in l)p=l[_e],l.hasOwnProperty(_e)&&p!==void 0&&!a.hasOwnProperty(_e)&&Jc(e,t,_e,void 0,a,p);for(T in a)p=a[T],S=l[T],!a.hasOwnProperty(T)||p===S||p===void 0&&S===void 0||Jc(e,t,T,p,a,S);return}}for(var y in l)p=l[y],l.hasOwnProperty(y)&&p!=null&&!a.hasOwnProperty(y)&&Ae(e,t,y,null,a,p);for(C in a)p=a[C],S=l[C],!a.hasOwnProperty(C)||p===S||p==null&&S==null||Ae(e,t,C,p,a,S)}function Jr(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Xm(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),a=0;a<l.length;a++){var n=l[a],u=n.transferSize,c=n.initiatorType,f=n.duration;if(u&&f&&Jr(c)){for(c=0,f=n.responseEnd,a+=1;a<l.length;a++){var r=l[a],g=r.startTime;if(g>f)break;var T=r.transferSize,C=r.initiatorType;T&&Jr(C)&&(r=r.responseEnd,c+=T*(r<f?1:(f-g)/(r-g)))}if(--a,t+=8*(u+c)/(n.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 kc=null,Wc=null;function Du(e){return e.nodeType===9?e:e.ownerDocument}function kr(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 Wr(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 $c(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 Fc=null;function Qm(){var e=window.event;return e&&e.type==="popstate"?e===Fc?!1:(Fc=e,!0):(Fc=null,!1)}var $r=typeof setTimeout=="function"?setTimeout:void 0,Lm=typeof clearTimeout=="function"?clearTimeout:void 0,Fr=typeof Promise=="function"?Promise:void 0,Zm=typeof queueMicrotask=="function"?queueMicrotask:typeof Fr<"u"?function(e){return Fr.resolve(null).then(e).catch(Vm)}:$r;function Vm(e){setTimeout(function(){throw e})}function bl(e){return e==="head"}function Ir(e,t){var l=t,a=0;do{var n=l.nextSibling;if(e.removeChild(l),n&&n.nodeType===8)if(l=n.data,l==="/$"||l==="/&"){if(a===0){e.removeChild(n),za(t);return}a--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")a++;else if(l==="html")vn(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,vn(l);for(var u=l.firstChild;u;){var c=u.nextSibling,f=u.nodeName;u[Ra]||f==="SCRIPT"||f==="STYLE"||f==="LINK"&&u.rel.toLowerCase()==="stylesheet"||l.removeChild(u),u=c}}else l==="body"&&vn(e.ownerDocument.body);l=n}while(l);za(t)}function Pr(e,t){var l=e;e=0;do{var a=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),a&&a.nodeType===8)if(l=a.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=a}while(l)}function Ic(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Ic(l),ai(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function Km(e,t,l,a){for(;e.nodeType===1;){var n=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!a&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(a){if(!e[Ra])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!==n.rel||e.getAttribute("href")!==(n.href==null||n.href===""?null:n.href)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin)||e.getAttribute("title")!==(n.title==null?null:n.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(n.src==null?null:n.src)||e.getAttribute("type")!==(n.type==null?null:n.type)||e.getAttribute("crossorigin")!==(n.crossOrigin==null?null:n.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=n.name==null?null:""+n.name;if(n.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=zt(e.nextSibling),e===null)break}return null}function Jm(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=zt(e.nextSibling),e===null))return null;return e}function ed(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=zt(e.nextSibling),e===null))return null;return e}function Pc(e){return e.data==="$?"||e.data==="$~"}function es(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function km(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var a=function(){t(),l.removeEventListener("DOMContentLoaded",a)};l.addEventListener("DOMContentLoaded",a),e._reactRetry=a}}function zt(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 ts=null;function td(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return zt(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function ld(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function ad(e,t,l){switch(t=Du(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function vn(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ai(e)}var Ot=new Map,nd=new Set;function Mu(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Pt=N.d;N.d={f:Wm,r:$m,D:Fm,C:Im,L:Pm,m:ey,X:ly,S:ty,M:ay};function Wm(){var e=Pt.f(),t=Tu();return e||t}function $m(e){var t=Kl(e);t!==null&&t.tag===5&&t.type==="form"?So(t):Pt.r(e)}var Ea=typeof document>"u"?null:document;function ud(e,t,l){var a=Ea;if(a&&typeof t=="string"&&t){var n=xt(t);n='link[rel="'+e+'"][href="'+n+'"]',typeof l=="string"&&(n+='[crossorigin="'+l+'"]'),nd.has(n)||(nd.add(n),e={rel:e,crossOrigin:l,href:t},a.querySelector(n)===null&&(t=a.createElement("link"),Ie(t,"link",e),Ke(t),a.head.appendChild(t)))}}function Fm(e){Pt.D(e),ud("dns-prefetch",e,null)}function Im(e,t){Pt.C(e,t),ud("preconnect",e,t)}function Pm(e,t,l){Pt.L(e,t,l);var a=Ea;if(a&&e&&t){var n='link[rel="preload"][as="'+xt(t)+'"]';t==="image"&&l&&l.imageSrcSet?(n+='[imagesrcset="'+xt(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(n+='[imagesizes="'+xt(l.imageSizes)+'"]')):n+='[href="'+xt(e)+'"]';var u=n;switch(t){case"style":u=Aa(e);break;case"script":u=_a(e)}Ot.has(u)||(e=O({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),Ot.set(u,e),a.querySelector(n)!==null||t==="style"&&a.querySelector(gn(u))||t==="script"&&a.querySelector(pn(u))||(t=a.createElement("link"),Ie(t,"link",e),Ke(t),a.head.appendChild(t)))}}function ey(e,t){Pt.m(e,t);var l=Ea;if(l&&e){var a=t&&typeof t.as=="string"?t.as:"script",n='link[rel="modulepreload"][as="'+xt(a)+'"][href="'+xt(e)+'"]',u=n;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=_a(e)}if(!Ot.has(u)&&(e=O({rel:"modulepreload",href:e},t),Ot.set(u,e),l.querySelector(n)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(pn(u)))return}a=l.createElement("link"),Ie(a,"link",e),Ke(a),l.head.appendChild(a)}}}function ty(e,t,l){Pt.S(e,t,l);var a=Ea;if(a&&e){var n=Jl(a).hoistableStyles,u=Aa(e);t=t||"default";var c=n.get(u);if(!c){var f={loading:0,preload:null};if(c=a.querySelector(gn(u)))f.loading=5;else{e=O({rel:"stylesheet",href:e,"data-precedence":t},l),(l=Ot.get(u))&&ls(e,l);var r=c=a.createElement("link");Ke(r),Ie(r,"link",e),r._p=new Promise(function(g,T){r.onload=g,r.onerror=T}),r.addEventListener("load",function(){f.loading|=1}),r.addEventListener("error",function(){f.loading|=2}),f.loading|=4,Ru(c,t,a)}c={type:"stylesheet",instance:c,count:1,state:f},n.set(u,c)}}}function ly(e,t){Pt.X(e,t);var l=Ea;if(l&&e){var a=Jl(l).hoistableScripts,n=_a(e),u=a.get(n);u||(u=l.querySelector(pn(n)),u||(e=O({src:e,async:!0},t),(t=Ot.get(n))&&as(e,t),u=l.createElement("script"),Ke(u),Ie(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function ay(e,t){Pt.M(e,t);var l=Ea;if(l&&e){var a=Jl(l).hoistableScripts,n=_a(e),u=a.get(n);u||(u=l.querySelector(pn(n)),u||(e=O({src:e,async:!0,type:"module"},t),(t=Ot.get(n))&&as(e,t),u=l.createElement("script"),Ke(u),Ie(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(n,u))}}function id(e,t,l,a){var n=(n=ue.current)?Mu(n):null;if(!n)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=Aa(l.href),l=Jl(n).hoistableStyles,a=l.get(t),a||(a={type:"style",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=Aa(l.href);var u=Jl(n).hoistableStyles,c=u.get(e);if(c||(n=n.ownerDocument||n,c={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,c),(u=n.querySelector(gn(e)))&&!u._p&&(c.instance=u,c.state.loading=5),Ot.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Ot.set(e,l),u||ny(n,e,l,c.state))),t&&a===null)throw Error(o(528,""));return c}if(t&&a!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=_a(l),l=Jl(n).hoistableScripts,a=l.get(t),a||(a={type:"script",instance:null,count:0,state:null},l.set(t,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Aa(e){return'href="'+xt(e)+'"'}function gn(e){return'link[rel="stylesheet"]['+e+"]"}function cd(e){return O({},e,{"data-precedence":e.precedence,precedence:null})}function ny(e,t,l,a){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?a.loading=1:(t=e.createElement("link"),a.preload=t,t.addEventListener("load",function(){return a.loading|=1}),t.addEventListener("error",function(){return a.loading|=2}),Ie(t,"link",l),Ke(t),e.head.appendChild(t))}function _a(e){return'[src="'+xt(e)+'"]'}function pn(e){return"script[async]"+e}function sd(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var a=e.querySelector('style[data-href~="'+xt(l.href)+'"]');if(a)return t.instance=a,Ke(a),a;var n=O({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return a=(e.ownerDocument||e).createElement("style"),Ke(a),Ie(a,"style",n),Ru(a,l.precedence,e),t.instance=a;case"stylesheet":n=Aa(l.href);var u=e.querySelector(gn(n));if(u)return t.state.loading|=4,t.instance=u,Ke(u),u;a=cd(l),(n=Ot.get(n))&&ls(a,n),u=(e.ownerDocument||e).createElement("link"),Ke(u);var c=u;return c._p=new Promise(function(f,r){c.onload=f,c.onerror=r}),Ie(u,"link",a),t.state.loading|=4,Ru(u,l.precedence,e),t.instance=u;case"script":return u=_a(l.src),(n=e.querySelector(pn(u)))?(t.instance=n,Ke(n),n):(a=l,(n=Ot.get(u))&&(a=O({},l),as(a,n)),e=e.ownerDocument||e,n=e.createElement("script"),Ke(n),Ie(n,"link",a),e.head.appendChild(n),t.instance=n);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(a=t.instance,t.state.loading|=4,Ru(a,l.precedence,e));return t.instance}function Ru(e,t,l){for(var a=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),n=a.length?a[a.length-1]:null,u=n,c=0;c<a.length;c++){var f=a[c];if(f.dataset.precedence===t)u=f;else if(u!==n)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function ls(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function as(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Uu=null;function fd(e,t,l){if(Uu===null){var a=new Map,n=Uu=new Map;n.set(l,a)}else n=Uu,a=n.get(l),a||(a=new Map,n.set(l,a));if(a.has(e))return a;for(a.set(e,null),l=l.getElementsByTagName(e),n=0;n<l.length;n++){var u=l[n];if(!(u[Ra]||u[ke]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var c=u.getAttribute(t)||"";c=e+c;var f=a.get(c);f?f.push(u):a.set(c,[u])}}return a}function od(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function uy(e,t,l){if(l===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 rd(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function iy(e,t,l,a){if(l.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var n=Aa(a.href),u=t.querySelector(gn(n));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=qu.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=u,Ke(u);return}u=t.ownerDocument||t,a=cd(a),(n=Ot.get(n))&&ls(a,n),u=u.createElement("link"),Ke(u);var c=u;c._p=new Promise(function(f,r){c.onload=f,c.onerror=r}),Ie(u,"link",a),l.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=qu.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var ns=0;function cy(e,t){return e.stylesheets&&e.count===0&&Bu(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var a=setTimeout(function(){if(e.stylesheets&&Bu(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&ns===0&&(ns=62500*Xm());var n=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Bu(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>ns?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(a),clearTimeout(n)}}:null}function qu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Hu=null;function Bu(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Hu=new Map,t.forEach(sy,e),Hu=null,qu.call(e))}function sy(e,t){if(!(t.state.loading&4)){var l=Hu.get(e);if(l)var a=l.get(null);else{l=new Map,Hu.set(e,l);for(var n=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<n.length;u++){var c=n[u];(c.nodeName==="LINK"||c.getAttribute("media")!=="not all")&&(l.set(c.dataset.precedence,c),a=c)}a&&l.set(null,a)}n=t.instance,c=n.getAttribute("data-precedence"),u=l.get(c)||a,u===a&&l.set(null,n),l.set(c,n),this.count++,a=qu.bind(this),n.addEventListener("load",a),n.addEventListener("error",a),u?u.parentNode.insertBefore(n,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(n,e.firstChild)),t.state.loading|=4}}var bn={$$typeof:le,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function fy(e,t,l,a,n,u,c,f,r){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=Pu(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pu(0),this.hiddenUpdates=Pu(null),this.identifierPrefix=a,this.onUncaughtError=n,this.onCaughtError=u,this.onRecoverableError=c,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=r,this.incompleteTransitions=new Map}function dd(e,t,l,a,n,u,c,f,r,g,T,C){return e=new fy(e,t,l,c,r,g,T,C,f),t=1,u===!0&&(t|=24),u=ht(3,null,null,t),e.current=u,u.stateNode=e,t=Bi(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:a,isDehydrated:l,cache:t},Xi(u),e}function hd(e){return e?(e=aa,e):aa}function md(e,t,l,a,n,u){n=hd(n),a.context===null?a.context=n:a.pendingContext=n,a=sl(t),a.payload={element:l},u=u===void 0?null:u,u!==null&&(a.callback=u),l=fl(e,a,t),l!==null&&(st(l,e,t),$a(l,e,t))}function yd(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function us(e,t){yd(e,t),(e=e.alternate)&&yd(e,t)}function vd(e){if(e.tag===13||e.tag===31){var t=Dl(e,67108864);t!==null&&st(t,e,67108864),us(e,67108864)}}function gd(e){if(e.tag===13||e.tag===31){var t=pt();t=ei(t);var l=Dl(e,t);l!==null&&st(l,e,t),us(e,t)}}var Yu=!0;function oy(e,t,l,a){var n=j.T;j.T=null;var u=N.p;try{N.p=2,is(e,t,l,a)}finally{N.p=u,j.T=n}}function ry(e,t,l,a){var n=j.T;j.T=null;var u=N.p;try{N.p=8,is(e,t,l,a)}finally{N.p=u,j.T=n}}function is(e,t,l,a){if(Yu){var n=cs(a);if(n===null)Kc(e,t,a,Gu,l),bd(e,a);else if(hy(n,e,t,l,a))a.stopPropagation();else if(bd(e,a),t&4&&-1<dy.indexOf(e)){for(;n!==null;){var u=Kl(n);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var c=_l(u.pendingLanes);if(c!==0){var f=u;for(f.pendingLanes|=2,f.entangledLanes|=2;c;){var r=1<<31-rt(c);f.entanglements[1]|=r,c&=~r}qt(u),(ye&6)===0&&(Su=ft()+500,hn(0))}}break;case 31:case 13:f=Dl(u,2),f!==null&&st(f,u,2),Tu(),us(u,2)}if(u=cs(a),u===null&&Kc(e,t,a,Gu,l),u===n)break;n=u}n!==null&&a.stopPropagation()}else Kc(e,t,a,null,l)}}function cs(e){return e=fi(e),ss(e)}var Gu=null;function ss(e){if(Gu=null,e=Vl(e),e!==null){var t=_(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=q(t),e!==null)return e;e=null}else if(l===31){if(e=H(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Gu=e,null}function pd(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(Fd()){case Es:return 2;case As:return 8;case On:case Id:return 32;case _s:return 268435456;default:return 32}default:return 32}}var fs=!1,xl=null,Sl=null,jl=null,xn=new Map,Sn=new Map,Tl=[],dy="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 bd(e,t){switch(e){case"focusin":case"focusout":xl=null;break;case"dragenter":case"dragleave":Sl=null;break;case"mouseover":case"mouseout":jl=null;break;case"pointerover":case"pointerout":xn.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Sn.delete(t.pointerId)}}function jn(e,t,l,a,n,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:l,eventSystemFlags:a,nativeEvent:u,targetContainers:[n]},t!==null&&(t=Kl(t),t!==null&&vd(t)),e):(e.eventSystemFlags|=a,t=e.targetContainers,n!==null&&t.indexOf(n)===-1&&t.push(n),e)}function hy(e,t,l,a,n){switch(t){case"focusin":return xl=jn(xl,e,t,l,a,n),!0;case"dragenter":return Sl=jn(Sl,e,t,l,a,n),!0;case"mouseover":return jl=jn(jl,e,t,l,a,n),!0;case"pointerover":var u=n.pointerId;return xn.set(u,jn(xn.get(u)||null,e,t,l,a,n)),!0;case"gotpointercapture":return u=n.pointerId,Sn.set(u,jn(Sn.get(u)||null,e,t,l,a,n)),!0}return!1}function xd(e){var t=Vl(e.target);if(t!==null){var l=_(t);if(l!==null){if(t=l.tag,t===13){if(t=q(l),t!==null){e.blockedOn=t,Ms(e.priority,function(){gd(l)});return}}else if(t===31){if(t=H(l),t!==null){e.blockedOn=t,Ms(e.priority,function(){gd(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function wu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=cs(e.nativeEvent);if(l===null){l=e.nativeEvent;var a=new l.constructor(l.type,l);si=a,l.target.dispatchEvent(a),si=null}else return t=Kl(l),t!==null&&vd(t),e.blockedOn=l,!1;t.shift()}return!0}function Sd(e,t,l){wu(e)&&l.delete(t)}function my(){fs=!1,xl!==null&&wu(xl)&&(xl=null),Sl!==null&&wu(Sl)&&(Sl=null),jl!==null&&wu(jl)&&(jl=null),xn.forEach(Sd),Sn.forEach(Sd)}function Xu(e,t){e.blockedOn===t&&(e.blockedOn=null,fs||(fs=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,my)))}var Qu=null;function jd(e){Qu!==e&&(Qu=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){Qu===e&&(Qu=null);for(var t=0;t<e.length;t+=3){var l=e[t],a=e[t+1],n=e[t+2];if(typeof a!="function"){if(ss(a||l)===null)continue;break}var u=Kl(l);u!==null&&(e.splice(t,3),t-=3,cc(u,{pending:!0,data:n,method:l.method,action:a},a,n))}}))}function za(e){function t(r){return Xu(r,e)}xl!==null&&Xu(xl,e),Sl!==null&&Xu(Sl,e),jl!==null&&Xu(jl,e),xn.forEach(t),Sn.forEach(t);for(var l=0;l<Tl.length;l++){var a=Tl[l];a.blockedOn===e&&(a.blockedOn=null)}for(;0<Tl.length&&(l=Tl[0],l.blockedOn===null);)xd(l),l.blockedOn===null&&Tl.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(a=0;a<l.length;a+=3){var n=l[a],u=l[a+1],c=n[lt]||null;if(typeof u=="function")c||jd(l);else if(c){var f=null;if(u&&u.hasAttribute("formAction")){if(n=u,c=u[lt]||null)f=c.formAction;else if(ss(n)!==null)continue}else f=c.action;typeof f=="function"?l[a+1]=f:(l.splice(a,3),a-=3),jd(l)}}}function Td(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(c){return n=c})},focusReset:"manual",scroll:"manual"})}function t(){n!==null&&(n(),n=null),a||setTimeout(l,20)}function l(){if(!a&&!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 a=!1,n=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){a=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),n!==null&&(n(),n=null)}}}function os(e){this._internalRoot=e}Lu.prototype.render=os.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,a=pt();md(l,a,e,t,null,null)},Lu.prototype.unmount=os.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;md(e.current,2,null,e,null,null),Tu(),t[Zl]=null}};function Lu(e){this._internalRoot=e}Lu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ds();e={blockedOn:null,target:e,priority:t};for(var l=0;l<Tl.length&&t!==0&&t<Tl[l].priority;l++);Tl.splice(l,0,e),l===0&&xd(e)}};var Ed=x.version;if(Ed!=="19.2.5")throw Error(o(527,Ed,"19.2.5"));N.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=d(t),e=e!==null?D(e):null,e=e===null?null:e.stateNode,e};var yy={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zu.isDisabled&&Zu.supportsFiber)try{Ca=Zu.inject(yy),ot=Zu}catch{}}return En.createRoot=function(e,t){if(!E(e))throw Error(o(299));var l=!1,a="",n=Do,u=Mo,c=Ro;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(a=t.identifierPrefix),t.onUncaughtError!==void 0&&(n=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=dd(e,1,!1,null,null,l,a,null,n,u,c,Td),e[Zl]=t.current,Vc(e),new os(t)},En.hydrateRoot=function(e,t,l){if(!E(e))throw Error(o(299));var a=!1,n="",u=Do,c=Mo,f=Ro,r=null;return l!=null&&(l.unstable_strictMode===!0&&(a=!0),l.identifierPrefix!==void 0&&(n=l.identifierPrefix),l.onUncaughtError!==void 0&&(u=l.onUncaughtError),l.onCaughtError!==void 0&&(c=l.onCaughtError),l.onRecoverableError!==void 0&&(f=l.onRecoverableError),l.formState!==void 0&&(r=l.formState)),t=dd(e,1,!0,t,l??null,a,n,r,u,c,f,Td),t.context=hd(null),l=t.current,a=pt(),a=ei(a),n=sl(a),n.callback=null,fl(l,n,a),l=a,t.current.lanes=l,Ma(t,l),qt(t),e[Zl]=t.current,Vc(e),new Lu(t)},En.version="19.2.5",En}var Ud;function Ay(){if(Ud)return hs.exports;Ud=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(x){console.error(x)}}return s(),hs.exports=Ey(),hs.exports}var _y=Ay();const zy=wd(_y),Qd="";class An extends Error{constructor(x,b,o){super(x),this.status=b,this.outcome=o}}function Ss(s){return s instanceof An?s.outcome?s.outcome==="unknown":s.status>=500||s.status===408:!0}async function Ne(s,x){const b=await fetch(`${Qd}${s}`,{...x,credentials:"same-origin",headers:{"Content-Type":"application/json",...x==null?void 0:x.headers}});if(!b.ok){const o=await b.json().catch(()=>null);b.status===401&&(window.location.hash="#login");const E=b.status===429?` Wait ${b.headers.get("retry-after")||"60"} seconds before retrying.`:"",_=typeof(o==null?void 0:o.message)=="string"?o.message:typeof(o==null?void 0:o.error)=="string"?o.error:`HTTP ${b.status}`,q=typeof(o==null?void 0:o.next_action)=="string"?` ${o.next_action}`:"",H=(o==null?void 0:o.outcome)==="unknown"||(o==null?void 0:o.outcome)==="failed"?o.outcome:void 0;throw new An(_+q+E,b.status,H)}return b.json()}async function Oy(s){const x=await fetch(`${Qd}${s}`,{credentials:"same-origin"});if(x.status===401)throw window.location.hash="#login",new Error("Unauthorized");if(!x.ok)throw new Error(`HTTP ${x.status}`);return x.text()}const be={oauthRequest:s=>Ne(`/admin/api/oauth-requests/${encodeURIComponent(s)}`),decideOAuthRequest:(s,x,b)=>Ne(`/admin/api/oauth-requests/${encodeURIComponent(s)}`,{method:"POST",body:JSON.stringify({decision:x,csrf:b})}),login:s=>Ne("/admin/login",{method:"POST",body:JSON.stringify({token:s})}),signOutEverywhere:()=>Ne("/admin/api/sign-out-everywhere",{method:"POST"}),stats:()=>Ne("/admin/api/stats"),health:()=>Ne("/admin/api/health-indicators"),agents:()=>Ne("/admin/api/agents"),agentsSpend:()=>Ne("/admin/api/agents/spend"),sources:()=>Ne("/admin/api/sources"),grantCatalog:()=>Ne("/admin/api/grant-catalog"),clientGrant:s=>Ne(`/admin/api/grants/${encodeURIComponent(s)}`),clientDetails:s=>Ne(`/admin/api/clients/${encodeURIComponent(s)}`),clientSetup:(s,x,b)=>{const o=new URLSearchParams({harness:x});return b&&o.set("flow",b),Ne(`/admin/api/clients/${encodeURIComponent(s)}/setup?${o}`)},clientLifecycle:(s,x)=>Ne(`/admin/api/clients/${encodeURIComponent(s)}/lifecycle`,{method:"POST",body:JSON.stringify(x)}),registerClient:s=>Ne("/admin/api/register-client",{method:"POST",body:JSON.stringify(s)}),recoverClient:(s,x,b)=>Ne("/admin/api/recover-client",{method:"POST",body:JSON.stringify({clientId:s,harness:x,flow:b})}),updateClientGrant:(s,x)=>Ne("/admin/api/rescope-client",{method:"POST",body:JSON.stringify({...x,clientId:s})}),requests:(s=1,x="")=>Ne(`/admin/api/requests?page=${s}${x}`),apiKeys:()=>Ne("/admin/api/api-keys"),createApiKey(s,x){return Ne("/admin/api/api-keys",{method:"POST",body:JSON.stringify({name:s,scopes:x})})},revokeApiKey(s){return Ne("/admin/api/api-keys/revoke",{method:"POST",body:JSON.stringify({id:s})})},updateClientTtl:(s,x)=>Ne("/admin/api/update-client-ttl",{method:"POST",body:JSON.stringify({clientId:s,tokenTtl:x})}),rescopeClient:(s,x,b)=>Ne("/admin/api/rescope-client",{method:"POST",body:JSON.stringify({clientId:s,sourceId:x,federatedRead:b})}),revokeClient:s=>Ne("/admin/api/revoke-client",{method:"POST",body:JSON.stringify({clientId:s})}),calibrationProfile:s=>Ne(`/admin/api/calibration/profile${s?`?holder=${encodeURIComponent(s)}`:""}`),calibrationChart:(s,x)=>Oy(`/admin/api/calibration/charts/${encodeURIComponent(s)}${x?`?holder=${encodeURIComponent(x)}`:""}`),jobsWatch:()=>Ne("/admin/api/jobs/watch")},ps="gbrain.pending-oauth-request",qd=s=>s!==null&&/^[a-f0-9]{64}$/.test(s);function Ku(){const s=new URL(window.location.href).searchParams.get("oauth_request");if(qd(s)){try{window.sessionStorage.setItem(ps,s)}catch{}return s}try{const x=window.sessionStorage.getItem(ps);if(qd(x))return x}catch{}}function Hd(){try{window.sessionStorage.removeItem(ps)}catch{}const s=new URL(window.location.href);s.searchParams.delete("oauth_request"),window.history.replaceState(null,"",s)}function Ny(s,x){const b=x?` --oauth-request ${x}`:"";return`Give me an owner admin login link for ${s}. On the brain host, run gbrain mcp admin login-link --url ${s}${b} using its protected owner credential. Deliver the single-use link privately and do not open it before I do.`}function Cy({onLogin:s}){const[x,b]=U.useState(""),[o,E]=U.useState(""),[_,q]=U.useState(!1),[H,A]=U.useState(!1),[d,D]=U.useState(""),[O,R]=U.useState(),[Q,G]=U.useState(""),[Z,W]=U.useState(0),ae=Ku(),$=O?Ny(O,ae):void 0;U.useEffect(()=>{let ne=!0;const xe=new AbortController,k=setTimeout(()=>xe.abort(),1e4);return R(void 0),G(""),A(!1),fetch("/.well-known/gbrain",{credentials:"omit",redirect:"error",cache:"no-store",signal:xe.signal}).then(async V=>{if(!V.ok)throw new Error("Server discovery is unavailable.");const Se=await V.json();if(typeof(Se==null?void 0:Se.endpoint)!="string")throw new Error("Server discovery has no MCP endpoint.");const je=new URL(Se.endpoint);if(!["https:","http:"].includes(je.protocol)||je.username||je.password||je.search||je.hash||je.pathname!=="/mcp")throw new Error("Server discovery returned an invalid MCP endpoint.");ne&&R(je.toString())}).catch(()=>{ne&&G("The configured MCP endpoint could not be discovered. Ask the brain host administrator to check the server’s configured public URL. You can still sign in with the owner credential below.")}).finally(()=>clearTimeout(k)),()=>{ne=!1,clearTimeout(k),xe.abort()}},[Z]);const le=async ne=>{ne.preventDefault(),E(""),q(!0);try{await be.login(x),b(""),s()}catch(xe){E(xe instanceof An&&xe.status===401?"The owner bootstrap credential was not accepted. An OAuth access token or client secret cannot log into this dashboard. Ask the brain host administrator for a fresh login link.":xe instanceof Error?xe.message:"Could not reach the owner login service. Check the server and retry.")}finally{q(!1)}};return i.jsx("div",{className:"login-page",children:i.jsxs("section",{className:"login-box","aria-labelledby":"owner-login-title",style:{maxWidth:560},children:[i.jsx("h1",{id:"owner-login-title",className:"login-logo",children:"GBrain owner login"}),i.jsx("p",{style:{marginBottom:16},children:"Ask the agent that administers the brain host for a login link. Ordinary MCP clients cannot create owner login links, even with an admin scope."}),ae&&i.jsx("p",{role:"status",style:{marginBottom:16},children:"A client connection is waiting for owner approval. The prompt below preserves that request when you open the login link in another browser or tab."}),$&&i.jsxs(i.Fragment,{children:[i.jsx("label",{htmlFor:"owner-login-prompt",children:"Prompt for the host administrator"}),i.jsx("textarea",{id:"owner-login-prompt",rows:7,readOnly:!0,value:$,style:{fontFamily:"var(--font-mono)",fontSize:12}}),i.jsx("button",{type:"button",className:"btn btn-secondary",style:{marginTop:8},onClick:()=>{D(""),navigator.clipboard.writeText($).then(()=>A(!0)).catch(()=>D("Clipboard unavailable. Select and copy the prompt above."))},children:H?"Prompt copied":"Copy owner login prompt"})]}),!$&&!Q&&i.jsx("p",{role:"status",children:"Discovering the server’s configured MCP endpoint…"}),Q&&i.jsxs("p",{role:"alert",children:[Q," ",i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>W(ne=>ne+1),children:"Retry server discovery"})]}),d&&i.jsx("p",{role:"alert",children:d}),i.jsx("p",{className:"grant-help",style:{margin:"12px 0 20px"},children:"Login links expire after five minutes and can be used once. A client’s PKCE sign-in requests access to memory; owner login approves that request."}),i.jsxs("details",{children:[i.jsx("summary",{style:{cursor:"pointer"},children:"Sign in with the owner bootstrap credential"}),i.jsxs("form",{onSubmit:le,style:{marginTop:12},children:[i.jsx("label",{htmlFor:"owner-bootstrap-token",children:"Owner bootstrap credential"}),i.jsx("input",{id:"owner-bootstrap-token",type:"password",autoComplete:"off",value:x,disabled:_,onChange:ne=>b(ne.target.value)}),i.jsx("button",{type:"submit",className:"btn btn-primary",style:{width:"100%",marginTop:12},disabled:_||!x.trim(),children:_?"Signing in…":"Sign in as owner"}),o&&i.jsx("p",{role:"alert",className:"login-error",children:o})]})]})]})})}function Dy(){const[s,x]=U.useState({connected_agents:0,requests_today:0,active_tokens:0}),[b,o]=U.useState({expiring_soon:0,error_rate:"0%"}),[E,_]=U.useState([]),[q,H]=U.useState("connecting"),A=U.useRef(null);U.useEffect(()=>{be.stats().then(x).catch(()=>{}),be.health().then(o).catch(()=>{});const D=new EventSource("/admin/events",{withCredentials:!0});A.current=D,D.onopen=()=>H("connected"),D.onmessage=R=>{try{const Q=JSON.parse(R.data);_(G=>[Q,...G].slice(0,50))}catch{}},D.onerror=()=>{H("disconnected"),setTimeout(()=>{H("connecting"),D.close()},3e3)};const O=setInterval(()=>{be.stats().then(x).catch(()=>{}),be.health().then(o).catch(()=>{})},3e4);return()=>{D.close(),clearInterval(O)}},[]);const d=D=>{const O=Date.now()-new Date(D).getTime();return O<6e4?`${Math.floor(O/1e3)}s ago`:O<36e5?`${Math.floor(O/6e4)} min ago`:`${Math.floor(O/36e5)}h ago`};return i.jsxs(i.Fragment,{children:[i.jsx("h1",{className:"page-title",children:"Dashboard"}),i.jsxs("div",{style:{display:"flex",gap:24},children:[i.jsxs("div",{style:{flex:1},children:[i.jsxs("div",{className:"metrics",children:[i.jsxs("div",{className:"metric",children:[i.jsx("div",{className:"metric-value",children:s.connected_agents}),i.jsx("div",{className:"metric-label",children:"Connected Agents"})]}),i.jsxs("div",{className:"metric",children:[i.jsx("div",{className:"metric-value",children:s.requests_today}),i.jsx("div",{className:"metric-label",children:"Requests Today"})]}),i.jsxs("div",{className:"metric",children:[i.jsx("div",{className:"metric-value",children:s.active_tokens}),i.jsx("div",{className:"metric-label",children:"Active Tokens"})]})]}),i.jsxs("h2",{className:"section-title",children:["Live Activity",i.jsx("span",{style:{marginLeft:8,fontSize:10,color:q==="connected"?"var(--success)":q==="connecting"?"var(--warning)":"var(--error)"},children:q==="connected"?"● connected":q==="connecting"?"● connecting...":"● disconnected"})]}),i.jsx("div",{className:"feed",children:E.length===0?i.jsx("div",{className:"feed-empty",children:q==="connected"?"No requests yet. Agents will appear when they connect.":"Connecting..."}):i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Agent"}),i.jsx("th",{children:"Operation"}),i.jsx("th",{children:"Scopes"}),i.jsx("th",{children:"Latency"}),i.jsx("th",{children:"Status"}),i.jsx("th",{children:"Time"})]})}),i.jsx("tbody",{children:E.map((D,O)=>i.jsxs("tr",{children:[i.jsx("td",{className:"mono",children:D.agent}),i.jsx("td",{className:"mono",children:D.operation}),i.jsx("td",{children:D.scopes.split(",").map(R=>i.jsx("span",{className:`badge badge-${R.trim()}`,style:{marginRight:4},children:R.trim()},R))}),i.jsxs("td",{className:"mono",children:[D.latency_ms," ms"]}),i.jsx("td",{children:i.jsx("span",{className:`badge badge-${D.status}`,children:D.status})}),i.jsx("td",{style:{color:"var(--text-secondary)"},children:d(D.timestamp)})]},O))})]})})]}),i.jsxs("div",{style:{width:220},children:[i.jsx("h2",{className:"section-title",children:"Token Health"}),i.jsxs("div",{className:"health-panel",children:[i.jsxs("div",{className:"health-row",children:[i.jsx("span",{style:{color:"var(--warning)"},children:"Expiring Soon"}),i.jsx("span",{className:"mono",children:b.expiring_soon})]}),i.jsxs("div",{className:"health-row",children:[i.jsx("span",{style:{color:"var(--error)"},children:"Error Rate"}),i.jsx("span",{className:"mono",children:b.error_rate})]})]})]})]})]})}const Oa=s=>s.split(/[\s,]+/).filter(Boolean);function bs(s){var x,b,o;return{profile:(s==null?void 0:s.profile)??"memory-writer",applyProfile:!s,source:(s==null?void 0:s.sourceId)??"default",reads:(s==null?void 0:s.federatedRead)??["default"],scopes:(s==null?void 0:s.scopes.join(" "))??"",directPrefixes:((x=s==null?void 0:s.boundSlugPrefixes)==null?void 0:x.join(`
-`))??"",tools:(s==null?void 0:s.boundTools)??[],namespace:(s==null?void 0:s.delegatedNamespace)??"job",delegatedPrefixes:((b=s==null?void 0:s.delegatedSlugPrefixes)==null?void 0:b.join(`
-`))??"",concurrency:String((s==null?void 0:s.boundMaxConcurrent)??1),budget:(s==null?void 0:s.budgetUsdPerDay)??"unlimited",ttl:s?String(s.tokenTtlSeconds??0):"3600",surface:(s==null?void 0:s.surface)??"starter",operationSnapshot:((o=s==null?void 0:s.allowedOperations)==null?void 0:o.join(`
-`))??"",editOperations:!1}}function Ld(s){const x=s.scopes?Oa(s.scopes).includes("agent"):["full","delegating-agent"].includes(s.profile);return{...s.applyProfile?{profile:s.profile}:{},sourceId:s.source,federatedRead:s.reads,boundSlugPrefixes:s.directPrefixes.trim()?Oa(s.directPrefixes):null,...s.scopes.trim()?{scopes:Oa(s.scopes)}:{},...s.editOperations?{allowedOperations:Oa(s.operationSnapshot)}:{},...x?{boundTools:s.tools,boundSourceId:s.source,delegatedNamespace:s.namespace,delegatedSlugPrefixes:s.namespace==="job"?null:Oa(s.delegatedPrefixes)}:{},boundMaxConcurrent:Number(s.concurrency),budgetUsdPerDay:s.budget==="unlimited"?null:s.budget,tokenTtl:s.ttl==="0"?null:Number(s.ttl),surface:s.surface==="default"?null:s.surface}}function Zd(s){return{...s.profile?{profile:s.profile}:{},scopes:s.scopes,sourceId:s.sourceId,federatedRead:s.federatedRead,boundSlugPrefixes:s.boundSlugPrefixes,allowedOperations:s.allowedOperations,boundTools:s.boundTools,boundSourceId:s.boundSourceId,boundBrainId:s.boundBrainId,delegatedNamespace:s.delegatedNamespace,delegatedSlugPrefixes:s.delegatedSlugPrefixes,boundMaxConcurrent:s.boundMaxConcurrent,budgetUsdPerDay:s.budgetUsdPerDay,tokenTtlSeconds:s.tokenTtlSeconds,surface:s.surface}}function Vd({draft:s,setDraft:x,sources:b,catalog:o,existing:E=!1}){const _=(d,D)=>x({...s,[d]:D}),q=new Set(b.map(d=>d.id)),H=s.scopes?Oa(s.scopes).includes("agent"):["full","delegating-agent"].includes(s.profile),A={marginBottom:14};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:A,children:[i.jsx("label",{htmlFor:"grant-profile",children:"Permission profile"}),i.jsx("select",{id:"grant-profile",value:s.profile,onChange:d=>x({...s,profile:d.target.value,applyProfile:!0,scopes:"",editOperations:!1,surface:["operator","full"].includes(d.target.value)?"full":"starter"}),children:o.profiles.map(d=>i.jsx("option",{children:d},d))}),i.jsx("p",{className:"grant-help",children:"Memory writer lets this agent recall, save, correct, and withdraw memory. Delegating profiles also allow selected server tools to run jobs."}),E&&i.jsxs("label",{className:"checkbox-label",children:[i.jsx("input",{type:"checkbox",checked:s.applyProfile,onChange:d=>_("applyProfile",d.target.checked)}),"Apply this profile's current operation snapshot"]})]}),i.jsxs("div",{style:A,children:[i.jsx("label",{htmlFor:"grant-source",children:"Primary / write source"}),i.jsxs("select",{id:"grant-source",value:s.source,onChange:d=>_("source",d.target.value),children:[!q.has(s.source)&&i.jsxs("option",{value:s.source,children:[s.source," · unavailable"]}),b.map(d=>i.jsxs("option",{value:d.id,children:[d.name," (",d.id,")"]},d.id))]})]}),i.jsxs("fieldset",{style:{border:0,padding:0,margin:"0 0 14px"},children:[i.jsx("legend",{children:"Readable sources"}),[...b,...s.reads.filter(d=>!q.has(d)).map(d=>({id:d,name:`${d} · unavailable`}))].map(d=>i.jsxs("label",{className:"checkbox-label",children:[i.jsx("input",{type:"checkbox",checked:s.reads.includes(d.id),onChange:D=>_("reads",D.target.checked?[...s.reads,d.id]:s.reads.filter(O=>O!==d.id))}),d.name]},d.id))]}),i.jsxs("div",{style:A,children:[i.jsx("label",{htmlFor:"grant-direct-prefixes",children:"Direct write prefixes (one per line)"}),i.jsx("textarea",{id:"grant-direct-prefixes",rows:2,value:s.directPrefixes,onChange:d=>_("directPrefixes",d.target.value),placeholder:"work-example/"}),i.jsx("p",{className:"grant-help",children:"Blank grants the whole primary source. Coding agent requires an explicit prefix."})]}),H&&i.jsxs("fieldset",{style:{border:"1px solid var(--border)",padding:12,marginBottom:14},children:[i.jsx("legend",{children:"Delegated jobs"}),i.jsx("p",{className:"grant-help",children:"Choose every tool explicitly. Jobs stay in the primary source; existing jobs retain their original limits."}),i.jsx("div",{className:"checkbox-group",style:{maxHeight:180,overflowY:"auto"},children:[...new Set([...o.delegatedTools,...s.tools])].map(d=>i.jsxs("label",{className:"checkbox-label",children:[i.jsx("input",{type:"checkbox",checked:s.tools.includes(d),onChange:D=>_("tools",D.target.checked?[...s.tools,d]:s.tools.filter(O=>O!==d))}),d,o.delegatedTools.includes(d)?"":" · unavailable"]},d))}),i.jsx("label",{htmlFor:"grant-namespace",children:"Delegated write namespace"}),i.jsxs("select",{id:"grant-namespace",value:s.namespace,onChange:d=>_("namespace",d.target.value),children:[i.jsx("option",{value:"job",children:"Each job's own wiki/agents/ directory"}),i.jsx("option",{value:"prefixes",children:"Explicit prefixes"})]}),s.namespace==="prefixes"&&i.jsx("textarea",{"aria-label":"Delegated prefixes",rows:2,value:s.delegatedPrefixes,onChange:d=>_("delegatedPrefixes",d.target.value),placeholder:"work-example/"})]}),i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,...A},children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"grant-concurrency",children:"Concurrent jobs"}),i.jsx("input",{id:"grant-concurrency",type:"number",min:1,step:1,value:s.concurrency,onChange:d=>_("concurrency",d.target.value)})]}),i.jsxs("div",{children:[i.jsx("label",{htmlFor:"grant-budget",children:"Daily delegated spend (USD)"}),i.jsx("input",{id:"grant-budget",value:s.budget,onChange:d=>_("budget",d.target.value),placeholder:"unlimited"}),i.jsx("p",{className:"grant-help",children:"Use unlimited for no spending cap, or an amount such as 2.50."})]})]}),i.jsxs("div",{style:A,children:[i.jsx("label",{htmlFor:"grant-ttl",children:"Future access token lifetime (seconds)"}),i.jsx("input",{id:"grant-ttl",type:"number",min:0,max:7776e3,step:1,value:s.ttl,onChange:d=>_("ttl",d.target.value)}),i.jsx("p",{className:"grant-help",children:"Renewable: 3600 (1 hour). Static bearer: 2592000 (30 days). 0 uses the server default. Existing tokens keep their expiry."})]}),i.jsxs("details",{style:A,children:[i.jsx("summary",{children:"Advanced permissions"}),i.jsx("label",{htmlFor:"grant-scopes",children:"Scope override"}),i.jsx("input",{id:"grant-scopes",value:s.scopes,onChange:d=>_("scopes",d.target.value),placeholder:"Use profile scopes"}),i.jsx("p",{className:"grant-help",children:"Scopes allow eligible brain operations. Admin does not grant owner dashboard access or delegation."}),i.jsx("label",{htmlFor:"grant-surface",children:"Visible tool catalog"}),i.jsx("select",{id:"grant-surface",value:s.surface,onChange:d=>_("surface",d.target.value),children:["verbs","starter","full","default"].map(d=>i.jsx("option",{children:d},d))}),i.jsx("p",{className:"grant-help",children:"Full shows all eligible tools; it does not grant additional authority."}),i.jsxs("label",{className:"checkbox-label",children:[i.jsx("input",{type:"checkbox",checked:s.editOperations,onChange:d=>_("editOperations",d.target.checked)}),"Replace operation authority snapshot"]}),s.editOperations&&i.jsxs(i.Fragment,{children:[i.jsx("textarea",{"aria-label":"Allowed operations",rows:5,value:s.operationSnapshot,onChange:d=>_("operationSnapshot",d.target.value)}),i.jsx("p",{className:"grant-help",children:"One operation name per line. An empty list denies every operation, including delegated tools."})]})]})]})}const My=[["Profile","profile"],["Scopes","scopes"],["Write source","sourceId"],["Readable sources","federatedRead"],["Direct prefixes","boundSlugPrefixes"],["Visible catalog","surface"],["Operation authority","allowedOperations"],["Delegated tools","boundTools"],["Delegated source","boundSourceId"],["Delegated brain","boundBrainId"],["Delegated namespace","delegatedNamespace"],["Delegated prefixes","delegatedSlugPrefixes"],["Concurrent jobs","boundMaxConcurrent"],["Daily USD cap","budgetUsdPerDay"],["Future token TTL","tokenTtlSeconds"]];function Ry(s,x){return s===null?x==="budgetUsdPerDay"?"Unlimited":x==="allowedOperations"?"Legacy scope-based catalog":"Unset":Array.isArray(s)?s.join(", ")||"(none)":String(s)}function Bd({grant:s,field:x}){const b=s[x];return x==="allowedOperations"&&Array.isArray(b)&&b.length>8?i.jsxs("details",{children:[i.jsxs("summary",{children:[b.length," operations · inspect list"]}),i.jsx("div",{style:{maxHeight:160,overflowY:"auto",marginTop:8},children:b.join(", ")})]}):i.jsx(i.Fragment,{children:Ry(b,x)})}function Kd({preview:s}){return i.jsxs("div",{"aria-live":"polite",style:{margin:"16px 0"},children:[i.jsx("h3",{children:"Review permissions"}),i.jsx("div",{style:{overflowX:"auto"},children:i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Permission"}),s.before&&i.jsx("th",{children:"Current"}),i.jsx("th",{children:"Proposed"})]})}),i.jsx("tbody",{children:My.filter(([,x])=>!s.before||JSON.stringify(s.before[x])!==JSON.stringify(s.after[x])).map(([x,b])=>i.jsxs("tr",{children:[i.jsx("th",{children:x}),s.before&&i.jsx("td",{style:{overflowWrap:"anywhere",maxWidth:200},children:i.jsx(Bd,{grant:s.before,field:b})}),i.jsx("td",{style:{overflowWrap:"anywhere",maxWidth:280},children:i.jsx(Bd,{grant:s.after,field:b})})]},b))})]})}),i.jsx("p",{className:"grant-help",children:s.tokenImplications})]})}function Uy({clientId:s,sources:x,sourcesReady:b=!0,onRescoped:o}){const[E,_]=U.useState(),[q,H]=U.useState(),[A,d]=U.useState(),[D,O]=U.useState(),[R,Q]=U.useState(""),[G,Z]=U.useState(!1),[W,ae]=U.useState(!1),[$,le]=U.useState(!1),ne=async(k=!1)=>{Z(!0),ae(!1);try{const[V,Se]=await Promise.all([be.clientGrant(s),be.grantCatalog()]);_(V.grant),H(bs(V.grant)),d(Se),O(void 0),Q(""),le(!1),k&&o(V.grant)}finally{Z(!1)}};U.useEffect(()=>{ne().catch(k=>Q(k.message))},[s]);const xe=async()=>{if(!(!q||!E||!b||$)){Z(!0),Q(""),ae(!1);try{const k=await be.updateClientGrant(s,{...D?Zd(D.after):Ld(q),expectedRevision:E.revision,dryRun:!D});D?(_(k.after),H(bs(k.after)),O(void 0),ae(!0),o(k.after)):O(k)}catch(k){const V=!!D&&Ss(k);le(V||k instanceof An&&k.status===409),O(void 0),Q(`${k instanceof Error?k.message:"Grant update failed."}${V?" The change may have completed. Reload the current grant before editing permissions again.":""}`)}finally{Z(!1)}}};return i.jsxs("section",{children:[i.jsx("div",{className:"section-title",children:"Permissions"}),E&&i.jsxs("p",{className:"grant-help",children:["Revision ",E.revision,". Review source access, direct tools, and delegated work independently."]}),E&&i.jsx(qy,{clientId:s,revision:E.revision}),!!(E!=null&&E.repairReasons.length)&&i.jsxs("p",{role:"status",style:{color:"var(--warning)"},children:["Delegation needs repair: ",E.repairReasons.join(", "),". Review and explicitly grant the missing bindings below."]}),!b&&i.jsx("p",{role:"alert",children:"Current sources are unavailable. Retry sources before editing permissions."}),i.jsx("fieldset",{disabled:G||!b||$,style:{border:0,padding:0},children:q&&A&&i.jsx(Vd,{draft:q,catalog:A,sources:x,existing:!0,setDraft:k=>{H(k),O(void 0),ae(!1)}})}),R&&i.jsxs("p",{role:"alert",style:{color:"var(--error)"},children:[R," ",i.jsx("button",{type:"button",className:"btn btn-secondary",disabled:G,onClick:()=>void ne(!0).catch(k=>Q(k.message)),children:"Reload current grant"})]}),D&&i.jsx(Kd,{preview:D}),W&&i.jsx("p",{role:"status",children:"Permissions saved. Credentials are unchanged."}),i.jsx("button",{type:"button",className:"btn btn-primary",disabled:G||!q||!A||!b||$,onClick:()=>void xe(),children:G?"Checking…":D?"Apply reviewed changes":"Preview changes"})]})}function qy({clientId:s,revision:x}){const[b,o]=U.useState(),[E,_]=U.useState(!1);return U.useEffect(()=>{let q=!0;const H=()=>void be.agentsSpend().then(d=>{q&&(o(d.find(D=>D.client_id===s)),_(!1))}).catch(()=>{q&&_(!0)});H();const A=setInterval(H,2e4);return()=>{q=!1,clearInterval(A)}},[s,x]),E?i.jsx("p",{role:"status",children:"Delegated spend is unavailable. Reload to check before starting more work."}):b?i.jsxs("div",{style:{border:"1px solid var(--border)",padding:12,marginBottom:14},children:[i.jsx("strong",{children:"Delegated work"}),i.jsxs("p",{children:[b.inflight_count," unfinished jobs · Daily cap: ",b.cap_usd_per_day===null?"Unlimited":`$${b.cap_usd_per_day.toFixed(2)}`]}),i.jsxs("p",{className:"grant-help",children:["Recorded today: $",(b.spent_cents_today/100).toFixed(2),". Known outstanding reservations: $",(b.pending_cents/100).toFixed(2),", including overdue calls from earlier days."]}),b.unknown_count>0&&i.jsxs("p",{role:"status",style:{color:"var(--warning)"},children:[b.unknown_count," unresolved calls have an unknown cost. The known amounts above do not bound total liability; a finite cap refuses further calls until reconciliation."]})]}):null}function Hy(s,x){const b=URL.createObjectURL(new Blob([JSON.stringify(s,null,2)],{type:"application/json"})),o=document.createElement("a");o.href=b,o.download=x,o.click(),URL.revokeObjectURL(b)}function Jd({clientId:s,grantTypes:x,revoked:b=!1,grantRevision:o}){const[E,_]=U.useState("generic"),q=x.includes("authorization_code")&&x.includes("client_credentials"),[H,A]=U.useState(q?"":x.includes("authorization_code")?"authorization-code":"client-credentials"),[d,D]=U.useState(),[O,R]=U.useState(),[Q,G]=U.useState([]),[Z,W]=U.useState(""),[ae,$]=U.useState(!1),[le,ne]=U.useState(!1),[xe,k]=U.useState(!1),[V,Se]=U.useState(0);U.useEffect(()=>{if(b)return;let se=!0;if(R(void 0),G([]),W(""),ne(!1),k(!1),!!H)return Promise.all([be.clientSetup(s,E,H),be.grantCatalog()]).then(([F,de])=>{se&&(R(F.setup),G(F.instructions),D(de))}).catch(F=>{se&&W(F instanceof Error?F.message:"Setup instructions are unavailable.")}),()=>{se=!1}},[s,E,H,b,o,V]);const je=async()=>{if(O){$(!0),W("");try{const se=await be.recoverClient(s,E,H),F=H==="authorization-code"?se.oauthSetup:se.credentials;if(!F)throw new Error("No matching setup file was returned. Ask the host administrator to inspect this client’s credential delivery.");Hy(F,`${s}-${H==="authorization-code"?"oauth-setup":"credentials"}.json`),ne(!0)}catch(se){W(se instanceof Error?se.message:"Download failed. Existing permissions are unchanged.")}finally{$(!1)}}};return i.jsxs("section",{"aria-labelledby":"client-setup-title",children:[i.jsx("h3",{id:"client-setup-title",className:"section-title",children:"Set up this client"}),b?i.jsx("p",{children:"This client is revoked. Register a new client to connect another harness."}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"grant-help",children:"Registration grants access. Configure the intended harness, then verify an actual memory round trip there."}),i.jsx("label",{htmlFor:"setup-harness",children:"Harness"}),i.jsxs("select",{id:"setup-harness",value:E,onChange:se=>_(se.target.value),disabled:ae,children:[!d&&i.jsx("option",{value:"generic",children:"Generic MCP client"}),d==null?void 0:d.harnesses.map(se=>i.jsx("option",{value:se.id,children:se.label},se.id))]}),q&&i.jsxs(i.Fragment,{children:[i.jsx("label",{htmlFor:"setup-flow",children:"Connection flow"}),i.jsxs("select",{id:"setup-flow",value:H,onChange:se=>A(se.target.value),disabled:ae,children:[i.jsx("option",{value:"",children:"Choose the flow supported by your harness"}),i.jsx("option",{value:"authorization-code",children:"Browser sign-in with PKCE"}),i.jsx("option",{value:"client-credentials",children:"Machine credentials"})]})]}),O&&i.jsxs(i.Fragment,{children:[i.jsxs("dl",{className:"oauth-consent-details",style:{marginTop:16},children:[i.jsx("dt",{children:"MCP URL"}),i.jsx("dd",{children:i.jsx("code",{children:O.mcp_url})}),i.jsx("dt",{children:"OAuth issuer"}),i.jsx("dd",{children:i.jsx("code",{children:O.issuer_url})}),i.jsx("dt",{children:"Client ID"}),i.jsx("dd",{children:i.jsx("code",{children:O.client.client_id})}),i.jsx("dt",{children:"Scopes"}),i.jsx("dd",{children:O.scopes.join(" ")||"None"}),i.jsx("dt",{children:"Authentication"}),i.jsx("dd",{children:O.client.token_endpoint_auth_method==="none"?"Public client — PKCE, no client secret":O.client.token_endpoint_auth_method}),O.flow==="authorization-code"&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"Redirect URIs"}),i.jsx("dd",{children:O.client.redirect_uris.map(se=>i.jsx("div",{children:i.jsx("code",{children:se})},se))})]})]}),i.jsx("ol",{children:Q.map((se,F)=>i.jsx("li",{style:{marginBottom:8,overflowWrap:"anywhere"},children:se},F))}),i.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:16},children:[i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>{navigator.clipboard.writeText(Q.join(`
-`)).then(()=>k(!0)).catch(()=>W("Clipboard unavailable. Select and copy the instructions above."))},children:xe?"Instructions copied":"Copy setup instructions"}),i.jsx("button",{type:"button",className:"btn btn-primary",disabled:ae,onClick:()=>void je(),children:ae?"Preparing download…":O.flow==="authorization-code"?"Download OAuth setup":"Download credentials"})]}),i.jsx("p",{className:"grant-help",children:"Keep downloaded files private. Set permissions to 0600 on the target computer. A setup download does not verify the harness."})]}),!H&&i.jsx("p",{role:"status",children:"This client supports both flows. Choose one before requesting setup instructions."}),H&&!O&&!Z&&i.jsx("p",{role:"status",children:"Loading setup instructions…"}),le&&i.jsx("p",{role:"status",children:"Setup file delivered to your browser. Harness verification is still required."}),Z&&i.jsxs("p",{role:"alert",style:{color:"var(--error)"},children:[Z," ",i.jsx("button",{type:"button",className:"btn btn-secondary",disabled:ae,onClick:()=>Se(se=>se+1),children:"Retry setup"})]})]})]})}const gs={"invalidate-tokens":"Invalidate tokens",revoke:"Revoke client",delete:"Delete client"};function By({clientId:s,name:x,revoked:b,onChanged:o,onBusyChange:E}){const[_,q]=U.useState(),[H,A]=U.useState(!1),[d,D]=U.useState(""),[O,R]=U.useState(!1),Q=async Z=>{A(!0),D(""),q(void 0);try{q(await be.clientLifecycle(s,{action:Z,dryRun:!0}))}catch(W){D(W instanceof Error?W.message:"Could not preview this action. Retry after checking the client.")}finally{A(!1)}},G=async()=>{if(_){A(!0),E==null||E(!0),D("");try{await be.clientLifecycle(s,{action:_.action,dryRun:!1,yes:!0,expectedRevision:_.before.revision}),o()}catch(Z){const W=Ss(Z);D(`${Z instanceof Error?Z.message:"Request failed."} ${W?"The action may have completed. Reload the client and inspect its current state before requesting another action.":"The request was refused. Review a fresh preview before applying an action."}`),R(W),q(void 0)}finally{A(!1),E==null||E(!1)}}};return i.jsxs("section",{"aria-labelledby":"client-lifecycle-title",style:{marginTop:28},children:[i.jsx("h3",{id:"client-lifecycle-title",className:"section-title",children:"Client access"}),i.jsx("p",{className:"grant-help",children:"Invalidating tokens keeps the client and its secret. Revoking ends access and keeps a visible registration. Deleting removes the registration. Memory and audit history remain."}),!_&&i.jsx("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:["invalidate-tokens","revoke","delete"].filter(Z=>!b||Z==="delete").map(Z=>i.jsx("button",{type:"button",className:"btn btn-secondary",disabled:H||O,onClick:()=>void Q(Z),children:gs[Z]},Z))}),_&&i.jsxs("div",{"aria-live":"polite",style:{border:"1px solid var(--border)",padding:16},children:[i.jsxs("h4",{style:{margin:"0 0 12px"},children:[gs[_.action],": ",x]}),i.jsxs("p",{children:[i.jsx("code",{children:s})," · Revision ",_.before.revision]}),i.jsx("ul",{children:(Array.isArray(_.consequences)?_.consequences:[_.consequences]).map((Z,W)=>i.jsx("li",{children:Z},W))}),i.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:16},children:[i.jsx("button",{type:"button",className:"btn btn-secondary",disabled:H,onClick:()=>q(void 0),children:"Cancel"}),i.jsx("button",{type:"button",className:"btn btn-danger",disabled:H,onClick:()=>void G(),children:H?"Applying…":`Confirm ${gs[_.action].toLowerCase()}`})]})]}),d&&i.jsxs("p",{role:"alert",style:{color:"var(--error)"},children:[d," ",O&&i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:o,children:"Reload client list"})]})]})}function _n({title:s,titleId:x,children:b,onClose:o,busy:E=!1,drawer:_=!1}){const q=U.useRef(null),H=U.useRef(o);H.current=o;const A=U.useRef(E);A.current=E;const[d]=U.useState(()=>document.activeElement instanceof HTMLElement?document.activeElement:null);return U.useEffect(()=>{const D=q.current;if(!D)return;(D.querySelector("[data-autofocus]")??D).focus();const O=R=>{if(R.key==="Escape"&&(R.preventDefault(),A.current||H.current()),R.key!=="Tab")return;const Q=[...D.querySelectorAll('button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), a[href], summary, [tabindex="0"]')].filter(W=>W.getClientRects().length>0&&!W.closest("fieldset:disabled")),G=Q[0],Z=Q[Q.length-1];if(!G){R.preventDefault(),D.focus();return}R.shiftKey&&(document.activeElement===G||document.activeElement===D)?(R.preventDefault(),Z.focus()):!R.shiftKey&&(document.activeElement===Z||document.activeElement===D)&&(R.preventDefault(),G.focus())};return D.addEventListener("keydown",O),()=>{D.removeEventListener("keydown",O),d!=null&&d.isConnected&&d.focus()}},[d]),i.jsx("div",{className:_?"drawer-overlay":"modal-overlay",onClick:()=>{E||o()},children:i.jsxs("div",{ref:q,role:"dialog","aria-modal":"true","aria-labelledby":x,"aria-busy":E,tabIndex:-1,className:_?"drawer":"modal",onClick:D=>D.stopPropagation(),style:_?{width:"min(640px, 95vw)"}:{maxWidth:760,width:"92vw",minWidth:0,maxHeight:"90vh",overflowY:"auto"},children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,alignItems:"start",marginBottom:20},children:[i.jsx("h2",{id:x,className:"modal-title",style:{margin:0},children:s}),i.jsx("button",{type:"button",className:"btn btn-secondary","aria-label":`Close ${s}`,disabled:E,onClick:o,children:"Close"})]}),b]})})}function Yy(s){const x=s.kind!=="machine",b=x?s.redirectUris.split(`
-`).map(o=>o.trim()).filter(Boolean):[];if(x&&!b.length)throw new Error("Enter the exact redirect URI from your MCP client settings, one per line.");for(const o of b)try{new URL(o)}catch{throw new Error("Each redirect URI must be a complete URI. Copy it exactly from your MCP client settings.")}return{grantTypes:x?["authorization_code","refresh_token"]:["client_credentials"],redirectUris:b,tokenEndpointAuthMethod:s.kind==="public-pkce"?"none":s.kind==="machine"?"client_secret_post":s.confidentialMethod}}function Gy(s){const x=Math.floor((Date.now()-s.getTime())/1e3);return x<60?"just now":x<3600?Math.floor(x/60)+"m ago":x<86400?Math.floor(x/3600)+"h ago":Math.floor(x/86400)+"d ago"}function wy(){const[s,x]=U.useState([]),[b,o]=U.useState([]),[E,_]=U.useState(!1),[q,H]=U.useState(!1),[A,d]=U.useState(""),[D,O]=U.useState(""),[R,Q]=U.useState(!0),[G,Z]=U.useState(!0),[W,ae]=U.useState(!1),[$,le]=U.useState(!1),[ne,xe]=U.useState(),[k,V]=U.useState(),[Se,je]=U.useState(!1),[se,F]=U.useState(),de=U.useRef(0),Ge=U.useRef(0),Ce=async()=>{const N=++de.current;Q(!0);try{const Y=await be.agents();if(N!==de.current)return;x(Y),_(!0),d("")}catch(Y){N===de.current&&d(Y instanceof Error?Y.message:"Clients are unavailable.")}finally{N===de.current&&Q(!1)}},Ze=async()=>{const N=++Ge.current;Z(!0);try{const Y=await be.sources();if(N!==Ge.current)return;o(Y),H(!0),O("")}catch(Y){N===Ge.current&&(H(!1),O(Y instanceof Error?Y.message:"Sources are unavailable."))}finally{N===Ge.current&&Z(!1)}};U.useEffect(()=>(Ce(),Ze(),()=>{de.current++,Ge.current++}),[]);const j=s.filter(N=>!W||N.status!=="revoked");return i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,flexWrap:"wrap",alignItems:"center",marginBottom:24},children:[i.jsx("h1",{className:"page-title",style:{marginBottom:0},children:"Agents"}),i.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[i.jsxs("label",{className:"checkbox-label",children:[i.jsx("input",{type:"checkbox",checked:W,onChange:N=>ae(N.target.checked)}),"Hide revoked"]}),i.jsx("button",{type:"button",className:"btn btn-secondary",disabled:R,onClick:()=>void Ce(),children:"Refresh clients"}),i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>je(!0),children:"+ API Key"}),i.jsx("button",{type:"button",className:"btn btn-primary",disabled:!q||!b.length||G,onClick:()=>le(!0),children:"+ OAuth Client"})]})]}),i.jsx("p",{className:"grant-help",style:{marginBottom:16},children:"Owner administration uses this dashboard’s login. An OAuth client’s admin scope allows eligible brain operations; it does not open this dashboard."}),A&&i.jsxs("p",{role:"alert",style:{marginBottom:16,color:"var(--error)"},children:[E?"Showing previously loaded clients. ":"Could not load clients. ",A," ",i.jsx("button",{type:"button",className:"btn btn-secondary",disabled:R,onClick:()=>void Ce(),children:"Retry clients"})]}),D&&i.jsxs("p",{role:"alert",style:{marginBottom:16,color:"var(--error)"},children:["Could not load current sources. Registration and permission changes are unavailable. ",D," ",i.jsx("button",{type:"button",className:"btn btn-secondary",disabled:G,onClick:()=>void Ze(),children:"Retry sources"})]}),!D&&!q&&i.jsx("p",{role:"status",children:"Loading sources before registration…"}),q&&!b.length&&i.jsx("p",{role:"status",children:"No active sources are available. Add or unarchive a source on the host before registering a client."}),!E&&!A&&i.jsx("p",{role:"status",children:"Loading clients…"}),E&&!s.length&&i.jsx("p",{style:{textAlign:"center",padding:48},children:"No clients registered. Register a client to grant access to a harness."}),E&&s.length>0&&!j.length&&i.jsx("p",{style:{textAlign:"center",padding:48},children:"All clients are revoked. Uncheck “Hide revoked” to view them."}),j.length>0&&i.jsxs("div",{style:{overflowX:"auto"},children:[i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Name"}),i.jsx("th",{children:"Type"}),i.jsx("th",{children:"Scopes"}),i.jsx("th",{children:"Sources"}),i.jsx("th",{children:"Status"}),i.jsx("th",{children:"Requests"}),i.jsx("th",{children:"Last used"})]})}),i.jsx("tbody",{children:j.map(N=>i.jsxs("tr",{onClick:()=>V(N),style:{cursor:"pointer"},children:[i.jsx("td",{children:i.jsx("button",{type:"button",className:"client-name-button",onClick:Y=>{Y.stopPropagation(),V(N)},children:N.name||N.client_name})}),i.jsx("td",{children:i.jsx("span",{className:"badge "+(N.auth_type==="oauth"?"badge-read":"badge-write"),children:N.auth_type==="oauth"?"OAuth":"API key"})}),i.jsx("td",{children:(N.scope||"").split(" ").filter(Boolean).map(Y=>i.jsx("span",{className:"badge badge-"+Y,style:{marginRight:4},children:Y},Y))}),i.jsx("td",{children:N.auth_type==="oauth"?(N.source_id||"none")+" · "+(N.federated_read||[]).length+" readable":"Unscoped"}),i.jsx("td",{children:i.jsx("span",{className:"badge "+(N.status==="active"?"badge-success":"badge-danger"),children:N.status})}),i.jsxs("td",{children:[N.requests_today||0,i.jsxs("span",{style:{color:"var(--text-muted)"},children:[" / ",N.total_requests||0]})]}),i.jsx("td",{children:N.last_used_at?Gy(new Date(N.last_used_at)):"Never"})]},N.auth_type+":"+N.id))})]}),i.jsxs("p",{className:"grant-help",style:{marginTop:12},children:[s.filter(N=>N.status==="active").length," active / ",s.length," total"]})]}),$&&i.jsx(Xy,{sources:b,sourcesReady:q,onClose:()=>le(!1),onRegistered:N=>{le(!1),xe(N),Ce()}}),ne&&i.jsxs(_n,{title:"Client registered",titleId:"registered-client-title",onClose:()=>xe(void 0),children:[i.jsxs("p",{role:"status",style:{marginBottom:16},children:[ne.name," is registered. Its harness connection has not been verified."]}),i.jsx(Jd,{clientId:ne.clientId,grantTypes:ne.grantTypes})]}),k&&i.jsx(Qy,{agent:k,sources:b,sourcesReady:q,onClose:()=>V(void 0),onChanged:()=>{V(void 0),Ce()},onRescoped:N=>{V(Y=>Y&&{...Y,source_id:N.sourceId,federated_read:N.federatedRead,scope:N.scopes.join(" "),token_ttl:N.tokenTtlSeconds}),Ce()}},k.id),Se&&i.jsx(Zy,{onClose:()=>je(!1),onCreated:N=>{je(!1),F(N),Ce()}}),se&&i.jsx(Vy,{token:se,onClose:()=>F(void 0)})]})}function Xy({sources:s,sourcesReady:x,onClose:b,onRegistered:o}){const[E,_]=U.useState(""),[q,H]=U.useState(()=>bs()),[A,d]=U.useState({kind:"machine",redirectUris:"",confidentialMethod:"client_secret_post"}),[D,O]=U.useState(),[R,Q]=U.useState(""),[G,Z]=U.useState(),[W,ae]=U.useState(!1),[$,le]=U.useState(""),[ne,xe]=U.useState(),[k,V]=U.useState(!1),Se=()=>{Q(""),be.grantCatalog().then(O).catch(F=>Q(F instanceof Error?F.message:"Permission catalog unavailable."))};U.useEffect(Se,[]);const je=F=>{d(F),Z(void 0)},se=async F=>{if(F.preventDefault(),!(!x||!D||k)){if(!E.trim()){le("Enter a client name.");return}ae(!0),le("");try{const de=(G==null?void 0:G.oauth)??Yy(A),Ge=(G==null?void 0:G.name)??E.trim(),Ce=await be.registerClient({...G?Zd(G.grant.after):Ld(q),...de,name:Ge,dryRun:!G});G?o({clientId:Ce.clientId,name:Ge,grantTypes:de.grantTypes}):Z({grant:Ce,oauth:de,name:Ge})}catch(de){le(de instanceof Error?de.message:"Registration failed.");const Ge=!!G&&Ss(de);if(V(Ge),G&&(Ge||de instanceof An&&de.status===409))try{const Ce=(await be.agents()).filter(Ze=>Ze.auth_type==="oauth"&&Ze.status==="active"&&(Ze.name||Ze.client_name)===G.name);Ce.length===1&&(xe({clientId:Ce[0].id||Ce[0].client_id,name:G.name,grantTypes:Ce[0].grant_types}),V(!0))}catch{}Z(void 0)}finally{ae(!1)}}};return i.jsx(_n,{title:"Register OAuth client",titleId:"register-client-title",onClose:b,busy:W,children:i.jsxs("form",{onSubmit:se,children:[i.jsxs("fieldset",{disabled:W||k,style:{border:0,padding:0},children:[i.jsx("label",{htmlFor:"agent-name",children:"Client name"}),i.jsx("input",{id:"agent-name","data-autofocus":!0,value:E,placeholder:"agent-example",onChange:F=>{_(F.target.value),Z(void 0)}}),i.jsx("label",{htmlFor:"oauth-connection-kind",style:{marginTop:16},children:"Connection type"}),i.jsxs("select",{id:"oauth-connection-kind",value:A.kind,onChange:F=>je({...A,kind:F.target.value}),children:[i.jsx("option",{value:"machine",children:"Machine credentials"}),i.jsx("option",{value:"public-pkce",children:"Browser sign-in: public client with PKCE"}),i.jsx("option",{value:"confidential-pkce",children:"Browser sign-in: confidential client with PKCE"})]}),i.jsx("p",{className:"grant-help",children:"Choose the method required by your MCP client. Browser sign-in requires the owner’s approval. Public clients use PKCE without a client secret."}),A.kind!=="machine"&&i.jsxs(i.Fragment,{children:[i.jsx("label",{htmlFor:"oauth-redirect-uris",children:"Exact redirect URIs (one per line)"}),i.jsx("textarea",{id:"oauth-redirect-uris",rows:3,value:A.redirectUris,onChange:F=>je({...A,redirectUris:F.target.value}),placeholder:"https://client.example.com/oauth/callback"}),i.jsx("p",{className:"grant-help",children:"Copy these from the client’s OAuth settings. Keep the complete path and query. GBrain uses S256 PKCE."})]}),A.kind==="confidential-pkce"&&i.jsxs(i.Fragment,{children:[i.jsx("label",{htmlFor:"oauth-client-auth",children:"Client secret authentication"}),i.jsxs("select",{id:"oauth-client-auth",value:A.confidentialMethod,onChange:F=>je({...A,confidentialMethod:F.target.value}),children:[i.jsx("option",{value:"client_secret_post",children:"client_secret_post (request body)"}),i.jsx("option",{value:"client_secret_basic",children:"client_secret_basic (HTTP Basic)"})]})]}),A.kind==="machine"&&i.jsx("p",{className:"grant-help",children:"Machine handoffs use client_secret_post to renew their access tokens."}),i.jsx("div",{style:{marginTop:24},children:D&&i.jsx(Vd,{draft:q,setDraft:F=>{H(F),Z(void 0)},catalog:D,sources:s})})]}),R&&i.jsxs("p",{role:"alert",style:{color:"var(--error)"},children:[R," ",i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:Se,children:"Retry permissions"})]}),!x&&i.jsx("p",{role:"alert",children:"Current sources are unavailable. Close this form and retry sources before registration."}),G&&i.jsxs(i.Fragment,{children:[i.jsx(Kd,{preview:G.grant}),i.jsxs("div",{"aria-live":"polite",children:[i.jsx("h3",{children:"Review connection"}),i.jsxs("dl",{className:"oauth-consent-details",children:[i.jsx("dt",{children:"Client name"}),i.jsx("dd",{children:G.name}),i.jsx("dt",{children:"Grant types"}),i.jsx("dd",{children:G.oauth.grantTypes.join(", ")}),i.jsx("dt",{children:"Authentication"}),i.jsx("dd",{children:G.oauth.tokenEndpointAuthMethod}),G.oauth.redirectUris.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"Exact redirect URIs"}),i.jsx("dd",{children:G.oauth.redirectUris.map(F=>i.jsx("div",{children:i.jsx("code",{children:F})},F))})]})]})]})]}),$&&i.jsx("p",{role:"alert",style:{color:"var(--error)",margin:"16px 0"},children:$}),ne&&i.jsxs("div",{role:"status",children:[i.jsxs("p",{children:["A client named ",ne.name," is registered. Open its setup instructions and recover its existing download."]}),i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>o(ne),children:"Open existing client setup"})]}),k&&!ne&&i.jsx("p",{role:"status",children:"Registration may have completed. Close this form and refresh clients before trying again. No automatic retry was made."}),i.jsxs("div",{style:{display:"flex",gap:12,justifyContent:"flex-end",marginTop:20},children:[i.jsx("button",{type:"button",className:"btn btn-secondary",disabled:W,onClick:b,children:"Cancel"}),i.jsx("button",{type:"submit",className:"btn btn-primary",disabled:W||!D||!x||k,children:W?"Checking…":G?"Register with reviewed permissions":"Preview permissions"})]})]})})}function Qy({agent:s,sources:x,sourcesReady:b,onClose:o,onChanged:E,onRescoped:_}){const q=s.id||s.client_id||"",H=s.name||s.client_name||q,[A,d]=U.useState(),[D,O]=U.useState(""),[R,Q]=U.useState(0),[G,Z]=U.useState(!1),[W,ae]=U.useState(!1);return U.useEffect(()=>{if(s.auth_type!=="oauth")return;let $=!0;return O(""),be.clientDetails(q).then(le=>{$&&d(le)}).catch(le=>{$&&O(le instanceof Error?le.message:"Client details unavailable.")}),()=>{$=!1}},[q,s.auth_type,R]),i.jsxs(_n,{title:H,titleId:"client-details-title",onClose:o,drawer:!0,busy:W,children:[i.jsx("span",{className:"badge "+(s.status==="active"?"badge-success":"badge-danger"),children:s.status}),i.jsxs("dl",{className:"oauth-consent-details",style:{marginTop:16},children:[i.jsx("dt",{children:"Client ID"}),i.jsx("dd",{children:i.jsx("code",{children:q})}),i.jsx("dt",{children:"Scopes"}),i.jsx("dd",{children:s.scope||"None"}),i.jsx("dt",{children:"Registered"}),i.jsx("dd",{children:new Date(s.created_at).toLocaleString()}),i.jsx("dt",{children:"Token lifetime"}),i.jsx("dd",{children:s.token_ttl?s.token_ttl+" seconds":"Server default (future tokens)"}),A&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"Grant types"}),i.jsx("dd",{children:A.client.grant_types.join(", ")}),i.jsx("dt",{children:"Authentication"}),i.jsx("dd",{children:A.client.token_endpoint_auth_method})]})]}),s.auth_type==="oauth"?i.jsxs(i.Fragment,{children:[D&&i.jsxs("p",{role:"alert",style:{color:"var(--error)"},children:[D," ",i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>Q($=>$+1),children:"Retry client details"})]}),!A&&!D&&i.jsx("p",{role:"status",children:"Loading client details…"}),A&&i.jsxs(i.Fragment,{children:[i.jsx(Jd,{clientId:q,grantTypes:A.client.grant_types,revoked:s.status==="revoked",grantRevision:A.grant.revision}),s.status==="active"&&i.jsxs("details",{style:{marginTop:24},children:[i.jsx("summary",{style:{cursor:"pointer",fontWeight:600},children:"Edit access levels"}),i.jsx(Uy,{clientId:q,sources:x,sourcesReady:b,onRescoped:$=>{d(le=>le&&{...le,grant:$}),_($)}})]}),i.jsx(By,{clientId:q,name:H,revoked:s.status==="revoked",onChanged:E,onBusyChange:ae})]})]}):i.jsxs(i.Fragment,{children:[i.jsx("h3",{className:"section-title",children:"API key"}),i.jsx("p",{children:"Use this key as a bearer token in a client that supports static authentication. Its value is available only in the original private handoff."}),s.status==="active"&&i.jsxs("div",{style:{marginTop:20},children:[G?i.jsxs(i.Fragment,{children:[i.jsxs("p",{children:["Revoke the API key ",H," (",q,")? Only this key stops working. Memory remains."]}),i.jsx("button",{type:"button",className:"btn btn-secondary",disabled:W,onClick:()=>Z(!1),children:"Cancel"})," ",i.jsx("button",{type:"button",className:"btn btn-danger",disabled:W,onClick:()=>{ae(!0),be.revokeApiKey(q).then(E).catch($=>O($ instanceof Error?$.message:"Revoke failed. Refresh the client list before retrying.")).finally(()=>ae(!1))},children:"Confirm revoke"})]}):i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>Z(!0),children:"Revoke API key"}),D&&i.jsx("p",{role:"alert",children:D})]})]})]})}const Ly=[{id:"read",label:"Read",help:"Search and read memory."},{id:"write",label:"Write",help:"Add and edit memory."},{id:"admin",label:"Admin",help:"Brain administration operations. Grant only to fully trusted clients."}];function Zy({onClose:s,onCreated:x}){const[b,o]=U.useState(""),[E,_]=U.useState(!1),[q,H]=U.useState(""),[A,d]=U.useState(["read","write"]),D=async O=>{if(O.preventDefault(),!b.trim()){H("Enter a key name.");return}if(A.length===0){H("Choose at least one access level.");return}_(!0),H("");try{const R=await be.createApiKey(b.trim(),A);x({name:R.name,token:R.token})}catch(R){H(R instanceof Error?R.message:"Key creation failed. Inspect the clients list before retrying.")}finally{_(!1)}};return i.jsx(_n,{title:"Create API key",titleId:"create-api-key-title",onClose:s,busy:E,children:i.jsxs("form",{onSubmit:D,children:[i.jsx("p",{className:"grant-help",children:"API keys default to read and write. Admin is granted only when you check it. Choose an OAuth client for per-source or per-operation access. This key cannot log into the owner dashboard."}),i.jsx("label",{htmlFor:"api-key-name",children:"Key name"}),i.jsx("input",{id:"api-key-name","data-autofocus":!0,value:b,maxLength:128,disabled:E,onChange:O=>o(O.target.value)}),i.jsxs("fieldset",{style:{marginTop:16},children:[i.jsx("legend",{children:"Access levels"}),Ly.map(O=>i.jsxs("label",{style:{display:"block"},children:[i.jsx("input",{type:"checkbox",checked:A.includes(O.id),disabled:E,onChange:R=>d(Q=>R.target.checked?[...Q,O.id]:Q.filter(G=>G!==O.id))})," ",O.label," ",i.jsx("span",{className:"grant-help",children:O.help})]},O.id))]}),q&&i.jsx("p",{role:"alert",children:q}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,marginTop:20},children:[i.jsx("button",{type:"button",className:"btn btn-secondary",disabled:E,onClick:s,children:"Cancel"}),i.jsx("button",{type:"submit",className:"btn btn-primary",disabled:E,children:E?"Creating…":"Create key"})]})]})})}function Vy({token:s,onClose:x}){const[b,o]=U.useState(!1),[E,_]=U.useState("");return i.jsxs(_n,{title:"API key created",titleId:"api-key-created-title",onClose:x,children:[i.jsx("p",{children:s.name}),i.jsx("label",{htmlFor:"new-api-key",children:"Bearer token"}),i.jsx("textarea",{id:"new-api-key",rows:3,readOnly:!0,value:s.token}),i.jsx("p",{className:"grant-help",children:"Save this token privately now. It will not be shown again. A key’s creation does not verify your harness connection."}),i.jsx("button",{type:"button",className:"btn btn-secondary",onClick:()=>{navigator.clipboard.writeText(s.token).then(()=>o(!0)).catch(()=>_("Clipboard unavailable. Select and copy the token above."))},children:b?"Copied":"Copy token"}),E&&i.jsx("p",{role:"alert",children:E}),i.jsx("button",{type:"button",className:"btn btn-primary",style:{marginLeft:12},onClick:x,children:"Done"})]})}function Ky(){const[s,x]=U.useState({rows:[],total:0,page:1,pages:1}),[b,o]=U.useState(1),[E,_]=U.useState("all"),[q,H]=U.useState(null);U.useEffect(()=>{A(b)},[b,E]);const A=R=>{const Q=E!=="all"?`&agent=${encodeURIComponent(E)}`:"";be.requests(R,Q).then(x).catch(()=>{})},d=R=>{const Q=Date.now()-new Date(R).getTime();return Q<6e4?`${Math.floor(Q/1e3)}s ago`:Q<36e5?`${Math.floor(Q/6e4)} min ago`:Q<864e5?`${Math.floor(Q/36e5)}h ago`:new Date(R).toLocaleDateString()},D=R=>{if(!R)return null;const{query:Q,slug:G,partial:Z,limit:W,...ae}=R,$=[];return Q&&$.push(`"${Q}"`),G&&$.push(G),Z&&$.push(`~${Z}`),W&&$.push(`limit=${W}`),Object.keys(ae).length>0&&$.push(`+${Object.keys(ae).length} params`),$.join(" ")},O=new Map;return s.rows.forEach(R=>{R.token_name&&O.set(R.token_name,R.agent_name||R.token_name)}),i.jsxs(i.Fragment,{children:[i.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[i.jsx("h1",{className:"page-title",style:{marginBottom:0},children:"Request Log"}),i.jsxs("select",{value:E,onChange:R=>{_(R.target.value),o(1)},style:{background:"var(--bg-secondary)",color:"var(--text-primary)",border:"1px solid var(--border)",borderRadius:6,padding:"4px 8px",fontSize:13},children:[i.jsx("option",{value:"all",children:"All agents"}),[...O.entries()].map(([R,Q])=>i.jsx("option",{value:R,children:Q},R))]})]}),s.rows.length===0?i.jsx("div",{style:{textAlign:"center",padding:48,color:"var(--text-muted)"},children:"No requests yet."}):i.jsxs(i.Fragment,{children:[i.jsxs("table",{children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"Time"}),i.jsx("th",{children:"Agent"}),i.jsx("th",{children:"Operation"}),i.jsx("th",{children:"Params"}),i.jsx("th",{children:"Latency"}),i.jsx("th",{children:"Status"})]})}),i.jsx("tbody",{children:s.rows.map(R=>i.jsxs(Xd.Fragment,{children:[i.jsxs("tr",{onClick:()=>H(q===R.id?null:R.id),style:{cursor:"pointer"},children:[i.jsx("td",{style:{color:"var(--text-secondary)",whiteSpace:"nowrap"},children:d(R.created_at)}),i.jsx("td",{children:i.jsx("a",{style:{color:"var(--text-link, #88aaff)",cursor:"pointer",textDecoration:"none",fontWeight:500},onClick:Q=>{Q.stopPropagation(),_(R.token_name),o(1)},children:R.agent_name||R.token_name})}),i.jsx("td",{className:"mono",children:R.operation}),i.jsx("td",{style:{color:"var(--text-secondary)",fontSize:12,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D(R.params)}),i.jsxs("td",{className:"mono",children:[R.latency_ms,"ms"]}),i.jsx("td",{children:i.jsx("span",{className:`badge badge-${R.status}`,children:R.status})})]}),q===R.id&&i.jsx("tr",{children:i.jsx("td",{colSpan:6,style:{background:"var(--bg-secondary, #0f0f1a)",padding:16},children:i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"100px 1fr",gap:"6px 12px",fontSize:13},children:[i.jsx("span",{style:{color:"var(--text-muted)"},children:"Time"}),i.jsx("span",{children:new Date(R.created_at).toLocaleString()}),i.jsx("span",{style:{color:"var(--text-muted)"},children:"Agent"}),i.jsx("span",{className:"mono",children:R.token_name}),i.jsx("span",{style:{color:"var(--text-muted)"},children:"Operation"}),i.jsx("span",{className:"mono",children:R.operation}),i.jsx("span",{style:{color:"var(--text-muted)"},children:"Latency"}),i.jsxs("span",{children:[R.latency_ms,"ms"]}),R.params&&i.jsxs(i.Fragment,{children:[i.jsx("span",{style:{color:"var(--text-muted)"},children:"Params"}),i.jsx("pre",{className:"mono",style:{margin:0,whiteSpace:"pre-wrap",fontSize:12},children:JSON.stringify(R.params,null,2)})]}),R.error_message&&i.jsxs(i.Fragment,{children:[i.jsx("span",{style:{color:"var(--error, #ff6b6b)"},children:"Error"}),i.jsx("span",{style:{color:"var(--error, #ff6b6b)"},children:R.error_message})]})]})})})]},R.id))})]}),i.jsxs("div",{className:"pagination",children:[i.jsxs("span",{children:["Page ",s.page," of ",s.pages," (",s.total," total)"]}),i.jsxs("div",{style:{display:"flex",gap:8},children:[i.jsx("button",{disabled:s.page<=1,onClick:()=>o(R=>R-1),children:"Previous"}),i.jsx("button",{disabled:s.page>=s.pages,onClick:()=>o(R=>R+1),children:"Next"})]})]})]})]})}function Jy({markup:s}){return i.jsx("div",{style:{width:"100%",overflow:"auto"},dangerouslySetInnerHTML:{__html:s}})}function Vu({type:s,ariaLabel:x}){const[b,o]=U.useState(""),[E,_]=U.useState("");return U.useEffect(()=>{let q=!1;return be.calibrationChart(s).then(H=>{q||o(H)}).catch(H=>{q||_(H.message??"fetch failed")}),()=>{q=!0}},[s]),E?i.jsxs("div",{style:{padding:16,color:"var(--error)"},role:"alert",children:[x,": ",E]}):b?i.jsx(Jy,{markup:b}):i.jsxs("div",{style:{padding:16,color:"var(--text-muted)"},children:[x," loading..."]})}function ky(){const[s,x]=U.useState(null),[b,o]=U.useState(!0),[E,_]=U.useState("");if(U.useEffect(()=>{be.calibrationProfile().then(A=>{x(A),o(!1)}).catch(A=>{_(A.message??"fetch failed"),o(!1)})},[]),b)return i.jsx("div",{style:{padding:24,color:"var(--text-secondary)"},children:"Loading calibration profile…"});if(E)return i.jsxs("div",{style:{padding:24,color:"var(--error)"},role:"alert",children:["Could not load calibration profile: ",E]});if(!s)return i.jsxs("div",{style:{padding:24,maxWidth:700},children:[i.jsx("h1",{style:{marginBottom:16},children:"Calibration"}),i.jsx("p",{style:{color:"var(--text-secondary)"},children:"No calibration profile yet. Builds after 5+ resolved takes."}),i.jsx("pre",{style:{background:"var(--bg-secondary)",padding:12,borderRadius:4,color:"var(--text-primary)",marginTop:12,fontFamily:"var(--font-mono)"},children:"gbrain dream --phase calibration_profile"})]});const q=new Date(s.generated_at),H=Math.floor((Date.now()-q.getTime())/(1e3*60*60*24));return i.jsxs("div",{style:{padding:32,maxWidth:720},children:[i.jsx("h1",{style:{marginBottom:8},children:"Calibration"}),i.jsxs("div",{style:{color:"var(--text-muted)",fontSize:13,marginBottom:24},children:["Holder: ",s.holder," · ","Updated ",H===0?"today":`${H}d ago`,s.published&&" · published",s.grade_completion<.9&&` · ~${Math.round(s.grade_completion*100)}% graded`,!s.voice_gate_passed&&" · voice gate fell back to template"]}),i.jsx("section",{style:{marginBottom:32},children:i.jsx(Vu,{type:"brier-trend",ariaLabel:"Brier trend"})}),i.jsxs("section",{style:{marginBottom:32},children:[i.jsx("h2",{style:{fontSize:14,color:"var(--text-secondary)",marginBottom:12,fontWeight:400},children:"Pattern statements"}),i.jsx(Vu,{type:"pattern-statements",ariaLabel:"Pattern statements"})]}),i.jsx("section",{style:{marginBottom:32},children:i.jsx(Vu,{type:"domain-bars",ariaLabel:"Per-domain accuracy"})}),i.jsx("section",{style:{marginBottom:32},children:i.jsx(Vu,{type:"abandoned-threads",ariaLabel:"Abandoned threads"})}),s.active_bias_tags.length>0&&i.jsxs("section",{style:{marginBottom:32,color:"var(--text-muted)",fontSize:13},children:["Active bias tags: ",s.active_bias_tags.join(", ")]})]})}function Wy(s){return s===0?"var(--accent-success, #2ea043)":s>=100?"var(--accent-danger, #f85149)":"var(--accent-warn, #d29922)"}function Yd(s){return`$${(s/100).toFixed(2)}`}function $y(){const[s,x]=U.useState(null),[b,o]=U.useState(null);if(U.useEffect(()=>{let _=!0,q=null;const H=async()=>{try{const A=await be.jobsWatch();_&&(x(A),o(null))}catch(A){_&&o(A instanceof Error?A.message:String(A))}_&&(q=setTimeout(H,1e3))};return H(),()=>{_=!1,q&&clearTimeout(q)}},[]),b)return i.jsxs("div",{style:{padding:24,color:"var(--accent-danger, #f85149)"},children:[i.jsx("h2",{children:"Jobs Watch — error"}),i.jsx("pre",{style:{whiteSpace:"pre-wrap"},children:b})]});if(!s)return i.jsx("div",{style:{padding:24,color:"var(--text-muted, #777)"},children:"Loading jobs watch…"});const E=new Date(s.ts_ms).toLocaleTimeString();return i.jsxs("div",{style:{padding:24,fontFamily:'var(--font-mono, "JetBrains Mono", monospace)'},children:[i.jsxs("h1",{style:{fontSize:18,marginBottom:4},children:["Jobs Watch",i.jsxs("span",{style:{marginLeft:12,color:"var(--text-muted, #777)",fontSize:12,fontWeight:"normal"},children:["updated ",E]})]}),i.jsxs("section",{style:{marginTop:24},children:[i.jsx("h2",{style:{fontSize:14,marginBottom:8},children:"Queue"}),i.jsxs("div",{children:["waiting=",i.jsx("b",{children:s.queue_health.waiting})," ","active=",i.jsx("b",{children:s.queue_health.active})," ","stalled=",i.jsx("b",{style:{color:s.queue_health.stalled>0?"var(--accent-warn, #d29922)":void 0},children:s.queue_health.stalled})]})]}),s.by_type.length>0&&i.jsxs("section",{style:{marginTop:24},children:[i.jsx("h2",{style:{fontSize:14,marginBottom:8},children:"By type (24h)"}),i.jsxs("table",{style:{borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{color:"var(--text-muted, #777)",fontSize:12},children:[i.jsx("th",{style:{textAlign:"left",padding:"4px 12px 4px 0"},children:"name"}),i.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"total"}),i.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"done"}),i.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"fail"}),i.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"dead"})]})}),i.jsx("tbody",{children:s.by_type.slice(0,6).map(_=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"4px 12px 4px 0"},children:_.name}),i.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:_.total}),i.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:_.completed}),i.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:_.failed}),i.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:_.dead})]},_.name))})]})]}),i.jsxs("section",{style:{marginTop:24},children:[i.jsx("h2",{style:{fontSize:14,marginBottom:8},children:"Lease pressure (1h)"}),i.jsxs("div",{style:{color:Wy(s.lease_pressure_1h)},children:[s.lease_pressure_1h," bounce",s.lease_pressure_1h===1?"":"s"]})]}),s.top_errors.length>0&&i.jsxs("section",{style:{marginTop:24},children:[i.jsx("h2",{style:{fontSize:14,marginBottom:8},children:"Top errors (24h)"}),i.jsx("table",{style:{borderCollapse:"collapse"},children:i.jsx("tbody",{children:s.top_errors.slice(0,5).map(_=>i.jsxs("tr",{children:[i.jsxs("td",{style:{textAlign:"right",padding:"4px 12px 4px 0",color:"var(--text-muted, #777)"},children:[_.count,"×"]}),i.jsx("td",{style:{padding:"4px 12px 4px 0"},children:_.cluster})]},_.cluster))})})]}),s.budget_owners.length>0&&i.jsxs("section",{style:{marginTop:24},children:[i.jsx("h2",{style:{fontSize:14,marginBottom:8},children:"Budget owners"}),i.jsxs("table",{style:{borderCollapse:"collapse"},children:[i.jsx("thead",{children:i.jsxs("tr",{style:{color:"var(--text-muted, #777)",fontSize:12},children:[i.jsx("th",{style:{textAlign:"left",padding:"4px 12px 4px 0"},children:"owner"}),i.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"spent"}),i.jsx("th",{style:{textAlign:"right",padding:"4px 12px"},children:"remaining"})]})}),i.jsx("tbody",{children:s.budget_owners.slice(0,5).map(_=>i.jsxs("tr",{children:[i.jsx("td",{style:{padding:"4px 12px 4px 0"},children:_.owner_id}),i.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:Yd(_.total_spent_cents)}),i.jsx("td",{style:{textAlign:"right",padding:"4px 12px"},children:Yd(_.remaining_cents)})]},_.owner_id))})]})]})]})}function Fy(){var H,A;const[s,x]=U.useState(),[b,o]=U.useState(""),[E,_]=U.useState(!1);U.useEffect(()=>{let d=!0;const D=Ku();if(!D){o("No pending authorization request. Restart the connection from your client.");return}return be.oauthRequest(D).then(O=>{d&&x(O)}).catch(O=>{d&&o(O.message)}),()=>{d=!1}},[]);const q=async d=>{if(!(!s||E)){_(!0),o("");try{const D=await be.decideOAuthRequest(s.id,d,s.csrf);Hd(),window.location.assign(D.redirectUrl)}catch(D){o(D instanceof Error?D.message:"Approval failed. Restart the connection from your client."),x(void 0),_(!1)}}};return i.jsxs("section",{"aria-labelledby":"consent-title",style:{maxWidth:760},children:[i.jsx("h1",{id:"consent-title",children:"Approve client access"}),i.jsx("p",{style:{color:"var(--text-secondary)",margin:"16px 0"},children:"Only approve a connection you initiated. These permissions let the client act on your brain."}),b&&i.jsx("div",{role:"alert",className:"login-error",style:{marginBottom:16},children:b}),!s&&!b&&i.jsx("p",{role:"status",children:"Loading authorization request…"}),s&&i.jsxs(i.Fragment,{children:[i.jsxs("dl",{className:"oauth-consent-details",children:[i.jsx("dt",{children:"Client"}),i.jsx("dd",{children:s.clientName}),i.jsx("dt",{children:"Client ID"}),i.jsx("dd",{children:i.jsx("code",{children:s.clientId})}),i.jsx("dt",{children:"Redirect destination"}),i.jsx("dd",{children:i.jsx("code",{children:s.redirectUri})}),i.jsx("dt",{children:"Permissions"}),i.jsx("dd",{children:s.scopes.length?s.scopes.map(d=>i.jsx("span",{className:`badge ${d.includes("admin")?"badge-error":""}`,style:{marginRight:8},children:d},d)):"No permissions"}),i.jsx("dt",{children:"Administrative brain operations"}),i.jsx("dd",{children:s.scopes.some(d=>d==="admin")?"Eligible operations within the grant below. This does not grant owner dashboard access.":s.scopes.some(d=>d.endsWith("_admin"))?"The named administrative brain operations. This does not grant owner dashboard access.":"None"}),i.jsx("dt",{children:"Allowed operations"}),i.jsx("dd",{children:s.allowedOperations===null?"All operations permitted by these scopes and the server policy":s.allowedOperations.join(", ")||"None"}),i.jsx("dt",{children:"Write paths"}),i.jsx("dd",{children:s.boundSlugPrefixes===null?"Within the granted source":s.boundSlugPrefixes.join(", ")||"None"}),s.scopes.includes("agent")&&i.jsxs(i.Fragment,{children:[i.jsx("dt",{children:"Delegated tools"}),i.jsx("dd",{children:((H=s.delegatedTools)==null?void 0:H.join(", "))||"None"}),i.jsx("dt",{children:"Delegated write paths"}),i.jsx("dd",{children:s.delegatedNamespace==="job"?"A separate namespace for each job":((A=s.delegatedSlugPrefixes)==null?void 0:A.join(", "))||"None"})]}),i.jsx("dt",{children:"Write source"}),i.jsx("dd",{children:s.sourceId??"Not configured"}),i.jsx("dt",{children:"Read sources"}),i.jsx("dd",{children:s.allowedSources.length?s.allowedSources.join(", "):s.sourceId??"Not configured"}),i.jsx("dt",{children:"Resource"}),i.jsx("dd",{children:i.jsx("code",{children:s.resource??"No resource binding requested"})}),i.jsx("dt",{children:"Request expires"}),i.jsx("dd",{children:new Date(s.expiresAt).toLocaleTimeString()})]}),i.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,marginTop:24},children:[i.jsx("button",{className:"btn",disabled:E,onClick:()=>q("deny"),children:"Deny"}),i.jsx("button",{className:"btn btn-primary",disabled:E,onClick:()=>q("approve"),children:E?"Completing request…":"Approve access"})]})]}),b&&i.jsx("button",{className:"btn",onClick:()=>{Hd(),window.location.hash="agents"},children:"Return to agents"})]})}function Gd(){const s=window.location.hash.replace("#","")||"dashboard";return Ku()&&s==="dashboard"?"oauth-consent":["login","dashboard","agents","log","calibration","jobs","oauth-consent"].includes(s)?s:"dashboard"}function Iy(){const[s,x]=U.useState(Gd);U.useEffect(()=>{const E=()=>x(Gd());return window.addEventListener("hashchange",E),()=>window.removeEventListener("hashchange",E)},[]);const b=E=>{window.location.hash=E,x(E)};if(s==="login")return i.jsx(Cy,{onLogin:()=>b(Ku()?"oauth-consent":"dashboard")});const o=async()=>{if(confirm("Sign out every active admin session, including other browsers and tabs? Each one will need to re-authenticate via a fresh magic link.")){try{await be.signOutEverywhere()}catch{}b("login")}};return i.jsxs("div",{className:"app",children:[i.jsxs("nav",{className:"sidebar",children:[i.jsx("div",{className:"sidebar-logo",children:"GBrain"}),i.jsxs("div",{className:"sidebar-nav",children:[i.jsx("a",{className:`nav-item ${s==="dashboard"?"active":""}`,onClick:()=>b("dashboard"),children:"Dashboard"}),i.jsx("a",{className:`nav-item ${s==="agents"?"active":""}`,onClick:()=>b("agents"),children:"Agents"}),i.jsx("a",{className:`nav-item ${s==="log"?"active":""}`,onClick:()=>b("log"),children:"Request Log"}),i.jsx("a",{className:`nav-item ${s==="calibration"?"active":""}`,onClick:()=>b("calibration"),children:"Calibration"}),i.jsx("a",{className:`nav-item ${s==="jobs"?"active":""}`,onClick:()=>b("jobs"),children:"Jobs Watch"})]}),i.jsx("div",{style:{marginTop:"auto",padding:"16px 12px",borderTop:"1px solid var(--border)"},children:i.jsx("button",{onClick:o,style:{background:"transparent",border:"1px solid var(--border)",color:"var(--text-secondary)",padding:"6px 10px",borderRadius:6,fontSize:12,cursor:"pointer",width:"100%"},title:"Revoke every active admin session — every browser, every tab",children:"Sign out everywhere"})})]}),i.jsxs("main",{className:"main",children:[s==="dashboard"&&i.jsx(Dy,{}),s==="agents"&&i.jsx(wy,{}),s==="log"&&i.jsx(Ky,{}),s==="calibration"&&i.jsx(ky,{}),s==="jobs"&&i.jsx($y,{}),s==="oauth-consent"&&i.jsx(Fy,{})]})]})}zy.createRoot(document.getElementById("root")).render(i.jsx(Xd.StrictMode,{children:i.jsx(Iy,{})}));
diff --git a/admin/dist/index.html b/admin/dist/index.html
index 23e435e3a3..b715fd0f2c 100644
--- a/admin/dist/index.html
+++ b/admin/dist/index.html
@@ -7,7 +7,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
- <script type="module" crossorigin src="/admin/assets/index-KW-GcSja.js"></script>
+ <script type="module" crossorigin src="/admin/assets/index-CaaGFcPc.js"></script>
<link rel="stylesheet" crossorigin href="/admin/assets/index-BB8hJoAN.css">
</head>
<body>
diff --git a/admin/e2e/admin.pw.ts b/admin/e2e/admin.pw.ts
index 3473752c78..0f4f97cbc6 100644
--- a/admin/e2e/admin.pw.ts
+++ b/admin/e2e/admin.pw.ts
@@ -103,6 +103,33 @@ for (const kind of ['public-pkce', 'confidential-pkce'] as const) {
});
}
+test('a self-registered client\'s first consent offers a source picker and posts the chosen source (#6202)', async ({ page, brain }) => {
+ const callback = `${brain.url}/browser-test-callback`;
+ const registered = await fetch(`${brain.url}/register`, { method: 'POST', headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ client_name: `browser-dcr-${randomBytes(4).toString('hex')}`, redirect_uris: [callback], grant_types: ['authorization_code'],
+ response_types: ['code'], scope: 'read', token_endpoint_auth_method: 'none' }) });
+ expect(registered.status).toBe(201);
+ const clientId = (await registered.json() as { client_id: string }).client_id;
+ const verifier = randomBytes(32).toString('base64url');
+ const authorization = new URLSearchParams({ client_id: clientId, redirect_uri: callback, response_type: 'code', scope: 'read',
+ code_challenge: createHash('sha256').update(verifier).digest('base64url'), code_challenge_method: 'S256', state: 'picker-state' });
+ const response = await fetch(`${brain.url}/authorize?${authorization}`, { redirect: 'manual' });
+ expect(response.status).toBe(302);
+ const pending = new URL(response.headers.get('location')!, brain.url).searchParams.get('oauth_request')!;
+ await page.goto(await brain.loginLink(pending));
+ const picker = page.getByLabel('Write source', { exact: true });
+ await expect(picker).toHaveValue('default');
+ await expect(page.getByText('This client reads and writes only this source.', { exact: false })).toBeVisible();
+ await picker.selectOption('wiki-example');
+ const posted = page.waitForRequest(request => request.method() === 'POST' && request.url().includes('/admin/api/oauth-requests/'));
+ await page.getByRole('button', { name: 'Approve access', exact: true }).click();
+ expect(JSON.parse((await posted).postData()!)).toMatchObject({ decision: 'approve', source_id: 'wiki-example' });
+ await page.waitForURL(url => url.pathname === '/browser-test-callback' && url.searchParams.has('code'));
+ const detail = await page.request.get(`${brain.url}/admin/api/clients/${clientId}`);
+ expect(detail.ok()).toBe(true);
+ expect(JSON.stringify(await detail.json())).toContain('wiki-example');
+});
+
test('owner can edit access, invalidate tokens, revoke and delete through reviewed controls', async ({ page, brain }) => {
await openOwnerClients(page, brain);
const { artifact, name, id } = await register(page, 'machine', undefined, 'memory-writer');
diff --git a/admin/e2e/server.ts b/admin/e2e/server.ts
index bc254984d4..f8f170707a 100644
--- a/admin/e2e/server.ts
+++ b/admin/e2e/server.ts
@@ -6,6 +6,8 @@ if (!process.env.GBRAIN_TEST_HTTP_PUBLIC_URL || !process.env.GBRAIN_TEST_HTTP_PO
const engine = new PGLiteEngine();
await engine.connect({});
await engine.initSchema();
+// A second source, so the first-consent source picker (#6202) has a real choice.
+await engine.executeRaw(`INSERT INTO sources (id, name) VALUES ('wiki-example', 'wiki-example') ON CONFLICT (id) DO NOTHING`);
try {
await runServeHttp(engine, { port: Number(process.env.GBRAIN_TEST_HTTP_PORT), publicUrl: process.env.GBRAIN_TEST_HTTP_PUBLIC_URL,
tokenTtl: 3600, enableDcr: true, bind: '127.0.0.1' });
diff --git a/admin/src/api.ts b/admin/src/api.ts
index 357a8ec99c..26a8b88de6 100644
--- a/admin/src/api.ts
+++ b/admin/src/api.ts
@@ -45,8 +45,8 @@ async function apiFetchText(path: string) {
export const api = {
oauthRequest: (id: string) => apiFetch(`/admin/api/oauth-requests/${encodeURIComponent(id)}`),
- decideOAuthRequest: (id: string, decision: 'approve' | 'deny', csrf: string) =>
- apiFetch(`/admin/api/oauth-requests/${encodeURIComponent(id)}`, { method: 'POST', body: JSON.stringify({ decision, csrf }) }),
+ decideOAuthRequest: (id: string, decision: 'approve' | 'deny', csrf: string, sourceId?: string) =>
+ apiFetch(`/admin/api/oauth-requests/${encodeURIComponent(id)}`, { method: 'POST', body: JSON.stringify(sourceId === undefined ? { decision, csrf } : { decision, csrf, source_id: sourceId }) }),
login: (token: string) => apiFetch('/admin/login', { method: 'POST', body: JSON.stringify({ token }) }),
signOutEverywhere: () => apiFetch('/admin/api/sign-out-everywhere', { method: 'POST' }),
stats: () => apiFetch('/admin/api/stats'),
diff --git a/admin/src/pages/OAuthConsent.tsx b/admin/src/pages/OAuthConsent.tsx
index 2f8d0da086..dbb91902e2 100644
--- a/admin/src/pages/OAuthConsent.tsx
+++ b/admin/src/pages/OAuthConsent.tsx
@@ -8,17 +8,19 @@ interface ConsentRequest {
allowedOperations: string[] | null; boundSlugPrefixes: string[] | null;
delegatedTools: string[] | null; delegatedSlugPrefixes: string[] | null; delegatedNamespace: string | null;
resource: string | null; expiresAt: number; csrf: string;
+ sourceChoice: { editable: boolean; options: Array<{ id: string; name: string }> };
}
export function OAuthConsentPage() {
const [request, setRequest] = useState<ConsentRequest>();
const [error, setError] = useState('');
const [busy, setBusy] = useState(false);
+ const [sourceId, setSourceId] = useState('');
useEffect(() => {
let active = true;
const id = pendingOAuthRequest();
if (!id) { setError('No pending authorization request. Restart the connection from your client.'); return; }
- api.oauthRequest(id).then(value => { if (active) setRequest(value); })
+ api.oauthRequest(id).then((value: ConsentRequest) => { if (active) { setRequest(value); setSourceId(value.sourceId ?? ''); } })
.catch(err => { if (active) setError(err.message); });
return () => { active = false; };
}, []);
@@ -27,7 +29,8 @@ export function OAuthConsentPage() {
setBusy(true);
setError('');
try {
- const result = await api.decideOAuthRequest(request.id, decision, request.csrf);
+ const chosen = decision === 'approve' && request.sourceChoice.editable && sourceId !== request.sourceId ? sourceId : undefined;
+ const result = await api.decideOAuthRequest(request.id, decision, request.csrf, chosen);
clearOAuthRequest();
window.location.assign(result.redirectUrl);
} catch (err) {
@@ -54,8 +57,19 @@ export function OAuthConsentPage() {
<dt>Delegated tools</dt><dd>{request.delegatedTools?.join(', ') || 'None'}</dd>
<dt>Delegated write paths</dt><dd>{request.delegatedNamespace === 'job' ? 'A separate namespace for each job' : request.delegatedSlugPrefixes?.join(', ') || 'None'}</dd>
</>}
- <dt>Write source</dt><dd>{request.sourceId ?? 'Not configured'}</dd>
- <dt>Read sources</dt><dd>{request.allowedSources.length ? request.allowedSources.join(', ') : request.sourceId ?? 'Not configured'}</dd>
+ {request.sourceChoice.editable ? <>
+ <dt><label htmlFor="consent-source">Write source</label></dt>
+ <dd>
+ <select id="consent-source" value={sourceId} disabled={busy} onChange={event => setSourceId(event.target.value)}>
+ {request.sourceChoice.options.map(option => <option key={option.id} value={option.id}>{option.name === option.id ? option.id : `${option.name} (${option.id})`}</option>)}
+ </select>
+ <div style={{ color: 'var(--text-secondary)', marginTop: 4 }}>This client reads and writes only this source. Change it later on the Agents page or with <code>gbrain auth rescope --client</code>.</div>
+ </dd>
+ <dt>Read sources</dt><dd>{sourceId}</dd>
+ </> : <>
+ <dt>Write source</dt><dd>{request.sourceId ?? 'Not configured'}</dd>
+ <dt>Read sources</dt><dd>{request.allowedSources.length ? request.allowedSources.join(', ') : request.sourceId ?? 'Not configured'}</dd>
+ </>}
<dt>Resource</dt><dd><code>{request.resource ?? 'No resource binding requested'}</code></dd>
<dt>Request expires</dt><dd>{new Date(request.expiresAt).toLocaleTimeString()}</dd>
</dl>
diff --git a/docs/architecture/key-files/security.md b/docs/architecture/key-files/security.md
index 96ff8db048..9c44bf5323 100644
--- a/docs/architecture/key-files/security.md
+++ b/docs/architecture/key-files/security.md
@@ -16,7 +16,7 @@ Current behavior and load-bearing invariants; history belongs in Git and CHANGEL
- `src/core/guardrails.ts` — vendor-neutral content guardrail seams (`registerGuardrailProvider`, `classify`). `loadGuardrailProvidersFromEnv(env = process.env, opts?: { cwd, skipCwdCheck })` accepts ONLY an absolute path or a `~/` path for `GBRAIN_GUARDRAILS_MODULE`; cwd-relative specs (`./`, `../`, bare `.`) and bare package specifiers (`pkg`, `@scope/pkg`, `pkg/sub` — in the compiled binary Bun's module walk-up starts at the cwd, so a hostile checkout's `node_modules/<name>/` would load) throw `GuardrailLoadError` before any import, and when `env` is `process.env` (or `opts.cwd` is given) a spec that a cwd .env file assigns is refused via `cwdDotenvAssignsKey` (message composed from env-trust's `CWD_DOTENV_REMEDIATION`) unless `opts.skipCwdCheck` (preflight's cwd == config-dir case). node:path/url/os are static imports. Registration is counted by EVENTS against a pre-import baseline so import-time side-effect registration and same-id replacement are accepted (#3688 residual). Pinned by `test/guardrails.test.ts` + `test/guardrails-env-load.test.ts`.
-- `src/core/oauth-grants.ts` — client-row-locked grant transactions shared by OAuth issuance, code/refresh consumption, and revocation. Preserves scope/resource ceilings and rolls back consumption with replacement writes. Issuance caps the resolved access-token lifetime (positive `oauth_clients.token_ttl` override, else the server default) at `TOKEN_TTL_MAX_SECONDS` from `src/core/grants/model.ts`, so a stored or configured lifetime above 90 days never mints a longer token (`test/oauth-token-ttl-clamp.test.ts`, both engines). `canonicalOAuthResource(requested, canonical)` is the one RFC 8707 resource canonicalizer: with the provider's `resourceUrl` (serve-http passes the /mcp URL derived from the configured public URL, never `Host`), `begin()`, code exchange and refresh map the issuer origin (any trailing slash, default port or host case) to the canonical /mcp resource and refuse anything else with `invalid_target` naming the accepted URL before a request is pending or a code is consumed; stored origin-bound grants canonicalize the same way and pre-resource grants stay valid. serve-http's bearer verifier uses the same function. Pending consent requests live in a bounded in-memory store (`MAX_PENDING_TOTAL` server-wide, `MAX_PENDING_PER_CLIENT` = 10 awaiting-decision requests per `client_id`; `assertCapacity` prunes expired entries and enforces both ceilings synchronously at the start of `begin()` and again immediately before the insert, with no await in between; decided entries stay until expiry but do not count toward a client's budget) and snapshot current operation and delegation policies. `begin()` rejects revoked or deleted clients before creating a request. `src/commands/serve-http-oauth.ts` authenticates request details, enforces session-bound CSRF decisions, and adds a `read write` bootstrap scope hint to scope-less `/mcp` Bearer challenges without changing token authority (`grantScopes` caps every request to the client row's scope, so a read-only row still yields a read-only token); `admin/src/pages/OAuthConsent.tsx` renders the existing admin login/approval flow without exposing protected details in the page shell.
+- `src/core/oauth-grants.ts` — client-row-locked grant transactions shared by OAuth issuance, code/refresh consumption, and revocation. Preserves scope/resource ceilings and rolls back consumption with replacement writes. Issuance caps the resolved access-token lifetime (positive `oauth_clients.token_ttl` override, else the server default) at `TOKEN_TTL_MAX_SECONDS` from `src/core/grants/model.ts`, so a stored or configured lifetime above 90 days never mints a longer token (`test/oauth-token-ttl-clamp.test.ts`, both engines). `canonicalOAuthResource(requested, canonical)` is the one RFC 8707 resource canonicalizer: with the provider's `resourceUrl` (serve-http passes the /mcp URL derived from the configured public URL, never `Host`), `begin()`, code exchange and refresh map the issuer origin (any trailing slash, default port or host case) to the canonical /mcp resource and refuse anything else with `invalid_target` naming the accepted URL before a request is pending or a code is consumed; stored origin-bound grants canonicalize the same way and pre-resource grants stay valid. serve-http's bearer verifier uses the same function. Pending consent requests live in a bounded in-memory store (`MAX_PENDING_TOTAL` server-wide, `MAX_PENDING_PER_CLIENT` = 10 awaiting-decision requests per `client_id`; `assertCapacity` prunes expired entries and enforces both ceilings synchronously at the start of `begin()` and again immediately before the insert, with no await in between; decided entries stay until expiry but do not count toward a client's budget) and snapshot current operation and delegation policies. `begin()` rejects revoked or deleted clients before creating a request. #6202 first-consent source choice: `begin()` marks a request `sourceChoice.editable` only for a self-registered client's first consent (`registered_via='dcr'`, set by the DCR insert and by migration `oauth_client_registered_via` as a nullable column; `grant_revision = 0`; no `client_credentials`; a source grant) and offers the active sources; `decide(id, approve, choice?)` refuses a choice on a denial, a read-only request or an unoffered source with 403 before claiming the request, and for an editable request calls `recordFirstConsentInTransaction` (`grants/service.ts`) inside the locked transaction before the code insert: revision 0 → 1 with an `action='consent'`, `actor='owner'` audit row even for an unchanged source, the chosen source validated against active sources (a `GrantError` maps to 409 `client_policy_changed`, request terminal). `registered_via` is part of `policyDigest`. `src/commands/serve-http-oauth.ts` authenticates request details, enforces session-bound CSRF decisions (the POST body allows `source_id` only as a string on `approve`; any other key or shape is 403 `invalid_consent`), and adds a `read write` bootstrap scope hint to scope-less `/mcp` Bearer challenges without changing token authority (`grantScopes` caps every request to the client row's scope, so a read-only row still yields a read-only token); `admin/src/pages/OAuthConsent.tsx` renders the existing admin login/approval flow without exposing protected details in the page shell; for an editable request the write source is a select of the offered sources (read sources mirror it) and `source_id` is posted only when it differs from the current source. Tests: `test/oauth-owner-consent.test.ts`, `test/oauth-consent-security.test.ts`, `test/oauth-client-registered-via-migration.test.ts`, `test/e2e/oauth-owner-consent-source-postgres.test.ts`, `test/e2e/oauth-client-registered-via-postgres.test.ts`, `admin/e2e/admin.pw.ts`.
- `src/core/oauth-provider.ts` — `GBrainOAuthProvider` implementing the MCP SDK's `OAuthServerProvider` + `OAuthRegisteredClientsStore`. Backed by raw SQL (works on both PGLite and Postgres — OAuth is infrastructure, not a BrainEngine concern). Full OAuth 2.1: `authorize` + `exchangeAuthorizationCode` with PKCE, `client_credentials`, `refresh_token` with rotation, `revokeToken`, `registerClient` (DCR validates redirect_uri is `https://` or loopback per RFC 6749 §3.1.2.1). All tokens + client secrets SHA-256 hashed before storage. Owner-approved authorization codes have a 10-minute TTL. Grant transactions lock the active client row before consuming codes or refresh tokens and creating replacements; revocation uses the same lock. Provider-side S256 PKCE validation is mandatory (`skipLocalPkceValidation=true` prevents the SDK from discarding the verifier first). Existing active-client grants remain usable. `pgArray()` escapes commas/quotes/braces so a comma-bearing redirect_uri can't smuggle a second array element. Legacy `access_tokens` fallback in `verifyAccessToken` honors the original-schema `scopes TEXT[]` column via `normalizeTokenScopes` (NULL = grandfathered `read+write+admin`, so every pre-scopes token is byte-identical; an array is filtered to known scopes and honored as-is, `[]`/all-unknown preserved as deny — a dedicated column is structurally immune to the permissions-object-replacement wipe class), and reads the token's source, operation and takes-holder grant through `resolveTokenGrant` (`src/core/grants/legacy-token.ts`, shared with the legacy HTTP transport so the two transports cannot drift; a legacy-shape row converts to the grant columns on that read; `[]` takes-holders preserved as explicit deny-all, NULL → the `/mcp` dispatch site's fail-closed `['world']`). `sweepExpiredTokens()` runs on startup in try/catch and returns the count via `RETURNING 1` + array length. RFC hardening: `client_id` folded atomically into the `DELETE WHERE` for both auth-code exchange and refresh rotation (wrong-client paths don't burn the row); refresh-scope-subset enforced against the original grant on the row (RFC 6749 §6, so revoking a scope shrinks existing refresh tokens); `client_id` bound on `revokeToken` (RFC 7009 §2.1); `/token` `redirect_uri` validated against the `/authorize` value (RFC 6749 §4.1.3, empty-string treated as missing not wildcard); `verifyAccessToken`/`getClient` catch only `isUndefinedColumnError` from `src/core/utils.ts` (only SQLSTATE 42703 falls through to legacy; lock timeouts/network blips throw); `dcrDisabled` constructor option lets `serve-http.ts` disable `/register` without monkey-patching the router. Module-private `coerceTimestamp()` normalizes postgres-driver-as-string BIGINT columns to JS numbers at 5 read sites (`getClient` for RFC 7591 §3.2.1 numeric timestamps, `exchangeRefreshToken` + `verifyAccessToken` for the SDK's `typeof === 'number'` check); throws on NaN/Infinity (fail loud at boundary), returns undefined for SQL NULL (callers treat NULL as expired). Not promoted to `utils.ts` — generic BIGINT precision-loss risk. `registerClient` honors `token_endpoint_auth_method: "none"` (RFC 7591 §3.2.1): public PKCE clients store `client_secret_hash = NULL` and the response omits `client_secret`; confidential clients (`client_secret_post` / `client_secret_basic`) keep their one-time-reveal shape; `getClient` normalizes NULL `client_secret_hash` to JS `undefined` so the SDK's clientAuth path accepts public clients. `verifyAccessToken` JOINs `oauth_clients.source_id` (write scope, scalar) + `oauth_clients.federated_read` (read scope, TEXT[]) + `oauth_clients.bound_slug_prefixes` (write fence, TEXT[] — consumed by `enforceClientSlugFence` in `operations.ts`) onto the returned `AuthInfo`; legacy brains degrade via `isUndefinedColumnError` fallback, dropping the newest projection first. `rescopeClient(clientId, {sourceId?, federatedRead?, boundSlugPrefixes?})` is the trusted-operator rescope (CLI `gbrain auth rescope-client`, admin `POST /admin/api/rescope-client`); `boundSlugPrefixes` is tri-state — undefined leaves the binding untouched, `null` clears it, a non-empty array replaces it (explicit empty array rejected as ambiguous deny-all) — so roster churn updates the write fence in place without rotating secrets. with `src/commands/serve-http.ts`: custom `/token` middleware that runs BEFORE the MCP SDK's `clientAuth`. The SDK does plaintext compare against the request's `client_secret`; gbrain stores SHA-256 hashes only, so every confidential-client `/token` request would fail. The middleware detects confidential auth via `Authorization: Basic` header OR `client_secret_post` form body (both shapes per RFC 6749 §2.3.1), verifies via `verifyClient(client_id, presented_secret)` (SHA-256 hash compare), and falls through to the SDK for public PKCE clients (which the SDK's clientAuth still accepts via NULL-`client_secret_hash` normalization). Pinned by `test/oauth-confidential-client.test.ts` (both `client_secret_basic` and `client_secret_post`). `authorize()` only calls `grants.begin()` and redirects to `/admin/?oauth_request=<id>#oauth-consent`; codes are minted solely in `OAuthGrants.decide()` behind the admin cookie session and session-bound CSRF. `registerClient` (the unauthenticated DCR store method) computes the `grant_types` default (`authorization_code`) BEFORE the scope block, then calls `dcrScopeViolation` once and throws `InvalidClientMetadataError` (HTTP 400) on a privileged request — rejected, never silently dropped — before the unknown-scope filter runs; a registration that omits `scope` registers an empty scope (no default scope) and its consent request carries `scopes: []`. `allowClientCredentialsDcr` (`--enable-dcr-insecure`) yields anonymous READ-ONLY machine clients; that gate is evaluated BEFORE `dcrScopeViolation`, so a `client_credentials` request without the flag gets 'not permitted via dynamic client registration' rather than the misleading 'limited to `read`' ceiling message (pinned in `test/oauth-dcr-scope-ceiling.test.ts`). Downstream is already bounded: `OAuthGrants.begin()` snapshots the intersected grant, `exchangeCode` and `verifyAccessToken` re-intersect with the client's current scope. Operator paths (`registerClientManual`, CLI, admin API) do not use this store method and accept every canonical scope. Pinned in-process by `test/oauth-consent-security.test.ts` (live SDK `/register` with a foreign `redirect_uri`), against the real server by `test/e2e/serve-http-consent.test.ts`, and for the ceiling by `test/oauth-dcr-scope-ceiling.test.ts` + `test/oauth-authorize-scope-default.test.ts` (DCR client: `/authorize` `read write admin` -> code `['read','write']`, `admin` alone -> `[]`).
diff --git a/docs/mcp/ADMIN.md b/docs/mcp/ADMIN.md
index aabcfc0130..9ddbd01715 100644
--- a/docs/mcp/ADMIN.md
+++ b/docs/mcp/ADMIN.md
@@ -186,6 +186,15 @@ or bypass consent. Its scope ceiling and redirect validation remain enforced;
see [DCR](DEPLOY.md#dynamic-client-registration-dcr). If DCR is disabled, manually
register the client and enter its metadata where that harness supports it.
+A self-registered client lands on the `default` source and is marked
+`registered_via = 'dcr'` in `oauth_clients`. At its first consent the owner
+picks the source it reads and writes; the choice is recorded in the grant audit
+(`action: consent`, revision 1). After that the consent screen shows the source
+read-only, and the source changes only through the Agents page or
+`gbrain auth rescope --client`. Clients registered before this marker existed,
+operator-registered clients and `client_credentials` clients never get the
+choice.
+
## Inspect clients and edit access
```bash
diff --git a/docs/mcp/DEPLOY.md b/docs/mcp/DEPLOY.md
index 8534cafa49..622480dae8 100644
--- a/docs/mcp/DEPLOY.md
+++ b/docs/mcp/DEPLOY.md
@@ -387,7 +387,12 @@ A self-registered client goes through three gates:
2. **Owner approval on `/authorize`.** Every authorization-code connection
redirects to the admin dashboard, where you see the client, its redirect
URI, and the requested scopes, and approve or deny. No code is minted
- until you approve. Consent never widens the registered scope.
+ until you approve. Consent never widens the registered scope. For a newly
+ self-registered client you also choose the source it reads and writes
+ (it registers on `default`); the choice is recorded in the grant audit
+ (`action: consent`), and the first approval ends the choice, so later
+ requests show the source read-only. A `client_credentials` client never
+ gets this choice and stays on `default`.
3. **Per-request clamp.** Issued codes and tokens are re-intersected with the
client's current registered scope, so a later `rescope-client` takes effect
on the next request.
diff --git a/src/admin-embedded.ts b/src/admin-embedded.ts
index ce4729c06e..5b7dd6154b 100644
--- a/src/admin-embedded.ts
+++ b/src/admin-embedded.ts
@@ -1,6 +1,6 @@
// AUTO-GENERATED — do not edit by hand.
// Run `bun run scripts/build-admin-embedded.ts` to regenerate.
-// Source: admin/dist/ at 2026-10-04.
+// Source: admin/dist/ at 2026-10-10.
//
// Bun resolves the file: imports to a path that works at runtime even
// inside a compiled binary (`bun build --compile`). The manifest maps
@@ -9,7 +9,7 @@
// @ts-ignore — type: 'file' is Bun ESM, not in lib.d.ts
import A_0_assets_index_BB8hJoAN_css from '../admin/dist/assets/index-BB8hJoAN.css' with { type: 'file' };
// @ts-ignore — type: 'file' is Bun ESM, not in lib.d.ts
-import A_1_assets_index_KW_GcSja_js from '../admin/dist/assets/index-KW-GcSja.js' with { type: 'file' };
+import A_1_assets_index_CaaGFcPc_js from '../admin/dist/assets/index-CaaGFcPc.js' with { type: 'file' };
// @ts-ignore — type: 'file' is Bun ESM, not in lib.d.ts
import A_2_index_html from '../admin/dist/index.html' with { type: 'file' };
@@ -20,7 +20,7 @@ export interface AdminAsset {
export const ADMIN_ASSETS: Record<string, AdminAsset> = {
"/admin/assets/index-BB8hJoAN.css": { path: A_0_assets_index_BB8hJoAN_css as unknown as string, mime: "text/css; charset=utf-8" },
- "/admin/assets/index-KW-GcSja.js": { path: A_1_assets_index_KW_GcSja_js as unknown as string, mime: "application/javascript; charset=utf-8" },
+ "/admin/assets/index-CaaGFcPc.js": { path: A_1_assets_index_CaaGFcPc_js as unknown as string, mime: "application/javascript; charset=utf-8" },
"/admin/index.html": { path: A_2_index_html as unknown as string, mime: "text/html; charset=utf-8" },
};
diff --git a/src/commands/serve-http-oauth.ts b/src/commands/serve-http-oauth.ts
index 17498cecef..7e5600f968 100644
--- a/src/commands/serve-http-oauth.ts
+++ b/src/commands/serve-http-oauth.ts
@@ -496,15 +496,17 @@ export function mountOAuthConsent(app: Express, provider: GBrainOAuthProvider, r
const id = String(req.params.id);
const body = req.body;
if (!body || typeof body !== 'object' || Array.isArray(body)
- || Object.keys(body).some(key => key !== 'decision' && key !== 'csrf')
+ || Object.keys(body).some(key => key !== 'decision' && key !== 'csrf' && key !== 'source_id')
|| (body.decision !== 'approve' && body.decision !== 'deny')
+ || (body.source_id !== undefined && (body.decision !== 'approve' || typeof body.source_id !== 'string'))
|| typeof body.csrf !== 'string' || !/^[a-f0-9]{64}$/.test(body.csrf)
|| !safeHexEqual(body.csrf, csrfFor(req, id))) {
res.status(403).json({ error: 'invalid_consent', message: 'Reload this request and review it again before approving.' });
return;
}
try {
- res.json({ redirectUrl: await provider.grants.decide(id, body.decision === 'approve') });
+ res.json({ redirectUrl: await provider.grants.decide(id, body.decision === 'approve',
+ body.source_id === undefined ? undefined : { sourceId: body.source_id }) });
} catch (error) { handleError(res, error); }
});
}
diff --git a/src/core/grants/service.ts b/src/core/grants/service.ts
index 603ce79e11..6426ffc016 100644
--- a/src/core/grants/service.ts
+++ b/src/core/grants/service.ts
@@ -145,6 +145,44 @@ export async function rescopeClientGrantInTransaction(db: GrantDatabase, clientI
return { before, after, revision: after.revision, dryRun: false };
}
+/**
+ * #6202: whether a client already holds a code or token. A first consent is
+ * offered and recorded only while it holds neither, so a client approved by a
+ * server that predates the consent transition (revision still 0) never has its
+ * source moved under tokens it already holds.
+ */
+export async function clientHoldsAuthorization(db: GrantDatabase, clientId: string): Promise<boolean> {
+ const [row] = await query(db)`SELECT EXISTS (SELECT 1 FROM oauth_tokens WHERE client_id = ${clientId})
+ OR EXISTS (SELECT 1 FROM oauth_codes WHERE client_id = ${clientId}) AS held`;
+ return row?.held === true;
+}
+
+/**
+ * #6202: the first owner consent of a self-registered client, run in the
+ * caller's transaction beside the authorization-code insert. Always persists:
+ * the revision moves 0 → 1 with an `action='consent'` audit row even when the
+ * source is unchanged, so the client is never offered the choice again and a
+ * second pending request fails its policy check. A new `sourceId` lands in
+ * `source_id` + `federated_read` and is validated against active sources;
+ * nothing else in the grant changes.
+ */
+export async function recordFirstConsentInTransaction(db: GrantDatabase, clientId: string, sourceId: string | undefined, actor: string): Promise<GrantMutationResult> {
+ const sql = query(db);
+ const rows = await sql`SELECT * FROM oauth_clients WHERE client_id = ${clientId} FOR UPDATE`;
+ if (!rows.length) throw new GrantError('client_not_found', `No OAuth client found with id "${clientId}"`);
+ if (!('grant_revision' in rows[0]) || !('takes_holders' in rows[0])) throw new GrantError('grant_schema_required', 'Run gbrain apply-migrations --yes before changing client grants');
+ const before = grantFromRow(rows[0]);
+ if (before.revision !== 0) throw new GrantError('grant_conflict', `Grant changed (expected revision 0, current ${before.revision}); review a fresh request`);
+ if (await clientHoldsAuthorization(sql, clientId)) throw new GrantError('grant_conflict', 'The client already holds an authorization; review a fresh request');
+ const after: ClientGrant = { ...before, revision: 1 };
+ if (sourceId !== undefined && sourceId !== before.sourceId) {
+ Object.assign(after, { sourceId, federatedRead: [sourceId], sourcesNone: false });
+ validateClientGrant(after, await grantValidationContext(db));
+ }
+ await persistGrant(sql, before, after, actor, 'consent');
+ return { before, after, revision: 1, dryRun: false };
+}
+
/** One UPDATE+audit statement: SQL-only provider callers get atomicity too. */
export async function persistGrant(sql: SqlQuery, before: ClientGrant, after: ClientGrant, actor: string, action: string): Promise<void> {
const result = await sql`
diff --git a/src/core/oauth-grants.ts b/src/core/oauth-grants.ts
index 1c87ceaf28..d7103e0fb8 100644
--- a/src/core/oauth-grants.ts
+++ b/src/core/oauth-grants.ts
@@ -9,6 +9,7 @@ import { generateToken, hashToken } from './utils.ts';
import { hasScope, parseScopeString } from './scope.ts';
import { TOKEN_TTL_MAX_SECONDS, intersectGrantedScopes } from './grants/model.ts';
import { safeHexEqual } from './timing-safe.ts';
+import { clientHoldsAuthorization, GrantError, recordFirstConsentInTransaction } from './grants/service.ts';
export type OAuthTransaction = <T>(fn: (sql: SqlQuery) => Promise<T>) => Promise<T>;
type ClientRow = Record<string, unknown>;
@@ -59,7 +60,7 @@ function policyDigest(row: ClientRow): string {
'source_id', 'federated_read', 'bound_tools', 'bound_source_id', 'bound_brain_id',
'bound_slug_prefixes', 'bound_max_concurrent', 'budget_usd_per_day', 'surface', 'token_ttl',
'allowed_operations', 'delegated_slug_prefixes', 'delegated_namespace', 'grant_profile',
- 'grant_revision', 'grant_repair_reasons'];
+ 'grant_revision', 'grant_repair_reasons', 'registered_via'];
return hashToken(JSON.stringify(fields.map(field => row[field] ?? null)));
}
@@ -78,6 +79,12 @@ export interface OAuthConsentDetails {
delegatedSlugPrefixes: string[] | null;
delegatedNamespace: string | null;
expiresAt: number;
+ /**
+ * #6202: `editable` only for a self-registered client's first consent
+ * (`registered_via='dcr'`, revision 0, no `client_credentials`, a source
+ * grant); `options` are the active sources then, `[]` otherwise.
+ */
+ sourceChoice: { editable: boolean; options: Array<{ id: string; name: string }> };
}
interface PendingAuthorization {
details: OAuthConsentDetails;
@@ -158,6 +165,12 @@ export class OAuthGrants {
if (!Array.isArray(row.redirect_uris) || !row.redirect_uris.some(uri => typeof uri === 'string' && redirectUriMatches(params.redirectUri, uri))) {
throw new InvalidRequestError('Redirect URI does not match registered client');
}
+ const editable = row.registered_via === 'dcr' && Number(row.grant_revision) === 0
+ && !row.grant_types.includes('client_credentials') && row.source_grant !== 'none'
+ && !await clientHoldsAuthorization(this.options.sql, clientId);
+ const options = editable
+ ? (await this.options.sql`SELECT id, name FROM sources WHERE archived = false ORDER BY id`).map(r => ({ id: String(r.id), name: String(r.name) }))
+ : [];
// No await between the capacity check and insert: concurrent DB reads cannot overfill the store or a client's budget.
this.assertCapacity(clientId);
const id = generateToken('');
@@ -172,6 +185,7 @@ export class OAuthGrants {
delegatedSlugPrefixes: Array.isArray(row.delegated_slug_prefixes) ? [...row.delegated_slug_prefixes] as string[] : null,
delegatedNamespace: typeof row.delegated_namespace === 'string' ? row.delegated_namespace : null,
resource: resource?.toString() ?? null, expiresAt: this.now() + 10 * 60_000,
+ sourceChoice: { editable, options },
};
this.pending.set(id, {
details, params: { ...params, scopes: [...details.scopes], resource },
@@ -194,8 +208,12 @@ export class OAuthGrants {
try { this.details(id); return true; } catch { return false; }
}
- async decide(id: string, approve: boolean): Promise<string> {
- this.details(id);
+ async decide(id: string, approve: boolean, choice?: { sourceId: string }): Promise<string> {
+ const { sourceChoice } = this.details(id);
+ if (choice !== undefined && (!approve || !sourceChoice.editable || !sourceChoice.options.some(o => o.id === choice.sourceId))) {
+ // Refused before the claim: the request stays pending and the owner can reload it.
+ throw new OAuthConsentError(403, 'invalid_consent', 'Reload this request and review it again before approving.');
+ }
const pending = this.pending.get(id)!;
pending.status = 'processing'; // claim synchronously before the first await
const redirect = new URL(pending.params.redirectUri);
@@ -209,6 +227,15 @@ export class OAuthGrants {
const code = await this.locked(pending.details.clientId, async (sql, row) => {
if (pending.details.expiresAt <= this.now()) throw new OAuthConsentError(410, 'authorization_expired', 'This request expired. Restart the connection from your client.');
if (policyDigest(row) !== pending.policy) throw new OAuthConsentError(409, 'client_policy_changed', 'Client permissions changed. Restart the connection and review the new request.');
+ if (sourceChoice.editable) {
+ // The first consent always consumes eligibility (revision 0 → 1), with or without a new source.
+ try {
+ await recordFirstConsentInTransaction(sql, pending.details.clientId, choice?.sourceId, 'owner');
+ } catch (error) {
+ if (error instanceof GrantError) throw new OAuthConsentError(409, 'client_policy_changed', 'Client permissions changed. Restart the connection and review the new request.');
+ throw error;
+ }
+ }
const code = generateToken('gbrain_code_');
await sql`
INSERT INTO oauth_codes (code_hash, client_id, scopes, code_challenge,
diff --git a/src/core/oauth-provider.ts b/src/core/oauth-provider.ts
index 4c1ac5ae3f..4a8d0fe122 100644
--- a/src/core/oauth-provider.ts
+++ b/src/core/oauth-provider.ts
@@ -443,60 +443,81 @@ class GBrainClientsStore implements OAuthRegisteredClientsStore {
// == write scope). Operators who need narrower / wider scope rescope
// via the CLI later. Pre-v60/v61 brain falls through to the legacy
// projection (no source_id / federated_read column yet).
- try {
- await this.sql`
- INSERT INTO oauth_clients (client_id, client_secret_hash, client_name, redirect_uris,
- grant_types, scope, token_endpoint_auth_method,
- client_id_issued_at, source_id, federated_read)
- VALUES (${clientId}, ${secretHash}, ${client.client_name || 'unnamed'},
- ${pgArray((client.redirect_uris || []).map(String))},
- ${pgArray(grantTypes)},
- ${registeredScope}, ${authMethod},
- ${now}, ${'default'}, ${pgArray(['default'])})
- `;
- } catch (err) {
- if (isUndefinedColumnError(err, 'federated_read')) {
- try {
- await this.sql`
- INSERT INTO oauth_clients (client_id, client_secret_hash, client_name, redirect_uris,
- grant_types, scope, token_endpoint_auth_method,
- client_id_issued_at, source_id)
- VALUES (${clientId}, ${secretHash}, ${client.client_name || 'unnamed'},
- ${pgArray((client.redirect_uris || []).map(String))},
- ${pgArray(grantTypes)},
- ${registeredScope}, ${authMethod},
- ${now}, ${'default'})
- `;
- } catch (err2) {
- if (isUndefinedColumnError(err2, 'source_id')) {
+ // #6202: registered_via='dcr' marks the client as self-registered, so its
+ // owner picks its source at the first consent (OAuthGrants.begin). A brain
+ // without the column yet (new server before the migration) falls through to
+ // the unmarked ladder: the client keeps today's read-only consent.
+ const insertUnmarked = async (): Promise<void> => {
+ try {
+ await this.sql`
+ INSERT INTO oauth_clients (client_id, client_secret_hash, client_name, redirect_uris,
+ grant_types, scope, token_endpoint_auth_method,
+ client_id_issued_at, source_id, federated_read)
+ VALUES (${clientId}, ${secretHash}, ${client.client_name || 'unnamed'},
+ ${pgArray((client.redirect_uris || []).map(String))},
+ ${pgArray(grantTypes)},
+ ${registeredScope}, ${authMethod},
+ ${now}, ${'default'}, ${pgArray(['default'])})
+ `;
+ } catch (err) {
+ if (isUndefinedColumnError(err, 'federated_read')) {
+ try {
await this.sql`
INSERT INTO oauth_clients (client_id, client_secret_hash, client_name, redirect_uris,
grant_types, scope, token_endpoint_auth_method,
- client_id_issued_at)
+ client_id_issued_at, source_id)
VALUES (${clientId}, ${secretHash}, ${client.client_name || 'unnamed'},
${pgArray((client.redirect_uris || []).map(String))},
${pgArray(grantTypes)},
${registeredScope}, ${authMethod},
- ${now})
+ ${now}, ${'default'})
`;
- } else {
- throw err2;
+ } catch (err2) {
+ if (isUndefinedColumnError(err2, 'source_id')) {
+ await this.sql`
+ INSERT INTO oauth_clients (client_id, client_secret_hash, client_name, redirect_uris,
+ grant_types, scope, token_endpoint_auth_method,
+ client_id_issued_at)
+ VALUES (${clientId}, ${secretHash}, ${client.client_name || 'unnamed'},
+ ${pgArray((client.redirect_uris || []).map(String))},
+ ${pgArray(grantTypes)},
+ ${registeredScope}, ${authMethod},
+ ${now})
+ `;
+ } else {
+ throw err2;
+ }
}
+ } else if (isUndefinedColumnError(err, 'source_id')) {
+ await this.sql`
+ INSERT INTO oauth_clients (client_id, client_secret_hash, client_name, redirect_uris,
+ grant_types, scope, token_endpoint_auth_method,
+ client_id_issued_at)
+ VALUES (${clientId}, ${secretHash}, ${client.client_name || 'unnamed'},
+ ${pgArray((client.redirect_uris || []).map(String))},
+ ${pgArray(grantTypes)},
+ ${registeredScope}, ${authMethod},
+ ${now})
+ `;
+ } else {
+ throw err;
}
- } else if (isUndefinedColumnError(err, 'source_id')) {
- await this.sql`
- INSERT INTO oauth_clients (client_id, client_secret_hash, client_name, redirect_uris,
- grant_types, scope, token_endpoint_auth_method,
- client_id_issued_at)
- VALUES (${clientId}, ${secretHash}, ${client.client_name || 'unnamed'},
- ${pgArray((client.redirect_uris || []).map(String))},
- ${pgArray(grantTypes)},
- ${registeredScope}, ${authMethod},
- ${now})
- `;
- } else {
- throw err;
}
+ };
+ try {
+ await this.sql`
+ INSERT INTO oauth_clients (client_id, client_secret_hash, client_name, redirect_uris,
+ grant_types, scope, token_endpoint_auth_method,
+ client_id_issued_at, source_id, federated_read, registered_via)
+ VALUES (${clientId}, ${secretHash}, ${client.client_name || 'unnamed'},
+ ${pgArray((client.redirect_uris || []).map(String))},
+ ${pgArray(grantTypes)},
+ ${registeredScope}, ${authMethod},
+ ${now}, ${'default'}, ${pgArray(['default'])}, ${'dcr'})
+ `;
+ } catch (err) {
+ if (!isUndefinedColumnError(err, 'registered_via')) throw err;
+ await insertUnmarked();
}
// #2179: optional `token_ttl_seconds` hint from the DCR request body,
diff --git a/src/core/schema-migrations/latest.generated.ts b/src/core/schema-migrations/latest.generated.ts
index ed00b02841..7cdcfafcf0 100644
--- a/src/core/schema-migrations/latest.generated.ts
+++ b/src/core/schema-migrations/latest.generated.ts
@@ -4,4 +4,4 @@
// The highest schema migration version (migrate.ts LATEST_VERSION), importable without
// loading the migrations themselves.
-export const LATEST_SCHEMA_VERSION = 232;
+export const LATEST_SCHEMA_VERSION = 233;
diff --git a/src/core/schema-migrations/registry.generated.ts b/src/core/schema-migrations/registry.generated.ts
index 5a9b7cf87c..66df0323fc 100644
--- a/src/core/schema-migrations/registry.generated.ts
+++ b/src/core/schema-migrations/registry.generated.ts
@@ -233,6 +233,7 @@ import { v229 } from './v229-trust-allow-rules.ts';
import { v230 } from './v230-trust-generation.ts';
import { v231 } from './v231-fact-purge-lookup-indexes.ts';
import { v232 } from './v232-fts-cjk-boundary.ts';
+import { v233 } from './v233-oauth-client-registered-via.ts';
// Array order is historical (see HISTORICAL_ARRAY_ORDER in the generator); the
// runner sorts by version before applying.
@@ -464,4 +465,5 @@ export const MIGRATIONS: Migration[] = [
v230,
v231,
v232,
+ v233,
];
diff --git a/src/core/schema-migrations/v233-oauth-client-registered-via.ts b/src/core/schema-migrations/v233-oauth-client-registered-via.ts
new file mode 100644
index 0000000000..ac4b0b6d2d
--- /dev/null
+++ b/src/core/schema-migrations/v233-oauth-client-registered-via.ts
@@ -0,0 +1,18 @@
+import type { Migration } from './types.ts';
+
+// #6202: marks self-registered (DCR) OAuth clients so the owner can pick the
+// client's source at its first consent. NULL for operator-registered clients
+// and for every row that exists before this migration, so those keep today's
+// read-only consent. No index and no backfill: only new DCR registrations
+// write 'dcr'. Migration-only like min_trust (trust-tiers): fresh installs get
+// the column from this migration too, so an upgraded brain and a fresh one end
+// with the same column order.
+export const v233: Migration = {
+ version: 233,
+ name: 'oauth_client_registered_via',
+ idempotent: true,
+ sql: `
+ ALTER TABLE oauth_clients ADD COLUMN IF NOT EXISTS registered_via TEXT
+ CHECK (registered_via IN ('dcr'));
+ `,
+};
diff --git a/test/e2e/oauth-client-registered-via-postgres.test.ts b/test/e2e/oauth-client-registered-via-postgres.test.ts
new file mode 100644
index 0000000000..e416c190b0
--- /dev/null
+++ b/test/e2e/oauth-client-registered-via-postgres.test.ts
@@ -0,0 +1,101 @@
+/**
+ * #6202 migration ladder for `oauth_clients.registered_via`, Postgres arm (the
+ * PGLite arm is test/oauth-client-registered-via-migration.test.ts; run this
+ * file with DATABASE_URL pointed at a transaction-mode PgBouncer for the pooled
+ * route):
+ * fresh bootstrap, rows that exist before the migration stay NULL (read-only
+ * consent), a repeated migration is a no-op, an old server's insert after the
+ * migration stays NULL, and a new server before the migration still registers
+ * DCR clients through the undefined-column fallback with no picker.
+ *
+ * Gated by DATABASE_URL; skips without a real Postgres.
+ */
+import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
+import type { BrainEngine } from '../../src/core/engine.ts';
+import { GBrainOAuthProvider } from '../../src/core/oauth-provider.ts';
+import { MIGRATIONS } from '../../src/core/migrate.ts';
+import { sqlQueryForEngine } from '../../src/core/sql-query.ts';
+import { TEST_PKCE_CHALLENGE } from '../helpers/oauth.ts';
+import { hasDatabase, setupDB, teardownDB } from './helpers.ts';
+
+const REDIRECT = 'https://dcr-client.example.com/callback';
+const migration = MIGRATIONS.find(m => m.name === 'oauth_client_registered_via')!;
+
+const describePg = hasDatabase() ? describe : describe.skip;
+let engine: BrainEngine;
+let provider: GBrainOAuthProvider;
+
+beforeAll(async () => {
+ if (!hasDatabase()) return;
+ engine = await setupDB();
+ await engine.executeRaw(`DELETE FROM oauth_clients WHERE client_id IN ('constraint-example', 'pre-migration-example', 'old-server-after-example')`);
+ provider = new GBrainOAuthProvider({
+ sql: sqlQueryForEngine(engine),
+ transaction: fn => engine.transaction(tx => fn(sqlQueryForEngine(tx))),
+ });
+}, 60_000);
+afterAll(async () => { if (hasDatabase()) await teardownDB(); }, 15_000);
+
+const registerDcr = async () => (await provider.clientsStore.registerClient!({
+ client_name: 'ladder-example', redirect_uris: [REDIRECT], grant_types: ['authorization_code'], scope: 'read', token_endpoint_auth_method: 'none',
+} as never)).client_id;
+const marker = async (clientId: string) => (await engine.executeRaw<{ registered_via?: string | null }>(
+ 'SELECT * FROM oauth_clients WHERE client_id = $1', [clientId]))[0]!.registered_via;
+const editable = async (clientId: string) => provider.grants.details(await provider.grants.begin(clientId, {
+ codeChallenge: TEST_PKCE_CHALLENGE, redirectUri: REDIRECT, scopes: ['read'],
+})).sourceChoice.editable;
+const hasColumn = async () => (await engine.executeRaw(
+ `SELECT 1 FROM information_schema.columns WHERE table_schema = current_schema() AND table_name = 'oauth_clients' AND column_name = 'registered_via'`)).length === 1;
+const oldServerInsert = (clientId: string) => engine.executeRaw(
+ `INSERT INTO oauth_clients (client_id, client_name, redirect_uris, grant_types, scope, token_endpoint_auth_method, client_id_issued_at, source_id, federated_read)
+ VALUES ($1, 'old-server-example', ARRAY[$2], ARRAY['authorization_code'], 'read', 'none', 0, 'default', ARRAY['default'])`, [clientId, REDIRECT]);
+
+describePg('oauth_client_registered_via migration on Postgres (#6202)', () => {
+ test('is registered, idempotent, and constrains the value to dcr', async () => {
+ expect(migration).toBeDefined();
+ expect(migration.idempotent).toBe(true);
+ expect(await hasColumn()).toBe(true);
+ await oldServerInsert('constraint-example');
+ await expect(engine.executeRaw(`UPDATE oauth_clients SET registered_via = 'operator' WHERE client_id = 'constraint-example'`)).rejects.toThrow();
+ });
+
+ test('fresh bootstrap: a DCR registration is marked and its first consent is editable', async () => {
+ const clientId = await registerDcr();
+ expect(await marker(clientId)).toBe('dcr');
+ expect(await editable(clientId)).toBe(true);
+ });
+
+ test('new server before the migration: DCR falls back to the unmarked insert and consent stays read-only', async () => {
+ await engine.executeRaw('ALTER TABLE oauth_clients DROP COLUMN registered_via');
+ try {
+ const clientId = await registerDcr();
+ expect(await marker(clientId)).toBeUndefined();
+ expect(await editable(clientId)).toBe(false);
+ await oldServerInsert('pre-migration-example');
+ } finally {
+ await engine.executeRaw(migration.sql);
+ }
+ expect(await hasColumn()).toBe(true);
+ });
+
+ test('rows from before the migration stay NULL and read-only; a repeat run changes nothing', async () => {
+ expect(await marker('pre-migration-example')).toBeNull();
+ expect(await editable('pre-migration-example')).toBe(false);
+ await engine.executeRaw(migration.sql);
+ expect(await marker('pre-migration-example')).toBeNull();
+ });
+
+ test('the runner applies it on an upgraded brain whose version predates it', async () => {
+ await engine.executeRaw('ALTER TABLE oauth_clients DROP COLUMN registered_via');
+ await engine.setConfig('version', String(migration.version - 1));
+ await engine.initSchema();
+ expect(await hasColumn()).toBe(true);
+ expect(Number(await engine.getConfig('version'))).toBeGreaterThanOrEqual(migration.version);
+ });
+
+ test('an old server inserting after the migration leaves the marker NULL, so consent is read-only', async () => {
+ await oldServerInsert('old-server-after-example');
+ expect(await marker('old-server-after-example')).toBeNull();
+ expect(await editable('old-server-after-example')).toBe(false);
+ });
+});
diff --git a/test/e2e/oauth-owner-consent-source-postgres.test.ts b/test/e2e/oauth-owner-consent-source-postgres.test.ts
new file mode 100644
index 0000000000..c8131619f9
--- /dev/null
+++ b/test/e2e/oauth-owner-consent-source-postgres.test.ts
@@ -0,0 +1,78 @@
+/**
+ * #6202 Postgres arm of the first-consent source choice (the PGLite matrix is
+ * in test/oauth-owner-consent.test.ts): a chosen source and the consent audit
+ * commit with the code in one locked transaction, an unchanged approval still
+ * consumes eligibility, and a source archived after review fails closed.
+ *
+ * Gated by DATABASE_URL; skips without a real Postgres.
+ */
+import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
+import type { BrainEngine } from '../../src/core/engine.ts';
+import { GBrainOAuthProvider } from '../../src/core/oauth-provider.ts';
+import { sqlQueryForEngine } from '../../src/core/sql-query.ts';
+import { TEST_PKCE_CHALLENGE } from '../helpers/oauth.ts';
+import { hasDatabase, setupDB, teardownDB } from './helpers.ts';
+
+const describePg = hasDatabase() ? describe : describe.skip;
+const REDIRECT = 'https://dcr-client.example.com/callback';
+
+describePg('first-consent source choice on Postgres (#6202)', () => {
+ let engine: BrainEngine;
+ let provider: GBrainOAuthProvider;
+
+ beforeAll(async () => {
+ engine = await setupDB();
+ await engine.executeRaw(`DELETE FROM oauth_clients WHERE client_name = 'pg-consent-example'`);
+ await engine.executeRaw(`INSERT INTO sources (id, name) VALUES ('wiki-6202', 'wiki-6202'), ('gone-6202', 'gone-6202') ON CONFLICT (id) DO UPDATE SET archived = false`);
+ provider = new GBrainOAuthProvider({
+ sql: sqlQueryForEngine(engine),
+ transaction: fn => engine.transaction(tx => fn(sqlQueryForEngine(tx))),
+ });
+ }, 60_000);
+ afterAll(async () => {
+ // setupDB's fixture reset deletes sources; clients pointing at ours would block it.
+ await engine.executeRaw(`DELETE FROM oauth_clients WHERE client_name = 'pg-consent-example'`);
+ await teardownDB();
+ }, 15_000);
+
+ const registerDcr = async () => (await provider.clientsStore.registerClient!({
+ client_name: 'pg-consent-example', redirect_uris: [REDIRECT], grant_types: ['authorization_code'], scope: 'read write', token_endpoint_auth_method: 'none',
+ } as never)).client_id;
+ const beginFor = (clientId: string) => provider.grants.begin(clientId, { codeChallenge: TEST_PKCE_CHALLENGE, redirectUri: REDIRECT, scopes: ['read'] });
+ const row = async (clientId: string) => (await engine.executeRaw<Record<string, unknown>>(
+ 'SELECT source_id, federated_read, grant_revision, registered_via FROM oauth_clients WHERE client_id = $1', [clientId]))[0]!;
+ const consentAudits = (clientId: string) => engine.executeRaw(`SELECT 1 FROM oauth_grant_audit WHERE client_id = $1 AND action = 'consent' AND actor = 'owner'`, [clientId]);
+ const codes = (clientId: string) => engine.executeRaw('SELECT 1 FROM oauth_codes WHERE client_id = $1', [clientId]);
+
+ test('a chosen source, its consent audit and the code commit together', async () => {
+ const clientId = await registerDcr();
+ expect((await row(clientId)).registered_via).toBe('dcr');
+ const id = await beginFor(clientId);
+ expect(provider.grants.details(id).sourceChoice.options.map(o => o.id)).toContain('wiki-6202');
+ await provider.grants.decide(id, true, { sourceId: 'wiki-6202' });
+ expect(await row(clientId)).toMatchObject({ source_id: 'wiki-6202', federated_read: ['wiki-6202'], grant_revision: 1 });
+ expect(await consentAudits(clientId)).toHaveLength(1);
+ expect(await codes(clientId)).toHaveLength(1);
+ });
+
+ test('an unchanged approval consumes eligibility and a second pending request fails', async () => {
+ const clientId = await registerDcr();
+ const first = await beginFor(clientId);
+ const second = await beginFor(clientId);
+ await provider.grants.decide(first, true);
+ expect(await row(clientId)).toMatchObject({ source_id: 'default', grant_revision: 1 });
+ await expect(provider.grants.decide(second, true)).rejects.toMatchObject({ status: 409 });
+ expect(provider.grants.details(await beginFor(clientId)).sourceChoice.editable).toBe(false);
+ expect(await codes(clientId)).toHaveLength(1);
+ });
+
+ test('a source archived after review fails 409 with nothing committed', async () => {
+ const clientId = await registerDcr();
+ const id = await beginFor(clientId);
+ await engine.executeRaw(`UPDATE sources SET archived = true WHERE id = 'gone-6202'`);
+ await expect(provider.grants.decide(id, true, { sourceId: 'gone-6202' })).rejects.toMatchObject({ status: 409, code: 'client_policy_changed' });
+ expect(await row(clientId)).toMatchObject({ source_id: 'default', grant_revision: 0 });
+ expect(await consentAudits(clientId)).toHaveLength(0);
+ expect(await codes(clientId)).toHaveLength(0);
+ });
+});
diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-default.json b/test/fixtures/goldens/catalog/pglite-engine-init-default.json
index be574249f8..b0a9cf166b 100644
--- a/test/fixtures/goldens/catalog/pglite-engine-init-default.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-default.json
@@ -182,6 +182,7 @@
"oauth_clients.oauth_clients_complete_agent_grant": "c CHECK (((NOT (COALESCE(scope, ''::text) ~ '(^|[[:space:]])agent([[:space:]]|$)'::text)) OR ((COALESCE(cardinality(bound_tools), 0) > 0) AND (source_id IS NOT NULL) AND (bound_source_id IS NOT NULL) AND (bound_source_id = source_id) AND COALESCE((source_id = ANY (federated_read)), false) AND (((delegated_namespace = 'job'::text) AND (delegated_slug_prefixes IS NULL)) OR ((delegated_namespace = 'prefixes'::text) AND (COALESCE(cardinality(delegated_slug_prefixes), 0) > 0))) AND (bound_max_concurrent > 0))))",
"oauth_clients.oauth_clients_min_trust_check": "c CHECK (((min_trust IS NULL) OR (min_trust = ANY (ARRAY['user_confirmed'::text, 'operator_curated'::text, 'tool_observed'::text, 'agent_written'::text, 'unknown'::text, 'external_untrusted'::text]))))",
"oauth_clients.oauth_clients_pkey": "p PRIMARY KEY (client_id)",
+ "oauth_clients.oauth_clients_registered_via_check": "c CHECK ((registered_via = 'dcr'::text))",
"oauth_clients.oauth_clients_source_grant_check": "c CHECK ((source_grant = 'none'::text))",
"oauth_clients.oauth_clients_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE RESTRICT",
"oauth_clients.trust_generation_update": "t TRIGGER DEFERRABLE INITIALLY DEFERRED",
@@ -2391,7 +2392,8 @@
"28 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",
"29 source_grant text/text NULL",
"30 takes_holders ARRAY/_text NULL",
- "31 min_trust text/text NULL"
+ "31 min_trust text/text NULL",
+ "32 registered_via text/text NULL"
],
"flags": "relkind=r rls=true force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
index f60716e308..9494b3a13d 100644
--- a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json
@@ -182,6 +182,7 @@
"oauth_clients.oauth_clients_complete_agent_grant": "c CHECK (((NOT (COALESCE(scope, ''::text) ~ '(^|[[:space:]])agent([[:space:]]|$)'::text)) OR ((COALESCE(cardinality(bound_tools), 0) > 0) AND (source_id IS NOT NULL) AND (bound_source_id IS NOT NULL) AND (bound_source_id = source_id) AND COALESCE((source_id = ANY (federated_read)), false) AND (((delegated_namespace = 'job'::text) AND (delegated_slug_prefixes IS NULL)) OR ((delegated_namespace = 'prefixes'::text) AND (COALESCE(cardinality(delegated_slug_prefixes), 0) > 0))) AND (bound_max_concurrent > 0))))",
"oauth_clients.oauth_clients_min_trust_check": "c CHECK (((min_trust IS NULL) OR (min_trust = ANY (ARRAY['user_confirmed'::text, 'operator_curated'::text, 'tool_observed'::text, 'agent_written'::text, 'unknown'::text, 'external_untrusted'::text]))))",
"oauth_clients.oauth_clients_pkey": "p PRIMARY KEY (client_id)",
+ "oauth_clients.oauth_clients_registered_via_check": "c CHECK ((registered_via = 'dcr'::text))",
"oauth_clients.oauth_clients_source_grant_check": "c CHECK ((source_grant = 'none'::text))",
"oauth_clients.oauth_clients_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE RESTRICT",
"oauth_clients.trust_generation_update": "t TRIGGER DEFERRABLE INITIALLY DEFERRED",
@@ -2391,7 +2392,8 @@
"28 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",
"29 source_grant text/text NULL",
"30 takes_holders ARRAY/_text NULL",
- "31 min_trust text/text NULL"
+ "31 min_trust text/text NULL",
+ "32 registered_via text/text NULL"
],
"flags": "relkind=r rls=true force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
index aafc143bd8..fea4d4b00c 100644
--- a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
+++ b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json
@@ -182,6 +182,7 @@
"oauth_clients.oauth_clients_complete_agent_grant": "c CHECK (((NOT (COALESCE(scope, ''::text) ~ '(^|[[:space:]])agent([[:space:]]|$)'::text)) OR ((COALESCE(cardinality(bound_tools), 0) > 0) AND (source_id IS NOT NULL) AND (bound_source_id IS NOT NULL) AND (bound_source_id = source_id) AND COALESCE((source_id = ANY (federated_read)), false) AND (((delegated_namespace = 'job'::text) AND (delegated_slug_prefixes IS NULL)) OR ((delegated_namespace = 'prefixes'::text) AND (COALESCE(cardinality(delegated_slug_prefixes), 0) > 0))) AND (bound_max_concurrent > 0))))",
"oauth_clients.oauth_clients_min_trust_check": "c CHECK (((min_trust IS NULL) OR (min_trust = ANY (ARRAY['user_confirmed'::text, 'operator_curated'::text, 'tool_observed'::text, 'agent_written'::text, 'unknown'::text, 'external_untrusted'::text]))))",
"oauth_clients.oauth_clients_pkey": "p PRIMARY KEY (client_id)",
+ "oauth_clients.oauth_clients_registered_via_check": "c CHECK ((registered_via = 'dcr'::text))",
"oauth_clients.oauth_clients_source_grant_check": "c CHECK ((source_grant = 'none'::text))",
"oauth_clients.oauth_clients_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE RESTRICT",
"oauth_clients.trust_generation_update": "t TRIGGER DEFERRABLE INITIALLY DEFERRED",
@@ -2387,7 +2388,8 @@
"28 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",
"29 source_grant text/text NULL",
"30 takes_holders ARRAY/_text NULL",
- "31 min_trust text/text NULL"
+ "31 min_trust text/text NULL",
+ "32 registered_via text/text NULL"
],
"flags": "relkind=r rls=true force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-default.json b/test/fixtures/goldens/catalog/postgres-engine-init-default.json
index a036eba3de..066e1dca0b 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-default.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-default.json
@@ -186,6 +186,7 @@
"oauth_clients.oauth_clients_complete_agent_grant": "c CHECK (((NOT (COALESCE(scope, ''::text) ~ '(^|[[:space:]])agent([[:space:]]|$)'::text)) OR ((COALESCE(cardinality(bound_tools), 0) > 0) AND (source_id IS NOT NULL) AND (bound_source_id IS NOT NULL) AND (bound_source_id = source_id) AND COALESCE((source_id = ANY (federated_read)), false) AND (((delegated_namespace = 'job'::text) AND (delegated_slug_prefixes IS NULL)) OR ((delegated_namespace = 'prefixes'::text) AND (COALESCE(cardinality(delegated_slug_prefixes), 0) > 0))) AND (bound_max_concurrent > 0))))",
"oauth_clients.oauth_clients_min_trust_check": "c CHECK (((min_trust IS NULL) OR (min_trust = ANY (ARRAY['user_confirmed'::text, 'operator_curated'::text, 'tool_observed'::text, 'agent_written'::text, 'unknown'::text, 'external_untrusted'::text]))))",
"oauth_clients.oauth_clients_pkey": "p PRIMARY KEY (client_id)",
+ "oauth_clients.oauth_clients_registered_via_check": "c CHECK ((registered_via = 'dcr'::text))",
"oauth_clients.oauth_clients_source_grant_check": "c CHECK ((source_grant = 'none'::text))",
"oauth_clients.oauth_clients_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE RESTRICT",
"oauth_clients.trust_generation_update": "t TRIGGER DEFERRABLE INITIALLY DEFERRED",
@@ -2403,7 +2404,8 @@
"28 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",
"29 source_grant text/text NULL",
"30 takes_holders ARRAY/_text NULL",
- "31 min_trust text/text NULL"
+ "31 min_trust text/text NULL",
+ "32 registered_via text/text NULL"
],
"flags": "relkind=r rls=true force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
index 8754d0d6ec..db0b6abc6a 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-fts-portuguese.json
@@ -186,6 +186,7 @@
"oauth_clients.oauth_clients_complete_agent_grant": "c CHECK (((NOT (COALESCE(scope, ''::text) ~ '(^|[[:space:]])agent([[:space:]]|$)'::text)) OR ((COALESCE(cardinality(bound_tools), 0) > 0) AND (source_id IS NOT NULL) AND (bound_source_id IS NOT NULL) AND (bound_source_id = source_id) AND COALESCE((source_id = ANY (federated_read)), false) AND (((delegated_namespace = 'job'::text) AND (delegated_slug_prefixes IS NULL)) OR ((delegated_namespace = 'prefixes'::text) AND (COALESCE(cardinality(delegated_slug_prefixes), 0) > 0))) AND (bound_max_concurrent > 0))))",
"oauth_clients.oauth_clients_min_trust_check": "c CHECK (((min_trust IS NULL) OR (min_trust = ANY (ARRAY['user_confirmed'::text, 'operator_curated'::text, 'tool_observed'::text, 'agent_written'::text, 'unknown'::text, 'external_untrusted'::text]))))",
"oauth_clients.oauth_clients_pkey": "p PRIMARY KEY (client_id)",
+ "oauth_clients.oauth_clients_registered_via_check": "c CHECK ((registered_via = 'dcr'::text))",
"oauth_clients.oauth_clients_source_grant_check": "c CHECK ((source_grant = 'none'::text))",
"oauth_clients.oauth_clients_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE RESTRICT",
"oauth_clients.trust_generation_update": "t TRIGGER DEFERRABLE INITIALLY DEFERRED",
@@ -2403,7 +2404,8 @@
"28 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",
"29 source_grant text/text NULL",
"30 takes_holders ARRAY/_text NULL",
- "31 min_trust text/text NULL"
+ "31 min_trust text/text NULL",
+ "32 registered_via text/text NULL"
],
"flags": "relkind=r rls=true force_rls=false"
},
diff --git a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
index 2c3867a7cc..2180f19394 100644
--- a/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
+++ b/test/fixtures/goldens/catalog/postgres-engine-init-high-dims.json
@@ -186,6 +186,7 @@
"oauth_clients.oauth_clients_complete_agent_grant": "c CHECK (((NOT (COALESCE(scope, ''::text) ~ '(^|[[:space:]])agent([[:space:]]|$)'::text)) OR ((COALESCE(cardinality(bound_tools), 0) > 0) AND (source_id IS NOT NULL) AND (bound_source_id IS NOT NULL) AND (bound_source_id = source_id) AND COALESCE((source_id = ANY (federated_read)), false) AND (((delegated_namespace = 'job'::text) AND (delegated_slug_prefixes IS NULL)) OR ((delegated_namespace = 'prefixes'::text) AND (COALESCE(cardinality(delegated_slug_prefixes), 0) > 0))) AND (bound_max_concurrent > 0))))",
"oauth_clients.oauth_clients_min_trust_check": "c CHECK (((min_trust IS NULL) OR (min_trust = ANY (ARRAY['user_confirmed'::text, 'operator_curated'::text, 'tool_observed'::text, 'agent_written'::text, 'unknown'::text, 'external_untrusted'::text]))))",
"oauth_clients.oauth_clients_pkey": "p PRIMARY KEY (client_id)",
+ "oauth_clients.oauth_clients_registered_via_check": "c CHECK ((registered_via = 'dcr'::text))",
"oauth_clients.oauth_clients_source_grant_check": "c CHECK ((source_grant = 'none'::text))",
"oauth_clients.oauth_clients_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE RESTRICT",
"oauth_clients.trust_generation_update": "t TRIGGER DEFERRABLE INITIALLY DEFERRED",
@@ -2399,7 +2400,8 @@
"28 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",
"29 source_grant text/text NULL",
"30 takes_holders ARRAY/_text NULL",
- "31 min_trust text/text NULL"
+ "31 min_trust text/text NULL",
+ "32 registered_via text/text NULL"
],
"flags": "relkind=r rls=true force_rls=false"
},
diff --git a/test/fixtures/goldens/migrations/records.json b/test/fixtures/goldens/migrations/records.json
index 44d397114f..43cd4df52e 100644
--- a/test/fixtures/goldens/migrations/records.json
+++ b/test/fixtures/goldens/migrations/records.json
@@ -1,6 +1,6 @@
{
"golden": {
- "count": 227,
+ "count": 228,
"gaps": [
17,
18,
@@ -49,7 +49,7 @@
"sqlQueryForEngine": "71fb1ccec1b22cdc1662876dbd8c17ed81e9ab83485c6965cdf5caa4fc4a4ab5",
"verifyProjectionStatistics": "0d231b04ecfbc5a4109d6fca9567bf4e8c9e9db6c3fbbb35212e026579ed6f67"
},
- "latest": 232,
+ "latest": 233,
"records": [
{
"handler": {
@@ -3492,6 +3492,19 @@
"transaction": "absent",
"verify": "absent",
"version": 232
+ },
+ {
+ "handler": "absent",
+ "idempotent": true,
+ "name": "oauth_client_registered_via",
+ "sql": {
+ "length": 119,
+ "sha256": "13fc89cb57e1c37195c776b832dbec7c5180b0be8a6e881406fe3280b09c066c"
+ },
+ "sqlFor": "absent",
+ "transaction": "absent",
+ "verify": "absent",
+ "version": 233
}
],
"versions": [
@@ -3721,7 +3734,8 @@
229,
230,
231,
- 232
+ 232,
+ 233
]
},
"normalizer": "migrations-record-v1"
diff --git a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
index 5fe5498a66..7465ad4854 100644
--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json
@@ -182,6 +182,7 @@
"oauth_clients.oauth_clients_complete_agent_grant": "c CHECK (((NOT (COALESCE(scope, ''::text) ~ '(^|[[:space:]])agent([[:space:]]|$)'::text)) OR ((COALESCE(cardinality(bound_tools), 0) > 0) AND (source_id IS NOT NULL) AND (bound_source_id IS NOT NULL) AND (bound_source_id = source_id) AND COALESCE((source_id = ANY (federated_read)), false) AND (((delegated_namespace = 'job'::text) AND (delegated_slug_prefixes IS NULL)) OR ((delegated_namespace = 'prefixes'::text) AND (COALESCE(cardinality(delegated_slug_prefixes), 0) > 0))) AND (bound_max_concurrent > 0))))",
"oauth_clients.oauth_clients_min_trust_check": "c CHECK (((min_trust IS NULL) OR (min_trust = ANY (ARRAY['user_confirmed'::text, 'operator_curated'::text, 'tool_observed'::text, 'agent_written'::text, 'unknown'::text, 'external_untrusted'::text]))))",
"oauth_clients.oauth_clients_pkey": "p PRIMARY KEY (client_id)",
+ "oauth_clients.oauth_clients_registered_via_check": "c CHECK ((registered_via = 'dcr'::text))",
"oauth_clients.oauth_clients_source_grant_check": "c CHECK ((source_grant = 'none'::text))",
"oauth_clients.oauth_clients_source_id_fkey": "f FOREIGN KEY (source_id) REFERENCES sources(id) ON DELETE RESTRICT",
"oauth_clients.trust_generation_update": "t TRIGGER DEFERRABLE INITIALLY DEFERRED",
@@ -2391,7 +2392,8 @@
"28 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",
"29 source_grant text/text NULL",
"30 takes_holders ARRAY/_text NULL",
- "31 min_trust text/text NULL"
+ "31 min_trust text/text NULL",
+ "32 registered_via text/text NULL"
],
"flags": "relkind=r rls=true force_rls=false"
},
diff --git a/test/oauth-client-registered-via-migration.test.ts b/test/oauth-client-registered-via-migration.test.ts
new file mode 100644
index 0000000000..520da9a6d9
--- /dev/null
+++ b/test/oauth-client-registered-via-migration.test.ts
@@ -0,0 +1,97 @@
+/**
+ * #6202 migration ladder for `oauth_clients.registered_via` (PGLite; the
+ * Postgres arm is test/e2e/oauth-client-registered-via-postgres.test.ts):
+ * fresh bootstrap, rows that exist before the migration stay NULL (read-only
+ * consent), a repeated migration is a no-op, an old server's insert after the
+ * migration stays NULL, and a new server before the migration still registers
+ * DCR clients through the undefined-column fallback with no picker.
+ *
+ * R3/R4: one engine per describe in beforeAll, disconnect in afterAll.
+ */
+import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
+import { PGLiteEngine } from '../src/core/pglite-engine.ts';
+import { GBrainOAuthProvider } from '../src/core/oauth-provider.ts';
+import { MIGRATIONS } from '../src/core/migrate.ts';
+import { sqlQueryForEngine } from '../src/core/sql-query.ts';
+import { TEST_PKCE_CHALLENGE } from './helpers/oauth.ts';
+
+const REDIRECT = 'https://dcr-client.example.com/callback';
+const migration = MIGRATIONS.find(m => m.name === 'oauth_client_registered_via')!;
+
+let engine: PGLiteEngine;
+let provider: GBrainOAuthProvider;
+
+beforeAll(async () => {
+ engine = new PGLiteEngine();
+ await engine.connect({});
+ await engine.initSchema();
+ provider = new GBrainOAuthProvider({
+ sql: sqlQueryForEngine(engine),
+ transaction: fn => engine.transaction(tx => fn(sqlQueryForEngine(tx))),
+ });
+}, 60_000);
+afterAll(async () => { await engine?.disconnect(); }, 15_000);
+
+const registerDcr = async () => (await provider.clientsStore.registerClient!({
+ client_name: 'ladder-example', redirect_uris: [REDIRECT], grant_types: ['authorization_code'], scope: 'read', token_endpoint_auth_method: 'none',
+} as never)).client_id;
+const marker = async (clientId: string) => (await engine.executeRaw<{ registered_via?: string | null }>(
+ 'SELECT * FROM oauth_clients WHERE client_id = $1', [clientId]))[0]!.registered_via;
+const editable = async (clientId: string) => provider.grants.details(await provider.grants.begin(clientId, {
+ codeChallenge: TEST_PKCE_CHALLENGE, redirectUri: REDIRECT, scopes: ['read'],
+})).sourceChoice.editable;
+const hasColumn = async () => (await engine.executeRaw(
+ `SELECT 1 FROM information_schema.columns WHERE table_name = 'oauth_clients' AND column_name = 'registered_via'`)).length === 1;
+const oldServerInsert = (clientId: string) => engine.executeRaw(
+ `INSERT INTO oauth_clients (client_id, client_name, redirect_uris, grant_types, scope, token_endpoint_auth_method, client_id_issued_at, source_id, federated_read)
+ VALUES ($1, 'old-server-example', ARRAY[$2], ARRAY['authorization_code'], 'read', 'none', 0, 'default', ARRAY['default'])`, [clientId, REDIRECT]);
+
+describe('oauth_client_registered_via migration (#6202)', () => {
+ test('is registered, idempotent, and constrains the value to dcr', async () => {
+ expect(migration).toBeDefined();
+ expect(migration.idempotent).toBe(true);
+ expect(await hasColumn()).toBe(true);
+ await oldServerInsert('constraint-example');
+ await expect(engine.executeRaw(`UPDATE oauth_clients SET registered_via = 'operator' WHERE client_id = 'constraint-example'`)).rejects.toThrow();
+ });
+
+ test('fresh bootstrap: a DCR registration is marked and its first consent is editable', async () => {
+ const clientId = await registerDcr();
+ expect(await marker(clientId)).toBe('dcr');
+ expect(await editable(clientId)).toBe(true);
+ });
+
+ test('new server before the migration: DCR falls back to the unmarked insert and consent stays read-only', async () => {
+ await engine.executeRaw('ALTER TABLE oauth_clients DROP COLUMN registered_via');
+ try {
+ const clientId = await registerDcr();
+ expect(await marker(clientId)).toBeUndefined();
+ expect(await editable(clientId)).toBe(false);
+ await oldServerInsert('pre-migration-example');
+ } finally {
+ await engine.executeRaw(migration.sql);
+ }
+ expect(await hasColumn()).toBe(true);
+ });
+
+ test('rows from before the migration stay NULL and read-only; a repeat run changes nothing', async () => {
+ expect(await marker('pre-migration-example')).toBeNull();
+ expect(await editable('pre-migration-example')).toBe(false);
+ await engine.executeRaw(migration.sql);
+ expect(await marker('pre-migration-example')).toBeNull();
+ });
+
+ test('the runner applies it on an upgraded brain whose version predates it', async () => {
+ await engine.executeRaw('ALTER TABLE oauth_clients DROP COLUMN registered_via');
+ await engine.setConfig('version', String(migration.version - 1));
+ await engine.initSchema();
+ expect(await hasColumn()).toBe(true);
+ expect(Number(await engine.getConfig('version'))).toBeGreaterThanOrEqual(migration.version);
+ });
+
+ test('an old server inserting after the migration leaves the marker NULL, so consent is read-only', async () => {
+ await oldServerInsert('old-server-after-example');
+ expect(await marker('old-server-after-example')).toBeNull();
+ expect(await editable('old-server-after-example')).toBe(false);
+ });
+});
diff --git a/test/oauth-consent-security.test.ts b/test/oauth-consent-security.test.ts
index 1381f15a12..41419ecd58 100644
--- a/test/oauth-consent-security.test.ts
+++ b/test/oauth-consent-security.test.ts
@@ -11,6 +11,7 @@ import type { SqlQuery } from '../src/core/sql-query.ts';
import { PGLITE_SCHEMA_SQL } from '../src/core/pglite-schema.ts';
import { mountConfidentialOAuth, mountOAuthConsent } from '../src/commands/serve-http-oauth.ts';
import { hashToken } from '../src/core/utils.ts';
+import { MIGRATIONS } from '../src/core/migrate.ts';
import { pgliteOAuthTransaction, TEST_PKCE_CHALLENGE, TEST_PKCE_VERIFIER } from './helpers/oauth.ts';
let db: PGlite;
@@ -307,6 +308,41 @@ describe('dynamically registered public clients', () => {
expect(await sql`SELECT * FROM oauth_codes WHERE client_id = ${client.client_id}`).toHaveLength(0);
});
+ test('#6202: source_id is accepted only on an approval, as a string, for an eligible request', async () => {
+ await sql`INSERT INTO sources (id, name) VALUES ('wiki-example', 'wiki-example') ON CONFLICT (id) DO NOTHING`;
+ // This suite boots the bare schema blob; the marker column arrives by migration.
+ await db.exec(MIGRATIONS.find(m => m.name === 'oauth_client_registered_via')!.sql);
+ const client = await registerDcr();
+ const id = await expectPending(client.client_id, 'read');
+ const request = await details(id);
+ expect(request.sourceChoice.editable).toBe(true);
+ expect(request.sourceChoice.options.map((o: { id: string }) => o.id)).toContain('wiki-example');
+ for (const extra of [{ source_id: 'wiki-example', decision: 'deny' }, { source_id: 42 }, { source_id: null }, { source_id: ['wiki-example'] }, { source: 'wiki-example' }]) {
+ const { decision = 'approve', ...rest } = extra as Record<string, unknown>;
+ const response = await decide(id, request.csrf, decision as string, OWNER, rest);
+ expect(response.status).toBe(403);
+ expect((await response.json() as any).error).toBe('invalid_consent');
+ }
+ expect((await decide(id, request.csrf, 'approve', OWNER, { source_id: 'not-offered-example' })).status).toBe(403);
+ expect((await decide(id, request.csrf, 'approve', OTHER_SESSION, { source_id: 'wiki-example' })).status).toBe(403);
+ expect(await sql`SELECT * FROM oauth_codes WHERE client_id = ${client.client_id}`).toHaveLength(0);
+ const response = await decide(id, request.csrf, 'approve', OWNER, { source_id: 'wiki-example' });
+ expect(response.status).toBe(200);
+ expect(new URL((await response.json() as any).redirectUrl).searchParams.get('code')).toStartWith('gbrain_code_');
+ const [row] = await sql`SELECT source_id, federated_read, grant_revision FROM oauth_clients WHERE client_id = ${client.client_id}`;
+ expect(row).toMatchObject({ source_id: 'wiki-example', federated_read: ['wiki-example'], grant_revision: 1 });
+ expect(await sql`SELECT actor, action FROM oauth_grant_audit WHERE client_id = ${client.client_id}`).toEqual([{ actor: 'owner', action: 'consent' }]);
+ });
+
+ test('#6202: an operator-registered client gets no source choice and a posted source_id is refused', async () => {
+ const { clientId } = await register();
+ const id = await begin(clientId);
+ const request = await details(id);
+ expect(request.sourceChoice).toEqual({ editable: false, options: [] });
+ expect((await decide(id, request.csrf, 'approve', OWNER, { source_id: 'default' })).status).toBe(403);
+ expect(await sql`SELECT * FROM oauth_codes WHERE client_id = ${clientId}`).toHaveLength(0);
+ });
+
test('a revoked self-registered client is rejected before any consent request is created', async () => {
const client = await registerDcr();
await provider.revokeClient(client.client_id);
diff --git a/test/oauth-owner-consent.test.ts b/test/oauth-owner-consent.test.ts
index f8204262e0..e523c88373 100644
--- a/test/oauth-owner-consent.test.ts
+++ b/test/oauth-owner-consent.test.ts
@@ -1,4 +1,4 @@
-import { afterAll, beforeAll, expect, test } from 'bun:test';
+import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
import { PGLiteEngine } from '../src/core/pglite-engine.ts';
import { GBrainOAuthProvider } from '../src/core/oauth-provider.ts';
import { sqlQueryForEngine } from '../src/core/sql-query.ts';
@@ -65,3 +65,134 @@ test('unchanged profile grants still require one owner decision', async () => {
await expect(provider.grants.decide(id, true)).rejects.toThrow('Restart the connection');
expect(await engine.executeRaw('SELECT code_hash FROM oauth_codes WHERE client_id = $1', [clientId])).toHaveLength(1);
});
+
+describe('#6202: the owner picks a self-registered client\'s source at its first consent', () => {
+ const REDIRECT = 'https://dcr-client.example.com/callback';
+ let dcrProvider: GBrainOAuthProvider;
+ beforeAll(async () => {
+ dcrProvider = new GBrainOAuthProvider({
+ sql: sqlQueryForEngine(engine),
+ transaction: fn => engine.transaction(tx => fn(sqlQueryForEngine(tx))),
+ allowClientCredentialsDcr: true,
+ });
+ await engine.executeRaw(`INSERT INTO sources (id, name) VALUES ('wiki', 'wiki'), ('archive-example', 'archive-example') ON CONFLICT (id) DO NOTHING`);
+ });
+ beforeEach(async () => {
+ await engine.executeRaw(`UPDATE sources SET archived = false WHERE id IN ('wiki', 'archive-example')`);
+ });
+
+ async function registerDcr(grantTypes = ['authorization_code']) {
+ const client = await dcrProvider.clientsStore.registerClient!({
+ client_name: 'self-registered-example', redirect_uris: [REDIRECT], grant_types: grantTypes,
+ scope: grantTypes.includes('client_credentials') ? 'read' : 'read write',
+ token_endpoint_auth_method: grantTypes.includes('client_credentials') ? 'client_secret_post' : 'none',
+ } as never);
+ return client.client_id;
+ }
+ const beginFor = (clientId: string) => dcrProvider.grants.begin(clientId, {
+ codeChallenge: TEST_PKCE_CHALLENGE, redirectUri: REDIRECT, scopes: ['read'],
+ });
+ const clientRow = async (clientId: string) => (await engine.executeRaw<Record<string, unknown>>(
+ 'SELECT source_id, federated_read, grant_revision, registered_via FROM oauth_clients WHERE client_id = $1', [clientId]))[0]!;
+ const audits = (clientId: string) => engine.executeRaw<Record<string, unknown>>(
+ 'SELECT actor, action, revision FROM oauth_grant_audit WHERE client_id = $1 ORDER BY id', [clientId]);
+ const codes = (clientId: string) => engine.executeRaw('SELECT code_hash FROM oauth_codes WHERE client_id = $1', [clientId]);
+
+ test('an eligible request offers the active sources; approving with one moves the client and records consent', async () => {
+ const clientId = await registerDcr();
+ expect((await clientRow(clientId)).registered_via).toBe('dcr');
+ const id = await beginFor(clientId);
+ const { sourceChoice } = dcrProvider.grants.details(id);
+ expect(sourceChoice.editable).toBe(true);
+ expect(sourceChoice.options.map(o => o.id)).toEqual(expect.arrayContaining(['default', 'wiki']));
+ expect(new URL(await dcrProvider.grants.decide(id, true, { sourceId: 'wiki' })).searchParams.get('code')).toStartWith('gbrain_code_');
+ expect(await clientRow(clientId)).toMatchObject({ source_id: 'wiki', federated_read: ['wiki'], grant_revision: 1 });
+ expect((await audits(clientId)).filter(a => a.action === 'consent')).toEqual([{ actor: 'owner', action: 'consent', revision: 1 }]);
+ expect(await codes(clientId)).toHaveLength(1);
+ });
+
+ test('approving the unchanged source still consumes eligibility; a second pending request fails and later requests are read-only', async () => {
+ const clientId = await registerDcr();
+ const first = await beginFor(clientId);
+ const second = await beginFor(clientId);
+ await dcrProvider.grants.decide(first, true);
+ expect(await clientRow(clientId)).toMatchObject({ source_id: 'default', federated_read: ['default'], grant_revision: 1 });
+ expect((await audits(clientId)).filter(a => a.action === 'consent')).toHaveLength(1);
+ await expect(dcrProvider.grants.decide(second, true)).rejects.toMatchObject({ status: 409, code: 'client_policy_changed' });
+ const later = await beginFor(clientId);
+ expect(dcrProvider.grants.details(later).sourceChoice).toEqual({ editable: false, options: [] });
+ await expect(dcrProvider.grants.decide(later, true, { sourceId: 'wiki' })).rejects.toMatchObject({ status: 403 });
+ expect(dcrProvider.grants.details(later).sourceChoice.editable).toBe(false);
+ expect(await codes(clientId)).toHaveLength(1);
+ });
+
+ test('denial is non-mutating and a choice on a denial is refused before the request is claimed', async () => {
+ const clientId = await registerDcr();
+ const id = await beginFor(clientId);
+ await expect(dcrProvider.grants.decide(id, false, { sourceId: 'wiki' })).rejects.toMatchObject({ status: 403, code: 'invalid_consent' });
+ expect(dcrProvider.grants.details(id).sourceChoice.editable).toBe(true);
+ expect(new URL(await dcrProvider.grants.decide(id, false)).searchParams.get('error')).toBe('access_denied');
+ expect(await clientRow(clientId)).toMatchObject({ source_id: 'default', grant_revision: 0 });
+ expect(await audits(clientId)).toEqual([]);
+ });
+
+ test('a source outside the offered list is refused and the request stays pending', async () => {
+ const clientId = await registerDcr();
+ const id = await beginFor(clientId);
+ await expect(dcrProvider.grants.decide(id, true, { sourceId: 'no-such-source' })).rejects.toMatchObject({ status: 403 });
+ expect(dcrProvider.grants.details(id).sourceChoice.editable).toBe(true);
+ expect(await clientRow(clientId)).toMatchObject({ source_id: 'default', grant_revision: 0 });
+ });
+
+ test('an operator-registered client is read-only and a choice creates no code', async () => {
+ const { id, clientId } = await pending();
+ const before = await clientRow(clientId);
+ expect(before).toMatchObject({ source_id: 'default', registered_via: null });
+ expect(provider.grants.details(id).sourceChoice).toEqual({ editable: false, options: [] });
+ await expect(provider.grants.decide(id, true, { sourceId: 'wiki' })).rejects.toMatchObject({ status: 403 });
+ expect(await clientRow(clientId)).toEqual(before);
+ expect(await codes(clientId)).toHaveLength(0);
+ });
+
+ test('a client_credentials DCR client never reaches consent and stays on default', async () => {
+ const clientId = await registerDcr(['client_credentials']);
+ await expect(beginFor(clientId)).rejects.toThrow('Authorization code grant not authorized');
+ expect(await clientRow(clientId)).toMatchObject({ source_id: 'default', grant_revision: 0 });
+ const both = await registerDcr(['authorization_code', 'client_credentials']);
+ expect(dcrProvider.grants.details(await beginFor(both)).sourceChoice.editable).toBe(false);
+ });
+
+ test('a source archived between review and approval fails 409, issues no code and leaves the request terminal', async () => {
+ const clientId = await registerDcr();
+ const id = await beginFor(clientId);
+ expect(dcrProvider.grants.details(id).sourceChoice.options.map(o => o.id)).toContain('archive-example');
+ await engine.executeRaw(`UPDATE sources SET archived = true WHERE id = 'archive-example'`);
+ await expect(dcrProvider.grants.decide(id, true, { sourceId: 'archive-example' })).rejects.toMatchObject({ status: 409, code: 'client_policy_changed' });
+ expect(await clientRow(clientId)).toMatchObject({ source_id: 'default', grant_revision: 0 });
+ expect(await audits(clientId)).toEqual([]);
+ expect(await codes(clientId)).toHaveLength(0);
+ expect(() => dcrProvider.grants.details(id)).toThrow('Restart the connection');
+ });
+
+ test('a client that already holds a token or code is never offered or given the choice', async () => {
+ const issued = await registerDcr();
+ await engine.executeRaw(`INSERT INTO oauth_tokens (token_hash, token_type, client_id, scopes, expires_at) VALUES ($1, 'access', $2, '{read}', 9999999999)`,
+ [`synthetic-${issued}`, issued]);
+ expect(dcrProvider.grants.details(await beginFor(issued)).sourceChoice.editable).toBe(false);
+ const racing = await registerDcr();
+ const id = await beginFor(racing);
+ await engine.executeRaw(`INSERT INTO oauth_codes (code_hash, client_id, scopes, code_challenge, code_challenge_method, redirect_uri, expires_at)
+ VALUES ($1, $2, '{read}', $3, 'S256', $4, 9999999999)`, [`synthetic-${racing}`, racing, TEST_PKCE_CHALLENGE, REDIRECT]);
+ await expect(dcrProvider.grants.decide(id, true, { sourceId: 'wiki' })).rejects.toMatchObject({ status: 409, code: 'client_policy_changed' });
+ expect(await clientRow(racing)).toMatchObject({ source_id: 'default', grant_revision: 0 });
+ });
+
+ test('a pre-migration DCR row (no marker) keeps read-only consent', async () => {
+ const clientId = await registerDcr();
+ await engine.executeRaw('UPDATE oauth_clients SET registered_via = NULL WHERE client_id = $1', [clientId]);
+ const id = await beginFor(clientId);
+ expect(dcrProvider.grants.details(id).sourceChoice.editable).toBe(false);
+ await dcrProvider.grants.decide(id, true);
+ expect(await clientRow(clientId)).toMatchObject({ source_id: 'default', grant_revision: 0 });
+ });
+});
diff --git a/test/schema-bootstrap-coverage.test.ts b/test/schema-bootstrap-coverage.test.ts
index 46c2f9de8d..9063cb13f3 100644
--- a/test/schema-bootstrap-coverage.test.ts
+++ b/test/schema-bootstrap-coverage.test.ts
@@ -903,6 +903,11 @@ const COLUMN_EXEMPTIONS = new Set<string>([
// the schema blob carries a comment, no CREATE TABLE column and no index
// reads it, so there is no forward reference for the bootstrap to trip on.
'content_chunks.embedding_pending_since',
+ // #6202 oauth_clients.registered_via (migration oauth_client_registered_via):
+ // migration-only like min_trust, so fresh and upgraded catalogs keep the same
+ // column order; no blob statement or index reads it, and the DCR insert falls
+ // back to the unmarked insert while the column is missing.
+ 'oauth_clients.registered_via',
// T7 — search_telemetry rank-1 drift columns (migration v111). search_telemetry
// is created entirely by migration v57 (not in the schema blob), so the v57+v111
// chain handles fresh + upgrade; no CREATE INDEX references these columns, so