@suveren/gateway 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var zf=Object.defineProperty;var Af=(e,t,n)=>t in e?zf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var To=(e,t,n)=>Af(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(a){if(a.ep)return;a.ep=!0;const s=n(a);fetch(a.href,s)}})();var Lc={exports:{}},co={},Mc={exports:{}},q={};/**
1
+ var Af=Object.defineProperty;var $f=(e,t,n)=>t in e?Af(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var To=(e,t,n)=>$f(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(a){if(a.ep)return;a.ep=!0;const s=n(a);fetch(a.href,s)}})();var Mc={exports:{}},co={},Fc={exports:{}},q={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@ var zf=Object.defineProperty;var Af=(e,t,n)=>t in e?zf(e,t,{enumerable:!0,config
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Gr=Symbol.for("react.element"),$f=Symbol.for("react.portal"),Lf=Symbol.for("react.fragment"),Mf=Symbol.for("react.strict_mode"),Ff=Symbol.for("react.profiler"),Of=Symbol.for("react.provider"),Bf=Symbol.for("react.context"),Df=Symbol.for("react.forward_ref"),Uf=Symbol.for("react.suspense"),Wf=Symbol.for("react.memo"),Hf=Symbol.for("react.lazy"),dl=Symbol.iterator;function Vf(e){return e===null||typeof e!="object"?null:(e=dl&&e[dl]||e["@@iterator"],typeof e=="function"?e:null)}var Fc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Oc=Object.assign,Bc={};function Zn(e,t,n){this.props=e,this.context=t,this.refs=Bc,this.updater=n||Fc}Zn.prototype.isReactComponent={};Zn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Zn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Dc(){}Dc.prototype=Zn.prototype;function li(e,t,n){this.props=e,this.context=t,this.refs=Bc,this.updater=n||Fc}var ci=li.prototype=new Dc;ci.constructor=li;Oc(ci,Zn.prototype);ci.isPureReactComponent=!0;var fl=Array.isArray,Uc=Object.prototype.hasOwnProperty,ui={current:null},Wc={key:!0,ref:!0,__self:!0,__source:!0};function Hc(e,t,n){var r,a={},s=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(s=""+t.key),t)Uc.call(t,r)&&!Wc.hasOwnProperty(r)&&(a[r]=t[r]);var l=arguments.length-2;if(l===1)a.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)a[r]===void 0&&(a[r]=l[r]);return{$$typeof:Gr,type:e,key:s,ref:i,props:a,_owner:ui.current}}function Kf(e,t){return{$$typeof:Gr,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function di(e){return typeof e=="object"&&e!==null&&e.$$typeof===Gr}function Gf(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var pl=/\/+/g;function Io(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Gf(""+e.key):t.toString(36)}function Sa(e,t,n,r,a){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(s){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case Gr:case $f:i=!0}}if(i)return i=e,a=a(i),e=r===""?"."+Io(i,0):r,fl(a)?(n="",e!=null&&(n=e.replace(pl,"$&/")+"/"),Sa(a,t,n,"",function(u){return u})):a!=null&&(di(a)&&(a=Kf(a,n+(!a.key||i&&i.key===a.key?"":(""+a.key).replace(pl,"$&/")+"/")+e)),t.push(a)),1;if(i=0,r=r===""?".":r+":",fl(e))for(var l=0;l<e.length;l++){s=e[l];var c=r+Io(s,l);i+=Sa(s,t,n,c,a)}else if(c=Vf(e),typeof c=="function")for(e=c.call(e),l=0;!(s=e.next()).done;)s=s.value,c=r+Io(s,l++),i+=Sa(s,t,n,c,a);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return i}function ta(e,t,n){if(e==null)return e;var r=[],a=0;return Sa(e,r,"","",function(s){return t.call(n,s,a++)}),r}function Qf(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Me={current:null},ja={transition:null},Yf={ReactCurrentDispatcher:Me,ReactCurrentBatchConfig:ja,ReactCurrentOwner:ui};function Vc(){throw Error("act(...) is not supported in production builds of React.")}q.Children={map:ta,forEach:function(e,t,n){ta(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ta(e,function(){t++}),t},toArray:function(e){return ta(e,function(t){return t})||[]},only:function(e){if(!di(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};q.Component=Zn;q.Fragment=Lf;q.Profiler=Ff;q.PureComponent=li;q.StrictMode=Mf;q.Suspense=Uf;q.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Yf;q.act=Vc;q.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Oc({},e.props),a=e.key,s=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,i=ui.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Uc.call(t,c)&&!Wc.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:Gr,type:e.type,key:a,ref:s,props:r,_owner:i}};q.createContext=function(e){return e={$$typeof:Bf,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Of,_context:e},e.Consumer=e};q.createElement=Hc;q.createFactory=function(e){var t=Hc.bind(null,e);return t.type=e,t};q.createRef=function(){return{current:null}};q.forwardRef=function(e){return{$$typeof:Df,render:e}};q.isValidElement=di;q.lazy=function(e){return{$$typeof:Hf,_payload:{_status:-1,_result:e},_init:Qf}};q.memo=function(e,t){return{$$typeof:Wf,type:e,compare:t===void 0?null:t}};q.startTransition=function(e){var t=ja.transition;ja.transition={};try{e()}finally{ja.transition=t}};q.unstable_act=Vc;q.useCallback=function(e,t){return Me.current.useCallback(e,t)};q.useContext=function(e){return Me.current.useContext(e)};q.useDebugValue=function(){};q.useDeferredValue=function(e){return Me.current.useDeferredValue(e)};q.useEffect=function(e,t){return Me.current.useEffect(e,t)};q.useId=function(){return Me.current.useId()};q.useImperativeHandle=function(e,t,n){return Me.current.useImperativeHandle(e,t,n)};q.useInsertionEffect=function(e,t){return Me.current.useInsertionEffect(e,t)};q.useLayoutEffect=function(e,t){return Me.current.useLayoutEffect(e,t)};q.useMemo=function(e,t){return Me.current.useMemo(e,t)};q.useReducer=function(e,t,n){return Me.current.useReducer(e,t,n)};q.useRef=function(e){return Me.current.useRef(e)};q.useState=function(e){return Me.current.useState(e)};q.useSyncExternalStore=function(e,t,n){return Me.current.useSyncExternalStore(e,t,n)};q.useTransition=function(){return Me.current.useTransition()};q.version="18.3.1";Mc.exports=q;var d=Mc.exports;/**
9
+ */var Gr=Symbol.for("react.element"),Lf=Symbol.for("react.portal"),Mf=Symbol.for("react.fragment"),Ff=Symbol.for("react.strict_mode"),Of=Symbol.for("react.profiler"),Bf=Symbol.for("react.provider"),Df=Symbol.for("react.context"),Uf=Symbol.for("react.forward_ref"),Wf=Symbol.for("react.suspense"),Hf=Symbol.for("react.memo"),Vf=Symbol.for("react.lazy"),fl=Symbol.iterator;function Kf(e){return e===null||typeof e!="object"?null:(e=fl&&e[fl]||e["@@iterator"],typeof e=="function"?e:null)}var Oc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Bc=Object.assign,Dc={};function Zn(e,t,n){this.props=e,this.context=t,this.refs=Dc,this.updater=n||Oc}Zn.prototype.isReactComponent={};Zn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Zn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Uc(){}Uc.prototype=Zn.prototype;function ci(e,t,n){this.props=e,this.context=t,this.refs=Dc,this.updater=n||Oc}var ui=ci.prototype=new Uc;ui.constructor=ci;Bc(ui,Zn.prototype);ui.isPureReactComponent=!0;var pl=Array.isArray,Wc=Object.prototype.hasOwnProperty,di={current:null},Hc={key:!0,ref:!0,__self:!0,__source:!0};function Vc(e,t,n){var r,a={},s=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(s=""+t.key),t)Wc.call(t,r)&&!Hc.hasOwnProperty(r)&&(a[r]=t[r]);var l=arguments.length-2;if(l===1)a.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)a[r]===void 0&&(a[r]=l[r]);return{$$typeof:Gr,type:e,key:s,ref:i,props:a,_owner:di.current}}function Gf(e,t){return{$$typeof:Gr,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function fi(e){return typeof e=="object"&&e!==null&&e.$$typeof===Gr}function Yf(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var ml=/\/+/g;function Io(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Yf(""+e.key):t.toString(36)}function Sa(e,t,n,r,a){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(s){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case Gr:case Lf:i=!0}}if(i)return i=e,a=a(i),e=r===""?"."+Io(i,0):r,pl(a)?(n="",e!=null&&(n=e.replace(ml,"$&/")+"/"),Sa(a,t,n,"",function(u){return u})):a!=null&&(fi(a)&&(a=Gf(a,n+(!a.key||i&&i.key===a.key?"":(""+a.key).replace(ml,"$&/")+"/")+e)),t.push(a)),1;if(i=0,r=r===""?".":r+":",pl(e))for(var l=0;l<e.length;l++){s=e[l];var c=r+Io(s,l);i+=Sa(s,t,n,c,a)}else if(c=Kf(e),typeof c=="function")for(e=c.call(e),l=0;!(s=e.next()).done;)s=s.value,c=r+Io(s,l++),i+=Sa(s,t,n,c,a);else if(s==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return i}function ta(e,t,n){if(e==null)return e;var r=[],a=0;return Sa(e,r,"","",function(s){return t.call(n,s,a++)}),r}function Qf(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Me={current:null},ja={transition:null},Jf={ReactCurrentDispatcher:Me,ReactCurrentBatchConfig:ja,ReactCurrentOwner:di};function Kc(){throw Error("act(...) is not supported in production builds of React.")}q.Children={map:ta,forEach:function(e,t,n){ta(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ta(e,function(){t++}),t},toArray:function(e){return ta(e,function(t){return t})||[]},only:function(e){if(!fi(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};q.Component=Zn;q.Fragment=Mf;q.Profiler=Of;q.PureComponent=ci;q.StrictMode=Ff;q.Suspense=Wf;q.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Jf;q.act=Kc;q.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Bc({},e.props),a=e.key,s=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,i=di.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Wc.call(t,c)&&!Hc.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:Gr,type:e.type,key:a,ref:s,props:r,_owner:i}};q.createContext=function(e){return e={$$typeof:Df,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Bf,_context:e},e.Consumer=e};q.createElement=Vc;q.createFactory=function(e){var t=Vc.bind(null,e);return t.type=e,t};q.createRef=function(){return{current:null}};q.forwardRef=function(e){return{$$typeof:Uf,render:e}};q.isValidElement=fi;q.lazy=function(e){return{$$typeof:Vf,_payload:{_status:-1,_result:e},_init:Qf}};q.memo=function(e,t){return{$$typeof:Hf,type:e,compare:t===void 0?null:t}};q.startTransition=function(e){var t=ja.transition;ja.transition={};try{e()}finally{ja.transition=t}};q.unstable_act=Kc;q.useCallback=function(e,t){return Me.current.useCallback(e,t)};q.useContext=function(e){return Me.current.useContext(e)};q.useDebugValue=function(){};q.useDeferredValue=function(e){return Me.current.useDeferredValue(e)};q.useEffect=function(e,t){return Me.current.useEffect(e,t)};q.useId=function(){return Me.current.useId()};q.useImperativeHandle=function(e,t,n){return Me.current.useImperativeHandle(e,t,n)};q.useInsertionEffect=function(e,t){return Me.current.useInsertionEffect(e,t)};q.useLayoutEffect=function(e,t){return Me.current.useLayoutEffect(e,t)};q.useMemo=function(e,t){return Me.current.useMemo(e,t)};q.useReducer=function(e,t,n){return Me.current.useReducer(e,t,n)};q.useRef=function(e){return Me.current.useRef(e)};q.useState=function(e){return Me.current.useState(e)};q.useSyncExternalStore=function(e,t,n){return Me.current.useSyncExternalStore(e,t,n)};q.useTransition=function(){return Me.current.useTransition()};q.version="18.3.1";Fc.exports=q;var d=Fc.exports;/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@ var zf=Object.defineProperty;var Af=(e,t,n)=>t in e?zf(e,t,{enumerable:!0,config
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Jf=d,Xf=Symbol.for("react.element"),qf=Symbol.for("react.fragment"),Zf=Object.prototype.hasOwnProperty,ep=Jf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,tp={key:!0,ref:!0,__self:!0,__source:!0};function Kc(e,t,n){var r,a={},s=null,i=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)Zf.call(t,r)&&!tp.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)a[r]===void 0&&(a[r]=t[r]);return{$$typeof:Xf,type:e,key:s,ref:i,props:a,_owner:ep.current}}co.Fragment=qf;co.jsx=Kc;co.jsxs=Kc;Lc.exports=co;var o=Lc.exports,Gc={exports:{}},Xe={},Qc={exports:{}},Yc={};/**
17
+ */var Xf=d,qf=Symbol.for("react.element"),Zf=Symbol.for("react.fragment"),ep=Object.prototype.hasOwnProperty,tp=Xf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,np={key:!0,ref:!0,__self:!0,__source:!0};function Gc(e,t,n){var r,a={},s=null,i=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)ep.call(t,r)&&!np.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)a[r]===void 0&&(a[r]=t[r]);return{$$typeof:qf,type:e,key:s,ref:i,props:a,_owner:tp.current}}co.Fragment=Zf;co.jsx=Gc;co.jsxs=Gc;Mc.exports=co;var o=Mc.exports,Yc={exports:{}},Xe={},Qc={exports:{}},Jc={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@ var zf=Object.defineProperty;var Af=(e,t,n)=>t in e?zf(e,t,{enumerable:!0,config
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(C,P){var z=C.length;C.push(P);e:for(;0<z;){var L=z-1>>>1,U=C[L];if(0<a(U,P))C[L]=P,C[z]=U,z=L;else break e}}function n(C){return C.length===0?null:C[0]}function r(C){if(C.length===0)return null;var P=C[0],z=C.pop();if(z!==P){C[0]=z;e:for(var L=0,U=C.length,ne=U>>>1;L<ne;){var J=2*(L+1)-1,ye=C[J],O=J+1,B=C[O];if(0>a(ye,z))O<U&&0>a(B,ye)?(C[L]=B,C[O]=z,L=O):(C[L]=ye,C[J]=z,L=J);else if(O<U&&0>a(B,z))C[L]=B,C[O]=z,L=O;else break e}}return P}function a(C,P){var z=C.sortIndex-P.sortIndex;return z!==0?z:C.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],h=1,f=null,g=3,v=!1,x=!1,w=!1,j=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(C){for(var P=n(u);P!==null;){if(P.callback===null)r(u);else if(P.startTime<=C)r(u),P.sortIndex=P.expirationTime,t(c,P);else break;P=n(u)}}function S(C){if(w=!1,y(C),!x)if(n(c)!==null)x=!0,Y(b);else{var P=n(u);P!==null&&_(S,P.startTime-C)}}function b(C,P){x=!1,w&&(w=!1,m(E),E=-1),v=!0;var z=g;try{for(y(P),f=n(c);f!==null&&(!(f.expirationTime>P)||C&&!D());){var L=f.callback;if(typeof L=="function"){f.callback=null,g=f.priorityLevel;var U=L(f.expirationTime<=P);P=e.unstable_now(),typeof U=="function"?f.callback=U:f===n(c)&&r(c),y(P)}else r(c);f=n(c)}if(f!==null)var ne=!0;else{var J=n(u);J!==null&&_(S,J.startTime-P),ne=!1}return ne}finally{f=null,g=z,v=!1}}var T=!1,k=null,E=-1,N=5,I=-1;function D(){return!(e.unstable_now()-I<N)}function V(){if(k!==null){var C=e.unstable_now();I=C;var P=!0;try{P=k(!0,C)}finally{P?M():(T=!1,k=null)}}else T=!1}var M;if(typeof p=="function")M=function(){p(V)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,R=$.port2;$.port1.onmessage=V,M=function(){R.postMessage(null)}}else M=function(){j(V,0)};function Y(C){k=C,T||(T=!0,M())}function _(C,P){E=j(function(){C(e.unstable_now())},P)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(C){C.callback=null},e.unstable_continueExecution=function(){x||v||(x=!0,Y(b))},e.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<C?Math.floor(1e3/C):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(C){switch(g){case 1:case 2:case 3:var P=3;break;default:P=g}var z=g;g=P;try{return C()}finally{g=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(C,P){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var z=g;g=C;try{return P()}finally{g=z}},e.unstable_scheduleCallback=function(C,P,z){var L=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?L+z:L):z=L,C){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=z+U,C={id:h++,callback:P,priorityLevel:C,startTime:z,expirationTime:U,sortIndex:-1},z>L?(C.sortIndex=z,t(u,C),n(c)===null&&C===n(u)&&(w?(m(E),E=-1):w=!0,_(S,z-L))):(C.sortIndex=U,t(c,C),x||v||(x=!0,Y(b))),C},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(C){var P=g;return function(){var z=g;g=P;try{return C.apply(this,arguments)}finally{g=z}}}})(Yc);Qc.exports=Yc;var np=Qc.exports;/**
25
+ */(function(e){function t(C,P){var z=C.length;C.push(P);e:for(;0<z;){var L=z-1>>>1,U=C[L];if(0<a(U,P))C[L]=P,C[z]=U,z=L;else break e}}function n(C){return C.length===0?null:C[0]}function r(C){if(C.length===0)return null;var P=C[0],z=C.pop();if(z!==P){C[0]=z;e:for(var L=0,U=C.length,ne=U>>>1;L<ne;){var J=2*(L+1)-1,ve=C[J],O=J+1,B=C[O];if(0>a(ve,z))O<U&&0>a(B,ve)?(C[L]=B,C[O]=z,L=O):(C[L]=ve,C[J]=z,L=J);else if(O<U&&0>a(B,z))C[L]=B,C[O]=z,L=O;else break e}}return P}function a(C,P){var z=C.sortIndex-P.sortIndex;return z!==0?z:C.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],u=[],h=1,f=null,v=3,y=!1,x=!1,w=!1,j=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(C){for(var P=n(u);P!==null;){if(P.callback===null)r(u);else if(P.startTime<=C)r(u),P.sortIndex=P.expirationTime,t(c,P);else break;P=n(u)}}function S(C){if(w=!1,g(C),!x)if(n(c)!==null)x=!0,Q(E);else{var P=n(u);P!==null&&R(S,P.startTime-C)}}function E(C,P){x=!1,w&&(w=!1,m(b),b=-1),y=!0;var z=v;try{for(g(P),f=n(c);f!==null&&(!(f.expirationTime>P)||C&&!D());){var L=f.callback;if(typeof L=="function"){f.callback=null,v=f.priorityLevel;var U=L(f.expirationTime<=P);P=e.unstable_now(),typeof U=="function"?f.callback=U:f===n(c)&&r(c),g(P)}else r(c);f=n(c)}if(f!==null)var ne=!0;else{var J=n(u);J!==null&&R(S,J.startTime-P),ne=!1}return ne}finally{f=null,v=z,y=!1}}var T=!1,k=null,b=-1,N=5,I=-1;function D(){return!(e.unstable_now()-I<N)}function V(){if(k!==null){var C=e.unstable_now();I=C;var P=!0;try{P=k(!0,C)}finally{P?M():(T=!1,k=null)}}else T=!1}var M;if(typeof p=="function")M=function(){p(V)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,_=$.port2;$.port1.onmessage=V,M=function(){_.postMessage(null)}}else M=function(){j(V,0)};function Q(C){k=C,T||(T=!0,M())}function R(C,P){b=j(function(){C(e.unstable_now())},P)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(C){C.callback=null},e.unstable_continueExecution=function(){x||y||(x=!0,Q(E))},e.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<C?Math.floor(1e3/C):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(C){switch(v){case 1:case 2:case 3:var P=3;break;default:P=v}var z=v;v=P;try{return C()}finally{v=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(C,P){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var z=v;v=C;try{return P()}finally{v=z}},e.unstable_scheduleCallback=function(C,P,z){var L=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?L+z:L):z=L,C){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=z+U,C={id:h++,callback:P,priorityLevel:C,startTime:z,expirationTime:U,sortIndex:-1},z>L?(C.sortIndex=z,t(u,C),n(c)===null&&C===n(u)&&(w?(m(b),b=-1):w=!0,R(S,z-L))):(C.sortIndex=U,t(c,C),x||y||(x=!0,Q(E))),C},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(C){var P=v;return function(){var z=v;v=P;try{return C.apply(this,arguments)}finally{v=z}}}})(Jc);Qc.exports=Jc;var rp=Qc.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,14 +30,14 @@ var zf=Object.defineProperty;var Af=(e,t,n)=>t in e?zf(e,t,{enumerable:!0,config
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var rp=d,Je=np;function A(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Jc=new Set,Tr={};function Nn(e,t){Kn(e,t),Kn(e+"Capture",t)}function Kn(e,t){for(Tr[e]=t,e=0;e<t.length;e++)Jc.add(t[e])}var At=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ls=Object.prototype.hasOwnProperty,ap=/^[: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]*$/,ml={},hl={};function op(e){return ls.call(hl,e)?!0:ls.call(ml,e)?!1:ap.test(e)?hl[e]=!0:(ml[e]=!0,!1)}function sp(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function ip(e,t,n,r){if(t===null||typeof t>"u"||sp(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Fe(e,t,n,r,a,s,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=i}var Pe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Pe[e]=new Fe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Pe[t]=new Fe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Pe[e]=new Fe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Pe[e]=new Fe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Pe[e]=new Fe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Pe[e]=new Fe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Pe[e]=new Fe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Pe[e]=new Fe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Pe[e]=new Fe(e,5,!1,e.toLowerCase(),null,!1,!1)});var fi=/[\-:]([a-z])/g;function pi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(fi,pi);Pe[t]=new Fe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(fi,pi);Pe[t]=new Fe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(fi,pi);Pe[t]=new Fe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Pe[e]=new Fe(e,1,!1,e.toLowerCase(),null,!1,!1)});Pe.xlinkHref=new Fe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Pe[e]=new Fe(e,1,!1,e.toLowerCase(),null,!0,!0)});function mi(e,t,n,r){var a=Pe.hasOwnProperty(t)?Pe[t]:null;(a!==null?a.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(ip(t,n,a,r)&&(n=null),r||a===null?op(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=n===null?a.type===3?!1:"":n:(t=a.attributeName,r=a.attributeNamespace,n===null?e.removeAttribute(t):(a=a.type,n=a===3||a===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ot=rp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,na=Symbol.for("react.element"),Pn=Symbol.for("react.portal"),Tn=Symbol.for("react.fragment"),hi=Symbol.for("react.strict_mode"),cs=Symbol.for("react.profiler"),Xc=Symbol.for("react.provider"),qc=Symbol.for("react.context"),gi=Symbol.for("react.forward_ref"),us=Symbol.for("react.suspense"),ds=Symbol.for("react.suspense_list"),yi=Symbol.for("react.memo"),Wt=Symbol.for("react.lazy"),Zc=Symbol.for("react.offscreen"),gl=Symbol.iterator;function or(e){return e===null||typeof e!="object"?null:(e=gl&&e[gl]||e["@@iterator"],typeof e=="function"?e:null)}var pe=Object.assign,_o;function mr(e){if(_o===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);_o=t&&t[1]||""}return`
34
- `+_o+e}var Ro=!1;function zo(e,t){if(!e||Ro)return"";Ro=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var a=u.stack.split(`
33
+ */var ap=d,Je=rp;function A(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Xc=new Set,Tr={};function Nn(e,t){Kn(e,t),Kn(e+"Capture",t)}function Kn(e,t){for(Tr[e]=t,e=0;e<t.length;e++)Xc.add(t[e])}var At=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cs=Object.prototype.hasOwnProperty,op=/^[: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]*$/,hl={},gl={};function sp(e){return cs.call(gl,e)?!0:cs.call(hl,e)?!1:op.test(e)?gl[e]=!0:(hl[e]=!0,!1)}function ip(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function lp(e,t,n,r){if(t===null||typeof t>"u"||ip(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Fe(e,t,n,r,a,s,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=i}var Pe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Pe[e]=new Fe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Pe[t]=new Fe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Pe[e]=new Fe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Pe[e]=new Fe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Pe[e]=new Fe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Pe[e]=new Fe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Pe[e]=new Fe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Pe[e]=new Fe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Pe[e]=new Fe(e,5,!1,e.toLowerCase(),null,!1,!1)});var pi=/[\-:]([a-z])/g;function mi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(pi,mi);Pe[t]=new Fe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(pi,mi);Pe[t]=new Fe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(pi,mi);Pe[t]=new Fe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Pe[e]=new Fe(e,1,!1,e.toLowerCase(),null,!1,!1)});Pe.xlinkHref=new Fe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Pe[e]=new Fe(e,1,!1,e.toLowerCase(),null,!0,!0)});function hi(e,t,n,r){var a=Pe.hasOwnProperty(t)?Pe[t]:null;(a!==null?a.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(lp(t,n,a,r)&&(n=null),r||a===null?sp(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=n===null?a.type===3?!1:"":n:(t=a.attributeName,r=a.attributeNamespace,n===null?e.removeAttribute(t):(a=a.type,n=a===3||a===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ot=ap.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,na=Symbol.for("react.element"),Pn=Symbol.for("react.portal"),Tn=Symbol.for("react.fragment"),gi=Symbol.for("react.strict_mode"),us=Symbol.for("react.profiler"),qc=Symbol.for("react.provider"),Zc=Symbol.for("react.context"),vi=Symbol.for("react.forward_ref"),ds=Symbol.for("react.suspense"),fs=Symbol.for("react.suspense_list"),yi=Symbol.for("react.memo"),Wt=Symbol.for("react.lazy"),eu=Symbol.for("react.offscreen"),vl=Symbol.iterator;function or(e){return e===null||typeof e!="object"?null:(e=vl&&e[vl]||e["@@iterator"],typeof e=="function"?e:null)}var pe=Object.assign,Ro;function mr(e){if(Ro===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ro=t&&t[1]||""}return`
34
+ `+Ro+e}var _o=!1;function zo(e,t){if(!e||_o)return"";_o=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var a=u.stack.split(`
35
35
  `),s=r.stack.split(`
36
36
  `),i=a.length-1,l=s.length-1;1<=i&&0<=l&&a[i]!==s[l];)l--;for(;1<=i&&0<=l;i--,l--)if(a[i]!==s[l]){if(i!==1||l!==1)do if(i--,l--,0>l||a[i]!==s[l]){var c=`
37
- `+a[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=l);break}}}finally{Ro=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?mr(e):""}function lp(e){switch(e.tag){case 5:return mr(e.type);case 16:return mr("Lazy");case 13:return mr("Suspense");case 19:return mr("SuspenseList");case 0:case 2:case 15:return e=zo(e.type,!1),e;case 11:return e=zo(e.type.render,!1),e;case 1:return e=zo(e.type,!0),e;default:return""}}function fs(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Tn:return"Fragment";case Pn:return"Portal";case cs:return"Profiler";case hi:return"StrictMode";case us:return"Suspense";case ds:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case qc:return(e.displayName||"Context")+".Consumer";case Xc:return(e._context.displayName||"Context")+".Provider";case gi:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case yi:return t=e.displayName||null,t!==null?t:fs(e.type)||"Memo";case Wt:t=e._payload,e=e._init;try{return fs(e(t))}catch{}}return null}function cp(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fs(t);case 8:return t===hi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function an(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function eu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function up(e){var t=eu(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(i){r=""+i,s.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ra(e){e._valueTracker||(e._valueTracker=up(e))}function tu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=eu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function $a(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}}function ps(e,t){var n=t.checked;return pe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function yl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=an(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function nu(e,t){t=t.checked,t!=null&&mi(e,"checked",t,!1)}function ms(e,t){nu(e,t);var n=an(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?hs(e,t.type,n):t.hasOwnProperty("defaultValue")&&hs(e,t.type,an(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function vl(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function hs(e,t,n){(t!=="number"||$a(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var hr=Array.isArray;function Bn(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+an(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function gs(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(A(91));return pe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function xl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(A(92));if(hr(n)){if(1<n.length)throw Error(A(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:an(n)}}function ru(e,t){var n=an(t.value),r=an(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function wl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function au(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ys(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?au(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var aa,ou=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,a){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,a)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(aa=aa||document.createElement("div"),aa.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=aa.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ir(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},dp=["Webkit","ms","Moz","O"];Object.keys(xr).forEach(function(e){dp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xr[t]=xr[e]})});function su(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||xr.hasOwnProperty(e)&&xr[e]?(""+t).trim():t+"px"}function iu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=su(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var fp=pe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vs(e,t){if(t){if(fp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(A(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(A(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(A(61))}if(t.style!=null&&typeof t.style!="object")throw Error(A(62))}}function xs(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 ws=null;function vi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ss=null,Dn=null,Un=null;function Sl(e){if(e=Jr(e)){if(typeof Ss!="function")throw Error(A(280));var t=e.stateNode;t&&(t=ho(t),Ss(e.stateNode,e.type,t))}}function lu(e){Dn?Un?Un.push(e):Un=[e]:Dn=e}function cu(){if(Dn){var e=Dn,t=Un;if(Un=Dn=null,Sl(e),t)for(e=0;e<t.length;e++)Sl(t[e])}}function uu(e,t){return e(t)}function du(){}var Ao=!1;function fu(e,t,n){if(Ao)return e(t,n);Ao=!0;try{return uu(e,t,n)}finally{Ao=!1,(Dn!==null||Un!==null)&&(du(),cu())}}function _r(e,t){var n=e.stateNode;if(n===null)return null;var r=ho(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(A(231,t,typeof n));return n}var js=!1;if(At)try{var sr={};Object.defineProperty(sr,"passive",{get:function(){js=!0}}),window.addEventListener("test",sr,sr),window.removeEventListener("test",sr,sr)}catch{js=!1}function pp(e,t,n,r,a,s,i,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(h){this.onError(h)}}var wr=!1,La=null,Ma=!1,ks=null,mp={onError:function(e){wr=!0,La=e}};function hp(e,t,n,r,a,s,i,l,c){wr=!1,La=null,pp.apply(mp,arguments)}function gp(e,t,n,r,a,s,i,l,c){if(hp.apply(this,arguments),wr){if(wr){var u=La;wr=!1,La=null}else throw Error(A(198));Ma||(Ma=!0,ks=u)}}function En(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function pu(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 jl(e){if(En(e)!==e)throw Error(A(188))}function yp(e){var t=e.alternate;if(!t){if(t=En(e),t===null)throw Error(A(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return jl(a),e;if(s===r)return jl(a),t;s=s.sibling}throw Error(A(188))}if(n.return!==r.return)n=a,r=s;else{for(var i=!1,l=a.child;l;){if(l===n){i=!0,n=a,r=s;break}if(l===r){i=!0,r=a,n=s;break}l=l.sibling}if(!i){for(l=s.child;l;){if(l===n){i=!0,n=s,r=a;break}if(l===r){i=!0,r=s,n=a;break}l=l.sibling}if(!i)throw Error(A(189))}}if(n.alternate!==r)throw Error(A(190))}if(n.tag!==3)throw Error(A(188));return n.stateNode.current===n?e:t}function mu(e){return e=yp(e),e!==null?hu(e):null}function hu(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=hu(e);if(t!==null)return t;e=e.sibling}return null}var gu=Je.unstable_scheduleCallback,kl=Je.unstable_cancelCallback,vp=Je.unstable_shouldYield,xp=Je.unstable_requestPaint,he=Je.unstable_now,wp=Je.unstable_getCurrentPriorityLevel,xi=Je.unstable_ImmediatePriority,yu=Je.unstable_UserBlockingPriority,Fa=Je.unstable_NormalPriority,Sp=Je.unstable_LowPriority,vu=Je.unstable_IdlePriority,uo=null,Ct=null;function jp(e){if(Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(uo,e,void 0,(e.current.flags&128)===128)}catch{}}var mt=Math.clz32?Math.clz32:Np,kp=Math.log,Cp=Math.LN2;function Np(e){return e>>>=0,e===0?32:31-(kp(e)/Cp|0)|0}var oa=64,sa=4194304;function gr(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Oa(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,a=e.suspendedLanes,s=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~a;l!==0?r=gr(l):(s&=i,s!==0&&(r=gr(s)))}else i=n&~a,i!==0?r=gr(i):s!==0&&(r=gr(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,s=t&-t,a>=s||a===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-mt(t),a=1<<n,r|=e[n],t&=~a;return r}function Ep(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function bp(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,s=e.pendingLanes;0<s;){var i=31-mt(s),l=1<<i,c=a[i];c===-1?(!(l&n)||l&r)&&(a[i]=Ep(l,t)):c<=t&&(e.expiredLanes|=l),s&=~l}}function Cs(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function xu(){var e=oa;return oa<<=1,!(oa&4194240)&&(oa=64),e}function $o(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Qr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-mt(t),e[t]=n}function Pp(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-mt(n),s=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~s}}function wi(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-mt(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var re=0;function wu(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Su,Si,ju,ku,Cu,Ns=!1,ia=[],Jt=null,Xt=null,qt=null,Rr=new Map,zr=new Map,Kt=[],Tp="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 submit".split(" ");function Cl(e,t){switch(e){case"focusin":case"focusout":Jt=null;break;case"dragenter":case"dragleave":Xt=null;break;case"mouseover":case"mouseout":qt=null;break;case"pointerover":case"pointerout":Rr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":zr.delete(t.pointerId)}}function ir(e,t,n,r,a,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[a]},t!==null&&(t=Jr(t),t!==null&&Si(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function Ip(e,t,n,r,a){switch(t){case"focusin":return Jt=ir(Jt,e,t,n,r,a),!0;case"dragenter":return Xt=ir(Xt,e,t,n,r,a),!0;case"mouseover":return qt=ir(qt,e,t,n,r,a),!0;case"pointerover":var s=a.pointerId;return Rr.set(s,ir(Rr.get(s)||null,e,t,n,r,a)),!0;case"gotpointercapture":return s=a.pointerId,zr.set(s,ir(zr.get(s)||null,e,t,n,r,a)),!0}return!1}function Nu(e){var t=mn(e.target);if(t!==null){var n=En(t);if(n!==null){if(t=n.tag,t===13){if(t=pu(n),t!==null){e.blockedOn=t,Cu(e.priority,function(){ju(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ka(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Es(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ws=r,n.target.dispatchEvent(r),ws=null}else return t=Jr(n),t!==null&&Si(t),e.blockedOn=n,!1;t.shift()}return!0}function Nl(e,t,n){ka(e)&&n.delete(t)}function _p(){Ns=!1,Jt!==null&&ka(Jt)&&(Jt=null),Xt!==null&&ka(Xt)&&(Xt=null),qt!==null&&ka(qt)&&(qt=null),Rr.forEach(Nl),zr.forEach(Nl)}function lr(e,t){e.blockedOn===t&&(e.blockedOn=null,Ns||(Ns=!0,Je.unstable_scheduleCallback(Je.unstable_NormalPriority,_p)))}function Ar(e){function t(a){return lr(a,e)}if(0<ia.length){lr(ia[0],e);for(var n=1;n<ia.length;n++){var r=ia[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Jt!==null&&lr(Jt,e),Xt!==null&&lr(Xt,e),qt!==null&&lr(qt,e),Rr.forEach(t),zr.forEach(t),n=0;n<Kt.length;n++)r=Kt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Kt.length&&(n=Kt[0],n.blockedOn===null);)Nu(n),n.blockedOn===null&&Kt.shift()}var Wn=Ot.ReactCurrentBatchConfig,Ba=!0;function Rp(e,t,n,r){var a=re,s=Wn.transition;Wn.transition=null;try{re=1,ji(e,t,n,r)}finally{re=a,Wn.transition=s}}function zp(e,t,n,r){var a=re,s=Wn.transition;Wn.transition=null;try{re=4,ji(e,t,n,r)}finally{re=a,Wn.transition=s}}function ji(e,t,n,r){if(Ba){var a=Es(e,t,n,r);if(a===null)Vo(e,t,r,Da,n),Cl(e,r);else if(Ip(a,e,t,n,r))r.stopPropagation();else if(Cl(e,r),t&4&&-1<Tp.indexOf(e)){for(;a!==null;){var s=Jr(a);if(s!==null&&Su(s),s=Es(e,t,n,r),s===null&&Vo(e,t,r,Da,n),s===a)break;a=s}a!==null&&r.stopPropagation()}else Vo(e,t,r,null,n)}}var Da=null;function Es(e,t,n,r){if(Da=null,e=vi(r),e=mn(e),e!==null)if(t=En(e),t===null)e=null;else if(n=t.tag,n===13){if(e=pu(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Da=e,null}function Eu(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(wp()){case xi:return 1;case yu:return 4;case Fa:case Sp:return 16;case vu:return 536870912;default:return 16}default:return 16}}var Qt=null,ki=null,Ca=null;function bu(){if(Ca)return Ca;var e,t=ki,n=t.length,r,a="value"in Qt?Qt.value:Qt.textContent,s=a.length;for(e=0;e<n&&t[e]===a[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===a[s-r];r++);return Ca=a.slice(e,1<r?1-r:void 0)}function Na(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 la(){return!0}function El(){return!1}function qe(e){function t(n,r,a,s,i){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=s,this.target=i,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?la:El,this.isPropagationStopped=El,this}return pe(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=la)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=la)},persist:function(){},isPersistent:la}),t}var er={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ci=qe(er),Yr=pe({},er,{view:0,detail:0}),Ap=qe(Yr),Lo,Mo,cr,fo=pe({},Yr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ni,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!==cr&&(cr&&e.type==="mousemove"?(Lo=e.screenX-cr.screenX,Mo=e.screenY-cr.screenY):Mo=Lo=0,cr=e),Lo)},movementY:function(e){return"movementY"in e?e.movementY:Mo}}),bl=qe(fo),$p=pe({},fo,{dataTransfer:0}),Lp=qe($p),Mp=pe({},Yr,{relatedTarget:0}),Fo=qe(Mp),Fp=pe({},er,{animationName:0,elapsedTime:0,pseudoElement:0}),Op=qe(Fp),Bp=pe({},er,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Dp=qe(Bp),Up=pe({},er,{data:0}),Pl=qe(Up),Wp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Hp={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"},Vp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Vp[e])?!!t[e]:!1}function Ni(){return Kp}var Gp=pe({},Yr,{key:function(e){if(e.key){var t=Wp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Na(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Hp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ni,charCode:function(e){return e.type==="keypress"?Na(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Na(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qp=qe(Gp),Yp=pe({},fo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Tl=qe(Yp),Jp=pe({},Yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ni}),Xp=qe(Jp),qp=pe({},er,{propertyName:0,elapsedTime:0,pseudoElement:0}),Zp=qe(qp),em=pe({},fo,{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}),tm=qe(em),nm=[9,13,27,32],Ei=At&&"CompositionEvent"in window,Sr=null;At&&"documentMode"in document&&(Sr=document.documentMode);var rm=At&&"TextEvent"in window&&!Sr,Pu=At&&(!Ei||Sr&&8<Sr&&11>=Sr),Il=" ",_l=!1;function Tu(e,t){switch(e){case"keyup":return nm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Iu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var In=!1;function am(e,t){switch(e){case"compositionend":return Iu(t);case"keypress":return t.which!==32?null:(_l=!0,Il);case"textInput":return e=t.data,e===Il&&_l?null:e;default:return null}}function om(e,t){if(In)return e==="compositionend"||!Ei&&Tu(e,t)?(e=bu(),Ca=ki=Qt=null,In=!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 Pu&&t.locale!=="ko"?null:t.data;default:return null}}var sm={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 Rl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!sm[e.type]:t==="textarea"}function _u(e,t,n,r){lu(r),t=Ua(t,"onChange"),0<t.length&&(n=new Ci("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var jr=null,$r=null;function im(e){Uu(e,0)}function po(e){var t=zn(e);if(tu(t))return e}function lm(e,t){if(e==="change")return t}var Ru=!1;if(At){var Oo;if(At){var Bo="oninput"in document;if(!Bo){var zl=document.createElement("div");zl.setAttribute("oninput","return;"),Bo=typeof zl.oninput=="function"}Oo=Bo}else Oo=!1;Ru=Oo&&(!document.documentMode||9<document.documentMode)}function Al(){jr&&(jr.detachEvent("onpropertychange",zu),$r=jr=null)}function zu(e){if(e.propertyName==="value"&&po($r)){var t=[];_u(t,$r,e,vi(e)),fu(im,t)}}function cm(e,t,n){e==="focusin"?(Al(),jr=t,$r=n,jr.attachEvent("onpropertychange",zu)):e==="focusout"&&Al()}function um(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return po($r)}function dm(e,t){if(e==="click")return po(t)}function fm(e,t){if(e==="input"||e==="change")return po(t)}function pm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gt=typeof Object.is=="function"?Object.is:pm;function Lr(e,t){if(gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!ls.call(t,a)||!gt(e[a],t[a]))return!1}return!0}function $l(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ll(e,t){var n=$l(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=$l(n)}}function Au(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Au(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $u(){for(var e=window,t=$a();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=$a(e.document)}return t}function bi(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")}function mm(e){var t=$u(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Au(n.ownerDocument.documentElement,n)){if(r!==null&&bi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,s=Math.min(r.start,a);r=r.end===void 0?s:Math.min(r.end,a),!e.extend&&s>r&&(a=r,r=s,s=a),a=Ll(n,s);var i=Ll(n,r);a&&i&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var hm=At&&"documentMode"in document&&11>=document.documentMode,_n=null,bs=null,kr=null,Ps=!1;function Ml(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ps||_n==null||_n!==$a(r)||(r=_n,"selectionStart"in r&&bi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kr&&Lr(kr,r)||(kr=r,r=Ua(bs,"onSelect"),0<r.length&&(t=new Ci("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=_n)))}function ca(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Rn={animationend:ca("Animation","AnimationEnd"),animationiteration:ca("Animation","AnimationIteration"),animationstart:ca("Animation","AnimationStart"),transitionend:ca("Transition","TransitionEnd")},Do={},Lu={};At&&(Lu=document.createElement("div").style,"AnimationEvent"in window||(delete Rn.animationend.animation,delete Rn.animationiteration.animation,delete Rn.animationstart.animation),"TransitionEvent"in window||delete Rn.transitionend.transition);function mo(e){if(Do[e])return Do[e];if(!Rn[e])return e;var t=Rn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Lu)return Do[e]=t[n];return e}var Mu=mo("animationend"),Fu=mo("animationiteration"),Ou=mo("animationstart"),Bu=mo("transitionend"),Du=new Map,Fl="abort auxClick 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(" ");function sn(e,t){Du.set(e,t),Nn(t,[e])}for(var Uo=0;Uo<Fl.length;Uo++){var Wo=Fl[Uo],gm=Wo.toLowerCase(),ym=Wo[0].toUpperCase()+Wo.slice(1);sn(gm,"on"+ym)}sn(Mu,"onAnimationEnd");sn(Fu,"onAnimationIteration");sn(Ou,"onAnimationStart");sn("dblclick","onDoubleClick");sn("focusin","onFocus");sn("focusout","onBlur");sn(Bu,"onTransitionEnd");Kn("onMouseEnter",["mouseout","mouseover"]);Kn("onMouseLeave",["mouseout","mouseover"]);Kn("onPointerEnter",["pointerout","pointerover"]);Kn("onPointerLeave",["pointerout","pointerover"]);Nn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Nn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Nn("onBeforeInput",["compositionend","keypress","textInput","paste"]);Nn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Nn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Nn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var yr="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(" "),vm=new Set("cancel close invalid load scroll toggle".split(" ").concat(yr));function Ol(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,gp(r,t,void 0,e),e.currentTarget=null}function Uu(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==s&&a.isPropagationStopped())break e;Ol(a,l,u),s=c}else for(i=0;i<r.length;i++){if(l=r[i],c=l.instance,u=l.currentTarget,l=l.listener,c!==s&&a.isPropagationStopped())break e;Ol(a,l,u),s=c}}}if(Ma)throw e=ks,Ma=!1,ks=null,e}function se(e,t){var n=t[zs];n===void 0&&(n=t[zs]=new Set);var r=e+"__bubble";n.has(r)||(Wu(t,e,2,!1),n.add(r))}function Ho(e,t,n){var r=0;t&&(r|=4),Wu(n,e,r,t)}var ua="_reactListening"+Math.random().toString(36).slice(2);function Mr(e){if(!e[ua]){e[ua]=!0,Jc.forEach(function(n){n!=="selectionchange"&&(vm.has(n)||Ho(n,!1,e),Ho(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ua]||(t[ua]=!0,Ho("selectionchange",!1,t))}}function Wu(e,t,n,r){switch(Eu(t)){case 1:var a=Rp;break;case 4:a=zp;break;default:a=ji}n=a.bind(null,t,n,e),a=void 0,!js||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Vo(e,t,n,r,a){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var l=r.stateNode.containerInfo;if(l===a||l.nodeType===8&&l.parentNode===a)break;if(i===4)for(i=r.return;i!==null;){var c=i.tag;if((c===3||c===4)&&(c=i.stateNode.containerInfo,c===a||c.nodeType===8&&c.parentNode===a))return;i=i.return}for(;l!==null;){if(i=mn(l),i===null)return;if(c=i.tag,c===5||c===6){r=s=i;continue e}l=l.parentNode}}r=r.return}fu(function(){var u=s,h=vi(n),f=[];e:{var g=Du.get(e);if(g!==void 0){var v=Ci,x=e;switch(e){case"keypress":if(Na(n)===0)break e;case"keydown":case"keyup":v=Qp;break;case"focusin":x="focus",v=Fo;break;case"focusout":x="blur",v=Fo;break;case"beforeblur":case"afterblur":v=Fo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":v=bl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":v=Lp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":v=Xp;break;case Mu:case Fu:case Ou:v=Op;break;case Bu:v=Zp;break;case"scroll":v=Ap;break;case"wheel":v=tm;break;case"copy":case"cut":case"paste":v=Dp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":v=Tl}var w=(t&4)!==0,j=!w&&e==="scroll",m=w?g!==null?g+"Capture":null:g;w=[];for(var p=u,y;p!==null;){y=p;var S=y.stateNode;if(y.tag===5&&S!==null&&(y=S,m!==null&&(S=_r(p,m),S!=null&&w.push(Fr(p,S,y)))),j)break;p=p.return}0<w.length&&(g=new v(g,x,null,n,h),f.push({event:g,listeners:w}))}}if(!(t&7)){e:{if(g=e==="mouseover"||e==="pointerover",v=e==="mouseout"||e==="pointerout",g&&n!==ws&&(x=n.relatedTarget||n.fromElement)&&(mn(x)||x[$t]))break e;if((v||g)&&(g=h.window===h?h:(g=h.ownerDocument)?g.defaultView||g.parentWindow:window,v?(x=n.relatedTarget||n.toElement,v=u,x=x?mn(x):null,x!==null&&(j=En(x),x!==j||x.tag!==5&&x.tag!==6)&&(x=null)):(v=null,x=u),v!==x)){if(w=bl,S="onMouseLeave",m="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(w=Tl,S="onPointerLeave",m="onPointerEnter",p="pointer"),j=v==null?g:zn(v),y=x==null?g:zn(x),g=new w(S,p+"leave",v,n,h),g.target=j,g.relatedTarget=y,S=null,mn(h)===u&&(w=new w(m,p+"enter",x,n,h),w.target=y,w.relatedTarget=j,S=w),j=S,v&&x)t:{for(w=v,m=x,p=0,y=w;y;y=bn(y))p++;for(y=0,S=m;S;S=bn(S))y++;for(;0<p-y;)w=bn(w),p--;for(;0<y-p;)m=bn(m),y--;for(;p--;){if(w===m||m!==null&&w===m.alternate)break t;w=bn(w),m=bn(m)}w=null}else w=null;v!==null&&Bl(f,g,v,w,!1),x!==null&&j!==null&&Bl(f,j,x,w,!0)}}e:{if(g=u?zn(u):window,v=g.nodeName&&g.nodeName.toLowerCase(),v==="select"||v==="input"&&g.type==="file")var b=lm;else if(Rl(g))if(Ru)b=fm;else{b=um;var T=cm}else(v=g.nodeName)&&v.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(b=dm);if(b&&(b=b(e,u))){_u(f,b,n,h);break e}T&&T(e,g,u),e==="focusout"&&(T=g._wrapperState)&&T.controlled&&g.type==="number"&&hs(g,"number",g.value)}switch(T=u?zn(u):window,e){case"focusin":(Rl(T)||T.contentEditable==="true")&&(_n=T,bs=u,kr=null);break;case"focusout":kr=bs=_n=null;break;case"mousedown":Ps=!0;break;case"contextmenu":case"mouseup":case"dragend":Ps=!1,Ml(f,n,h);break;case"selectionchange":if(hm)break;case"keydown":case"keyup":Ml(f,n,h)}var k;if(Ei)e:{switch(e){case"compositionstart":var E="onCompositionStart";break e;case"compositionend":E="onCompositionEnd";break e;case"compositionupdate":E="onCompositionUpdate";break e}E=void 0}else In?Tu(e,n)&&(E="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(Pu&&n.locale!=="ko"&&(In||E!=="onCompositionStart"?E==="onCompositionEnd"&&In&&(k=bu()):(Qt=h,ki="value"in Qt?Qt.value:Qt.textContent,In=!0)),T=Ua(u,E),0<T.length&&(E=new Pl(E,e,null,n,h),f.push({event:E,listeners:T}),k?E.data=k:(k=Iu(n),k!==null&&(E.data=k)))),(k=rm?am(e,n):om(e,n))&&(u=Ua(u,"onBeforeInput"),0<u.length&&(h=new Pl("onBeforeInput","beforeinput",null,n,h),f.push({event:h,listeners:u}),h.data=k))}Uu(f,t)})}function Fr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ua(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,s=a.stateNode;a.tag===5&&s!==null&&(a=s,s=_r(e,n),s!=null&&r.unshift(Fr(e,s,a)),s=_r(e,t),s!=null&&r.push(Fr(e,s,a))),e=e.return}return r}function bn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Bl(e,t,n,r,a){for(var s=t._reactName,i=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,a?(c=_r(n,s),c!=null&&i.unshift(Fr(n,c,l))):a||(c=_r(n,s),c!=null&&i.push(Fr(n,c,l)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var xm=/\r\n?/g,wm=/\u0000|\uFFFD/g;function Dl(e){return(typeof e=="string"?e:""+e).replace(xm,`
38
- `).replace(wm,"")}function da(e,t,n){if(t=Dl(t),Dl(e)!==t&&n)throw Error(A(425))}function Wa(){}var Ts=null,Is=null;function _s(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Rs=typeof setTimeout=="function"?setTimeout:void 0,Sm=typeof clearTimeout=="function"?clearTimeout:void 0,Ul=typeof Promise=="function"?Promise:void 0,jm=typeof queueMicrotask=="function"?queueMicrotask:typeof Ul<"u"?function(e){return Ul.resolve(null).then(e).catch(km)}:Rs;function km(e){setTimeout(function(){throw e})}function Ko(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(r===0){e.removeChild(a),Ar(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);Ar(t)}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==="$?")break;if(t==="/$")return null}}return e}function Wl(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var tr=Math.random().toString(36).slice(2),kt="__reactFiber$"+tr,Or="__reactProps$"+tr,$t="__reactContainer$"+tr,zs="__reactEvents$"+tr,Cm="__reactListeners$"+tr,Nm="__reactHandles$"+tr;function mn(e){var t=e[kt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[$t]||n[kt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Wl(e);e!==null;){if(n=e[kt])return n;e=Wl(e)}return t}e=n,n=e.parentNode}return null}function Jr(e){return e=e[kt]||e[$t],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function zn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(A(33))}function ho(e){return e[Or]||null}var As=[],An=-1;function ln(e){return{current:e}}function ie(e){0>An||(e.current=As[An],As[An]=null,An--)}function oe(e,t){An++,As[An]=e.current,e.current=t}var on={},ze=ln(on),Ue=ln(!1),wn=on;function Gn(e,t){var n=e.type.contextTypes;if(!n)return on;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},s;for(s in n)a[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function We(e){return e=e.childContextTypes,e!=null}function Ha(){ie(Ue),ie(ze)}function Hl(e,t,n){if(ze.current!==on)throw Error(A(168));oe(ze,t),oe(Ue,n)}function Hu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var a in r)if(!(a in t))throw Error(A(108,cp(e)||"Unknown",a));return pe({},n,r)}function Va(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||on,wn=ze.current,oe(ze,e),oe(Ue,Ue.current),!0}function Vl(e,t,n){var r=e.stateNode;if(!r)throw Error(A(169));n?(e=Hu(e,t,wn),r.__reactInternalMemoizedMergedChildContext=e,ie(Ue),ie(ze),oe(ze,e)):ie(Ue),oe(Ue,n)}var Tt=null,go=!1,Go=!1;function Vu(e){Tt===null?Tt=[e]:Tt.push(e)}function Em(e){go=!0,Vu(e)}function cn(){if(!Go&&Tt!==null){Go=!0;var e=0,t=re;try{var n=Tt;for(re=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Tt=null,go=!1}catch(a){throw Tt!==null&&(Tt=Tt.slice(e+1)),gu(xi,cn),a}finally{re=t,Go=!1}}return null}var $n=[],Ln=0,Ka=null,Ga=0,tt=[],nt=0,Sn=null,It=1,_t="";function dn(e,t){$n[Ln++]=Ga,$n[Ln++]=Ka,Ka=e,Ga=t}function Ku(e,t,n){tt[nt++]=It,tt[nt++]=_t,tt[nt++]=Sn,Sn=e;var r=It;e=_t;var a=32-mt(r)-1;r&=~(1<<a),n+=1;var s=32-mt(t)+a;if(30<s){var i=a-a%5;s=(r&(1<<i)-1).toString(32),r>>=i,a-=i,It=1<<32-mt(t)+a|n<<a|r,_t=s+e}else It=1<<s|n<<a|r,_t=e}function Pi(e){e.return!==null&&(dn(e,1),Ku(e,1,0))}function Ti(e){for(;e===Ka;)Ka=$n[--Ln],$n[Ln]=null,Ga=$n[--Ln],$n[Ln]=null;for(;e===Sn;)Sn=tt[--nt],tt[nt]=null,_t=tt[--nt],tt[nt]=null,It=tt[--nt],tt[nt]=null}var Ye=null,Qe=null,le=!1,pt=null;function Gu(e,t){var n=rt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Kl(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Ye=e,Qe=Zt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Ye=e,Qe=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Sn!==null?{id:It,overflow:_t}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ye=e,Qe=null,!0):!1;default:return!1}}function $s(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ls(e){if(le){var t=Qe;if(t){var n=t;if(!Kl(e,t)){if($s(e))throw Error(A(418));t=Zt(n.nextSibling);var r=Ye;t&&Kl(e,t)?Gu(r,n):(e.flags=e.flags&-4097|2,le=!1,Ye=e)}}else{if($s(e))throw Error(A(418));e.flags=e.flags&-4097|2,le=!1,Ye=e}}}function Gl(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ye=e}function fa(e){if(e!==Ye)return!1;if(!le)return Gl(e),le=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!_s(e.type,e.memoizedProps)),t&&(t=Qe)){if($s(e))throw Qu(),Error(A(418));for(;t;)Gu(e,t),t=Zt(t.nextSibling)}if(Gl(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(A(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Qe=Zt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Qe=null}}else Qe=Ye?Zt(e.stateNode.nextSibling):null;return!0}function Qu(){for(var e=Qe;e;)e=Zt(e.nextSibling)}function Qn(){Qe=Ye=null,le=!1}function Ii(e){pt===null?pt=[e]:pt.push(e)}var bm=Ot.ReactCurrentBatchConfig;function ur(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(A(309));var r=n.stateNode}if(!r)throw Error(A(147,e));var a=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(i){var l=a.refs;i===null?delete l[s]:l[s]=i},t._stringRef=s,t)}if(typeof e!="string")throw Error(A(284));if(!n._owner)throw Error(A(290,e))}return e}function pa(e,t){throw e=Object.prototype.toString.call(t),Error(A(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Ql(e){var t=e._init;return t(e._payload)}function Yu(e){function t(m,p){if(e){var y=m.deletions;y===null?(m.deletions=[p],m.flags|=16):y.push(p)}}function n(m,p){if(!e)return null;for(;p!==null;)t(m,p),p=p.sibling;return null}function r(m,p){for(m=new Map;p!==null;)p.key!==null?m.set(p.key,p):m.set(p.index,p),p=p.sibling;return m}function a(m,p){return m=rn(m,p),m.index=0,m.sibling=null,m}function s(m,p,y){return m.index=y,e?(y=m.alternate,y!==null?(y=y.index,y<p?(m.flags|=2,p):y):(m.flags|=2,p)):(m.flags|=1048576,p)}function i(m){return e&&m.alternate===null&&(m.flags|=2),m}function l(m,p,y,S){return p===null||p.tag!==6?(p=es(y,m.mode,S),p.return=m,p):(p=a(p,y),p.return=m,p)}function c(m,p,y,S){var b=y.type;return b===Tn?h(m,p,y.props.children,S,y.key):p!==null&&(p.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Wt&&Ql(b)===p.type)?(S=a(p,y.props),S.ref=ur(m,p,y),S.return=m,S):(S=Ra(y.type,y.key,y.props,null,m.mode,S),S.ref=ur(m,p,y),S.return=m,S)}function u(m,p,y,S){return p===null||p.tag!==4||p.stateNode.containerInfo!==y.containerInfo||p.stateNode.implementation!==y.implementation?(p=ts(y,m.mode,S),p.return=m,p):(p=a(p,y.children||[]),p.return=m,p)}function h(m,p,y,S,b){return p===null||p.tag!==7?(p=xn(y,m.mode,S,b),p.return=m,p):(p=a(p,y),p.return=m,p)}function f(m,p,y){if(typeof p=="string"&&p!==""||typeof p=="number")return p=es(""+p,m.mode,y),p.return=m,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case na:return y=Ra(p.type,p.key,p.props,null,m.mode,y),y.ref=ur(m,null,p),y.return=m,y;case Pn:return p=ts(p,m.mode,y),p.return=m,p;case Wt:var S=p._init;return f(m,S(p._payload),y)}if(hr(p)||or(p))return p=xn(p,m.mode,y,null),p.return=m,p;pa(m,p)}return null}function g(m,p,y,S){var b=p!==null?p.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return b!==null?null:l(m,p,""+y,S);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case na:return y.key===b?c(m,p,y,S):null;case Pn:return y.key===b?u(m,p,y,S):null;case Wt:return b=y._init,g(m,p,b(y._payload),S)}if(hr(y)||or(y))return b!==null?null:h(m,p,y,S,null);pa(m,y)}return null}function v(m,p,y,S,b){if(typeof S=="string"&&S!==""||typeof S=="number")return m=m.get(y)||null,l(p,m,""+S,b);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case na:return m=m.get(S.key===null?y:S.key)||null,c(p,m,S,b);case Pn:return m=m.get(S.key===null?y:S.key)||null,u(p,m,S,b);case Wt:var T=S._init;return v(m,p,y,T(S._payload),b)}if(hr(S)||or(S))return m=m.get(y)||null,h(p,m,S,b,null);pa(p,S)}return null}function x(m,p,y,S){for(var b=null,T=null,k=p,E=p=0,N=null;k!==null&&E<y.length;E++){k.index>E?(N=k,k=null):N=k.sibling;var I=g(m,k,y[E],S);if(I===null){k===null&&(k=N);break}e&&k&&I.alternate===null&&t(m,k),p=s(I,p,E),T===null?b=I:T.sibling=I,T=I,k=N}if(E===y.length)return n(m,k),le&&dn(m,E),b;if(k===null){for(;E<y.length;E++)k=f(m,y[E],S),k!==null&&(p=s(k,p,E),T===null?b=k:T.sibling=k,T=k);return le&&dn(m,E),b}for(k=r(m,k);E<y.length;E++)N=v(k,m,E,y[E],S),N!==null&&(e&&N.alternate!==null&&k.delete(N.key===null?E:N.key),p=s(N,p,E),T===null?b=N:T.sibling=N,T=N);return e&&k.forEach(function(D){return t(m,D)}),le&&dn(m,E),b}function w(m,p,y,S){var b=or(y);if(typeof b!="function")throw Error(A(150));if(y=b.call(y),y==null)throw Error(A(151));for(var T=b=null,k=p,E=p=0,N=null,I=y.next();k!==null&&!I.done;E++,I=y.next()){k.index>E?(N=k,k=null):N=k.sibling;var D=g(m,k,I.value,S);if(D===null){k===null&&(k=N);break}e&&k&&D.alternate===null&&t(m,k),p=s(D,p,E),T===null?b=D:T.sibling=D,T=D,k=N}if(I.done)return n(m,k),le&&dn(m,E),b;if(k===null){for(;!I.done;E++,I=y.next())I=f(m,I.value,S),I!==null&&(p=s(I,p,E),T===null?b=I:T.sibling=I,T=I);return le&&dn(m,E),b}for(k=r(m,k);!I.done;E++,I=y.next())I=v(k,m,E,I.value,S),I!==null&&(e&&I.alternate!==null&&k.delete(I.key===null?E:I.key),p=s(I,p,E),T===null?b=I:T.sibling=I,T=I);return e&&k.forEach(function(V){return t(m,V)}),le&&dn(m,E),b}function j(m,p,y,S){if(typeof y=="object"&&y!==null&&y.type===Tn&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case na:e:{for(var b=y.key,T=p;T!==null;){if(T.key===b){if(b=y.type,b===Tn){if(T.tag===7){n(m,T.sibling),p=a(T,y.props.children),p.return=m,m=p;break e}}else if(T.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Wt&&Ql(b)===T.type){n(m,T.sibling),p=a(T,y.props),p.ref=ur(m,T,y),p.return=m,m=p;break e}n(m,T);break}else t(m,T);T=T.sibling}y.type===Tn?(p=xn(y.props.children,m.mode,S,y.key),p.return=m,m=p):(S=Ra(y.type,y.key,y.props,null,m.mode,S),S.ref=ur(m,p,y),S.return=m,m=S)}return i(m);case Pn:e:{for(T=y.key;p!==null;){if(p.key===T)if(p.tag===4&&p.stateNode.containerInfo===y.containerInfo&&p.stateNode.implementation===y.implementation){n(m,p.sibling),p=a(p,y.children||[]),p.return=m,m=p;break e}else{n(m,p);break}else t(m,p);p=p.sibling}p=ts(y,m.mode,S),p.return=m,m=p}return i(m);case Wt:return T=y._init,j(m,p,T(y._payload),S)}if(hr(y))return x(m,p,y,S);if(or(y))return w(m,p,y,S);pa(m,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,p!==null&&p.tag===6?(n(m,p.sibling),p=a(p,y),p.return=m,m=p):(n(m,p),p=es(y,m.mode,S),p.return=m,m=p),i(m)):n(m,p)}return j}var Yn=Yu(!0),Ju=Yu(!1),Qa=ln(null),Ya=null,Mn=null,_i=null;function Ri(){_i=Mn=Ya=null}function zi(e){var t=Qa.current;ie(Qa),e._currentValue=t}function Ms(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Hn(e,t){Ya=e,_i=Mn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(De=!0),e.firstContext=null)}function ot(e){var t=e._currentValue;if(_i!==e)if(e={context:e,memoizedValue:t,next:null},Mn===null){if(Ya===null)throw Error(A(308));Mn=e,Ya.dependencies={lanes:0,firstContext:e}}else Mn=Mn.next=e;return t}var hn=null;function Ai(e){hn===null?hn=[e]:hn.push(e)}function Xu(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,Ai(t)):(n.next=a.next,a.next=n),t.interleaved=n,Lt(e,r)}function Lt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ht=!1;function $i(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects: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,effects:e.effects})}function zt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function en(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ee&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Lt(e,n)}return a=r.interleaved,a===null?(t.next=t,Ai(r)):(t.next=a.next,a.next=t),r.interleaved=t,Lt(e,n)}function Ea(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,wi(e,n)}}function Yl(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?a=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?a=s=t:s=s.next=t}else a=s=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ja(e,t,n,r){var a=e.updateQueue;Ht=!1;var s=a.firstBaseUpdate,i=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,u=c.next;c.next=null,i===null?s=u:i.next=u,i=c;var h=e.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==i&&(l===null?h.firstBaseUpdate=u:l.next=u,h.lastBaseUpdate=c))}if(s!==null){var f=a.baseState;i=0,h=u=c=null,l=s;do{var g=l.lane,v=l.eventTime;if((r&g)===g){h!==null&&(h=h.next={eventTime:v,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,w=l;switch(g=t,v=n,w.tag){case 1:if(x=w.payload,typeof x=="function"){f=x.call(v,f,g);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=w.payload,g=typeof x=="function"?x.call(v,f,g):x,g==null)break e;f=pe({},f,g);break e;case 2:Ht=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,g=a.effects,g===null?a.effects=[l]:g.push(l))}else v={eventTime:v,lane:g,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(u=h=v,c=f):h=h.next=v,i|=g;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;g=l,l=g.next,g.next=null,a.lastBaseUpdate=g,a.shared.pending=null}}while(!0);if(h===null&&(c=f),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=h,t=a.shared.interleaved,t!==null){a=t;do i|=a.lane,a=a.next;while(a!==t)}else s===null&&(a.shared.lanes=0);kn|=i,e.lanes=i,e.memoizedState=f}}function Jl(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(a!==null){if(r.callback=null,r=n,typeof a!="function")throw Error(A(191,a));a.call(r)}}}var Xr={},Nt=ln(Xr),Br=ln(Xr),Dr=ln(Xr);function gn(e){if(e===Xr)throw Error(A(174));return e}function Li(e,t){switch(oe(Dr,t),oe(Br,e),oe(Nt,Xr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ys(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ys(t,e)}ie(Nt),oe(Nt,t)}function Jn(){ie(Nt),ie(Br),ie(Dr)}function Zu(e){gn(Dr.current);var t=gn(Nt.current),n=ys(t,e.type);t!==n&&(oe(Br,e),oe(Nt,n))}function Mi(e){Br.current===e&&(ie(Nt),ie(Br))}var de=ln(0);function Xa(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)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 Qo=[];function Fi(){for(var e=0;e<Qo.length;e++)Qo[e]._workInProgressVersionPrimary=null;Qo.length=0}var ba=Ot.ReactCurrentDispatcher,Yo=Ot.ReactCurrentBatchConfig,jn=0,fe=null,xe=null,je=null,qa=!1,Cr=!1,Ur=0,Pm=0;function Te(){throw Error(A(321))}function Oi(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gt(e[n],t[n]))return!1;return!0}function Bi(e,t,n,r,a,s){if(jn=s,fe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ba.current=e===null||e.memoizedState===null?Rm:zm,e=n(r,a),Cr){s=0;do{if(Cr=!1,Ur=0,25<=s)throw Error(A(301));s+=1,je=xe=null,t.updateQueue=null,ba.current=Am,e=n(r,a)}while(Cr)}if(ba.current=Za,t=xe!==null&&xe.next!==null,jn=0,je=xe=fe=null,qa=!1,t)throw Error(A(300));return e}function Di(){var e=Ur!==0;return Ur=0,e}function St(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return je===null?fe.memoizedState=je=e:je=je.next=e,je}function st(){if(xe===null){var e=fe.alternate;e=e!==null?e.memoizedState:null}else e=xe.next;var t=je===null?fe.memoizedState:je.next;if(t!==null)je=t,xe=e;else{if(e===null)throw Error(A(310));xe=e,e={memoizedState:xe.memoizedState,baseState:xe.baseState,baseQueue:xe.baseQueue,queue:xe.queue,next:null},je===null?fe.memoizedState=je=e:je=je.next=e}return je}function Wr(e,t){return typeof t=="function"?t(e):t}function Jo(e){var t=st(),n=t.queue;if(n===null)throw Error(A(311));n.lastRenderedReducer=e;var r=xe,a=r.baseQueue,s=n.pending;if(s!==null){if(a!==null){var i=a.next;a.next=s.next,s.next=i}r.baseQueue=a=s,n.pending=null}if(a!==null){s=a.next,r=r.baseState;var l=i=null,c=null,u=s;do{var h=u.lane;if((jn&h)===h)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:h,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,i=r):c=c.next=f,fe.lanes|=h,kn|=h}u=u.next}while(u!==null&&u!==s);c===null?i=r:c.next=l,gt(r,t.memoizedState)||(De=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){a=e;do s=a.lane,fe.lanes|=s,kn|=s,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Xo(e){var t=st(),n=t.queue;if(n===null)throw Error(A(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,s=t.memoizedState;if(a!==null){n.pending=null;var i=a=a.next;do s=e(s,i.action),i=i.next;while(i!==a);gt(s,t.memoizedState)||(De=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function ed(){}function td(e,t){var n=fe,r=st(),a=t(),s=!gt(r.memoizedState,a);if(s&&(r.memoizedState=a,De=!0),r=r.queue,Ui(ad.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||je!==null&&je.memoizedState.tag&1){if(n.flags|=2048,Hr(9,rd.bind(null,n,r,a,t),void 0,null),ke===null)throw Error(A(349));jn&30||nd(n,t,a)}return a}function nd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=fe.updateQueue,t===null?(t={lastEffect:null,stores:null},fe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function rd(e,t,n,r){t.value=n,t.getSnapshot=r,od(t)&&sd(e)}function ad(e,t,n){return n(function(){od(t)&&sd(e)})}function od(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gt(e,n)}catch{return!0}}function sd(e){var t=Lt(e,1);t!==null&&ht(t,e,1,-1)}function Xl(e){var t=St();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Wr,lastRenderedState:e},t.queue=e,e=e.dispatch=_m.bind(null,fe,e),[t.memoizedState,e]}function Hr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=fe.updateQueue,t===null?(t={lastEffect:null,stores:null},fe.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function id(){return st().memoizedState}function Pa(e,t,n,r){var a=St();fe.flags|=e,a.memoizedState=Hr(1|t,n,void 0,r===void 0?null:r)}function yo(e,t,n,r){var a=st();r=r===void 0?null:r;var s=void 0;if(xe!==null){var i=xe.memoizedState;if(s=i.destroy,r!==null&&Oi(r,i.deps)){a.memoizedState=Hr(t,n,s,r);return}}fe.flags|=e,a.memoizedState=Hr(1|t,n,s,r)}function ql(e,t){return Pa(8390656,8,e,t)}function Ui(e,t){return yo(2048,8,e,t)}function ld(e,t){return yo(4,2,e,t)}function cd(e,t){return yo(4,4,e,t)}function ud(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function dd(e,t,n){return n=n!=null?n.concat([e]):null,yo(4,4,ud.bind(null,t,e),n)}function Wi(){}function fd(e,t){var n=st();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oi(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function pd(e,t){var n=st();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oi(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function md(e,t,n){return jn&21?(gt(n,t)||(n=xu(),fe.lanes|=n,kn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,De=!0),e.memoizedState=n)}function Tm(e,t){var n=re;re=n!==0&&4>n?n:4,e(!0);var r=Yo.transition;Yo.transition={};try{e(!1),t()}finally{re=n,Yo.transition=r}}function hd(){return st().memoizedState}function Im(e,t,n){var r=nn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},gd(e))yd(t,n);else if(n=Xu(e,t,n,r),n!==null){var a=Le();ht(n,e,r,a),vd(n,t,r)}}function _m(e,t,n){var r=nn(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(gd(e))yd(t,a);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var i=t.lastRenderedState,l=s(i,n);if(a.hasEagerState=!0,a.eagerState=l,gt(l,i)){var c=t.interleaved;c===null?(a.next=a,Ai(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=Xu(e,t,a,r),n!==null&&(a=Le(),ht(n,e,r,a),vd(n,t,r))}}function gd(e){var t=e.alternate;return e===fe||t!==null&&t===fe}function yd(e,t){Cr=qa=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function vd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,wi(e,n)}}var Za={readContext:ot,useCallback:Te,useContext:Te,useEffect:Te,useImperativeHandle:Te,useInsertionEffect:Te,useLayoutEffect:Te,useMemo:Te,useReducer:Te,useRef:Te,useState:Te,useDebugValue:Te,useDeferredValue:Te,useTransition:Te,useMutableSource:Te,useSyncExternalStore:Te,useId:Te,unstable_isNewReconciler:!1},Rm={readContext:ot,useCallback:function(e,t){return St().memoizedState=[e,t===void 0?null:t],e},useContext:ot,useEffect:ql,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Pa(4194308,4,ud.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Pa(4194308,4,e,t)},useInsertionEffect:function(e,t){return Pa(4,2,e,t)},useMemo:function(e,t){var n=St();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=St();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Im.bind(null,fe,e),[r.memoizedState,e]},useRef:function(e){var t=St();return e={current:e},t.memoizedState=e},useState:Xl,useDebugValue:Wi,useDeferredValue:function(e){return St().memoizedState=e},useTransition:function(){var e=Xl(!1),t=e[0];return e=Tm.bind(null,e[1]),St().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=fe,a=St();if(le){if(n===void 0)throw Error(A(407));n=n()}else{if(n=t(),ke===null)throw Error(A(349));jn&30||nd(r,t,n)}a.memoizedState=n;var s={value:n,getSnapshot:t};return a.queue=s,ql(ad.bind(null,r,s,e),[e]),r.flags|=2048,Hr(9,rd.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=St(),t=ke.identifierPrefix;if(le){var n=_t,r=It;n=(r&~(1<<32-mt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ur++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Pm++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},zm={readContext:ot,useCallback:fd,useContext:ot,useEffect:Ui,useImperativeHandle:dd,useInsertionEffect:ld,useLayoutEffect:cd,useMemo:pd,useReducer:Jo,useRef:id,useState:function(){return Jo(Wr)},useDebugValue:Wi,useDeferredValue:function(e){var t=st();return md(t,xe.memoizedState,e)},useTransition:function(){var e=Jo(Wr)[0],t=st().memoizedState;return[e,t]},useMutableSource:ed,useSyncExternalStore:td,useId:hd,unstable_isNewReconciler:!1},Am={readContext:ot,useCallback:fd,useContext:ot,useEffect:Ui,useImperativeHandle:dd,useInsertionEffect:ld,useLayoutEffect:cd,useMemo:pd,useReducer:Xo,useRef:id,useState:function(){return Xo(Wr)},useDebugValue:Wi,useDeferredValue:function(e){var t=st();return xe===null?t.memoizedState=e:md(t,xe.memoizedState,e)},useTransition:function(){var e=Xo(Wr)[0],t=st().memoizedState;return[e,t]},useMutableSource:ed,useSyncExternalStore:td,useId:hd,unstable_isNewReconciler:!1};function dt(e,t){if(e&&e.defaultProps){t=pe({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Fs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:pe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vo={isMounted:function(e){return(e=e._reactInternals)?En(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Le(),a=nn(e),s=zt(r,a);s.payload=t,n!=null&&(s.callback=n),t=en(e,s,a),t!==null&&(ht(t,e,a,r),Ea(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Le(),a=nn(e),s=zt(r,a);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=en(e,s,a),t!==null&&(ht(t,e,a,r),Ea(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Le(),r=nn(e),a=zt(n,r);a.tag=2,t!=null&&(a.callback=t),t=en(e,a,r),t!==null&&(ht(t,e,r,n),Ea(t,e,r))}};function Zl(e,t,n,r,a,s,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,i):t.prototype&&t.prototype.isPureReactComponent?!Lr(n,r)||!Lr(a,s):!0}function xd(e,t,n){var r=!1,a=on,s=t.contextType;return typeof s=="object"&&s!==null?s=ot(s):(a=We(t)?wn:ze.current,r=t.contextTypes,s=(r=r!=null)?Gn(e,a):on),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=vo,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=s),t}function ec(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&vo.enqueueReplaceState(t,t.state,null)}function Os(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},$i(e);var s=t.contextType;typeof s=="object"&&s!==null?a.context=ot(s):(s=We(t)?wn:ze.current,a.context=Gn(e,s)),a.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Fs(e,t,s,n),a.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(t=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),t!==a.state&&vo.enqueueReplaceState(a,a.state,null),Ja(e,n,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function Xn(e,t){try{var n="",r=t;do n+=lp(r),r=r.return;while(r);var a=n}catch(s){a=`
37
+ `+a[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=l);break}}}finally{_o=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?mr(e):""}function cp(e){switch(e.tag){case 5:return mr(e.type);case 16:return mr("Lazy");case 13:return mr("Suspense");case 19:return mr("SuspenseList");case 0:case 2:case 15:return e=zo(e.type,!1),e;case 11:return e=zo(e.type.render,!1),e;case 1:return e=zo(e.type,!0),e;default:return""}}function ps(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Tn:return"Fragment";case Pn:return"Portal";case us:return"Profiler";case gi:return"StrictMode";case ds:return"Suspense";case fs:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Zc:return(e.displayName||"Context")+".Consumer";case qc:return(e._context.displayName||"Context")+".Provider";case vi:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case yi:return t=e.displayName||null,t!==null?t:ps(e.type)||"Memo";case Wt:t=e._payload,e=e._init;try{return ps(e(t))}catch{}}return null}function up(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ps(t);case 8:return t===gi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function an(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function tu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function dp(e){var t=tu(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(i){r=""+i,s.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ra(e){e._valueTracker||(e._valueTracker=dp(e))}function nu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=tu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function $a(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}}function ms(e,t){var n=t.checked;return pe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function yl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=an(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function ru(e,t){t=t.checked,t!=null&&hi(e,"checked",t,!1)}function hs(e,t){ru(e,t);var n=an(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?gs(e,t.type,n):t.hasOwnProperty("defaultValue")&&gs(e,t.type,an(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xl(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function gs(e,t,n){(t!=="number"||$a(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var hr=Array.isArray;function Bn(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+an(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function vs(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(A(91));return pe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function wl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(A(92));if(hr(n)){if(1<n.length)throw Error(A(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:an(n)}}function au(e,t){var n=an(t.value),r=an(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Sl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function ou(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ys(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?ou(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var aa,su=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,a){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,a)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(aa=aa||document.createElement("div"),aa.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=aa.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ir(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fp=["Webkit","ms","Moz","O"];Object.keys(xr).forEach(function(e){fp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xr[t]=xr[e]})});function iu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||xr.hasOwnProperty(e)&&xr[e]?(""+t).trim():t+"px"}function lu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=iu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var pp=pe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function xs(e,t){if(t){if(pp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(A(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(A(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(A(61))}if(t.style!=null&&typeof t.style!="object")throw Error(A(62))}}function ws(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 Ss=null;function xi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var js=null,Dn=null,Un=null;function jl(e){if(e=Jr(e)){if(typeof js!="function")throw Error(A(280));var t=e.stateNode;t&&(t=ho(t),js(e.stateNode,e.type,t))}}function cu(e){Dn?Un?Un.push(e):Un=[e]:Dn=e}function uu(){if(Dn){var e=Dn,t=Un;if(Un=Dn=null,jl(e),t)for(e=0;e<t.length;e++)jl(t[e])}}function du(e,t){return e(t)}function fu(){}var Ao=!1;function pu(e,t,n){if(Ao)return e(t,n);Ao=!0;try{return du(e,t,n)}finally{Ao=!1,(Dn!==null||Un!==null)&&(fu(),uu())}}function Rr(e,t){var n=e.stateNode;if(n===null)return null;var r=ho(n);if(r===null)return null;n=r[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":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(A(231,t,typeof n));return n}var ks=!1;if(At)try{var sr={};Object.defineProperty(sr,"passive",{get:function(){ks=!0}}),window.addEventListener("test",sr,sr),window.removeEventListener("test",sr,sr)}catch{ks=!1}function mp(e,t,n,r,a,s,i,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(h){this.onError(h)}}var wr=!1,La=null,Ma=!1,Cs=null,hp={onError:function(e){wr=!0,La=e}};function gp(e,t,n,r,a,s,i,l,c){wr=!1,La=null,mp.apply(hp,arguments)}function vp(e,t,n,r,a,s,i,l,c){if(gp.apply(this,arguments),wr){if(wr){var u=La;wr=!1,La=null}else throw Error(A(198));Ma||(Ma=!0,Cs=u)}}function bn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function mu(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 kl(e){if(bn(e)!==e)throw Error(A(188))}function yp(e){var t=e.alternate;if(!t){if(t=bn(e),t===null)throw Error(A(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return kl(a),e;if(s===r)return kl(a),t;s=s.sibling}throw Error(A(188))}if(n.return!==r.return)n=a,r=s;else{for(var i=!1,l=a.child;l;){if(l===n){i=!0,n=a,r=s;break}if(l===r){i=!0,r=a,n=s;break}l=l.sibling}if(!i){for(l=s.child;l;){if(l===n){i=!0,n=s,r=a;break}if(l===r){i=!0,r=s,n=a;break}l=l.sibling}if(!i)throw Error(A(189))}}if(n.alternate!==r)throw Error(A(190))}if(n.tag!==3)throw Error(A(188));return n.stateNode.current===n?e:t}function hu(e){return e=yp(e),e!==null?gu(e):null}function gu(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=gu(e);if(t!==null)return t;e=e.sibling}return null}var vu=Je.unstable_scheduleCallback,Cl=Je.unstable_cancelCallback,xp=Je.unstable_shouldYield,wp=Je.unstable_requestPaint,he=Je.unstable_now,Sp=Je.unstable_getCurrentPriorityLevel,wi=Je.unstable_ImmediatePriority,yu=Je.unstable_UserBlockingPriority,Fa=Je.unstable_NormalPriority,jp=Je.unstable_LowPriority,xu=Je.unstable_IdlePriority,uo=null,Ct=null;function kp(e){if(Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(uo,e,void 0,(e.current.flags&128)===128)}catch{}}var mt=Math.clz32?Math.clz32:bp,Cp=Math.log,Np=Math.LN2;function bp(e){return e>>>=0,e===0?32:31-(Cp(e)/Np|0)|0}var oa=64,sa=4194304;function gr(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Oa(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,a=e.suspendedLanes,s=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~a;l!==0?r=gr(l):(s&=i,s!==0&&(r=gr(s)))}else i=n&~a,i!==0?r=gr(i):s!==0&&(r=gr(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,s=t&-t,a>=s||a===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-mt(t),a=1<<n,r|=e[n],t&=~a;return r}function Ep(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pp(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,s=e.pendingLanes;0<s;){var i=31-mt(s),l=1<<i,c=a[i];c===-1?(!(l&n)||l&r)&&(a[i]=Ep(l,t)):c<=t&&(e.expiredLanes|=l),s&=~l}}function Ns(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function wu(){var e=oa;return oa<<=1,!(oa&4194240)&&(oa=64),e}function $o(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Yr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-mt(t),e[t]=n}function Tp(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-mt(n),s=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~s}}function Si(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-mt(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var re=0;function Su(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var ju,ji,ku,Cu,Nu,bs=!1,ia=[],Jt=null,Xt=null,qt=null,_r=new Map,zr=new Map,Kt=[],Ip="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 submit".split(" ");function Nl(e,t){switch(e){case"focusin":case"focusout":Jt=null;break;case"dragenter":case"dragleave":Xt=null;break;case"mouseover":case"mouseout":qt=null;break;case"pointerover":case"pointerout":_r.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":zr.delete(t.pointerId)}}function ir(e,t,n,r,a,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[a]},t!==null&&(t=Jr(t),t!==null&&ji(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function Rp(e,t,n,r,a){switch(t){case"focusin":return Jt=ir(Jt,e,t,n,r,a),!0;case"dragenter":return Xt=ir(Xt,e,t,n,r,a),!0;case"mouseover":return qt=ir(qt,e,t,n,r,a),!0;case"pointerover":var s=a.pointerId;return _r.set(s,ir(_r.get(s)||null,e,t,n,r,a)),!0;case"gotpointercapture":return s=a.pointerId,zr.set(s,ir(zr.get(s)||null,e,t,n,r,a)),!0}return!1}function bu(e){var t=mn(e.target);if(t!==null){var n=bn(t);if(n!==null){if(t=n.tag,t===13){if(t=mu(n),t!==null){e.blockedOn=t,Nu(e.priority,function(){ku(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ka(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Es(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ss=r,n.target.dispatchEvent(r),Ss=null}else return t=Jr(n),t!==null&&ji(t),e.blockedOn=n,!1;t.shift()}return!0}function bl(e,t,n){ka(e)&&n.delete(t)}function _p(){bs=!1,Jt!==null&&ka(Jt)&&(Jt=null),Xt!==null&&ka(Xt)&&(Xt=null),qt!==null&&ka(qt)&&(qt=null),_r.forEach(bl),zr.forEach(bl)}function lr(e,t){e.blockedOn===t&&(e.blockedOn=null,bs||(bs=!0,Je.unstable_scheduleCallback(Je.unstable_NormalPriority,_p)))}function Ar(e){function t(a){return lr(a,e)}if(0<ia.length){lr(ia[0],e);for(var n=1;n<ia.length;n++){var r=ia[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Jt!==null&&lr(Jt,e),Xt!==null&&lr(Xt,e),qt!==null&&lr(qt,e),_r.forEach(t),zr.forEach(t),n=0;n<Kt.length;n++)r=Kt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Kt.length&&(n=Kt[0],n.blockedOn===null);)bu(n),n.blockedOn===null&&Kt.shift()}var Wn=Ot.ReactCurrentBatchConfig,Ba=!0;function zp(e,t,n,r){var a=re,s=Wn.transition;Wn.transition=null;try{re=1,ki(e,t,n,r)}finally{re=a,Wn.transition=s}}function Ap(e,t,n,r){var a=re,s=Wn.transition;Wn.transition=null;try{re=4,ki(e,t,n,r)}finally{re=a,Wn.transition=s}}function ki(e,t,n,r){if(Ba){var a=Es(e,t,n,r);if(a===null)Vo(e,t,r,Da,n),Nl(e,r);else if(Rp(a,e,t,n,r))r.stopPropagation();else if(Nl(e,r),t&4&&-1<Ip.indexOf(e)){for(;a!==null;){var s=Jr(a);if(s!==null&&ju(s),s=Es(e,t,n,r),s===null&&Vo(e,t,r,Da,n),s===a)break;a=s}a!==null&&r.stopPropagation()}else Vo(e,t,r,null,n)}}var Da=null;function Es(e,t,n,r){if(Da=null,e=xi(r),e=mn(e),e!==null)if(t=bn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=mu(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Da=e,null}function Eu(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Sp()){case wi:return 1;case yu:return 4;case Fa:case jp:return 16;case xu:return 536870912;default:return 16}default:return 16}}var Yt=null,Ci=null,Ca=null;function Pu(){if(Ca)return Ca;var e,t=Ci,n=t.length,r,a="value"in Yt?Yt.value:Yt.textContent,s=a.length;for(e=0;e<n&&t[e]===a[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===a[s-r];r++);return Ca=a.slice(e,1<r?1-r:void 0)}function Na(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 la(){return!0}function El(){return!1}function qe(e){function t(n,r,a,s,i){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=s,this.target=i,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?la:El,this.isPropagationStopped=El,this}return pe(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=la)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=la)},persist:function(){},isPersistent:la}),t}var er={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ni=qe(er),Qr=pe({},er,{view:0,detail:0}),$p=qe(Qr),Lo,Mo,cr,fo=pe({},Qr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:bi,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!==cr&&(cr&&e.type==="mousemove"?(Lo=e.screenX-cr.screenX,Mo=e.screenY-cr.screenY):Mo=Lo=0,cr=e),Lo)},movementY:function(e){return"movementY"in e?e.movementY:Mo}}),Pl=qe(fo),Lp=pe({},fo,{dataTransfer:0}),Mp=qe(Lp),Fp=pe({},Qr,{relatedTarget:0}),Fo=qe(Fp),Op=pe({},er,{animationName:0,elapsedTime:0,pseudoElement:0}),Bp=qe(Op),Dp=pe({},er,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Up=qe(Dp),Wp=pe({},er,{data:0}),Tl=qe(Wp),Hp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Vp={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"},Kp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Gp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Kp[e])?!!t[e]:!1}function bi(){return Gp}var Yp=pe({},Qr,{key:function(e){if(e.key){var t=Hp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Na(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Vp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:bi,charCode:function(e){return e.type==="keypress"?Na(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Na(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Qp=qe(Yp),Jp=pe({},fo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Il=qe(Jp),Xp=pe({},Qr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:bi}),qp=qe(Xp),Zp=pe({},er,{propertyName:0,elapsedTime:0,pseudoElement:0}),em=qe(Zp),tm=pe({},fo,{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}),nm=qe(tm),rm=[9,13,27,32],Ei=At&&"CompositionEvent"in window,Sr=null;At&&"documentMode"in document&&(Sr=document.documentMode);var am=At&&"TextEvent"in window&&!Sr,Tu=At&&(!Ei||Sr&&8<Sr&&11>=Sr),Rl=" ",_l=!1;function Iu(e,t){switch(e){case"keyup":return rm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ru(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var In=!1;function om(e,t){switch(e){case"compositionend":return Ru(t);case"keypress":return t.which!==32?null:(_l=!0,Rl);case"textInput":return e=t.data,e===Rl&&_l?null:e;default:return null}}function sm(e,t){if(In)return e==="compositionend"||!Ei&&Iu(e,t)?(e=Pu(),Ca=Ci=Yt=null,In=!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 Tu&&t.locale!=="ko"?null:t.data;default:return null}}var im={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 zl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!im[e.type]:t==="textarea"}function _u(e,t,n,r){cu(r),t=Ua(t,"onChange"),0<t.length&&(n=new Ni("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var jr=null,$r=null;function lm(e){Wu(e,0)}function po(e){var t=zn(e);if(nu(t))return e}function cm(e,t){if(e==="change")return t}var zu=!1;if(At){var Oo;if(At){var Bo="oninput"in document;if(!Bo){var Al=document.createElement("div");Al.setAttribute("oninput","return;"),Bo=typeof Al.oninput=="function"}Oo=Bo}else Oo=!1;zu=Oo&&(!document.documentMode||9<document.documentMode)}function $l(){jr&&(jr.detachEvent("onpropertychange",Au),$r=jr=null)}function Au(e){if(e.propertyName==="value"&&po($r)){var t=[];_u(t,$r,e,xi(e)),pu(lm,t)}}function um(e,t,n){e==="focusin"?($l(),jr=t,$r=n,jr.attachEvent("onpropertychange",Au)):e==="focusout"&&$l()}function dm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return po($r)}function fm(e,t){if(e==="click")return po(t)}function pm(e,t){if(e==="input"||e==="change")return po(t)}function mm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gt=typeof Object.is=="function"?Object.is:mm;function Lr(e,t){if(gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!cs.call(t,a)||!gt(e[a],t[a]))return!1}return!0}function Ll(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ml(e,t){var n=Ll(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ll(n)}}function $u(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$u(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lu(){for(var e=window,t=$a();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=$a(e.document)}return t}function Pi(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")}function hm(e){var t=Lu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&$u(n.ownerDocument.documentElement,n)){if(r!==null&&Pi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,s=Math.min(r.start,a);r=r.end===void 0?s:Math.min(r.end,a),!e.extend&&s>r&&(a=r,r=s,s=a),a=Ml(n,s);var i=Ml(n,r);a&&i&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var gm=At&&"documentMode"in document&&11>=document.documentMode,Rn=null,Ps=null,kr=null,Ts=!1;function Fl(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ts||Rn==null||Rn!==$a(r)||(r=Rn,"selectionStart"in r&&Pi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kr&&Lr(kr,r)||(kr=r,r=Ua(Ps,"onSelect"),0<r.length&&(t=new Ni("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Rn)))}function ca(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var _n={animationend:ca("Animation","AnimationEnd"),animationiteration:ca("Animation","AnimationIteration"),animationstart:ca("Animation","AnimationStart"),transitionend:ca("Transition","TransitionEnd")},Do={},Mu={};At&&(Mu=document.createElement("div").style,"AnimationEvent"in window||(delete _n.animationend.animation,delete _n.animationiteration.animation,delete _n.animationstart.animation),"TransitionEvent"in window||delete _n.transitionend.transition);function mo(e){if(Do[e])return Do[e];if(!_n[e])return e;var t=_n[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Mu)return Do[e]=t[n];return e}var Fu=mo("animationend"),Ou=mo("animationiteration"),Bu=mo("animationstart"),Du=mo("transitionend"),Uu=new Map,Ol="abort auxClick 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(" ");function sn(e,t){Uu.set(e,t),Nn(t,[e])}for(var Uo=0;Uo<Ol.length;Uo++){var Wo=Ol[Uo],vm=Wo.toLowerCase(),ym=Wo[0].toUpperCase()+Wo.slice(1);sn(vm,"on"+ym)}sn(Fu,"onAnimationEnd");sn(Ou,"onAnimationIteration");sn(Bu,"onAnimationStart");sn("dblclick","onDoubleClick");sn("focusin","onFocus");sn("focusout","onBlur");sn(Du,"onTransitionEnd");Kn("onMouseEnter",["mouseout","mouseover"]);Kn("onMouseLeave",["mouseout","mouseover"]);Kn("onPointerEnter",["pointerout","pointerover"]);Kn("onPointerLeave",["pointerout","pointerover"]);Nn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Nn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Nn("onBeforeInput",["compositionend","keypress","textInput","paste"]);Nn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Nn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Nn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vr="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(" "),xm=new Set("cancel close invalid load scroll toggle".split(" ").concat(vr));function Bl(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,vp(r,t,void 0,e),e.currentTarget=null}function Wu(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==s&&a.isPropagationStopped())break e;Bl(a,l,u),s=c}else for(i=0;i<r.length;i++){if(l=r[i],c=l.instance,u=l.currentTarget,l=l.listener,c!==s&&a.isPropagationStopped())break e;Bl(a,l,u),s=c}}}if(Ma)throw e=Cs,Ma=!1,Cs=null,e}function se(e,t){var n=t[As];n===void 0&&(n=t[As]=new Set);var r=e+"__bubble";n.has(r)||(Hu(t,e,2,!1),n.add(r))}function Ho(e,t,n){var r=0;t&&(r|=4),Hu(n,e,r,t)}var ua="_reactListening"+Math.random().toString(36).slice(2);function Mr(e){if(!e[ua]){e[ua]=!0,Xc.forEach(function(n){n!=="selectionchange"&&(xm.has(n)||Ho(n,!1,e),Ho(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ua]||(t[ua]=!0,Ho("selectionchange",!1,t))}}function Hu(e,t,n,r){switch(Eu(t)){case 1:var a=zp;break;case 4:a=Ap;break;default:a=ki}n=a.bind(null,t,n,e),a=void 0,!ks||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function Vo(e,t,n,r,a){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var l=r.stateNode.containerInfo;if(l===a||l.nodeType===8&&l.parentNode===a)break;if(i===4)for(i=r.return;i!==null;){var c=i.tag;if((c===3||c===4)&&(c=i.stateNode.containerInfo,c===a||c.nodeType===8&&c.parentNode===a))return;i=i.return}for(;l!==null;){if(i=mn(l),i===null)return;if(c=i.tag,c===5||c===6){r=s=i;continue e}l=l.parentNode}}r=r.return}pu(function(){var u=s,h=xi(n),f=[];e:{var v=Uu.get(e);if(v!==void 0){var y=Ni,x=e;switch(e){case"keypress":if(Na(n)===0)break e;case"keydown":case"keyup":y=Qp;break;case"focusin":x="focus",y=Fo;break;case"focusout":x="blur",y=Fo;break;case"beforeblur":case"afterblur":y=Fo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":y=Pl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=Mp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=qp;break;case Fu:case Ou:case Bu:y=Bp;break;case Du:y=em;break;case"scroll":y=$p;break;case"wheel":y=nm;break;case"copy":case"cut":case"paste":y=Up;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=Il}var w=(t&4)!==0,j=!w&&e==="scroll",m=w?v!==null?v+"Capture":null:v;w=[];for(var p=u,g;p!==null;){g=p;var S=g.stateNode;if(g.tag===5&&S!==null&&(g=S,m!==null&&(S=Rr(p,m),S!=null&&w.push(Fr(p,S,g)))),j)break;p=p.return}0<w.length&&(v=new y(v,x,null,n,h),f.push({event:v,listeners:w}))}}if(!(t&7)){e:{if(v=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",v&&n!==Ss&&(x=n.relatedTarget||n.fromElement)&&(mn(x)||x[$t]))break e;if((y||v)&&(v=h.window===h?h:(v=h.ownerDocument)?v.defaultView||v.parentWindow:window,y?(x=n.relatedTarget||n.toElement,y=u,x=x?mn(x):null,x!==null&&(j=bn(x),x!==j||x.tag!==5&&x.tag!==6)&&(x=null)):(y=null,x=u),y!==x)){if(w=Pl,S="onMouseLeave",m="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(w=Il,S="onPointerLeave",m="onPointerEnter",p="pointer"),j=y==null?v:zn(y),g=x==null?v:zn(x),v=new w(S,p+"leave",y,n,h),v.target=j,v.relatedTarget=g,S=null,mn(h)===u&&(w=new w(m,p+"enter",x,n,h),w.target=g,w.relatedTarget=j,S=w),j=S,y&&x)t:{for(w=y,m=x,p=0,g=w;g;g=En(g))p++;for(g=0,S=m;S;S=En(S))g++;for(;0<p-g;)w=En(w),p--;for(;0<g-p;)m=En(m),g--;for(;p--;){if(w===m||m!==null&&w===m.alternate)break t;w=En(w),m=En(m)}w=null}else w=null;y!==null&&Dl(f,v,y,w,!1),x!==null&&j!==null&&Dl(f,j,x,w,!0)}}e:{if(v=u?zn(u):window,y=v.nodeName&&v.nodeName.toLowerCase(),y==="select"||y==="input"&&v.type==="file")var E=cm;else if(zl(v))if(zu)E=pm;else{E=dm;var T=um}else(y=v.nodeName)&&y.toLowerCase()==="input"&&(v.type==="checkbox"||v.type==="radio")&&(E=fm);if(E&&(E=E(e,u))){_u(f,E,n,h);break e}T&&T(e,v,u),e==="focusout"&&(T=v._wrapperState)&&T.controlled&&v.type==="number"&&gs(v,"number",v.value)}switch(T=u?zn(u):window,e){case"focusin":(zl(T)||T.contentEditable==="true")&&(Rn=T,Ps=u,kr=null);break;case"focusout":kr=Ps=Rn=null;break;case"mousedown":Ts=!0;break;case"contextmenu":case"mouseup":case"dragend":Ts=!1,Fl(f,n,h);break;case"selectionchange":if(gm)break;case"keydown":case"keyup":Fl(f,n,h)}var k;if(Ei)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else In?Iu(e,n)&&(b="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(b="onCompositionStart");b&&(Tu&&n.locale!=="ko"&&(In||b!=="onCompositionStart"?b==="onCompositionEnd"&&In&&(k=Pu()):(Yt=h,Ci="value"in Yt?Yt.value:Yt.textContent,In=!0)),T=Ua(u,b),0<T.length&&(b=new Tl(b,e,null,n,h),f.push({event:b,listeners:T}),k?b.data=k:(k=Ru(n),k!==null&&(b.data=k)))),(k=am?om(e,n):sm(e,n))&&(u=Ua(u,"onBeforeInput"),0<u.length&&(h=new Tl("onBeforeInput","beforeinput",null,n,h),f.push({event:h,listeners:u}),h.data=k))}Wu(f,t)})}function Fr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ua(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,s=a.stateNode;a.tag===5&&s!==null&&(a=s,s=Rr(e,n),s!=null&&r.unshift(Fr(e,s,a)),s=Rr(e,t),s!=null&&r.push(Fr(e,s,a))),e=e.return}return r}function En(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Dl(e,t,n,r,a){for(var s=t._reactName,i=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,a?(c=Rr(n,s),c!=null&&i.unshift(Fr(n,c,l))):a||(c=Rr(n,s),c!=null&&i.push(Fr(n,c,l)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var wm=/\r\n?/g,Sm=/\u0000|\uFFFD/g;function Ul(e){return(typeof e=="string"?e:""+e).replace(wm,`
38
+ `).replace(Sm,"")}function da(e,t,n){if(t=Ul(t),Ul(e)!==t&&n)throw Error(A(425))}function Wa(){}var Is=null,Rs=null;function _s(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var zs=typeof setTimeout=="function"?setTimeout:void 0,jm=typeof clearTimeout=="function"?clearTimeout:void 0,Wl=typeof Promise=="function"?Promise:void 0,km=typeof queueMicrotask=="function"?queueMicrotask:typeof Wl<"u"?function(e){return Wl.resolve(null).then(e).catch(Cm)}:zs;function Cm(e){setTimeout(function(){throw e})}function Ko(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(r===0){e.removeChild(a),Ar(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);Ar(t)}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==="$?")break;if(t==="/$")return null}}return e}function Hl(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var tr=Math.random().toString(36).slice(2),kt="__reactFiber$"+tr,Or="__reactProps$"+tr,$t="__reactContainer$"+tr,As="__reactEvents$"+tr,Nm="__reactListeners$"+tr,bm="__reactHandles$"+tr;function mn(e){var t=e[kt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[$t]||n[kt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Hl(e);e!==null;){if(n=e[kt])return n;e=Hl(e)}return t}e=n,n=e.parentNode}return null}function Jr(e){return e=e[kt]||e[$t],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function zn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(A(33))}function ho(e){return e[Or]||null}var $s=[],An=-1;function ln(e){return{current:e}}function ie(e){0>An||(e.current=$s[An],$s[An]=null,An--)}function oe(e,t){An++,$s[An]=e.current,e.current=t}var on={},ze=ln(on),Ue=ln(!1),wn=on;function Gn(e,t){var n=e.type.contextTypes;if(!n)return on;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},s;for(s in n)a[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function We(e){return e=e.childContextTypes,e!=null}function Ha(){ie(Ue),ie(ze)}function Vl(e,t,n){if(ze.current!==on)throw Error(A(168));oe(ze,t),oe(Ue,n)}function Vu(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var a in r)if(!(a in t))throw Error(A(108,up(e)||"Unknown",a));return pe({},n,r)}function Va(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||on,wn=ze.current,oe(ze,e),oe(Ue,Ue.current),!0}function Kl(e,t,n){var r=e.stateNode;if(!r)throw Error(A(169));n?(e=Vu(e,t,wn),r.__reactInternalMemoizedMergedChildContext=e,ie(Ue),ie(ze),oe(ze,e)):ie(Ue),oe(Ue,n)}var Tt=null,go=!1,Go=!1;function Ku(e){Tt===null?Tt=[e]:Tt.push(e)}function Em(e){go=!0,Ku(e)}function cn(){if(!Go&&Tt!==null){Go=!0;var e=0,t=re;try{var n=Tt;for(re=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Tt=null,go=!1}catch(a){throw Tt!==null&&(Tt=Tt.slice(e+1)),vu(wi,cn),a}finally{re=t,Go=!1}}return null}var $n=[],Ln=0,Ka=null,Ga=0,tt=[],nt=0,Sn=null,It=1,Rt="";function dn(e,t){$n[Ln++]=Ga,$n[Ln++]=Ka,Ka=e,Ga=t}function Gu(e,t,n){tt[nt++]=It,tt[nt++]=Rt,tt[nt++]=Sn,Sn=e;var r=It;e=Rt;var a=32-mt(r)-1;r&=~(1<<a),n+=1;var s=32-mt(t)+a;if(30<s){var i=a-a%5;s=(r&(1<<i)-1).toString(32),r>>=i,a-=i,It=1<<32-mt(t)+a|n<<a|r,Rt=s+e}else It=1<<s|n<<a|r,Rt=e}function Ti(e){e.return!==null&&(dn(e,1),Gu(e,1,0))}function Ii(e){for(;e===Ka;)Ka=$n[--Ln],$n[Ln]=null,Ga=$n[--Ln],$n[Ln]=null;for(;e===Sn;)Sn=tt[--nt],tt[nt]=null,Rt=tt[--nt],tt[nt]=null,It=tt[--nt],tt[nt]=null}var Qe=null,Ye=null,le=!1,pt=null;function Yu(e,t){var n=rt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Gl(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Qe=e,Ye=Zt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Qe=e,Ye=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Sn!==null?{id:It,overflow:Rt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Qe=e,Ye=null,!0):!1;default:return!1}}function Ls(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ms(e){if(le){var t=Ye;if(t){var n=t;if(!Gl(e,t)){if(Ls(e))throw Error(A(418));t=Zt(n.nextSibling);var r=Qe;t&&Gl(e,t)?Yu(r,n):(e.flags=e.flags&-4097|2,le=!1,Qe=e)}}else{if(Ls(e))throw Error(A(418));e.flags=e.flags&-4097|2,le=!1,Qe=e}}}function Yl(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Qe=e}function fa(e){if(e!==Qe)return!1;if(!le)return Yl(e),le=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!_s(e.type,e.memoizedProps)),t&&(t=Ye)){if(Ls(e))throw Qu(),Error(A(418));for(;t;)Yu(e,t),t=Zt(t.nextSibling)}if(Yl(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(A(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ye=Zt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ye=null}}else Ye=Qe?Zt(e.stateNode.nextSibling):null;return!0}function Qu(){for(var e=Ye;e;)e=Zt(e.nextSibling)}function Yn(){Ye=Qe=null,le=!1}function Ri(e){pt===null?pt=[e]:pt.push(e)}var Pm=Ot.ReactCurrentBatchConfig;function ur(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(A(309));var r=n.stateNode}if(!r)throw Error(A(147,e));var a=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(i){var l=a.refs;i===null?delete l[s]:l[s]=i},t._stringRef=s,t)}if(typeof e!="string")throw Error(A(284));if(!n._owner)throw Error(A(290,e))}return e}function pa(e,t){throw e=Object.prototype.toString.call(t),Error(A(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Ql(e){var t=e._init;return t(e._payload)}function Ju(e){function t(m,p){if(e){var g=m.deletions;g===null?(m.deletions=[p],m.flags|=16):g.push(p)}}function n(m,p){if(!e)return null;for(;p!==null;)t(m,p),p=p.sibling;return null}function r(m,p){for(m=new Map;p!==null;)p.key!==null?m.set(p.key,p):m.set(p.index,p),p=p.sibling;return m}function a(m,p){return m=rn(m,p),m.index=0,m.sibling=null,m}function s(m,p,g){return m.index=g,e?(g=m.alternate,g!==null?(g=g.index,g<p?(m.flags|=2,p):g):(m.flags|=2,p)):(m.flags|=1048576,p)}function i(m){return e&&m.alternate===null&&(m.flags|=2),m}function l(m,p,g,S){return p===null||p.tag!==6?(p=es(g,m.mode,S),p.return=m,p):(p=a(p,g),p.return=m,p)}function c(m,p,g,S){var E=g.type;return E===Tn?h(m,p,g.props.children,S,g.key):p!==null&&(p.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Wt&&Ql(E)===p.type)?(S=a(p,g.props),S.ref=ur(m,p,g),S.return=m,S):(S=_a(g.type,g.key,g.props,null,m.mode,S),S.ref=ur(m,p,g),S.return=m,S)}function u(m,p,g,S){return p===null||p.tag!==4||p.stateNode.containerInfo!==g.containerInfo||p.stateNode.implementation!==g.implementation?(p=ts(g,m.mode,S),p.return=m,p):(p=a(p,g.children||[]),p.return=m,p)}function h(m,p,g,S,E){return p===null||p.tag!==7?(p=xn(g,m.mode,S,E),p.return=m,p):(p=a(p,g),p.return=m,p)}function f(m,p,g){if(typeof p=="string"&&p!==""||typeof p=="number")return p=es(""+p,m.mode,g),p.return=m,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case na:return g=_a(p.type,p.key,p.props,null,m.mode,g),g.ref=ur(m,null,p),g.return=m,g;case Pn:return p=ts(p,m.mode,g),p.return=m,p;case Wt:var S=p._init;return f(m,S(p._payload),g)}if(hr(p)||or(p))return p=xn(p,m.mode,g,null),p.return=m,p;pa(m,p)}return null}function v(m,p,g,S){var E=p!==null?p.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return E!==null?null:l(m,p,""+g,S);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case na:return g.key===E?c(m,p,g,S):null;case Pn:return g.key===E?u(m,p,g,S):null;case Wt:return E=g._init,v(m,p,E(g._payload),S)}if(hr(g)||or(g))return E!==null?null:h(m,p,g,S,null);pa(m,g)}return null}function y(m,p,g,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return m=m.get(g)||null,l(p,m,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case na:return m=m.get(S.key===null?g:S.key)||null,c(p,m,S,E);case Pn:return m=m.get(S.key===null?g:S.key)||null,u(p,m,S,E);case Wt:var T=S._init;return y(m,p,g,T(S._payload),E)}if(hr(S)||or(S))return m=m.get(g)||null,h(p,m,S,E,null);pa(p,S)}return null}function x(m,p,g,S){for(var E=null,T=null,k=p,b=p=0,N=null;k!==null&&b<g.length;b++){k.index>b?(N=k,k=null):N=k.sibling;var I=v(m,k,g[b],S);if(I===null){k===null&&(k=N);break}e&&k&&I.alternate===null&&t(m,k),p=s(I,p,b),T===null?E=I:T.sibling=I,T=I,k=N}if(b===g.length)return n(m,k),le&&dn(m,b),E;if(k===null){for(;b<g.length;b++)k=f(m,g[b],S),k!==null&&(p=s(k,p,b),T===null?E=k:T.sibling=k,T=k);return le&&dn(m,b),E}for(k=r(m,k);b<g.length;b++)N=y(k,m,b,g[b],S),N!==null&&(e&&N.alternate!==null&&k.delete(N.key===null?b:N.key),p=s(N,p,b),T===null?E=N:T.sibling=N,T=N);return e&&k.forEach(function(D){return t(m,D)}),le&&dn(m,b),E}function w(m,p,g,S){var E=or(g);if(typeof E!="function")throw Error(A(150));if(g=E.call(g),g==null)throw Error(A(151));for(var T=E=null,k=p,b=p=0,N=null,I=g.next();k!==null&&!I.done;b++,I=g.next()){k.index>b?(N=k,k=null):N=k.sibling;var D=v(m,k,I.value,S);if(D===null){k===null&&(k=N);break}e&&k&&D.alternate===null&&t(m,k),p=s(D,p,b),T===null?E=D:T.sibling=D,T=D,k=N}if(I.done)return n(m,k),le&&dn(m,b),E;if(k===null){for(;!I.done;b++,I=g.next())I=f(m,I.value,S),I!==null&&(p=s(I,p,b),T===null?E=I:T.sibling=I,T=I);return le&&dn(m,b),E}for(k=r(m,k);!I.done;b++,I=g.next())I=y(k,m,b,I.value,S),I!==null&&(e&&I.alternate!==null&&k.delete(I.key===null?b:I.key),p=s(I,p,b),T===null?E=I:T.sibling=I,T=I);return e&&k.forEach(function(V){return t(m,V)}),le&&dn(m,b),E}function j(m,p,g,S){if(typeof g=="object"&&g!==null&&g.type===Tn&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case na:e:{for(var E=g.key,T=p;T!==null;){if(T.key===E){if(E=g.type,E===Tn){if(T.tag===7){n(m,T.sibling),p=a(T,g.props.children),p.return=m,m=p;break e}}else if(T.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Wt&&Ql(E)===T.type){n(m,T.sibling),p=a(T,g.props),p.ref=ur(m,T,g),p.return=m,m=p;break e}n(m,T);break}else t(m,T);T=T.sibling}g.type===Tn?(p=xn(g.props.children,m.mode,S,g.key),p.return=m,m=p):(S=_a(g.type,g.key,g.props,null,m.mode,S),S.ref=ur(m,p,g),S.return=m,m=S)}return i(m);case Pn:e:{for(T=g.key;p!==null;){if(p.key===T)if(p.tag===4&&p.stateNode.containerInfo===g.containerInfo&&p.stateNode.implementation===g.implementation){n(m,p.sibling),p=a(p,g.children||[]),p.return=m,m=p;break e}else{n(m,p);break}else t(m,p);p=p.sibling}p=ts(g,m.mode,S),p.return=m,m=p}return i(m);case Wt:return T=g._init,j(m,p,T(g._payload),S)}if(hr(g))return x(m,p,g,S);if(or(g))return w(m,p,g,S);pa(m,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,p!==null&&p.tag===6?(n(m,p.sibling),p=a(p,g),p.return=m,m=p):(n(m,p),p=es(g,m.mode,S),p.return=m,m=p),i(m)):n(m,p)}return j}var Qn=Ju(!0),Xu=Ju(!1),Ya=ln(null),Qa=null,Mn=null,_i=null;function zi(){_i=Mn=Qa=null}function Ai(e){var t=Ya.current;ie(Ya),e._currentValue=t}function Fs(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Hn(e,t){Qa=e,_i=Mn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(De=!0),e.firstContext=null)}function ot(e){var t=e._currentValue;if(_i!==e)if(e={context:e,memoizedValue:t,next:null},Mn===null){if(Qa===null)throw Error(A(308));Mn=e,Qa.dependencies={lanes:0,firstContext:e}}else Mn=Mn.next=e;return t}var hn=null;function $i(e){hn===null?hn=[e]:hn.push(e)}function qu(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,$i(t)):(n.next=a.next,a.next=n),t.interleaved=n,Lt(e,r)}function Lt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ht=!1;function Li(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Zu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function zt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function en(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ee&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Lt(e,n)}return a=r.interleaved,a===null?(t.next=t,$i(r)):(t.next=a.next,a.next=t),r.interleaved=t,Lt(e,n)}function ba(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Si(e,n)}}function Jl(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?a=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?a=s=t:s=s.next=t}else a=s=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ja(e,t,n,r){var a=e.updateQueue;Ht=!1;var s=a.firstBaseUpdate,i=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,u=c.next;c.next=null,i===null?s=u:i.next=u,i=c;var h=e.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==i&&(l===null?h.firstBaseUpdate=u:l.next=u,h.lastBaseUpdate=c))}if(s!==null){var f=a.baseState;i=0,h=u=c=null,l=s;do{var v=l.lane,y=l.eventTime;if((r&v)===v){h!==null&&(h=h.next={eventTime:y,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,w=l;switch(v=t,y=n,w.tag){case 1:if(x=w.payload,typeof x=="function"){f=x.call(y,f,v);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=w.payload,v=typeof x=="function"?x.call(y,f,v):x,v==null)break e;f=pe({},f,v);break e;case 2:Ht=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,v=a.effects,v===null?a.effects=[l]:v.push(l))}else y={eventTime:y,lane:v,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(u=h=y,c=f):h=h.next=y,i|=v;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;v=l,l=v.next,v.next=null,a.lastBaseUpdate=v,a.shared.pending=null}}while(!0);if(h===null&&(c=f),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=h,t=a.shared.interleaved,t!==null){a=t;do i|=a.lane,a=a.next;while(a!==t)}else s===null&&(a.shared.lanes=0);kn|=i,e.lanes=i,e.memoizedState=f}}function Xl(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(a!==null){if(r.callback=null,r=n,typeof a!="function")throw Error(A(191,a));a.call(r)}}}var Xr={},Nt=ln(Xr),Br=ln(Xr),Dr=ln(Xr);function gn(e){if(e===Xr)throw Error(A(174));return e}function Mi(e,t){switch(oe(Dr,t),oe(Br,e),oe(Nt,Xr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ys(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ys(t,e)}ie(Nt),oe(Nt,t)}function Jn(){ie(Nt),ie(Br),ie(Dr)}function ed(e){gn(Dr.current);var t=gn(Nt.current),n=ys(t,e.type);t!==n&&(oe(Br,e),oe(Nt,n))}function Fi(e){Br.current===e&&(ie(Nt),ie(Br))}var de=ln(0);function Xa(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)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 Yo=[];function Oi(){for(var e=0;e<Yo.length;e++)Yo[e]._workInProgressVersionPrimary=null;Yo.length=0}var Ea=Ot.ReactCurrentDispatcher,Qo=Ot.ReactCurrentBatchConfig,jn=0,fe=null,xe=null,je=null,qa=!1,Cr=!1,Ur=0,Tm=0;function Te(){throw Error(A(321))}function Bi(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gt(e[n],t[n]))return!1;return!0}function Di(e,t,n,r,a,s){if(jn=s,fe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ea.current=e===null||e.memoizedState===null?zm:Am,e=n(r,a),Cr){s=0;do{if(Cr=!1,Ur=0,25<=s)throw Error(A(301));s+=1,je=xe=null,t.updateQueue=null,Ea.current=$m,e=n(r,a)}while(Cr)}if(Ea.current=Za,t=xe!==null&&xe.next!==null,jn=0,je=xe=fe=null,qa=!1,t)throw Error(A(300));return e}function Ui(){var e=Ur!==0;return Ur=0,e}function St(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return je===null?fe.memoizedState=je=e:je=je.next=e,je}function st(){if(xe===null){var e=fe.alternate;e=e!==null?e.memoizedState:null}else e=xe.next;var t=je===null?fe.memoizedState:je.next;if(t!==null)je=t,xe=e;else{if(e===null)throw Error(A(310));xe=e,e={memoizedState:xe.memoizedState,baseState:xe.baseState,baseQueue:xe.baseQueue,queue:xe.queue,next:null},je===null?fe.memoizedState=je=e:je=je.next=e}return je}function Wr(e,t){return typeof t=="function"?t(e):t}function Jo(e){var t=st(),n=t.queue;if(n===null)throw Error(A(311));n.lastRenderedReducer=e;var r=xe,a=r.baseQueue,s=n.pending;if(s!==null){if(a!==null){var i=a.next;a.next=s.next,s.next=i}r.baseQueue=a=s,n.pending=null}if(a!==null){s=a.next,r=r.baseState;var l=i=null,c=null,u=s;do{var h=u.lane;if((jn&h)===h)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:h,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,i=r):c=c.next=f,fe.lanes|=h,kn|=h}u=u.next}while(u!==null&&u!==s);c===null?i=r:c.next=l,gt(r,t.memoizedState)||(De=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){a=e;do s=a.lane,fe.lanes|=s,kn|=s,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Xo(e){var t=st(),n=t.queue;if(n===null)throw Error(A(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,s=t.memoizedState;if(a!==null){n.pending=null;var i=a=a.next;do s=e(s,i.action),i=i.next;while(i!==a);gt(s,t.memoizedState)||(De=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function td(){}function nd(e,t){var n=fe,r=st(),a=t(),s=!gt(r.memoizedState,a);if(s&&(r.memoizedState=a,De=!0),r=r.queue,Wi(od.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||je!==null&&je.memoizedState.tag&1){if(n.flags|=2048,Hr(9,ad.bind(null,n,r,a,t),void 0,null),ke===null)throw Error(A(349));jn&30||rd(n,t,a)}return a}function rd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=fe.updateQueue,t===null?(t={lastEffect:null,stores:null},fe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ad(e,t,n,r){t.value=n,t.getSnapshot=r,sd(t)&&id(e)}function od(e,t,n){return n(function(){sd(t)&&id(e)})}function sd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gt(e,n)}catch{return!0}}function id(e){var t=Lt(e,1);t!==null&&ht(t,e,1,-1)}function ql(e){var t=St();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Wr,lastRenderedState:e},t.queue=e,e=e.dispatch=_m.bind(null,fe,e),[t.memoizedState,e]}function Hr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=fe.updateQueue,t===null?(t={lastEffect:null,stores:null},fe.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function ld(){return st().memoizedState}function Pa(e,t,n,r){var a=St();fe.flags|=e,a.memoizedState=Hr(1|t,n,void 0,r===void 0?null:r)}function vo(e,t,n,r){var a=st();r=r===void 0?null:r;var s=void 0;if(xe!==null){var i=xe.memoizedState;if(s=i.destroy,r!==null&&Bi(r,i.deps)){a.memoizedState=Hr(t,n,s,r);return}}fe.flags|=e,a.memoizedState=Hr(1|t,n,s,r)}function Zl(e,t){return Pa(8390656,8,e,t)}function Wi(e,t){return vo(2048,8,e,t)}function cd(e,t){return vo(4,2,e,t)}function ud(e,t){return vo(4,4,e,t)}function dd(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function fd(e,t,n){return n=n!=null?n.concat([e]):null,vo(4,4,dd.bind(null,t,e),n)}function Hi(){}function pd(e,t){var n=st();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Bi(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function md(e,t){var n=st();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Bi(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function hd(e,t,n){return jn&21?(gt(n,t)||(n=wu(),fe.lanes|=n,kn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,De=!0),e.memoizedState=n)}function Im(e,t){var n=re;re=n!==0&&4>n?n:4,e(!0);var r=Qo.transition;Qo.transition={};try{e(!1),t()}finally{re=n,Qo.transition=r}}function gd(){return st().memoizedState}function Rm(e,t,n){var r=nn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vd(e))yd(t,n);else if(n=qu(e,t,n,r),n!==null){var a=Le();ht(n,e,r,a),xd(n,t,r)}}function _m(e,t,n){var r=nn(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vd(e))yd(t,a);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var i=t.lastRenderedState,l=s(i,n);if(a.hasEagerState=!0,a.eagerState=l,gt(l,i)){var c=t.interleaved;c===null?(a.next=a,$i(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=qu(e,t,a,r),n!==null&&(a=Le(),ht(n,e,r,a),xd(n,t,r))}}function vd(e){var t=e.alternate;return e===fe||t!==null&&t===fe}function yd(e,t){Cr=qa=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function xd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Si(e,n)}}var Za={readContext:ot,useCallback:Te,useContext:Te,useEffect:Te,useImperativeHandle:Te,useInsertionEffect:Te,useLayoutEffect:Te,useMemo:Te,useReducer:Te,useRef:Te,useState:Te,useDebugValue:Te,useDeferredValue:Te,useTransition:Te,useMutableSource:Te,useSyncExternalStore:Te,useId:Te,unstable_isNewReconciler:!1},zm={readContext:ot,useCallback:function(e,t){return St().memoizedState=[e,t===void 0?null:t],e},useContext:ot,useEffect:Zl,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Pa(4194308,4,dd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Pa(4194308,4,e,t)},useInsertionEffect:function(e,t){return Pa(4,2,e,t)},useMemo:function(e,t){var n=St();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=St();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Rm.bind(null,fe,e),[r.memoizedState,e]},useRef:function(e){var t=St();return e={current:e},t.memoizedState=e},useState:ql,useDebugValue:Hi,useDeferredValue:function(e){return St().memoizedState=e},useTransition:function(){var e=ql(!1),t=e[0];return e=Im.bind(null,e[1]),St().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=fe,a=St();if(le){if(n===void 0)throw Error(A(407));n=n()}else{if(n=t(),ke===null)throw Error(A(349));jn&30||rd(r,t,n)}a.memoizedState=n;var s={value:n,getSnapshot:t};return a.queue=s,Zl(od.bind(null,r,s,e),[e]),r.flags|=2048,Hr(9,ad.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=St(),t=ke.identifierPrefix;if(le){var n=Rt,r=It;n=(r&~(1<<32-mt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ur++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Tm++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Am={readContext:ot,useCallback:pd,useContext:ot,useEffect:Wi,useImperativeHandle:fd,useInsertionEffect:cd,useLayoutEffect:ud,useMemo:md,useReducer:Jo,useRef:ld,useState:function(){return Jo(Wr)},useDebugValue:Hi,useDeferredValue:function(e){var t=st();return hd(t,xe.memoizedState,e)},useTransition:function(){var e=Jo(Wr)[0],t=st().memoizedState;return[e,t]},useMutableSource:td,useSyncExternalStore:nd,useId:gd,unstable_isNewReconciler:!1},$m={readContext:ot,useCallback:pd,useContext:ot,useEffect:Wi,useImperativeHandle:fd,useInsertionEffect:cd,useLayoutEffect:ud,useMemo:md,useReducer:Xo,useRef:ld,useState:function(){return Xo(Wr)},useDebugValue:Hi,useDeferredValue:function(e){var t=st();return xe===null?t.memoizedState=e:hd(t,xe.memoizedState,e)},useTransition:function(){var e=Xo(Wr)[0],t=st().memoizedState;return[e,t]},useMutableSource:td,useSyncExternalStore:nd,useId:gd,unstable_isNewReconciler:!1};function dt(e,t){if(e&&e.defaultProps){t=pe({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Os(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:pe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var yo={isMounted:function(e){return(e=e._reactInternals)?bn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Le(),a=nn(e),s=zt(r,a);s.payload=t,n!=null&&(s.callback=n),t=en(e,s,a),t!==null&&(ht(t,e,a,r),ba(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Le(),a=nn(e),s=zt(r,a);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=en(e,s,a),t!==null&&(ht(t,e,a,r),ba(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Le(),r=nn(e),a=zt(n,r);a.tag=2,t!=null&&(a.callback=t),t=en(e,a,r),t!==null&&(ht(t,e,r,n),ba(t,e,r))}};function ec(e,t,n,r,a,s,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,i):t.prototype&&t.prototype.isPureReactComponent?!Lr(n,r)||!Lr(a,s):!0}function wd(e,t,n){var r=!1,a=on,s=t.contextType;return typeof s=="object"&&s!==null?s=ot(s):(a=We(t)?wn:ze.current,r=t.contextTypes,s=(r=r!=null)?Gn(e,a):on),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=yo,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=s),t}function tc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&yo.enqueueReplaceState(t,t.state,null)}function Bs(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},Li(e);var s=t.contextType;typeof s=="object"&&s!==null?a.context=ot(s):(s=We(t)?wn:ze.current,a.context=Gn(e,s)),a.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Os(e,t,s,n),a.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(t=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),t!==a.state&&yo.enqueueReplaceState(a,a.state,null),Ja(e,n,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function Xn(e,t){try{var n="",r=t;do n+=cp(r),r=r.return;while(r);var a=n}catch(s){a=`
39
39
  Error generating stack: `+s.message+`
40
- `+s.stack}return{value:e,source:t,stack:a,digest:null}}function qo(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Bs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var $m=typeof WeakMap=="function"?WeakMap:Map;function wd(e,t,n){n=zt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){to||(to=!0,Js=r),Bs(e,t)},n}function Sd(e,t,n){n=zt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){Bs(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Bs(e,t),typeof r!="function"&&(tn===null?tn=new Set([this]):tn.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function tc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new $m;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=Ym.bind(null,e,t,n),t.then(e,e))}function nc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function rc(e,t,n,r,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=zt(-1,1),t.tag=2,en(n,t,1))),n.lanes|=1),e)}var Lm=Ot.ReactCurrentOwner,De=!1;function $e(e,t,n,r){t.child=e===null?Ju(t,null,n,r):Yn(t,e.child,n,r)}function ac(e,t,n,r,a){n=n.render;var s=t.ref;return Hn(t,a),r=Bi(e,t,n,r,s,a),n=Di(),e!==null&&!De?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Mt(e,t,a)):(le&&n&&Pi(t),t.flags|=1,$e(e,t,r,a),t.child)}function oc(e,t,n,r,a){if(e===null){var s=n.type;return typeof s=="function"&&!Xi(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,jd(e,t,s,r,a)):(e=Ra(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&a)){var i=s.memoizedProps;if(n=n.compare,n=n!==null?n:Lr,n(i,r)&&e.ref===t.ref)return Mt(e,t,a)}return t.flags|=1,e=rn(s,r),e.ref=t.ref,e.return=t,t.child=e}function jd(e,t,n,r,a){if(e!==null){var s=e.memoizedProps;if(Lr(s,r)&&e.ref===t.ref)if(De=!1,t.pendingProps=r=s,(e.lanes&a)!==0)e.flags&131072&&(De=!0);else return t.lanes=e.lanes,Mt(e,t,a)}return Ds(e,t,n,r,a)}function kd(e,t,n){var r=t.pendingProps,a=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},oe(On,Ke),Ke|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,oe(On,Ke),Ke|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,oe(On,Ke),Ke|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,oe(On,Ke),Ke|=r;return $e(e,t,a,n),t.child}function Cd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ds(e,t,n,r,a){var s=We(n)?wn:ze.current;return s=Gn(t,s),Hn(t,a),n=Bi(e,t,n,r,s,a),r=Di(),e!==null&&!De?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Mt(e,t,a)):(le&&r&&Pi(t),t.flags|=1,$e(e,t,n,a),t.child)}function sc(e,t,n,r,a){if(We(n)){var s=!0;Va(t)}else s=!1;if(Hn(t,a),t.stateNode===null)Ta(e,t),xd(t,n,r),Os(t,n,r,a),r=!0;else if(e===null){var i=t.stateNode,l=t.memoizedProps;i.props=l;var c=i.context,u=n.contextType;typeof u=="object"&&u!==null?u=ot(u):(u=We(n)?wn:ze.current,u=Gn(t,u));var h=n.getDerivedStateFromProps,f=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==r||c!==u)&&ec(t,i,r,u),Ht=!1;var g=t.memoizedState;i.state=g,Ja(t,r,i,a),c=t.memoizedState,l!==r||g!==c||Ue.current||Ht?(typeof h=="function"&&(Fs(t,n,h,r),c=t.memoizedState),(l=Ht||Zl(t,n,l,r,g,c,u))?(f||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=r,t.memoizedState=c),i.props=r,i.state=c,i.context=u,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,qu(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:dt(t.type,l),i.props=u,f=t.pendingProps,g=i.context,c=n.contextType,typeof c=="object"&&c!==null?c=ot(c):(c=We(n)?wn:ze.current,c=Gn(t,c));var v=n.getDerivedStateFromProps;(h=typeof v=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==f||g!==c)&&ec(t,i,r,c),Ht=!1,g=t.memoizedState,i.state=g,Ja(t,r,i,a);var x=t.memoizedState;l!==f||g!==x||Ue.current||Ht?(typeof v=="function"&&(Fs(t,n,v,r),x=t.memoizedState),(u=Ht||Zl(t,n,u,r,g,x,c)||!1)?(h||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,x,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,x,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),i.props=r,i.state=x,i.context=c,r=u):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),r=!1)}return Us(e,t,n,r,s,a)}function Us(e,t,n,r,a,s){Cd(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return a&&Vl(t,n,!1),Mt(e,t,s);r=t.stateNode,Lm.current=t;var l=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=Yn(t,e.child,null,s),t.child=Yn(t,null,l,s)):$e(e,t,l,s),t.memoizedState=r.state,a&&Vl(t,n,!0),t.child}function Nd(e){var t=e.stateNode;t.pendingContext?Hl(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Hl(e,t.context,!1),Li(e,t.containerInfo)}function ic(e,t,n,r,a){return Qn(),Ii(a),t.flags|=256,$e(e,t,n,r),t.child}var Ws={dehydrated:null,treeContext:null,retryLane:0};function Hs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ed(e,t,n){var r=t.pendingProps,a=de.current,s=!1,i=(t.flags&128)!==0,l;if((l=i)||(l=e!==null&&e.memoizedState===null?!1:(a&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),oe(de,a&1),e===null)return Ls(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,s?(r=t.mode,s=t.child,i={mode:"hidden",children:i},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=i):s=So(i,r,0,null),e=xn(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Hs(n),t.memoizedState=Ws,e):Hi(t,i));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return Mm(e,t,i,r,l,a,n);if(s){s=r.fallback,i=t.mode,a=e.child,l=a.sibling;var c={mode:"hidden",children:r.children};return!(i&1)&&t.child!==a?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=rn(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?s=rn(l,s):(s=xn(s,i,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,i=e.child.memoizedState,i=i===null?Hs(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},s.memoizedState=i,s.childLanes=e.childLanes&~n,t.memoizedState=Ws,r}return s=e.child,e=s.sibling,r=rn(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Hi(e,t){return t=So({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ma(e,t,n,r){return r!==null&&Ii(r),Yn(t,e.child,null,n),e=Hi(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Mm(e,t,n,r,a,s,i){if(n)return t.flags&256?(t.flags&=-257,r=qo(Error(A(422))),ma(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,a=t.mode,r=So({mode:"visible",children:r.children},a,0,null),s=xn(s,a,i,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Yn(t,e.child,null,i),t.child.memoizedState=Hs(i),t.memoizedState=Ws,s);if(!(t.mode&1))return ma(e,t,i,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(A(419)),r=qo(s,r,void 0),ma(e,t,i,r)}if(l=(i&e.childLanes)!==0,De||l){if(r=ke,r!==null){switch(i&-i){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(r.suspendedLanes|i)?0:a,a!==0&&a!==s.retryLane&&(s.retryLane=a,Lt(e,a),ht(r,e,a,-1))}return Ji(),r=qo(Error(A(421))),ma(e,t,i,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=Jm.bind(null,e),a._reactRetry=t,null):(e=s.treeContext,Qe=Zt(a.nextSibling),Ye=t,le=!0,pt=null,e!==null&&(tt[nt++]=It,tt[nt++]=_t,tt[nt++]=Sn,It=e.id,_t=e.overflow,Sn=t),t=Hi(t,r.children),t.flags|=4096,t)}function lc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ms(e.return,t,n)}function Zo(e,t,n,r,a){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=a)}function bd(e,t,n){var r=t.pendingProps,a=r.revealOrder,s=r.tail;if($e(e,t,r.children,n),r=de.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&lc(e,n,t);else if(e.tag===19)lc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(oe(de,r),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&Xa(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Zo(t,!1,a,n,s);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&Xa(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Zo(t,!0,n,null,s);break;case"together":Zo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ta(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Mt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),kn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(A(153));if(t.child!==null){for(e=t.child,n=rn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=rn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Fm(e,t,n){switch(t.tag){case 3:Nd(t),Qn();break;case 5:Zu(t);break;case 1:We(t.type)&&Va(t);break;case 4:Li(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;oe(Qa,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(oe(de,de.current&1),t.flags|=128,null):n&t.child.childLanes?Ed(e,t,n):(oe(de,de.current&1),e=Mt(e,t,n),e!==null?e.sibling:null);oe(de,de.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return bd(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),oe(de,de.current),r)break;return null;case 22:case 23:return t.lanes=0,kd(e,t,n)}return Mt(e,t,n)}var Pd,Vs,Td,Id;Pd=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Vs=function(){};Td=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,gn(Nt.current);var s=null;switch(n){case"input":a=ps(e,a),r=ps(e,r),s=[];break;case"select":a=pe({},a,{value:void 0}),r=pe({},r,{value:void 0}),s=[];break;case"textarea":a=gs(e,a),r=gs(e,r),s=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Wa)}vs(n,r);var i;n=null;for(u in a)if(!r.hasOwnProperty(u)&&a.hasOwnProperty(u)&&a[u]!=null)if(u==="style"){var l=a[u];for(i in l)l.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Tr.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(l=a!=null?a[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(i in l)!l.hasOwnProperty(i)||c&&c.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in c)c.hasOwnProperty(i)&&l[i]!==c[i]&&(n||(n={}),n[i]=c[i])}else n||(s||(s=[]),s.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(s=s||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Tr.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&se("scroll",e),s||l===c||(s=[])):(s=s||[]).push(u,c))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}};Id=function(e,t,n,r){n!==r&&(t.flags|=4)};function dr(e,t){if(!le)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ie(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&14680064,r|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Om(e,t,n){var r=t.pendingProps;switch(Ti(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return We(t.type)&&Ha(),Ie(t),null;case 3:return r=t.stateNode,Jn(),ie(Ue),ie(ze),Fi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(fa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pt!==null&&(Zs(pt),pt=null))),Vs(e,t),Ie(t),null;case 5:Mi(t);var a=gn(Dr.current);if(n=t.type,e!==null&&t.stateNode!=null)Td(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(A(166));return Ie(t),null}if(e=gn(Nt.current),fa(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[kt]=t,r[Or]=s,e=(t.mode&1)!==0,n){case"dialog":se("cancel",r),se("close",r);break;case"iframe":case"object":case"embed":se("load",r);break;case"video":case"audio":for(a=0;a<yr.length;a++)se(yr[a],r);break;case"source":se("error",r);break;case"img":case"image":case"link":se("error",r),se("load",r);break;case"details":se("toggle",r);break;case"input":yl(r,s),se("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},se("invalid",r);break;case"textarea":xl(r,s),se("invalid",r)}vs(n,s),a=null;for(var i in s)if(s.hasOwnProperty(i)){var l=s[i];i==="children"?typeof l=="string"?r.textContent!==l&&(s.suppressHydrationWarning!==!0&&da(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&da(r.textContent,l,e),a=["children",""+l]):Tr.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&se("scroll",r)}switch(n){case"input":ra(r),vl(r,s,!0);break;case"textarea":ra(r),wl(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Wa)}r=a,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=au(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[kt]=t,e[Or]=r,Pd(e,t,!1,!1),t.stateNode=e;e:{switch(i=xs(n,r),n){case"dialog":se("cancel",e),se("close",e),a=r;break;case"iframe":case"object":case"embed":se("load",e),a=r;break;case"video":case"audio":for(a=0;a<yr.length;a++)se(yr[a],e);a=r;break;case"source":se("error",e),a=r;break;case"img":case"image":case"link":se("error",e),se("load",e),a=r;break;case"details":se("toggle",e),a=r;break;case"input":yl(e,r),a=ps(e,r),se("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=pe({},r,{value:void 0}),se("invalid",e);break;case"textarea":xl(e,r),a=gs(e,r),se("invalid",e);break;default:a=r}vs(n,a),l=a;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];s==="style"?iu(e,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&ou(e,c)):s==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Ir(e,c):typeof c=="number"&&Ir(e,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Tr.hasOwnProperty(s)?c!=null&&s==="onScroll"&&se("scroll",e):c!=null&&mi(e,s,c,i))}switch(n){case"input":ra(e),vl(e,r,!1);break;case"textarea":ra(e),wl(e);break;case"option":r.value!=null&&e.setAttribute("value",""+an(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Bn(e,!!r.multiple,s,!1):r.defaultValue!=null&&Bn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=Wa)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ie(t),null;case 6:if(e&&t.stateNode!=null)Id(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(A(166));if(n=gn(Dr.current),gn(Nt.current),fa(t)){if(r=t.stateNode,n=t.memoizedProps,r[kt]=t,(s=r.nodeValue!==n)&&(e=Ye,e!==null))switch(e.tag){case 3:da(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&da(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[kt]=t,t.stateNode=r}return Ie(t),null;case 13:if(ie(de),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(le&&Qe!==null&&t.mode&1&&!(t.flags&128))Qu(),Qn(),t.flags|=98560,s=!1;else if(s=fa(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(A(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(A(317));s[kt]=t}else Qn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ie(t),s=!1}else pt!==null&&(Zs(pt),pt=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||de.current&1?we===0&&(we=3):Ji())),t.updateQueue!==null&&(t.flags|=4),Ie(t),null);case 4:return Jn(),Vs(e,t),e===null&&Mr(t.stateNode.containerInfo),Ie(t),null;case 10:return zi(t.type._context),Ie(t),null;case 17:return We(t.type)&&Ha(),Ie(t),null;case 19:if(ie(de),s=t.memoizedState,s===null)return Ie(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)dr(s,!1);else{if(we!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Xa(e),i!==null){for(t.flags|=128,dr(s,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,i=s.alternate,i===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=i.childLanes,s.lanes=i.lanes,s.child=i.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=i.memoizedProps,s.memoizedState=i.memoizedState,s.updateQueue=i.updateQueue,s.type=i.type,e=i.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return oe(de,de.current&1|2),t.child}e=e.sibling}s.tail!==null&&he()>qn&&(t.flags|=128,r=!0,dr(s,!1),t.lanes=4194304)}else{if(!r)if(e=Xa(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!le)return Ie(t),null}else 2*he()-s.renderingStartTime>qn&&n!==1073741824&&(t.flags|=128,r=!0,dr(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(n=s.last,n!==null?n.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=he(),t.sibling=null,n=de.current,oe(de,r?n&1|2:n&1),t):(Ie(t),null);case 22:case 23:return Yi(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ke&1073741824&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),null;case 24:return null;case 25:return null}throw Error(A(156,t.tag))}function Bm(e,t){switch(Ti(t),t.tag){case 1:return We(t.type)&&Ha(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Jn(),ie(Ue),ie(ze),Fi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Mi(t),null;case 13:if(ie(de),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(A(340));Qn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ie(de),null;case 4:return Jn(),null;case 10:return zi(t.type._context),null;case 22:case 23:return Yi(),null;case 24:return null;default:return null}}var ha=!1,_e=!1,Dm=typeof WeakSet=="function"?WeakSet:Set,H=null;function Fn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){me(e,t,r)}else n.current=null}function Ks(e,t,n){try{n()}catch(r){me(e,t,r)}}var cc=!1;function Um(e,t){if(Ts=Ba,e=$u(),bi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var i=0,l=-1,c=-1,u=0,h=0,f=e,g=null;t:for(;;){for(var v;f!==n||a!==0&&f.nodeType!==3||(l=i+a),f!==s||r!==0&&f.nodeType!==3||(c=i+r),f.nodeType===3&&(i+=f.nodeValue.length),(v=f.firstChild)!==null;)g=f,f=v;for(;;){if(f===e)break t;if(g===n&&++u===a&&(l=i),g===s&&++h===r&&(c=i),(v=f.nextSibling)!==null)break;f=g,g=f.parentNode}f=v}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Is={focusedElem:e,selectionRange:n},Ba=!1,H=t;H!==null;)if(t=H,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,H=e;else for(;H!==null;){t=H;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var w=x.memoizedProps,j=x.memoizedState,m=t.stateNode,p=m.getSnapshotBeforeUpdate(t.elementType===t.type?w:dt(t.type,w),j);m.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(A(163))}}catch(S){me(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,H=e;break}H=t.return}return x=cc,cc=!1,x}function Nr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var s=a.destroy;a.destroy=void 0,s!==void 0&&Ks(t,n,s)}a=a.next}while(a!==r)}}function xo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Gs(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function _d(e){var t=e.alternate;t!==null&&(e.alternate=null,_d(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[kt],delete t[Or],delete t[zs],delete t[Cm],delete t[Nm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Rd(e){return e.tag===5||e.tag===3||e.tag===4}function uc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rd(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.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 Qs(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Wa));else if(r!==4&&(e=e.child,e!==null))for(Qs(e,t,n),e=e.sibling;e!==null;)Qs(e,t,n),e=e.sibling}function Ys(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ys(e,t,n),e=e.sibling;e!==null;)Ys(e,t,n),e=e.sibling}var Ee=null,ft=!1;function Ut(e,t,n){for(n=n.child;n!==null;)zd(e,t,n),n=n.sibling}function zd(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(uo,n)}catch{}switch(n.tag){case 5:_e||Fn(n,t);case 6:var r=Ee,a=ft;Ee=null,Ut(e,t,n),Ee=r,ft=a,Ee!==null&&(ft?(e=Ee,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ee.removeChild(n.stateNode));break;case 18:Ee!==null&&(ft?(e=Ee,n=n.stateNode,e.nodeType===8?Ko(e.parentNode,n):e.nodeType===1&&Ko(e,n),Ar(e)):Ko(Ee,n.stateNode));break;case 4:r=Ee,a=ft,Ee=n.stateNode.containerInfo,ft=!0,Ut(e,t,n),Ee=r,ft=a;break;case 0:case 11:case 14:case 15:if(!_e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var s=a,i=s.destroy;s=s.tag,i!==void 0&&(s&2||s&4)&&Ks(n,t,i),a=a.next}while(a!==r)}Ut(e,t,n);break;case 1:if(!_e&&(Fn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){me(n,t,l)}Ut(e,t,n);break;case 21:Ut(e,t,n);break;case 22:n.mode&1?(_e=(r=_e)||n.memoizedState!==null,Ut(e,t,n),_e=r):Ut(e,t,n);break;default:Ut(e,t,n)}}function dc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Dm),t.forEach(function(r){var a=Xm.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function ut(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r];try{var s=e,i=t,l=i;e:for(;l!==null;){switch(l.tag){case 5:Ee=l.stateNode,ft=!1;break e;case 3:Ee=l.stateNode.containerInfo,ft=!0;break e;case 4:Ee=l.stateNode.containerInfo,ft=!0;break e}l=l.return}if(Ee===null)throw Error(A(160));zd(s,i,a),Ee=null,ft=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(u){me(a,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ad(t,e),t=t.sibling}function Ad(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ut(t,e),wt(e),r&4){try{Nr(3,e,e.return),xo(3,e)}catch(w){me(e,e.return,w)}try{Nr(5,e,e.return)}catch(w){me(e,e.return,w)}}break;case 1:ut(t,e),wt(e),r&512&&n!==null&&Fn(n,n.return);break;case 5:if(ut(t,e),wt(e),r&512&&n!==null&&Fn(n,n.return),e.flags&32){var a=e.stateNode;try{Ir(a,"")}catch(w){me(e,e.return,w)}}if(r&4&&(a=e.stateNode,a!=null)){var s=e.memoizedProps,i=n!==null?n.memoizedProps:s,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&nu(a,s),xs(l,i);var u=xs(l,s);for(i=0;i<c.length;i+=2){var h=c[i],f=c[i+1];h==="style"?iu(a,f):h==="dangerouslySetInnerHTML"?ou(a,f):h==="children"?Ir(a,f):mi(a,h,f,u)}switch(l){case"input":ms(a,s);break;case"textarea":ru(a,s);break;case"select":var g=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!s.multiple;var v=s.value;v!=null?Bn(a,!!s.multiple,v,!1):g!==!!s.multiple&&(s.defaultValue!=null?Bn(a,!!s.multiple,s.defaultValue,!0):Bn(a,!!s.multiple,s.multiple?[]:"",!1))}a[Or]=s}catch(w){me(e,e.return,w)}}break;case 6:if(ut(t,e),wt(e),r&4){if(e.stateNode===null)throw Error(A(162));a=e.stateNode,s=e.memoizedProps;try{a.nodeValue=s}catch(w){me(e,e.return,w)}}break;case 3:if(ut(t,e),wt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ar(t.containerInfo)}catch(w){me(e,e.return,w)}break;case 4:ut(t,e),wt(e);break;case 13:ut(t,e),wt(e),a=e.child,a.flags&8192&&(s=a.memoizedState!==null,a.stateNode.isHidden=s,!s||a.alternate!==null&&a.alternate.memoizedState!==null||(Gi=he())),r&4&&dc(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(_e=(u=_e)||h,ut(t,e),_e=u):ut(t,e),wt(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!h&&e.mode&1)for(H=e,h=e.child;h!==null;){for(f=H=h;H!==null;){switch(g=H,v=g.child,g.tag){case 0:case 11:case 14:case 15:Nr(4,g,g.return);break;case 1:Fn(g,g.return);var x=g.stateNode;if(typeof x.componentWillUnmount=="function"){r=g,n=g.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(w){me(r,n,w)}}break;case 5:Fn(g,g.return);break;case 22:if(g.memoizedState!==null){pc(f);continue}}v!==null?(v.return=g,H=v):pc(f)}h=h.sibling}e:for(h=null,f=e;;){if(f.tag===5){if(h===null){h=f;try{a=f.stateNode,u?(s=a.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=f.stateNode,c=f.memoizedProps.style,i=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=su("display",i))}catch(w){me(e,e.return,w)}}}else if(f.tag===6){if(h===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(w){me(e,e.return,w)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;h===f&&(h=null),f=f.return}h===f&&(h=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:ut(t,e),wt(e),r&4&&dc(e);break;case 21:break;default:ut(t,e),wt(e)}}function wt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Rd(n)){var r=n;break e}n=n.return}throw Error(A(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Ir(a,""),r.flags&=-33);var s=uc(e);Ys(e,s,a);break;case 3:case 4:var i=r.stateNode.containerInfo,l=uc(e);Qs(e,l,i);break;default:throw Error(A(161))}}catch(c){me(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Wm(e,t,n){H=e,$d(e)}function $d(e,t,n){for(var r=(e.mode&1)!==0;H!==null;){var a=H,s=a.child;if(a.tag===22&&r){var i=a.memoizedState!==null||ha;if(!i){var l=a.alternate,c=l!==null&&l.memoizedState!==null||_e;l=ha;var u=_e;if(ha=i,(_e=c)&&!u)for(H=a;H!==null;)i=H,c=i.child,i.tag===22&&i.memoizedState!==null?mc(a):c!==null?(c.return=i,H=c):mc(a);for(;s!==null;)H=s,$d(s),s=s.sibling;H=a,ha=l,_e=u}fc(e)}else a.subtreeFlags&8772&&s!==null?(s.return=a,H=s):fc(e)}}function fc(e){for(;H!==null;){var t=H;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:_e||xo(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!_e)if(n===null)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:dt(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Jl(t,s,r);break;case 3:var i=t.updateQueue;if(i!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Jl(t,i,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var h=u.memoizedState;if(h!==null){var f=h.dehydrated;f!==null&&Ar(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(A(163))}_e||t.flags&512&&Gs(t)}catch(g){me(t,t.return,g)}}if(t===e){H=null;break}if(n=t.sibling,n!==null){n.return=t.return,H=n;break}H=t.return}}function pc(e){for(;H!==null;){var t=H;if(t===e){H=null;break}var n=t.sibling;if(n!==null){n.return=t.return,H=n;break}H=t.return}}function mc(e){for(;H!==null;){var t=H;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{xo(4,t)}catch(c){me(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){me(t,a,c)}}var s=t.return;try{Gs(t)}catch(c){me(t,s,c)}break;case 5:var i=t.return;try{Gs(t)}catch(c){me(t,i,c)}}}catch(c){me(t,t.return,c)}if(t===e){H=null;break}var l=t.sibling;if(l!==null){l.return=t.return,H=l;break}H=t.return}}var Hm=Math.ceil,eo=Ot.ReactCurrentDispatcher,Vi=Ot.ReactCurrentOwner,at=Ot.ReactCurrentBatchConfig,ee=0,ke=null,ge=null,be=0,Ke=0,On=ln(0),we=0,Vr=null,kn=0,wo=0,Ki=0,Er=null,Be=null,Gi=0,qn=1/0,Pt=null,to=!1,Js=null,tn=null,ga=!1,Yt=null,no=0,br=0,Xs=null,Ia=-1,_a=0;function Le(){return ee&6?he():Ia!==-1?Ia:Ia=he()}function nn(e){return e.mode&1?ee&2&&be!==0?be&-be:bm.transition!==null?(_a===0&&(_a=xu()),_a):(e=re,e!==0||(e=window.event,e=e===void 0?16:Eu(e.type)),e):1}function ht(e,t,n,r){if(50<br)throw br=0,Xs=null,Error(A(185));Qr(e,n,r),(!(ee&2)||e!==ke)&&(e===ke&&(!(ee&2)&&(wo|=n),we===4&&Gt(e,be)),He(e,r),n===1&&ee===0&&!(t.mode&1)&&(qn=he()+500,go&&cn()))}function He(e,t){var n=e.callbackNode;bp(e,t);var r=Oa(e,e===ke?be:0);if(r===0)n!==null&&kl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&kl(n),t===1)e.tag===0?Em(hc.bind(null,e)):Vu(hc.bind(null,e)),jm(function(){!(ee&6)&&cn()}),n=null;else{switch(wu(r)){case 1:n=xi;break;case 4:n=yu;break;case 16:n=Fa;break;case 536870912:n=vu;break;default:n=Fa}n=Wd(n,Ld.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Ld(e,t){if(Ia=-1,_a=0,ee&6)throw Error(A(327));var n=e.callbackNode;if(Vn()&&e.callbackNode!==n)return null;var r=Oa(e,e===ke?be:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ro(e,r);else{t=r;var a=ee;ee|=2;var s=Fd();(ke!==e||be!==t)&&(Pt=null,qn=he()+500,vn(e,t));do try{Gm();break}catch(l){Md(e,l)}while(!0);Ri(),eo.current=s,ee=a,ge!==null?t=0:(ke=null,be=0,t=we)}if(t!==0){if(t===2&&(a=Cs(e),a!==0&&(r=a,t=qs(e,a))),t===1)throw n=Vr,vn(e,0),Gt(e,r),He(e,he()),n;if(t===6)Gt(e,r);else{if(a=e.current.alternate,!(r&30)&&!Vm(a)&&(t=ro(e,r),t===2&&(s=Cs(e),s!==0&&(r=s,t=qs(e,s))),t===1))throw n=Vr,vn(e,0),Gt(e,r),He(e,he()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(A(345));case 2:fn(e,Be,Pt);break;case 3:if(Gt(e,r),(r&130023424)===r&&(t=Gi+500-he(),10<t)){if(Oa(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){Le(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Rs(fn.bind(null,e,Be,Pt),t);break}fn(e,Be,Pt);break;case 4:if(Gt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var i=31-mt(r);s=1<<i,i=t[i],i>a&&(a=i),r&=~s}if(r=a,r=he()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Hm(r/1960))-r,10<r){e.timeoutHandle=Rs(fn.bind(null,e,Be,Pt),r);break}fn(e,Be,Pt);break;case 5:fn(e,Be,Pt);break;default:throw Error(A(329))}}}return He(e,he()),e.callbackNode===n?Ld.bind(null,e):null}function qs(e,t){var n=Er;return e.current.memoizedState.isDehydrated&&(vn(e,t).flags|=256),e=ro(e,t),e!==2&&(t=Be,Be=n,t!==null&&Zs(t)),e}function Zs(e){Be===null?Be=e:Be.push.apply(Be,e)}function Vm(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var a=n[r],s=a.getSnapshot;a=a.value;try{if(!gt(s(),a))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Gt(e,t){for(t&=~Ki,t&=~wo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-mt(t),r=1<<n;e[n]=-1,t&=~r}}function hc(e){if(ee&6)throw Error(A(327));Vn();var t=Oa(e,0);if(!(t&1))return He(e,he()),null;var n=ro(e,t);if(e.tag!==0&&n===2){var r=Cs(e);r!==0&&(t=r,n=qs(e,r))}if(n===1)throw n=Vr,vn(e,0),Gt(e,t),He(e,he()),n;if(n===6)throw Error(A(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,fn(e,Be,Pt),He(e,he()),null}function Qi(e,t){var n=ee;ee|=1;try{return e(t)}finally{ee=n,ee===0&&(qn=he()+500,go&&cn())}}function Cn(e){Yt!==null&&Yt.tag===0&&!(ee&6)&&Vn();var t=ee;ee|=1;var n=at.transition,r=re;try{if(at.transition=null,re=1,e)return e()}finally{re=r,at.transition=n,ee=t,!(ee&6)&&cn()}}function Yi(){Ke=On.current,ie(On)}function vn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Sm(n)),ge!==null)for(n=ge.return;n!==null;){var r=n;switch(Ti(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ha();break;case 3:Jn(),ie(Ue),ie(ze),Fi();break;case 5:Mi(r);break;case 4:Jn();break;case 13:ie(de);break;case 19:ie(de);break;case 10:zi(r.type._context);break;case 22:case 23:Yi()}n=n.return}if(ke=e,ge=e=rn(e.current,null),be=Ke=t,we=0,Vr=null,Ki=wo=kn=0,Be=Er=null,hn!==null){for(t=0;t<hn.length;t++)if(n=hn[t],r=n.interleaved,r!==null){n.interleaved=null;var a=r.next,s=n.pending;if(s!==null){var i=s.next;s.next=a,r.next=i}n.pending=r}hn=null}return e}function Md(e,t){do{var n=ge;try{if(Ri(),ba.current=Za,qa){for(var r=fe.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}qa=!1}if(jn=0,je=xe=fe=null,Cr=!1,Ur=0,Vi.current=null,n===null||n.return===null){we=1,Vr=t,ge=null;break}e:{var s=e,i=n.return,l=n,c=t;if(t=be,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,h=l,f=h.tag;if(!(h.mode&1)&&(f===0||f===11||f===15)){var g=h.alternate;g?(h.updateQueue=g.updateQueue,h.memoizedState=g.memoizedState,h.lanes=g.lanes):(h.updateQueue=null,h.memoizedState=null)}var v=nc(i);if(v!==null){v.flags&=-257,rc(v,i,l,s,t),v.mode&1&&tc(s,u,t),t=v,c=u;var x=t.updateQueue;if(x===null){var w=new Set;w.add(c),t.updateQueue=w}else x.add(c);break e}else{if(!(t&1)){tc(s,u,t),Ji();break e}c=Error(A(426))}}else if(le&&l.mode&1){var j=nc(i);if(j!==null){!(j.flags&65536)&&(j.flags|=256),rc(j,i,l,s,t),Ii(Xn(c,l));break e}}s=c=Xn(c,l),we!==4&&(we=2),Er===null?Er=[s]:Er.push(s),s=i;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var m=wd(s,c,t);Yl(s,m);break e;case 1:l=c;var p=s.type,y=s.stateNode;if(!(s.flags&128)&&(typeof p.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(tn===null||!tn.has(y)))){s.flags|=65536,t&=-t,s.lanes|=t;var S=Sd(s,l,t);Yl(s,S);break e}}s=s.return}while(s!==null)}Bd(n)}catch(b){t=b,ge===n&&n!==null&&(ge=n=n.return);continue}break}while(!0)}function Fd(){var e=eo.current;return eo.current=Za,e===null?Za:e}function Ji(){(we===0||we===3||we===2)&&(we=4),ke===null||!(kn&268435455)&&!(wo&268435455)||Gt(ke,be)}function ro(e,t){var n=ee;ee|=2;var r=Fd();(ke!==e||be!==t)&&(Pt=null,vn(e,t));do try{Km();break}catch(a){Md(e,a)}while(!0);if(Ri(),ee=n,eo.current=r,ge!==null)throw Error(A(261));return ke=null,be=0,we}function Km(){for(;ge!==null;)Od(ge)}function Gm(){for(;ge!==null&&!vp();)Od(ge)}function Od(e){var t=Ud(e.alternate,e,Ke);e.memoizedProps=e.pendingProps,t===null?Bd(e):ge=t,Vi.current=null}function Bd(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Bm(n,t),n!==null){n.flags&=32767,ge=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{we=6,ge=null;return}}else if(n=Om(n,t,Ke),n!==null){ge=n;return}if(t=t.sibling,t!==null){ge=t;return}ge=t=e}while(t!==null);we===0&&(we=5)}function fn(e,t,n){var r=re,a=at.transition;try{at.transition=null,re=1,Qm(e,t,n,r)}finally{at.transition=a,re=r}return null}function Qm(e,t,n,r){do Vn();while(Yt!==null);if(ee&6)throw Error(A(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(A(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(Pp(e,s),e===ke&&(ge=ke=null,be=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ga||(ga=!0,Wd(Fa,function(){return Vn(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=at.transition,at.transition=null;var i=re;re=1;var l=ee;ee|=4,Vi.current=null,Um(e,n),Ad(n,e),mm(Is),Ba=!!Ts,Is=Ts=null,e.current=n,Wm(n),xp(),ee=l,re=i,at.transition=s}else e.current=n;if(ga&&(ga=!1,Yt=e,no=a),s=e.pendingLanes,s===0&&(tn=null),jp(n.stateNode),He(e,he()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(to)throw to=!1,e=Js,Js=null,e;return no&1&&e.tag!==0&&Vn(),s=e.pendingLanes,s&1?e===Xs?br++:(br=0,Xs=e):br=0,cn(),null}function Vn(){if(Yt!==null){var e=wu(no),t=at.transition,n=re;try{if(at.transition=null,re=16>e?16:e,Yt===null)var r=!1;else{if(e=Yt,Yt=null,no=0,ee&6)throw Error(A(331));var a=ee;for(ee|=4,H=e.current;H!==null;){var s=H,i=s.child;if(H.flags&16){var l=s.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(H=u;H!==null;){var h=H;switch(h.tag){case 0:case 11:case 15:Nr(8,h,s)}var f=h.child;if(f!==null)f.return=h,H=f;else for(;H!==null;){h=H;var g=h.sibling,v=h.return;if(_d(h),h===u){H=null;break}if(g!==null){g.return=v,H=g;break}H=v}}}var x=s.alternate;if(x!==null){var w=x.child;if(w!==null){x.child=null;do{var j=w.sibling;w.sibling=null,w=j}while(w!==null)}}H=s}}if(s.subtreeFlags&2064&&i!==null)i.return=s,H=i;else e:for(;H!==null;){if(s=H,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Nr(9,s,s.return)}var m=s.sibling;if(m!==null){m.return=s.return,H=m;break e}H=s.return}}var p=e.current;for(H=p;H!==null;){i=H;var y=i.child;if(i.subtreeFlags&2064&&y!==null)y.return=i,H=y;else e:for(i=p;H!==null;){if(l=H,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:xo(9,l)}}catch(b){me(l,l.return,b)}if(l===i){H=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,H=S;break e}H=l.return}}if(ee=a,cn(),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(uo,e)}catch{}r=!0}return r}finally{re=n,at.transition=t}}return!1}function gc(e,t,n){t=Xn(n,t),t=wd(e,t,1),e=en(e,t,1),t=Le(),e!==null&&(Qr(e,1,t),He(e,t))}function me(e,t,n){if(e.tag===3)gc(e,e,n);else for(;t!==null;){if(t.tag===3){gc(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(tn===null||!tn.has(r))){e=Xn(n,e),e=Sd(t,e,1),t=en(t,e,1),e=Le(),t!==null&&(Qr(t,1,e),He(t,e));break}}t=t.return}}function Ym(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Le(),e.pingedLanes|=e.suspendedLanes&n,ke===e&&(be&n)===n&&(we===4||we===3&&(be&130023424)===be&&500>he()-Gi?vn(e,0):Ki|=n),He(e,t)}function Dd(e,t){t===0&&(e.mode&1?(t=sa,sa<<=1,!(sa&130023424)&&(sa=4194304)):t=1);var n=Le();e=Lt(e,t),e!==null&&(Qr(e,t,n),He(e,n))}function Jm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Dd(e,n)}function Xm(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(A(314))}r!==null&&r.delete(t),Dd(e,n)}var Ud;Ud=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ue.current)De=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return De=!1,Fm(e,t,n);De=!!(e.flags&131072)}else De=!1,le&&t.flags&1048576&&Ku(t,Ga,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ta(e,t),e=t.pendingProps;var a=Gn(t,ze.current);Hn(t,n),a=Bi(null,t,r,e,a,n);var s=Di();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,We(r)?(s=!0,Va(t)):s=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,$i(t),a.updater=vo,t.stateNode=a,a._reactInternals=t,Os(t,r,e,n),t=Us(null,t,r,!0,s,n)):(t.tag=0,le&&s&&Pi(t),$e(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ta(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=Zm(r),e=dt(r,e),a){case 0:t=Ds(null,t,r,e,n);break e;case 1:t=sc(null,t,r,e,n);break e;case 11:t=ac(null,t,r,e,n);break e;case 14:t=oc(null,t,r,dt(r.type,e),n);break e}throw Error(A(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:dt(r,a),Ds(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:dt(r,a),sc(e,t,r,a,n);case 3:e:{if(Nd(t),e===null)throw Error(A(387));r=t.pendingProps,s=t.memoizedState,a=s.element,qu(e,t),Ja(t,r,null,n);var i=t.memoizedState;if(r=i.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){a=Xn(Error(A(423)),t),t=ic(e,t,r,n,a);break e}else if(r!==a){a=Xn(Error(A(424)),t),t=ic(e,t,r,n,a);break e}else for(Qe=Zt(t.stateNode.containerInfo.firstChild),Ye=t,le=!0,pt=null,n=Ju(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Qn(),r===a){t=Mt(e,t,n);break e}$e(e,t,r,n)}t=t.child}return t;case 5:return Zu(t),e===null&&Ls(t),r=t.type,a=t.pendingProps,s=e!==null?e.memoizedProps:null,i=a.children,_s(r,a)?i=null:s!==null&&_s(r,s)&&(t.flags|=32),Cd(e,t),$e(e,t,i,n),t.child;case 6:return e===null&&Ls(t),null;case 13:return Ed(e,t,n);case 4:return Li(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Yn(t,null,r,n):$e(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:dt(r,a),ac(e,t,r,a,n);case 7:return $e(e,t,t.pendingProps,n),t.child;case 8:return $e(e,t,t.pendingProps.children,n),t.child;case 12:return $e(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,s=t.memoizedProps,i=a.value,oe(Qa,r._currentValue),r._currentValue=i,s!==null)if(gt(s.value,i)){if(s.children===a.children&&!Ue.current){t=Mt(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){i=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=zt(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?c.next=c:(c.next=h.next,h.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ms(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)i=s.type===t.type?null:s.child;else if(s.tag===18){if(i=s.return,i===null)throw Error(A(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Ms(i,n,t),i=s.sibling}else i=s.child;if(i!==null)i.return=s;else for(i=s;i!==null;){if(i===t){i=null;break}if(s=i.sibling,s!==null){s.return=i.return,i=s;break}i=i.return}s=i}$e(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,Hn(t,n),a=ot(a),r=r(a),t.flags|=1,$e(e,t,r,n),t.child;case 14:return r=t.type,a=dt(r,t.pendingProps),a=dt(r.type,a),oc(e,t,r,a,n);case 15:return jd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:dt(r,a),Ta(e,t),t.tag=1,We(r)?(e=!0,Va(t)):e=!1,Hn(t,n),xd(t,r,a),Os(t,r,a,n),Us(null,t,r,!0,e,n);case 19:return bd(e,t,n);case 22:return kd(e,t,n)}throw Error(A(156,t.tag))};function Wd(e,t){return gu(e,t)}function qm(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rt(e,t,n,r){return new qm(e,t,n,r)}function Xi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Zm(e){if(typeof e=="function")return Xi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===gi)return 11;if(e===yi)return 14}return 2}function rn(e,t){var n=e.alternate;return n===null?(n=rt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ra(e,t,n,r,a,s){var i=2;if(r=e,typeof e=="function")Xi(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Tn:return xn(n.children,a,s,t);case hi:i=8,a|=8;break;case cs:return e=rt(12,n,t,a|2),e.elementType=cs,e.lanes=s,e;case us:return e=rt(13,n,t,a),e.elementType=us,e.lanes=s,e;case ds:return e=rt(19,n,t,a),e.elementType=ds,e.lanes=s,e;case Zc:return So(n,a,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Xc:i=10;break e;case qc:i=9;break e;case gi:i=11;break e;case yi:i=14;break e;case Wt:i=16,r=null;break e}throw Error(A(130,e==null?e:typeof e,""))}return t=rt(i,n,t,a),t.elementType=e,t.type=r,t.lanes=s,t}function xn(e,t,n,r){return e=rt(7,e,r,t),e.lanes=n,e}function So(e,t,n,r){return e=rt(22,e,r,t),e.elementType=Zc,e.lanes=n,e.stateNode={isHidden:!1},e}function es(e,t,n){return e=rt(6,e,null,t),e.lanes=n,e}function ts(e,t,n){return t=rt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function eh(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$o(0),this.expirationTimes=$o(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$o(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function qi(e,t,n,r,a,s,i,l,c){return e=new eh(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=rt(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},$i(s),e}function th(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Pn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Hd(e){if(!e)return on;e=e._reactInternals;e:{if(En(e)!==e||e.tag!==1)throw Error(A(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(We(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(A(171))}if(e.tag===1){var n=e.type;if(We(n))return Hu(e,n,t)}return t}function Vd(e,t,n,r,a,s,i,l,c){return e=qi(n,r,!0,e,a,s,i,l,c),e.context=Hd(null),n=e.current,r=Le(),a=nn(n),s=zt(r,a),s.callback=t??null,en(n,s,a),e.current.lanes=a,Qr(e,a,r),He(e,r),e}function jo(e,t,n,r){var a=t.current,s=Le(),i=nn(a);return n=Hd(n),t.context===null?t.context=n:t.pendingContext=n,t=zt(s,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=en(a,t,i),e!==null&&(ht(e,a,i,s),Ea(e,a,i)),i}function ao(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function yc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Zi(e,t){yc(e,t),(e=e.alternate)&&yc(e,t)}function nh(){return null}var Kd=typeof reportError=="function"?reportError:function(e){console.error(e)};function el(e){this._internalRoot=e}ko.prototype.render=el.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(A(409));jo(e,t,null,null)};ko.prototype.unmount=el.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Cn(function(){jo(null,e,null,null)}),t[$t]=null}};function ko(e){this._internalRoot=e}ko.prototype.unstable_scheduleHydration=function(e){if(e){var t=ku();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Kt.length&&t!==0&&t<Kt[n].priority;n++);Kt.splice(n,0,e),n===0&&Nu(e)}};function tl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Co(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function vc(){}function rh(e,t,n,r,a){if(a){if(typeof r=="function"){var s=r;r=function(){var u=ao(i);s.call(u)}}var i=Vd(t,r,e,0,null,!1,!1,"",vc);return e._reactRootContainer=i,e[$t]=i.current,Mr(e.nodeType===8?e.parentNode:e),Cn(),i}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var u=ao(c);l.call(u)}}var c=qi(e,0,!1,null,null,!1,!1,"",vc);return e._reactRootContainer=c,e[$t]=c.current,Mr(e.nodeType===8?e.parentNode:e),Cn(function(){jo(t,c,n,r)}),c}function No(e,t,n,r,a){var s=n._reactRootContainer;if(s){var i=s;if(typeof a=="function"){var l=a;a=function(){var c=ao(i);l.call(c)}}jo(t,i,e,a)}else i=rh(n,t,e,a,r);return ao(i)}Su=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=gr(t.pendingLanes);n!==0&&(wi(t,n|1),He(t,he()),!(ee&6)&&(qn=he()+500,cn()))}break;case 13:Cn(function(){var r=Lt(e,1);if(r!==null){var a=Le();ht(r,e,1,a)}}),Zi(e,1)}};Si=function(e){if(e.tag===13){var t=Lt(e,134217728);if(t!==null){var n=Le();ht(t,e,134217728,n)}Zi(e,134217728)}};ju=function(e){if(e.tag===13){var t=nn(e),n=Lt(e,t);if(n!==null){var r=Le();ht(n,e,t,r)}Zi(e,t)}};ku=function(){return re};Cu=function(e,t){var n=re;try{return re=e,t()}finally{re=n}};Ss=function(e,t,n){switch(t){case"input":if(ms(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=ho(r);if(!a)throw Error(A(90));tu(r),ms(r,a)}}}break;case"textarea":ru(e,n);break;case"select":t=n.value,t!=null&&Bn(e,!!n.multiple,t,!1)}};uu=Qi;du=Cn;var ah={usingClientEntryPoint:!1,Events:[Jr,zn,ho,lu,cu,Qi]},fr={findFiberByHostInstance:mn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},oh={bundleType:fr.bundleType,version:fr.version,rendererPackageName:fr.rendererPackageName,rendererConfig:fr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ot.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=mu(e),e===null?null:e.stateNode},findFiberByHostInstance:fr.findFiberByHostInstance||nh,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ya=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ya.isDisabled&&ya.supportsFiber)try{uo=ya.inject(oh),Ct=ya}catch{}}Xe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ah;Xe.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!tl(t))throw Error(A(200));return th(e,t,null,n)};Xe.createRoot=function(e,t){if(!tl(e))throw Error(A(299));var n=!1,r="",a=Kd;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=qi(e,1,!1,null,null,n,!1,r,a),e[$t]=t.current,Mr(e.nodeType===8?e.parentNode:e),new el(t)};Xe.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(A(188)):(e=Object.keys(e).join(","),Error(A(268,e)));return e=mu(t),e=e===null?null:e.stateNode,e};Xe.flushSync=function(e){return Cn(e)};Xe.hydrate=function(e,t,n){if(!Co(t))throw Error(A(200));return No(null,e,t,!0,n)};Xe.hydrateRoot=function(e,t,n){if(!tl(e))throw Error(A(405));var r=n!=null&&n.hydratedSources||null,a=!1,s="",i=Kd;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=Vd(t,null,e,1,n??null,a,!1,s,i),e[$t]=t.current,Mr(e),r)for(e=0;e<r.length;e++)n=r[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new ko(t)};Xe.render=function(e,t,n){if(!Co(t))throw Error(A(200));return No(null,e,t,!1,n)};Xe.unmountComponentAtNode=function(e){if(!Co(e))throw Error(A(40));return e._reactRootContainer?(Cn(function(){No(null,null,e,!1,function(){e._reactRootContainer=null,e[$t]=null})}),!0):!1};Xe.unstable_batchedUpdates=Qi;Xe.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Co(n))throw Error(A(200));if(e==null||e._reactInternals===void 0)throw Error(A(38));return No(e,t,n,!1,r)};Xe.version="18.3.1-next-f1338f8080-20240426";function Gd(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Gd)}catch(e){console.error(e)}}Gd(),Gc.exports=Xe;var Qd=Gc.exports,Yd,xc=Qd;Yd=xc.createRoot,xc.hydrateRoot;/**
40
+ `+s.stack}return{value:e,source:t,stack:a,digest:null}}function qo(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ds(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Lm=typeof WeakMap=="function"?WeakMap:Map;function Sd(e,t,n){n=zt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){to||(to=!0,Xs=r),Ds(e,t)},n}function jd(e,t,n){n=zt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){Ds(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Ds(e,t),typeof r!="function"&&(tn===null?tn=new Set([this]):tn.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function nc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Lm;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=Jm.bind(null,e,t,n),t.then(e,e))}function rc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function ac(e,t,n,r,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=zt(-1,1),t.tag=2,en(n,t,1))),n.lanes|=1),e)}var Mm=Ot.ReactCurrentOwner,De=!1;function $e(e,t,n,r){t.child=e===null?Xu(t,null,n,r):Qn(t,e.child,n,r)}function oc(e,t,n,r,a){n=n.render;var s=t.ref;return Hn(t,a),r=Di(e,t,n,r,s,a),n=Ui(),e!==null&&!De?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Mt(e,t,a)):(le&&n&&Ti(t),t.flags|=1,$e(e,t,r,a),t.child)}function sc(e,t,n,r,a){if(e===null){var s=n.type;return typeof s=="function"&&!qi(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,kd(e,t,s,r,a)):(e=_a(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&a)){var i=s.memoizedProps;if(n=n.compare,n=n!==null?n:Lr,n(i,r)&&e.ref===t.ref)return Mt(e,t,a)}return t.flags|=1,e=rn(s,r),e.ref=t.ref,e.return=t,t.child=e}function kd(e,t,n,r,a){if(e!==null){var s=e.memoizedProps;if(Lr(s,r)&&e.ref===t.ref)if(De=!1,t.pendingProps=r=s,(e.lanes&a)!==0)e.flags&131072&&(De=!0);else return t.lanes=e.lanes,Mt(e,t,a)}return Us(e,t,n,r,a)}function Cd(e,t,n){var r=t.pendingProps,a=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},oe(On,Ke),Ke|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,oe(On,Ke),Ke|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,oe(On,Ke),Ke|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,oe(On,Ke),Ke|=r;return $e(e,t,a,n),t.child}function Nd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Us(e,t,n,r,a){var s=We(n)?wn:ze.current;return s=Gn(t,s),Hn(t,a),n=Di(e,t,n,r,s,a),r=Ui(),e!==null&&!De?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Mt(e,t,a)):(le&&r&&Ti(t),t.flags|=1,$e(e,t,n,a),t.child)}function ic(e,t,n,r,a){if(We(n)){var s=!0;Va(t)}else s=!1;if(Hn(t,a),t.stateNode===null)Ta(e,t),wd(t,n,r),Bs(t,n,r,a),r=!0;else if(e===null){var i=t.stateNode,l=t.memoizedProps;i.props=l;var c=i.context,u=n.contextType;typeof u=="object"&&u!==null?u=ot(u):(u=We(n)?wn:ze.current,u=Gn(t,u));var h=n.getDerivedStateFromProps,f=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==r||c!==u)&&tc(t,i,r,u),Ht=!1;var v=t.memoizedState;i.state=v,Ja(t,r,i,a),c=t.memoizedState,l!==r||v!==c||Ue.current||Ht?(typeof h=="function"&&(Os(t,n,h,r),c=t.memoizedState),(l=Ht||ec(t,n,l,r,v,c,u))?(f||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=r,t.memoizedState=c),i.props=r,i.state=c,i.context=u,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Zu(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:dt(t.type,l),i.props=u,f=t.pendingProps,v=i.context,c=n.contextType,typeof c=="object"&&c!==null?c=ot(c):(c=We(n)?wn:ze.current,c=Gn(t,c));var y=n.getDerivedStateFromProps;(h=typeof y=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==f||v!==c)&&tc(t,i,r,c),Ht=!1,v=t.memoizedState,i.state=v,Ja(t,r,i,a);var x=t.memoizedState;l!==f||v!==x||Ue.current||Ht?(typeof y=="function"&&(Os(t,n,y,r),x=t.memoizedState),(u=Ht||ec(t,n,u,r,v,x,c)||!1)?(h||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,x,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,x,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&v===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&v===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),i.props=r,i.state=x,i.context=c,r=u):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&v===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&v===e.memoizedState||(t.flags|=1024),r=!1)}return Ws(e,t,n,r,s,a)}function Ws(e,t,n,r,a,s){Nd(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return a&&Kl(t,n,!1),Mt(e,t,s);r=t.stateNode,Mm.current=t;var l=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=Qn(t,e.child,null,s),t.child=Qn(t,null,l,s)):$e(e,t,l,s),t.memoizedState=r.state,a&&Kl(t,n,!0),t.child}function bd(e){var t=e.stateNode;t.pendingContext?Vl(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Vl(e,t.context,!1),Mi(e,t.containerInfo)}function lc(e,t,n,r,a){return Yn(),Ri(a),t.flags|=256,$e(e,t,n,r),t.child}var Hs={dehydrated:null,treeContext:null,retryLane:0};function Vs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ed(e,t,n){var r=t.pendingProps,a=de.current,s=!1,i=(t.flags&128)!==0,l;if((l=i)||(l=e!==null&&e.memoizedState===null?!1:(a&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),oe(de,a&1),e===null)return Ms(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,s?(r=t.mode,s=t.child,i={mode:"hidden",children:i},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=i):s=So(i,r,0,null),e=xn(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Vs(n),t.memoizedState=Hs,e):Vi(t,i));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return Fm(e,t,i,r,l,a,n);if(s){s=r.fallback,i=t.mode,a=e.child,l=a.sibling;var c={mode:"hidden",children:r.children};return!(i&1)&&t.child!==a?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=rn(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?s=rn(l,s):(s=xn(s,i,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,i=e.child.memoizedState,i=i===null?Vs(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},s.memoizedState=i,s.childLanes=e.childLanes&~n,t.memoizedState=Hs,r}return s=e.child,e=s.sibling,r=rn(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Vi(e,t){return t=So({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ma(e,t,n,r){return r!==null&&Ri(r),Qn(t,e.child,null,n),e=Vi(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Fm(e,t,n,r,a,s,i){if(n)return t.flags&256?(t.flags&=-257,r=qo(Error(A(422))),ma(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,a=t.mode,r=So({mode:"visible",children:r.children},a,0,null),s=xn(s,a,i,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Qn(t,e.child,null,i),t.child.memoizedState=Vs(i),t.memoizedState=Hs,s);if(!(t.mode&1))return ma(e,t,i,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(A(419)),r=qo(s,r,void 0),ma(e,t,i,r)}if(l=(i&e.childLanes)!==0,De||l){if(r=ke,r!==null){switch(i&-i){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(r.suspendedLanes|i)?0:a,a!==0&&a!==s.retryLane&&(s.retryLane=a,Lt(e,a),ht(r,e,a,-1))}return Xi(),r=qo(Error(A(421))),ma(e,t,i,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=Xm.bind(null,e),a._reactRetry=t,null):(e=s.treeContext,Ye=Zt(a.nextSibling),Qe=t,le=!0,pt=null,e!==null&&(tt[nt++]=It,tt[nt++]=Rt,tt[nt++]=Sn,It=e.id,Rt=e.overflow,Sn=t),t=Vi(t,r.children),t.flags|=4096,t)}function cc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Fs(e.return,t,n)}function Zo(e,t,n,r,a){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=a)}function Pd(e,t,n){var r=t.pendingProps,a=r.revealOrder,s=r.tail;if($e(e,t,r.children,n),r=de.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&cc(e,n,t);else if(e.tag===19)cc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(oe(de,r),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&Xa(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),Zo(t,!1,a,n,s);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&Xa(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}Zo(t,!0,n,null,s);break;case"together":Zo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ta(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Mt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),kn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(A(153));if(t.child!==null){for(e=t.child,n=rn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=rn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Om(e,t,n){switch(t.tag){case 3:bd(t),Yn();break;case 5:ed(t);break;case 1:We(t.type)&&Va(t);break;case 4:Mi(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;oe(Ya,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(oe(de,de.current&1),t.flags|=128,null):n&t.child.childLanes?Ed(e,t,n):(oe(de,de.current&1),e=Mt(e,t,n),e!==null?e.sibling:null);oe(de,de.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Pd(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),oe(de,de.current),r)break;return null;case 22:case 23:return t.lanes=0,Cd(e,t,n)}return Mt(e,t,n)}var Td,Ks,Id,Rd;Td=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Ks=function(){};Id=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,gn(Nt.current);var s=null;switch(n){case"input":a=ms(e,a),r=ms(e,r),s=[];break;case"select":a=pe({},a,{value:void 0}),r=pe({},r,{value:void 0}),s=[];break;case"textarea":a=vs(e,a),r=vs(e,r),s=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Wa)}xs(n,r);var i;n=null;for(u in a)if(!r.hasOwnProperty(u)&&a.hasOwnProperty(u)&&a[u]!=null)if(u==="style"){var l=a[u];for(i in l)l.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Tr.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(l=a!=null?a[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(i in l)!l.hasOwnProperty(i)||c&&c.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in c)c.hasOwnProperty(i)&&l[i]!==c[i]&&(n||(n={}),n[i]=c[i])}else n||(s||(s=[]),s.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(s=s||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Tr.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&se("scroll",e),s||l===c||(s=[])):(s=s||[]).push(u,c))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}};Rd=function(e,t,n,r){n!==r&&(t.flags|=4)};function dr(e,t){if(!le)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ie(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&14680064,r|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Bm(e,t,n){var r=t.pendingProps;switch(Ii(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return We(t.type)&&Ha(),Ie(t),null;case 3:return r=t.stateNode,Jn(),ie(Ue),ie(ze),Oi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(fa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pt!==null&&(ei(pt),pt=null))),Ks(e,t),Ie(t),null;case 5:Fi(t);var a=gn(Dr.current);if(n=t.type,e!==null&&t.stateNode!=null)Id(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(A(166));return Ie(t),null}if(e=gn(Nt.current),fa(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[kt]=t,r[Or]=s,e=(t.mode&1)!==0,n){case"dialog":se("cancel",r),se("close",r);break;case"iframe":case"object":case"embed":se("load",r);break;case"video":case"audio":for(a=0;a<vr.length;a++)se(vr[a],r);break;case"source":se("error",r);break;case"img":case"image":case"link":se("error",r),se("load",r);break;case"details":se("toggle",r);break;case"input":yl(r,s),se("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},se("invalid",r);break;case"textarea":wl(r,s),se("invalid",r)}xs(n,s),a=null;for(var i in s)if(s.hasOwnProperty(i)){var l=s[i];i==="children"?typeof l=="string"?r.textContent!==l&&(s.suppressHydrationWarning!==!0&&da(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&da(r.textContent,l,e),a=["children",""+l]):Tr.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&se("scroll",r)}switch(n){case"input":ra(r),xl(r,s,!0);break;case"textarea":ra(r),Sl(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Wa)}r=a,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=ou(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[kt]=t,e[Or]=r,Td(e,t,!1,!1),t.stateNode=e;e:{switch(i=ws(n,r),n){case"dialog":se("cancel",e),se("close",e),a=r;break;case"iframe":case"object":case"embed":se("load",e),a=r;break;case"video":case"audio":for(a=0;a<vr.length;a++)se(vr[a],e);a=r;break;case"source":se("error",e),a=r;break;case"img":case"image":case"link":se("error",e),se("load",e),a=r;break;case"details":se("toggle",e),a=r;break;case"input":yl(e,r),a=ms(e,r),se("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=pe({},r,{value:void 0}),se("invalid",e);break;case"textarea":wl(e,r),a=vs(e,r),se("invalid",e);break;default:a=r}xs(n,a),l=a;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];s==="style"?lu(e,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&su(e,c)):s==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Ir(e,c):typeof c=="number"&&Ir(e,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Tr.hasOwnProperty(s)?c!=null&&s==="onScroll"&&se("scroll",e):c!=null&&hi(e,s,c,i))}switch(n){case"input":ra(e),xl(e,r,!1);break;case"textarea":ra(e),Sl(e);break;case"option":r.value!=null&&e.setAttribute("value",""+an(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Bn(e,!!r.multiple,s,!1):r.defaultValue!=null&&Bn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=Wa)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ie(t),null;case 6:if(e&&t.stateNode!=null)Rd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(A(166));if(n=gn(Dr.current),gn(Nt.current),fa(t)){if(r=t.stateNode,n=t.memoizedProps,r[kt]=t,(s=r.nodeValue!==n)&&(e=Qe,e!==null))switch(e.tag){case 3:da(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&da(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[kt]=t,t.stateNode=r}return Ie(t),null;case 13:if(ie(de),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(le&&Ye!==null&&t.mode&1&&!(t.flags&128))Qu(),Yn(),t.flags|=98560,s=!1;else if(s=fa(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(A(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(A(317));s[kt]=t}else Yn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ie(t),s=!1}else pt!==null&&(ei(pt),pt=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||de.current&1?we===0&&(we=3):Xi())),t.updateQueue!==null&&(t.flags|=4),Ie(t),null);case 4:return Jn(),Ks(e,t),e===null&&Mr(t.stateNode.containerInfo),Ie(t),null;case 10:return Ai(t.type._context),Ie(t),null;case 17:return We(t.type)&&Ha(),Ie(t),null;case 19:if(ie(de),s=t.memoizedState,s===null)return Ie(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)dr(s,!1);else{if(we!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Xa(e),i!==null){for(t.flags|=128,dr(s,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,i=s.alternate,i===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=i.childLanes,s.lanes=i.lanes,s.child=i.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=i.memoizedProps,s.memoizedState=i.memoizedState,s.updateQueue=i.updateQueue,s.type=i.type,e=i.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return oe(de,de.current&1|2),t.child}e=e.sibling}s.tail!==null&&he()>qn&&(t.flags|=128,r=!0,dr(s,!1),t.lanes=4194304)}else{if(!r)if(e=Xa(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!le)return Ie(t),null}else 2*he()-s.renderingStartTime>qn&&n!==1073741824&&(t.flags|=128,r=!0,dr(s,!1),t.lanes=4194304);s.isBackwards?(i.sibling=t.child,t.child=i):(n=s.last,n!==null?n.sibling=i:t.child=i,s.last=i)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=he(),t.sibling=null,n=de.current,oe(de,r?n&1|2:n&1),t):(Ie(t),null);case 22:case 23:return Ji(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ke&1073741824&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),null;case 24:return null;case 25:return null}throw Error(A(156,t.tag))}function Dm(e,t){switch(Ii(t),t.tag){case 1:return We(t.type)&&Ha(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Jn(),ie(Ue),ie(ze),Oi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Fi(t),null;case 13:if(ie(de),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(A(340));Yn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ie(de),null;case 4:return Jn(),null;case 10:return Ai(t.type._context),null;case 22:case 23:return Ji(),null;case 24:return null;default:return null}}var ha=!1,Re=!1,Um=typeof WeakSet=="function"?WeakSet:Set,H=null;function Fn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){me(e,t,r)}else n.current=null}function Gs(e,t,n){try{n()}catch(r){me(e,t,r)}}var uc=!1;function Wm(e,t){if(Is=Ba,e=Lu(),Pi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var i=0,l=-1,c=-1,u=0,h=0,f=e,v=null;t:for(;;){for(var y;f!==n||a!==0&&f.nodeType!==3||(l=i+a),f!==s||r!==0&&f.nodeType!==3||(c=i+r),f.nodeType===3&&(i+=f.nodeValue.length),(y=f.firstChild)!==null;)v=f,f=y;for(;;){if(f===e)break t;if(v===n&&++u===a&&(l=i),v===s&&++h===r&&(c=i),(y=f.nextSibling)!==null)break;f=v,v=f.parentNode}f=y}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Rs={focusedElem:e,selectionRange:n},Ba=!1,H=t;H!==null;)if(t=H,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,H=e;else for(;H!==null;){t=H;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var w=x.memoizedProps,j=x.memoizedState,m=t.stateNode,p=m.getSnapshotBeforeUpdate(t.elementType===t.type?w:dt(t.type,w),j);m.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(A(163))}}catch(S){me(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,H=e;break}H=t.return}return x=uc,uc=!1,x}function Nr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var s=a.destroy;a.destroy=void 0,s!==void 0&&Gs(t,n,s)}a=a.next}while(a!==r)}}function xo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ys(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function _d(e){var t=e.alternate;t!==null&&(e.alternate=null,_d(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[kt],delete t[Or],delete t[As],delete t[Nm],delete t[bm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function zd(e){return e.tag===5||e.tag===3||e.tag===4}function dc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||zd(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.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 Qs(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Wa));else if(r!==4&&(e=e.child,e!==null))for(Qs(e,t,n),e=e.sibling;e!==null;)Qs(e,t,n),e=e.sibling}function Js(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Js(e,t,n),e=e.sibling;e!==null;)Js(e,t,n),e=e.sibling}var be=null,ft=!1;function Ut(e,t,n){for(n=n.child;n!==null;)Ad(e,t,n),n=n.sibling}function Ad(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(uo,n)}catch{}switch(n.tag){case 5:Re||Fn(n,t);case 6:var r=be,a=ft;be=null,Ut(e,t,n),be=r,ft=a,be!==null&&(ft?(e=be,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):be.removeChild(n.stateNode));break;case 18:be!==null&&(ft?(e=be,n=n.stateNode,e.nodeType===8?Ko(e.parentNode,n):e.nodeType===1&&Ko(e,n),Ar(e)):Ko(be,n.stateNode));break;case 4:r=be,a=ft,be=n.stateNode.containerInfo,ft=!0,Ut(e,t,n),be=r,ft=a;break;case 0:case 11:case 14:case 15:if(!Re&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var s=a,i=s.destroy;s=s.tag,i!==void 0&&(s&2||s&4)&&Gs(n,t,i),a=a.next}while(a!==r)}Ut(e,t,n);break;case 1:if(!Re&&(Fn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){me(n,t,l)}Ut(e,t,n);break;case 21:Ut(e,t,n);break;case 22:n.mode&1?(Re=(r=Re)||n.memoizedState!==null,Ut(e,t,n),Re=r):Ut(e,t,n);break;default:Ut(e,t,n)}}function fc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Um),t.forEach(function(r){var a=qm.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function ut(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r];try{var s=e,i=t,l=i;e:for(;l!==null;){switch(l.tag){case 5:be=l.stateNode,ft=!1;break e;case 3:be=l.stateNode.containerInfo,ft=!0;break e;case 4:be=l.stateNode.containerInfo,ft=!0;break e}l=l.return}if(be===null)throw Error(A(160));Ad(s,i,a),be=null,ft=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(u){me(a,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)$d(t,e),t=t.sibling}function $d(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ut(t,e),wt(e),r&4){try{Nr(3,e,e.return),xo(3,e)}catch(w){me(e,e.return,w)}try{Nr(5,e,e.return)}catch(w){me(e,e.return,w)}}break;case 1:ut(t,e),wt(e),r&512&&n!==null&&Fn(n,n.return);break;case 5:if(ut(t,e),wt(e),r&512&&n!==null&&Fn(n,n.return),e.flags&32){var a=e.stateNode;try{Ir(a,"")}catch(w){me(e,e.return,w)}}if(r&4&&(a=e.stateNode,a!=null)){var s=e.memoizedProps,i=n!==null?n.memoizedProps:s,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&ru(a,s),ws(l,i);var u=ws(l,s);for(i=0;i<c.length;i+=2){var h=c[i],f=c[i+1];h==="style"?lu(a,f):h==="dangerouslySetInnerHTML"?su(a,f):h==="children"?Ir(a,f):hi(a,h,f,u)}switch(l){case"input":hs(a,s);break;case"textarea":au(a,s);break;case"select":var v=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!s.multiple;var y=s.value;y!=null?Bn(a,!!s.multiple,y,!1):v!==!!s.multiple&&(s.defaultValue!=null?Bn(a,!!s.multiple,s.defaultValue,!0):Bn(a,!!s.multiple,s.multiple?[]:"",!1))}a[Or]=s}catch(w){me(e,e.return,w)}}break;case 6:if(ut(t,e),wt(e),r&4){if(e.stateNode===null)throw Error(A(162));a=e.stateNode,s=e.memoizedProps;try{a.nodeValue=s}catch(w){me(e,e.return,w)}}break;case 3:if(ut(t,e),wt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ar(t.containerInfo)}catch(w){me(e,e.return,w)}break;case 4:ut(t,e),wt(e);break;case 13:ut(t,e),wt(e),a=e.child,a.flags&8192&&(s=a.memoizedState!==null,a.stateNode.isHidden=s,!s||a.alternate!==null&&a.alternate.memoizedState!==null||(Yi=he())),r&4&&fc(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(Re=(u=Re)||h,ut(t,e),Re=u):ut(t,e),wt(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!h&&e.mode&1)for(H=e,h=e.child;h!==null;){for(f=H=h;H!==null;){switch(v=H,y=v.child,v.tag){case 0:case 11:case 14:case 15:Nr(4,v,v.return);break;case 1:Fn(v,v.return);var x=v.stateNode;if(typeof x.componentWillUnmount=="function"){r=v,n=v.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(w){me(r,n,w)}}break;case 5:Fn(v,v.return);break;case 22:if(v.memoizedState!==null){mc(f);continue}}y!==null?(y.return=v,H=y):mc(f)}h=h.sibling}e:for(h=null,f=e;;){if(f.tag===5){if(h===null){h=f;try{a=f.stateNode,u?(s=a.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=f.stateNode,c=f.memoizedProps.style,i=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=iu("display",i))}catch(w){me(e,e.return,w)}}}else if(f.tag===6){if(h===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(w){me(e,e.return,w)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;h===f&&(h=null),f=f.return}h===f&&(h=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:ut(t,e),wt(e),r&4&&fc(e);break;case 21:break;default:ut(t,e),wt(e)}}function wt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(zd(n)){var r=n;break e}n=n.return}throw Error(A(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Ir(a,""),r.flags&=-33);var s=dc(e);Js(e,s,a);break;case 3:case 4:var i=r.stateNode.containerInfo,l=dc(e);Qs(e,l,i);break;default:throw Error(A(161))}}catch(c){me(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Hm(e,t,n){H=e,Ld(e)}function Ld(e,t,n){for(var r=(e.mode&1)!==0;H!==null;){var a=H,s=a.child;if(a.tag===22&&r){var i=a.memoizedState!==null||ha;if(!i){var l=a.alternate,c=l!==null&&l.memoizedState!==null||Re;l=ha;var u=Re;if(ha=i,(Re=c)&&!u)for(H=a;H!==null;)i=H,c=i.child,i.tag===22&&i.memoizedState!==null?hc(a):c!==null?(c.return=i,H=c):hc(a);for(;s!==null;)H=s,Ld(s),s=s.sibling;H=a,ha=l,Re=u}pc(e)}else a.subtreeFlags&8772&&s!==null?(s.return=a,H=s):pc(e)}}function pc(e){for(;H!==null;){var t=H;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Re||xo(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Re)if(n===null)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:dt(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&Xl(t,s,r);break;case 3:var i=t.updateQueue;if(i!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Xl(t,i,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var h=u.memoizedState;if(h!==null){var f=h.dehydrated;f!==null&&Ar(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(A(163))}Re||t.flags&512&&Ys(t)}catch(v){me(t,t.return,v)}}if(t===e){H=null;break}if(n=t.sibling,n!==null){n.return=t.return,H=n;break}H=t.return}}function mc(e){for(;H!==null;){var t=H;if(t===e){H=null;break}var n=t.sibling;if(n!==null){n.return=t.return,H=n;break}H=t.return}}function hc(e){for(;H!==null;){var t=H;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{xo(4,t)}catch(c){me(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){me(t,a,c)}}var s=t.return;try{Ys(t)}catch(c){me(t,s,c)}break;case 5:var i=t.return;try{Ys(t)}catch(c){me(t,i,c)}}}catch(c){me(t,t.return,c)}if(t===e){H=null;break}var l=t.sibling;if(l!==null){l.return=t.return,H=l;break}H=t.return}}var Vm=Math.ceil,eo=Ot.ReactCurrentDispatcher,Ki=Ot.ReactCurrentOwner,at=Ot.ReactCurrentBatchConfig,ee=0,ke=null,ge=null,Ee=0,Ke=0,On=ln(0),we=0,Vr=null,kn=0,wo=0,Gi=0,br=null,Be=null,Yi=0,qn=1/0,Pt=null,to=!1,Xs=null,tn=null,ga=!1,Qt=null,no=0,Er=0,qs=null,Ia=-1,Ra=0;function Le(){return ee&6?he():Ia!==-1?Ia:Ia=he()}function nn(e){return e.mode&1?ee&2&&Ee!==0?Ee&-Ee:Pm.transition!==null?(Ra===0&&(Ra=wu()),Ra):(e=re,e!==0||(e=window.event,e=e===void 0?16:Eu(e.type)),e):1}function ht(e,t,n,r){if(50<Er)throw Er=0,qs=null,Error(A(185));Yr(e,n,r),(!(ee&2)||e!==ke)&&(e===ke&&(!(ee&2)&&(wo|=n),we===4&&Gt(e,Ee)),He(e,r),n===1&&ee===0&&!(t.mode&1)&&(qn=he()+500,go&&cn()))}function He(e,t){var n=e.callbackNode;Pp(e,t);var r=Oa(e,e===ke?Ee:0);if(r===0)n!==null&&Cl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Cl(n),t===1)e.tag===0?Em(gc.bind(null,e)):Ku(gc.bind(null,e)),km(function(){!(ee&6)&&cn()}),n=null;else{switch(Su(r)){case 1:n=wi;break;case 4:n=yu;break;case 16:n=Fa;break;case 536870912:n=xu;break;default:n=Fa}n=Hd(n,Md.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Md(e,t){if(Ia=-1,Ra=0,ee&6)throw Error(A(327));var n=e.callbackNode;if(Vn()&&e.callbackNode!==n)return null;var r=Oa(e,e===ke?Ee:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ro(e,r);else{t=r;var a=ee;ee|=2;var s=Od();(ke!==e||Ee!==t)&&(Pt=null,qn=he()+500,yn(e,t));do try{Ym();break}catch(l){Fd(e,l)}while(!0);zi(),eo.current=s,ee=a,ge!==null?t=0:(ke=null,Ee=0,t=we)}if(t!==0){if(t===2&&(a=Ns(e),a!==0&&(r=a,t=Zs(e,a))),t===1)throw n=Vr,yn(e,0),Gt(e,r),He(e,he()),n;if(t===6)Gt(e,r);else{if(a=e.current.alternate,!(r&30)&&!Km(a)&&(t=ro(e,r),t===2&&(s=Ns(e),s!==0&&(r=s,t=Zs(e,s))),t===1))throw n=Vr,yn(e,0),Gt(e,r),He(e,he()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(A(345));case 2:fn(e,Be,Pt);break;case 3:if(Gt(e,r),(r&130023424)===r&&(t=Yi+500-he(),10<t)){if(Oa(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){Le(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=zs(fn.bind(null,e,Be,Pt),t);break}fn(e,Be,Pt);break;case 4:if(Gt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var i=31-mt(r);s=1<<i,i=t[i],i>a&&(a=i),r&=~s}if(r=a,r=he()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Vm(r/1960))-r,10<r){e.timeoutHandle=zs(fn.bind(null,e,Be,Pt),r);break}fn(e,Be,Pt);break;case 5:fn(e,Be,Pt);break;default:throw Error(A(329))}}}return He(e,he()),e.callbackNode===n?Md.bind(null,e):null}function Zs(e,t){var n=br;return e.current.memoizedState.isDehydrated&&(yn(e,t).flags|=256),e=ro(e,t),e!==2&&(t=Be,Be=n,t!==null&&ei(t)),e}function ei(e){Be===null?Be=e:Be.push.apply(Be,e)}function Km(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var a=n[r],s=a.getSnapshot;a=a.value;try{if(!gt(s(),a))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Gt(e,t){for(t&=~Gi,t&=~wo,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-mt(t),r=1<<n;e[n]=-1,t&=~r}}function gc(e){if(ee&6)throw Error(A(327));Vn();var t=Oa(e,0);if(!(t&1))return He(e,he()),null;var n=ro(e,t);if(e.tag!==0&&n===2){var r=Ns(e);r!==0&&(t=r,n=Zs(e,r))}if(n===1)throw n=Vr,yn(e,0),Gt(e,t),He(e,he()),n;if(n===6)throw Error(A(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,fn(e,Be,Pt),He(e,he()),null}function Qi(e,t){var n=ee;ee|=1;try{return e(t)}finally{ee=n,ee===0&&(qn=he()+500,go&&cn())}}function Cn(e){Qt!==null&&Qt.tag===0&&!(ee&6)&&Vn();var t=ee;ee|=1;var n=at.transition,r=re;try{if(at.transition=null,re=1,e)return e()}finally{re=r,at.transition=n,ee=t,!(ee&6)&&cn()}}function Ji(){Ke=On.current,ie(On)}function yn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,jm(n)),ge!==null)for(n=ge.return;n!==null;){var r=n;switch(Ii(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ha();break;case 3:Jn(),ie(Ue),ie(ze),Oi();break;case 5:Fi(r);break;case 4:Jn();break;case 13:ie(de);break;case 19:ie(de);break;case 10:Ai(r.type._context);break;case 22:case 23:Ji()}n=n.return}if(ke=e,ge=e=rn(e.current,null),Ee=Ke=t,we=0,Vr=null,Gi=wo=kn=0,Be=br=null,hn!==null){for(t=0;t<hn.length;t++)if(n=hn[t],r=n.interleaved,r!==null){n.interleaved=null;var a=r.next,s=n.pending;if(s!==null){var i=s.next;s.next=a,r.next=i}n.pending=r}hn=null}return e}function Fd(e,t){do{var n=ge;try{if(zi(),Ea.current=Za,qa){for(var r=fe.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}qa=!1}if(jn=0,je=xe=fe=null,Cr=!1,Ur=0,Ki.current=null,n===null||n.return===null){we=1,Vr=t,ge=null;break}e:{var s=e,i=n.return,l=n,c=t;if(t=Ee,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,h=l,f=h.tag;if(!(h.mode&1)&&(f===0||f===11||f===15)){var v=h.alternate;v?(h.updateQueue=v.updateQueue,h.memoizedState=v.memoizedState,h.lanes=v.lanes):(h.updateQueue=null,h.memoizedState=null)}var y=rc(i);if(y!==null){y.flags&=-257,ac(y,i,l,s,t),y.mode&1&&nc(s,u,t),t=y,c=u;var x=t.updateQueue;if(x===null){var w=new Set;w.add(c),t.updateQueue=w}else x.add(c);break e}else{if(!(t&1)){nc(s,u,t),Xi();break e}c=Error(A(426))}}else if(le&&l.mode&1){var j=rc(i);if(j!==null){!(j.flags&65536)&&(j.flags|=256),ac(j,i,l,s,t),Ri(Xn(c,l));break e}}s=c=Xn(c,l),we!==4&&(we=2),br===null?br=[s]:br.push(s),s=i;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var m=Sd(s,c,t);Jl(s,m);break e;case 1:l=c;var p=s.type,g=s.stateNode;if(!(s.flags&128)&&(typeof p.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(tn===null||!tn.has(g)))){s.flags|=65536,t&=-t,s.lanes|=t;var S=jd(s,l,t);Jl(s,S);break e}}s=s.return}while(s!==null)}Dd(n)}catch(E){t=E,ge===n&&n!==null&&(ge=n=n.return);continue}break}while(!0)}function Od(){var e=eo.current;return eo.current=Za,e===null?Za:e}function Xi(){(we===0||we===3||we===2)&&(we=4),ke===null||!(kn&268435455)&&!(wo&268435455)||Gt(ke,Ee)}function ro(e,t){var n=ee;ee|=2;var r=Od();(ke!==e||Ee!==t)&&(Pt=null,yn(e,t));do try{Gm();break}catch(a){Fd(e,a)}while(!0);if(zi(),ee=n,eo.current=r,ge!==null)throw Error(A(261));return ke=null,Ee=0,we}function Gm(){for(;ge!==null;)Bd(ge)}function Ym(){for(;ge!==null&&!xp();)Bd(ge)}function Bd(e){var t=Wd(e.alternate,e,Ke);e.memoizedProps=e.pendingProps,t===null?Dd(e):ge=t,Ki.current=null}function Dd(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Dm(n,t),n!==null){n.flags&=32767,ge=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{we=6,ge=null;return}}else if(n=Bm(n,t,Ke),n!==null){ge=n;return}if(t=t.sibling,t!==null){ge=t;return}ge=t=e}while(t!==null);we===0&&(we=5)}function fn(e,t,n){var r=re,a=at.transition;try{at.transition=null,re=1,Qm(e,t,n,r)}finally{at.transition=a,re=r}return null}function Qm(e,t,n,r){do Vn();while(Qt!==null);if(ee&6)throw Error(A(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(A(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(Tp(e,s),e===ke&&(ge=ke=null,Ee=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ga||(ga=!0,Hd(Fa,function(){return Vn(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=at.transition,at.transition=null;var i=re;re=1;var l=ee;ee|=4,Ki.current=null,Wm(e,n),$d(n,e),hm(Rs),Ba=!!Is,Rs=Is=null,e.current=n,Hm(n),wp(),ee=l,re=i,at.transition=s}else e.current=n;if(ga&&(ga=!1,Qt=e,no=a),s=e.pendingLanes,s===0&&(tn=null),kp(n.stateNode),He(e,he()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(to)throw to=!1,e=Xs,Xs=null,e;return no&1&&e.tag!==0&&Vn(),s=e.pendingLanes,s&1?e===qs?Er++:(Er=0,qs=e):Er=0,cn(),null}function Vn(){if(Qt!==null){var e=Su(no),t=at.transition,n=re;try{if(at.transition=null,re=16>e?16:e,Qt===null)var r=!1;else{if(e=Qt,Qt=null,no=0,ee&6)throw Error(A(331));var a=ee;for(ee|=4,H=e.current;H!==null;){var s=H,i=s.child;if(H.flags&16){var l=s.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(H=u;H!==null;){var h=H;switch(h.tag){case 0:case 11:case 15:Nr(8,h,s)}var f=h.child;if(f!==null)f.return=h,H=f;else for(;H!==null;){h=H;var v=h.sibling,y=h.return;if(_d(h),h===u){H=null;break}if(v!==null){v.return=y,H=v;break}H=y}}}var x=s.alternate;if(x!==null){var w=x.child;if(w!==null){x.child=null;do{var j=w.sibling;w.sibling=null,w=j}while(w!==null)}}H=s}}if(s.subtreeFlags&2064&&i!==null)i.return=s,H=i;else e:for(;H!==null;){if(s=H,s.flags&2048)switch(s.tag){case 0:case 11:case 15:Nr(9,s,s.return)}var m=s.sibling;if(m!==null){m.return=s.return,H=m;break e}H=s.return}}var p=e.current;for(H=p;H!==null;){i=H;var g=i.child;if(i.subtreeFlags&2064&&g!==null)g.return=i,H=g;else e:for(i=p;H!==null;){if(l=H,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:xo(9,l)}}catch(E){me(l,l.return,E)}if(l===i){H=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,H=S;break e}H=l.return}}if(ee=a,cn(),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(uo,e)}catch{}r=!0}return r}finally{re=n,at.transition=t}}return!1}function vc(e,t,n){t=Xn(n,t),t=Sd(e,t,1),e=en(e,t,1),t=Le(),e!==null&&(Yr(e,1,t),He(e,t))}function me(e,t,n){if(e.tag===3)vc(e,e,n);else for(;t!==null;){if(t.tag===3){vc(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(tn===null||!tn.has(r))){e=Xn(n,e),e=jd(t,e,1),t=en(t,e,1),e=Le(),t!==null&&(Yr(t,1,e),He(t,e));break}}t=t.return}}function Jm(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Le(),e.pingedLanes|=e.suspendedLanes&n,ke===e&&(Ee&n)===n&&(we===4||we===3&&(Ee&130023424)===Ee&&500>he()-Yi?yn(e,0):Gi|=n),He(e,t)}function Ud(e,t){t===0&&(e.mode&1?(t=sa,sa<<=1,!(sa&130023424)&&(sa=4194304)):t=1);var n=Le();e=Lt(e,t),e!==null&&(Yr(e,t,n),He(e,n))}function Xm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Ud(e,n)}function qm(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(A(314))}r!==null&&r.delete(t),Ud(e,n)}var Wd;Wd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ue.current)De=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return De=!1,Om(e,t,n);De=!!(e.flags&131072)}else De=!1,le&&t.flags&1048576&&Gu(t,Ga,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ta(e,t),e=t.pendingProps;var a=Gn(t,ze.current);Hn(t,n),a=Di(null,t,r,e,a,n);var s=Ui();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,We(r)?(s=!0,Va(t)):s=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Li(t),a.updater=yo,t.stateNode=a,a._reactInternals=t,Bs(t,r,e,n),t=Ws(null,t,r,!0,s,n)):(t.tag=0,le&&s&&Ti(t),$e(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ta(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=eh(r),e=dt(r,e),a){case 0:t=Us(null,t,r,e,n);break e;case 1:t=ic(null,t,r,e,n);break e;case 11:t=oc(null,t,r,e,n);break e;case 14:t=sc(null,t,r,dt(r.type,e),n);break e}throw Error(A(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:dt(r,a),Us(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:dt(r,a),ic(e,t,r,a,n);case 3:e:{if(bd(t),e===null)throw Error(A(387));r=t.pendingProps,s=t.memoizedState,a=s.element,Zu(e,t),Ja(t,r,null,n);var i=t.memoizedState;if(r=i.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){a=Xn(Error(A(423)),t),t=lc(e,t,r,n,a);break e}else if(r!==a){a=Xn(Error(A(424)),t),t=lc(e,t,r,n,a);break e}else for(Ye=Zt(t.stateNode.containerInfo.firstChild),Qe=t,le=!0,pt=null,n=Xu(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Yn(),r===a){t=Mt(e,t,n);break e}$e(e,t,r,n)}t=t.child}return t;case 5:return ed(t),e===null&&Ms(t),r=t.type,a=t.pendingProps,s=e!==null?e.memoizedProps:null,i=a.children,_s(r,a)?i=null:s!==null&&_s(r,s)&&(t.flags|=32),Nd(e,t),$e(e,t,i,n),t.child;case 6:return e===null&&Ms(t),null;case 13:return Ed(e,t,n);case 4:return Mi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Qn(t,null,r,n):$e(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:dt(r,a),oc(e,t,r,a,n);case 7:return $e(e,t,t.pendingProps,n),t.child;case 8:return $e(e,t,t.pendingProps.children,n),t.child;case 12:return $e(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,s=t.memoizedProps,i=a.value,oe(Ya,r._currentValue),r._currentValue=i,s!==null)if(gt(s.value,i)){if(s.children===a.children&&!Ue.current){t=Mt(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){i=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=zt(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?c.next=c:(c.next=h.next,h.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Fs(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)i=s.type===t.type?null:s.child;else if(s.tag===18){if(i=s.return,i===null)throw Error(A(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Fs(i,n,t),i=s.sibling}else i=s.child;if(i!==null)i.return=s;else for(i=s;i!==null;){if(i===t){i=null;break}if(s=i.sibling,s!==null){s.return=i.return,i=s;break}i=i.return}s=i}$e(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,Hn(t,n),a=ot(a),r=r(a),t.flags|=1,$e(e,t,r,n),t.child;case 14:return r=t.type,a=dt(r,t.pendingProps),a=dt(r.type,a),sc(e,t,r,a,n);case 15:return kd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:dt(r,a),Ta(e,t),t.tag=1,We(r)?(e=!0,Va(t)):e=!1,Hn(t,n),wd(t,r,a),Bs(t,r,a,n),Ws(null,t,r,!0,e,n);case 19:return Pd(e,t,n);case 22:return Cd(e,t,n)}throw Error(A(156,t.tag))};function Hd(e,t){return vu(e,t)}function Zm(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rt(e,t,n,r){return new Zm(e,t,n,r)}function qi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eh(e){if(typeof e=="function")return qi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===vi)return 11;if(e===yi)return 14}return 2}function rn(e,t){var n=e.alternate;return n===null?(n=rt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function _a(e,t,n,r,a,s){var i=2;if(r=e,typeof e=="function")qi(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Tn:return xn(n.children,a,s,t);case gi:i=8,a|=8;break;case us:return e=rt(12,n,t,a|2),e.elementType=us,e.lanes=s,e;case ds:return e=rt(13,n,t,a),e.elementType=ds,e.lanes=s,e;case fs:return e=rt(19,n,t,a),e.elementType=fs,e.lanes=s,e;case eu:return So(n,a,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case qc:i=10;break e;case Zc:i=9;break e;case vi:i=11;break e;case yi:i=14;break e;case Wt:i=16,r=null;break e}throw Error(A(130,e==null?e:typeof e,""))}return t=rt(i,n,t,a),t.elementType=e,t.type=r,t.lanes=s,t}function xn(e,t,n,r){return e=rt(7,e,r,t),e.lanes=n,e}function So(e,t,n,r){return e=rt(22,e,r,t),e.elementType=eu,e.lanes=n,e.stateNode={isHidden:!1},e}function es(e,t,n){return e=rt(6,e,null,t),e.lanes=n,e}function ts(e,t,n){return t=rt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function th(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$o(0),this.expirationTimes=$o(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$o(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Zi(e,t,n,r,a,s,i,l,c){return e=new th(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=rt(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Li(s),e}function nh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Pn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Vd(e){if(!e)return on;e=e._reactInternals;e:{if(bn(e)!==e||e.tag!==1)throw Error(A(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(We(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(A(171))}if(e.tag===1){var n=e.type;if(We(n))return Vu(e,n,t)}return t}function Kd(e,t,n,r,a,s,i,l,c){return e=Zi(n,r,!0,e,a,s,i,l,c),e.context=Vd(null),n=e.current,r=Le(),a=nn(n),s=zt(r,a),s.callback=t??null,en(n,s,a),e.current.lanes=a,Yr(e,a,r),He(e,r),e}function jo(e,t,n,r){var a=t.current,s=Le(),i=nn(a);return n=Vd(n),t.context===null?t.context=n:t.pendingContext=n,t=zt(s,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=en(a,t,i),e!==null&&(ht(e,a,i,s),ba(e,a,i)),i}function ao(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function yc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function el(e,t){yc(e,t),(e=e.alternate)&&yc(e,t)}function rh(){return null}var Gd=typeof reportError=="function"?reportError:function(e){console.error(e)};function tl(e){this._internalRoot=e}ko.prototype.render=tl.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(A(409));jo(e,t,null,null)};ko.prototype.unmount=tl.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Cn(function(){jo(null,e,null,null)}),t[$t]=null}};function ko(e){this._internalRoot=e}ko.prototype.unstable_scheduleHydration=function(e){if(e){var t=Cu();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Kt.length&&t!==0&&t<Kt[n].priority;n++);Kt.splice(n,0,e),n===0&&bu(e)}};function nl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Co(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function xc(){}function ah(e,t,n,r,a){if(a){if(typeof r=="function"){var s=r;r=function(){var u=ao(i);s.call(u)}}var i=Kd(t,r,e,0,null,!1,!1,"",xc);return e._reactRootContainer=i,e[$t]=i.current,Mr(e.nodeType===8?e.parentNode:e),Cn(),i}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var u=ao(c);l.call(u)}}var c=Zi(e,0,!1,null,null,!1,!1,"",xc);return e._reactRootContainer=c,e[$t]=c.current,Mr(e.nodeType===8?e.parentNode:e),Cn(function(){jo(t,c,n,r)}),c}function No(e,t,n,r,a){var s=n._reactRootContainer;if(s){var i=s;if(typeof a=="function"){var l=a;a=function(){var c=ao(i);l.call(c)}}jo(t,i,e,a)}else i=ah(n,t,e,a,r);return ao(i)}ju=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=gr(t.pendingLanes);n!==0&&(Si(t,n|1),He(t,he()),!(ee&6)&&(qn=he()+500,cn()))}break;case 13:Cn(function(){var r=Lt(e,1);if(r!==null){var a=Le();ht(r,e,1,a)}}),el(e,1)}};ji=function(e){if(e.tag===13){var t=Lt(e,134217728);if(t!==null){var n=Le();ht(t,e,134217728,n)}el(e,134217728)}};ku=function(e){if(e.tag===13){var t=nn(e),n=Lt(e,t);if(n!==null){var r=Le();ht(n,e,t,r)}el(e,t)}};Cu=function(){return re};Nu=function(e,t){var n=re;try{return re=e,t()}finally{re=n}};js=function(e,t,n){switch(t){case"input":if(hs(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=ho(r);if(!a)throw Error(A(90));nu(r),hs(r,a)}}}break;case"textarea":au(e,n);break;case"select":t=n.value,t!=null&&Bn(e,!!n.multiple,t,!1)}};du=Qi;fu=Cn;var oh={usingClientEntryPoint:!1,Events:[Jr,zn,ho,cu,uu,Qi]},fr={findFiberByHostInstance:mn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},sh={bundleType:fr.bundleType,version:fr.version,rendererPackageName:fr.rendererPackageName,rendererConfig:fr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ot.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=hu(e),e===null?null:e.stateNode},findFiberByHostInstance:fr.findFiberByHostInstance||rh,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var va=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!va.isDisabled&&va.supportsFiber)try{uo=va.inject(sh),Ct=va}catch{}}Xe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=oh;Xe.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!nl(t))throw Error(A(200));return nh(e,t,null,n)};Xe.createRoot=function(e,t){if(!nl(e))throw Error(A(299));var n=!1,r="",a=Gd;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=Zi(e,1,!1,null,null,n,!1,r,a),e[$t]=t.current,Mr(e.nodeType===8?e.parentNode:e),new tl(t)};Xe.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(A(188)):(e=Object.keys(e).join(","),Error(A(268,e)));return e=hu(t),e=e===null?null:e.stateNode,e};Xe.flushSync=function(e){return Cn(e)};Xe.hydrate=function(e,t,n){if(!Co(t))throw Error(A(200));return No(null,e,t,!0,n)};Xe.hydrateRoot=function(e,t,n){if(!nl(e))throw Error(A(405));var r=n!=null&&n.hydratedSources||null,a=!1,s="",i=Gd;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=Kd(t,null,e,1,n??null,a,!1,s,i),e[$t]=t.current,Mr(e),r)for(e=0;e<r.length;e++)n=r[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new ko(t)};Xe.render=function(e,t,n){if(!Co(t))throw Error(A(200));return No(null,e,t,!1,n)};Xe.unmountComponentAtNode=function(e){if(!Co(e))throw Error(A(40));return e._reactRootContainer?(Cn(function(){No(null,null,e,!1,function(){e._reactRootContainer=null,e[$t]=null})}),!0):!1};Xe.unstable_batchedUpdates=Qi;Xe.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Co(n))throw Error(A(200));if(e==null||e._reactInternals===void 0)throw Error(A(38));return No(e,t,n,!1,r)};Xe.version="18.3.1-next-f1338f8080-20240426";function Yd(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Yd)}catch(e){console.error(e)}}Yd(),Yc.exports=Xe;var Qd=Yc.exports,Jd,wc=Qd;Jd=wc.createRoot,wc.hydrateRoot;/**
41
41
  * react-router v7.13.1
42
42
  *
43
43
  * Copyright (c) Remix Software Inc.
@@ -46,24 +46,24 @@ Error generating stack: `+s.message+`
46
46
  * LICENSE.md file in the root directory of this source tree.
47
47
  *
48
48
  * @license MIT
49
- */var wc="popstate";function Sc(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function sh(e={}){function t(r,a){var u;let s=(u=a.state)==null?void 0:u.masked,{pathname:i,search:l,hash:c}=s||r.location;return ei("",{pathname:i,search:l,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default",s?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,a){return typeof a=="string"?a:Kr(a)}return lh(t,n,null,e)}function ce(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function it(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ih(){return Math.random().toString(36).substring(2,10)}function jc(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ei(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?nr(t):t,state:n,key:t&&t.key||r||ih(),unstable_mask:a}}function Kr({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function nr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function lh(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:s=!1}=r,i=a.history,l="POP",c=null,u=h();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function h(){return(i.state||{idx:null}).idx}function f(){l="POP";let j=h(),m=j==null?null:j-u;u=j,c&&c({action:l,location:w.location,delta:m})}function g(j,m){l="PUSH";let p=Sc(j)?j:ei(w.location,j,m);u=h()+1;let y=jc(p,u),S=w.createHref(p.unstable_mask||p);try{i.pushState(y,"",S)}catch(b){if(b instanceof DOMException&&b.name==="DataCloneError")throw b;a.location.assign(S)}s&&c&&c({action:l,location:w.location,delta:1})}function v(j,m){l="REPLACE";let p=Sc(j)?j:ei(w.location,j,m);u=h();let y=jc(p,u),S=w.createHref(p.unstable_mask||p);i.replaceState(y,"",S),s&&c&&c({action:l,location:w.location,delta:0})}function x(j){return ch(j)}let w={get action(){return l},get location(){return e(a,i)},listen(j){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(wc,f),c=j,()=>{a.removeEventListener(wc,f),c=null}},createHref(j){return t(a,j)},createURL:x,encodeLocation(j){let m=x(j);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:g,replace:v,go(j){return i.go(j)}};return w}function ch(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ce(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Kr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Jd(e,t,n="/"){return uh(e,t,n,!1)}function uh(e,t,n,r){let a=typeof t=="string"?nr(t):t,s=Ft(a.pathname||"/",n);if(s==null)return null;let i=Xd(e);dh(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let u=jh(s);l=wh(i[c],u,r)}return l}function Xd(e,t=[],n=[],r="",a=!1){let s=(i,l,c=a,u)=>{let h={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&c)return;ce(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let f=Et([r,h.relativePath]),g=n.concat(h);i.children&&i.children.length>0&&(ce(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),Xd(i.children,t,g,f,c)),!(i.path==null&&!i.index)&&t.push({path:f,score:vh(f,i.index),routesMeta:g})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))s(i,l);else for(let u of qd(i.path))s(i,l,!0,u)}),t}function qd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return a?[s,""]:[s];let i=qd(r.join("/")),l=[];return l.push(...i.map(c=>c===""?s:[s,c].join("/"))),a&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function dh(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:xh(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var fh=/^:[\w-]+$/,ph=3,mh=2,hh=1,gh=10,yh=-2,kc=e=>e==="*";function vh(e,t){let n=e.split("/"),r=n.length;return n.some(kc)&&(r+=yh),t&&(r+=mh),n.filter(a=>!kc(a)).reduce((a,s)=>a+(fh.test(s)?ph:s===""?hh:gh),r)}function xh(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function wh(e,t,n=!1){let{routesMeta:r}=e,a={},s="/",i=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,h=s==="/"?t:t.slice(s.length)||"/",f=oo({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},h),g=c.route;if(!f&&u&&n&&!r[r.length-1].route.index&&(f=oo({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},h)),!f)return null;Object.assign(a,f.params),i.push({params:a,pathname:Et([s,f.pathname]),pathnameBase:Eh(Et([s,f.pathnameBase])),route:g}),f.pathnameBase!=="/"&&(s=Et([s,f.pathnameBase]))}return i}function oo(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Sh(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let s=a[0],i=s.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce((u,{paramName:h,isOptional:f},g)=>{if(h==="*"){let x=l[g]||"";i=s.slice(0,s.length-x.length).replace(/(.)\/+$/,"$1")}const v=l[g];return f&&!v?u[h]=void 0:u[h]=(v||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:i,pattern:e}}function Sh(e,t=!1,n=!0){it(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c,u,h)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let f=h.charAt(u+i.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function jh(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return it(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ft(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var kh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Ch(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?nr(e):e,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=Cc(n.substring(1),"/"):s=Cc(n,t)):s=t,{pathname:s,search:bh(r),hash:Ph(a)}}function Cc(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function ns(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Nh(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function nl(e){let t=Nh(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Eo(e,t,n,r=!1){let a;typeof e=="string"?a=nr(e):(a={...e},ce(!a.pathname||!a.pathname.includes("?"),ns("?","pathname","search",a)),ce(!a.pathname||!a.pathname.includes("#"),ns("#","pathname","hash",a)),ce(!a.search||!a.search.includes("#"),ns("#","search","hash",a)));let s=e===""||a.pathname==="",i=s?"/":a.pathname,l;if(i==null)l=n;else{let f=t.length-1;if(!r&&i.startsWith("..")){let g=i.split("/");for(;g[0]==="..";)g.shift(),f-=1;a.pathname=g.join("/")}l=f>=0?t[f]:"/"}let c=Ch(a,l),u=i&&i!=="/"&&i.endsWith("/"),h=(s||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||h)&&(c.pathname+="/"),c}var Et=e=>e.join("/").replace(/\/\/+/g,"/"),Eh=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),bh=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Ph=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Th=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Ih(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function _h(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Zd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ef(e,t){let n=e;if(typeof n!="string"||!kh.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(Zd)try{let s=new URL(window.location.href),i=n.startsWith("//")?new URL(s.protocol+n):new URL(n),l=Ft(i.pathname,t);i.origin===s.origin&&l!=null?n=l+i.search+i.hash:a=!0}catch{it(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var tf=["POST","PUT","PATCH","DELETE"];new Set(tf);var Rh=["GET",...tf];new Set(Rh);var rr=d.createContext(null);rr.displayName="DataRouter";var bo=d.createContext(null);bo.displayName="DataRouterState";var zh=d.createContext(!1),nf=d.createContext({isTransitioning:!1});nf.displayName="ViewTransition";var Ah=d.createContext(new Map);Ah.displayName="Fetchers";var $h=d.createContext(null);$h.displayName="Await";var Ze=d.createContext(null);Ze.displayName="Navigation";var qr=d.createContext(null);qr.displayName="Location";var yt=d.createContext({outlet:null,matches:[],isDataRoute:!1});yt.displayName="Route";var rl=d.createContext(null);rl.displayName="RouteError";var rf="REACT_ROUTER_ERROR",Lh="REDIRECT",Mh="ROUTE_ERROR_RESPONSE";function Fh(e){if(e.startsWith(`${rf}:${Lh}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Oh(e){if(e.startsWith(`${rf}:${Mh}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Th(t.status,t.statusText,t.data)}catch{}}function Bh(e,{relative:t}={}){ce(ar(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=d.useContext(Ze),{hash:a,pathname:s,search:i}=Zr(e,{relative:t}),l=s;return n!=="/"&&(l=s==="/"?n:Et([n,s])),r.createHref({pathname:l,search:i,hash:a})}function ar(){return d.useContext(qr)!=null}function lt(){return ce(ar(),"useLocation() may be used only in the context of a <Router> component."),d.useContext(qr).location}var af="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function of(e){d.useContext(Ze).static||d.useLayoutEffect(e)}function Bt(){let{isDataRoute:e}=d.useContext(yt);return e?tg():Dh()}function Dh(){ce(ar(),"useNavigate() may be used only in the context of a <Router> component.");let e=d.useContext(rr),{basename:t,navigator:n}=d.useContext(Ze),{matches:r}=d.useContext(yt),{pathname:a}=lt(),s=JSON.stringify(nl(r)),i=d.useRef(!1);return of(()=>{i.current=!0}),d.useCallback((c,u={})=>{if(it(i.current,af),!i.current)return;if(typeof c=="number"){n.go(c);return}let h=Eo(c,JSON.parse(s),a,u.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Et([t,h.pathname])),(u.replace?n.replace:n.push)(h,u.state,u)},[t,n,s,a,e])}var Uh=d.createContext(null);function Wh(e){let t=d.useContext(yt).outlet;return d.useMemo(()=>t&&d.createElement(Uh.Provider,{value:e},t),[t,e])}function Zr(e,{relative:t}={}){let{matches:n}=d.useContext(yt),{pathname:r}=lt(),a=JSON.stringify(nl(n));return d.useMemo(()=>Eo(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function Hh(e,t){return sf(e,t)}function sf(e,t,n){var j;ce(ar(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=d.useContext(Ze),{matches:a}=d.useContext(yt),s=a[a.length-1],i=s?s.params:{},l=s?s.pathname:"/",c=s?s.pathnameBase:"/",u=s&&s.route;{let m=u&&u.path||"";cf(l,!u||m.endsWith("*")||m.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${m}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
49
+ */var Sc="popstate";function jc(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ih(e={}){function t(r,a){var u;let s=(u=a.state)==null?void 0:u.masked,{pathname:i,search:l,hash:c}=s||r.location;return ti("",{pathname:i,search:l,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default",s?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,a){return typeof a=="string"?a:Kr(a)}return ch(t,n,null,e)}function ce(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function it(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function lh(){return Math.random().toString(36).substring(2,10)}function kc(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ti(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?nr(t):t,state:n,key:t&&t.key||r||lh(),unstable_mask:a}}function Kr({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function nr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ch(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:s=!1}=r,i=a.history,l="POP",c=null,u=h();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function h(){return(i.state||{idx:null}).idx}function f(){l="POP";let j=h(),m=j==null?null:j-u;u=j,c&&c({action:l,location:w.location,delta:m})}function v(j,m){l="PUSH";let p=jc(j)?j:ti(w.location,j,m);u=h()+1;let g=kc(p,u),S=w.createHref(p.unstable_mask||p);try{i.pushState(g,"",S)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;a.location.assign(S)}s&&c&&c({action:l,location:w.location,delta:1})}function y(j,m){l="REPLACE";let p=jc(j)?j:ti(w.location,j,m);u=h();let g=kc(p,u),S=w.createHref(p.unstable_mask||p);i.replaceState(g,"",S),s&&c&&c({action:l,location:w.location,delta:0})}function x(j){return uh(j)}let w={get action(){return l},get location(){return e(a,i)},listen(j){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Sc,f),c=j,()=>{a.removeEventListener(Sc,f),c=null}},createHref(j){return t(a,j)},createURL:x,encodeLocation(j){let m=x(j);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:v,replace:y,go(j){return i.go(j)}};return w}function uh(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ce(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Kr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Xd(e,t,n="/"){return dh(e,t,n,!1)}function dh(e,t,n,r){let a=typeof t=="string"?nr(t):t,s=Ft(a.pathname||"/",n);if(s==null)return null;let i=qd(e);fh(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let u=kh(s);l=Sh(i[c],u,r)}return l}function qd(e,t=[],n=[],r="",a=!1){let s=(i,l,c=a,u)=>{let h={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&c)return;ce(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let f=bt([r,h.relativePath]),v=n.concat(h);i.children&&i.children.length>0&&(ce(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),qd(i.children,t,v,f,c)),!(i.path==null&&!i.index)&&t.push({path:f,score:xh(f,i.index),routesMeta:v})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))s(i,l);else for(let u of Zd(i.path))s(i,l,!0,u)}),t}function Zd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return a?[s,""]:[s];let i=Zd(r.join("/")),l=[];return l.push(...i.map(c=>c===""?s:[s,c].join("/"))),a&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function fh(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:wh(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var ph=/^:[\w-]+$/,mh=3,hh=2,gh=1,vh=10,yh=-2,Cc=e=>e==="*";function xh(e,t){let n=e.split("/"),r=n.length;return n.some(Cc)&&(r+=yh),t&&(r+=hh),n.filter(a=>!Cc(a)).reduce((a,s)=>a+(ph.test(s)?mh:s===""?gh:vh),r)}function wh(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function Sh(e,t,n=!1){let{routesMeta:r}=e,a={},s="/",i=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,h=s==="/"?t:t.slice(s.length)||"/",f=oo({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},h),v=c.route;if(!f&&u&&n&&!r[r.length-1].route.index&&(f=oo({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},h)),!f)return null;Object.assign(a,f.params),i.push({params:a,pathname:bt([s,f.pathname]),pathnameBase:Eh(bt([s,f.pathnameBase])),route:v}),f.pathnameBase!=="/"&&(s=bt([s,f.pathnameBase]))}return i}function oo(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=jh(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let s=a[0],i=s.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce((u,{paramName:h,isOptional:f},v)=>{if(h==="*"){let x=l[v]||"";i=s.slice(0,s.length-x.length).replace(/(.)\/+$/,"$1")}const y=l[v];return f&&!y?u[h]=void 0:u[h]=(y||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:i,pattern:e}}function jh(e,t=!1,n=!0){it(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c,u,h)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let f=h.charAt(u+i.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function kh(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return it(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ft(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}var Ch=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Nh(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?nr(e):e,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=Nc(n.substring(1),"/"):s=Nc(n,t)):s=t,{pathname:s,search:Ph(r),hash:Th(a)}}function Nc(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function ns(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function bh(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function rl(e){let t=bh(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function bo(e,t,n,r=!1){let a;typeof e=="string"?a=nr(e):(a={...e},ce(!a.pathname||!a.pathname.includes("?"),ns("?","pathname","search",a)),ce(!a.pathname||!a.pathname.includes("#"),ns("#","pathname","hash",a)),ce(!a.search||!a.search.includes("#"),ns("#","search","hash",a)));let s=e===""||a.pathname==="",i=s?"/":a.pathname,l;if(i==null)l=n;else{let f=t.length-1;if(!r&&i.startsWith("..")){let v=i.split("/");for(;v[0]==="..";)v.shift(),f-=1;a.pathname=v.join("/")}l=f>=0?t[f]:"/"}let c=Nh(a,l),u=i&&i!=="/"&&i.endsWith("/"),h=(s||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||h)&&(c.pathname+="/"),c}var bt=e=>e.join("/").replace(/\/\/+/g,"/"),Eh=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ph=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Th=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Ih=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Rh(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function _h(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var ef=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function tf(e,t){let n=e;if(typeof n!="string"||!Ch.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(ef)try{let s=new URL(window.location.href),i=n.startsWith("//")?new URL(s.protocol+n):new URL(n),l=Ft(i.pathname,t);i.origin===s.origin&&l!=null?n=l+i.search+i.hash:a=!0}catch{it(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var nf=["POST","PUT","PATCH","DELETE"];new Set(nf);var zh=["GET",...nf];new Set(zh);var rr=d.createContext(null);rr.displayName="DataRouter";var Eo=d.createContext(null);Eo.displayName="DataRouterState";var Ah=d.createContext(!1),rf=d.createContext({isTransitioning:!1});rf.displayName="ViewTransition";var $h=d.createContext(new Map);$h.displayName="Fetchers";var Lh=d.createContext(null);Lh.displayName="Await";var Ze=d.createContext(null);Ze.displayName="Navigation";var qr=d.createContext(null);qr.displayName="Location";var vt=d.createContext({outlet:null,matches:[],isDataRoute:!1});vt.displayName="Route";var al=d.createContext(null);al.displayName="RouteError";var af="REACT_ROUTER_ERROR",Mh="REDIRECT",Fh="ROUTE_ERROR_RESPONSE";function Oh(e){if(e.startsWith(`${af}:${Mh}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Bh(e){if(e.startsWith(`${af}:${Fh}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ih(t.status,t.statusText,t.data)}catch{}}function Dh(e,{relative:t}={}){ce(ar(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=d.useContext(Ze),{hash:a,pathname:s,search:i}=Zr(e,{relative:t}),l=s;return n!=="/"&&(l=s==="/"?n:bt([n,s])),r.createHref({pathname:l,search:i,hash:a})}function ar(){return d.useContext(qr)!=null}function lt(){return ce(ar(),"useLocation() may be used only in the context of a <Router> component."),d.useContext(qr).location}var of="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function sf(e){d.useContext(Ze).static||d.useLayoutEffect(e)}function Bt(){let{isDataRoute:e}=d.useContext(vt);return e?ng():Uh()}function Uh(){ce(ar(),"useNavigate() may be used only in the context of a <Router> component.");let e=d.useContext(rr),{basename:t,navigator:n}=d.useContext(Ze),{matches:r}=d.useContext(vt),{pathname:a}=lt(),s=JSON.stringify(rl(r)),i=d.useRef(!1);return sf(()=>{i.current=!0}),d.useCallback((c,u={})=>{if(it(i.current,of),!i.current)return;if(typeof c=="number"){n.go(c);return}let h=bo(c,JSON.parse(s),a,u.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:bt([t,h.pathname])),(u.replace?n.replace:n.push)(h,u.state,u)},[t,n,s,a,e])}var Wh=d.createContext(null);function Hh(e){let t=d.useContext(vt).outlet;return d.useMemo(()=>t&&d.createElement(Wh.Provider,{value:e},t),[t,e])}function Zr(e,{relative:t}={}){let{matches:n}=d.useContext(vt),{pathname:r}=lt(),a=JSON.stringify(rl(n));return d.useMemo(()=>bo(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function Vh(e,t){return lf(e,t)}function lf(e,t,n){var j;ce(ar(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=d.useContext(Ze),{matches:a}=d.useContext(vt),s=a[a.length-1],i=s?s.params:{},l=s?s.pathname:"/",c=s?s.pathnameBase:"/",u=s&&s.route;{let m=u&&u.path||"";uf(l,!u||m.endsWith("*")||m.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${m}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
50
50
 
51
- Please change the parent <Route path="${m}"> to <Route path="${m==="/"?"*":`${m}/*`}">.`)}let h=lt(),f;if(t){let m=typeof t=="string"?nr(t):t;ce(c==="/"||((j=m.pathname)==null?void 0:j.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${m.pathname}" was given in the \`location\` prop.`),f=m}else f=h;let g=f.pathname||"/",v=g;if(c!=="/"){let m=c.replace(/^\//,"").split("/");v="/"+g.replace(/^\//,"").split("/").slice(m.length).join("/")}let x=Jd(e,{pathname:v});it(u||x!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),it(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=Yh(x&&x.map(m=>Object.assign({},m,{params:Object.assign({},i,m.params),pathname:Et([c,r.encodeLocation?r.encodeLocation(m.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?c:Et([c,r.encodeLocation?r.encodeLocation(m.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathnameBase])})),a,n);return t&&w?d.createElement(qr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...f},navigationType:"POP"}},w):w}function Vh(){let e=eg(),t=Ih(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=d.createElement(d.Fragment,null,d.createElement("p",null,"💿 Hey developer 👋"),d.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",d.createElement("code",{style:s},"ErrorBoundary")," or"," ",d.createElement("code",{style:s},"errorElement")," prop on your route.")),d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},t),n?d.createElement("pre",{style:a},n):null,i)}var Kh=d.createElement(Vh,null),lf=class extends d.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Oh(e.digest);n&&(e=n)}let t=e!==void 0?d.createElement(yt.Provider,{value:this.props.routeContext},d.createElement(rl.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?d.createElement(Gh,{error:e},t):t}};lf.contextType=zh;var rs=new WeakMap;function Gh({children:e,error:t}){let{basename:n}=d.useContext(Ze);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Fh(t.digest);if(r){let a=rs.get(t);if(a)throw a;let s=ef(r.location,n);if(Zd&&!rs.get(t))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw rs.set(t,i),i}return d.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function Qh({routeContext:e,match:t,children:n}){let r=d.useContext(rr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(yt.Provider,{value:e},n)}function Yh(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,s=r==null?void 0:r.errors;if(s!=null){let h=a.findIndex(f=>f.route.id&&(s==null?void 0:s[f.route.id])!==void 0);ce(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),a=a.slice(0,Math.min(a.length,h+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let h=0;h<a.length;h++){let f=a[h];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=h),f.route.id){let{loaderData:g,errors:v}=r,x=f.route.loader&&!g.hasOwnProperty(f.route.id)&&(!v||v[f.route.id]===void 0);if(f.route.lazy||x){n.isStatic&&(i=!0),l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,u=r&&c?(h,f)=>{var g,v;c(h,{location:r.location,params:((v=(g=r.matches)==null?void 0:g[0])==null?void 0:v.params)??{},unstable_pattern:_h(r.matches),errorInfo:f})}:void 0;return a.reduceRight((h,f,g)=>{let v,x=!1,w=null,j=null;r&&(v=s&&f.route.id?s[f.route.id]:void 0,w=f.route.errorElement||Kh,i&&(l<0&&g===0?(cf("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,j=null):l===g&&(x=!0,j=f.route.hydrateFallbackElement||null)));let m=t.concat(a.slice(0,g+1)),p=()=>{let y;return v?y=w:x?y=j:f.route.Component?y=d.createElement(f.route.Component,null):f.route.element?y=f.route.element:y=h,d.createElement(Qh,{match:f,routeContext:{outlet:h,matches:m,isDataRoute:r!=null},children:y})};return r&&(f.route.ErrorBoundary||f.route.errorElement||g===0)?d.createElement(lf,{location:r.location,revalidation:r.revalidation,component:w,error:v,children:p(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:u}):p()},null)}function al(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Jh(e){let t=d.useContext(rr);return ce(t,al(e)),t}function Xh(e){let t=d.useContext(bo);return ce(t,al(e)),t}function qh(e){let t=d.useContext(yt);return ce(t,al(e)),t}function ol(e){let t=qh(e),n=t.matches[t.matches.length-1];return ce(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Zh(){return ol("useRouteId")}function eg(){var r;let e=d.useContext(rl),t=Xh("useRouteError"),n=ol("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function tg(){let{router:e}=Jh("useNavigate"),t=ol("useNavigate"),n=d.useRef(!1);return of(()=>{n.current=!0}),d.useCallback(async(a,s={})=>{it(n.current,af),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...s}))},[e,t])}var Nc={};function cf(e,t,n){!t&&!Nc[e]&&(Nc[e]=!0,it(!1,n))}d.memo(ng);function ng({routes:e,future:t,state:n,isStatic:r,onError:a}){return sf(e,void 0,{state:n,isStatic:r,onError:a})}function Vt({to:e,replace:t,state:n,relative:r}){ce(ar(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=d.useContext(Ze);it(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=d.useContext(yt),{pathname:i}=lt(),l=Bt(),c=Eo(e,nl(s),i,r==="path"),u=JSON.stringify(c);return d.useEffect(()=>{l(JSON.parse(u),{replace:t,state:n,relative:r})},[l,u,r,t,n]),null}function rg(e){return Wh(e.context)}function Se(e){ce(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function ag({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:s=!1,unstable_useTransitions:i}){ce(!ar(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=d.useMemo(()=>({basename:l,navigator:a,static:s,unstable_useTransitions:i,future:{}}),[l,a,s,i]);typeof n=="string"&&(n=nr(n));let{pathname:u="/",search:h="",hash:f="",state:g=null,key:v="default",unstable_mask:x}=n,w=d.useMemo(()=>{let j=Ft(u,l);return j==null?null:{location:{pathname:j,search:h,hash:f,state:g,key:v,unstable_mask:x},navigationType:r}},[l,u,h,f,g,v,r,x]);return it(w!=null,`<Router basename="${l}"> is not able to match the URL "${u}${h}${f}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:d.createElement(Ze.Provider,{value:c},d.createElement(qr.Provider,{children:t,value:w}))}function og({children:e,location:t}){return Hh(ti(e),t)}function ti(e,t=[]){let n=[];return d.Children.forEach(e,(r,a)=>{if(!d.isValidElement(r))return;let s=[...t,a];if(r.type===d.Fragment){n.push.apply(n,ti(r.props.children,s));return}ce(r.type===Se,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ce(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=ti(r.props.children,s)),n.push(i)}),n}var za="get",Aa="application/x-www-form-urlencoded";function Po(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function sg(e){return Po(e)&&e.tagName.toLowerCase()==="button"}function ig(e){return Po(e)&&e.tagName.toLowerCase()==="form"}function lg(e){return Po(e)&&e.tagName.toLowerCase()==="input"}function cg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ug(e,t){return e.button===0&&(!t||t==="_self")&&!cg(e)}function ni(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function dg(e,t){let n=ni(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(s=>{n.append(a,s)})}),n}var va=null;function fg(){if(va===null)try{new FormData(document.createElement("form"),0),va=!1}catch{va=!0}return va}var pg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function as(e){return e!=null&&!pg.has(e)?(it(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Aa}"`),null):e}function mg(e,t){let n,r,a,s,i;if(ig(e)){let l=e.getAttribute("action");r=l?Ft(l,t):null,n=e.getAttribute("method")||za,a=as(e.getAttribute("enctype"))||Aa,s=new FormData(e)}else if(sg(e)||lg(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?Ft(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||za,a=as(e.getAttribute("formenctype"))||as(l.getAttribute("enctype"))||Aa,s=new FormData(l,e),!fg()){let{name:u,type:h,value:f}=e;if(h==="image"){let g=u?`${u}.`:"";s.append(`${g}x`,"0"),s.append(`${g}y`,"0")}else u&&s.append(u,f)}}else{if(Po(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=za,r=null,a=Aa,i=e}return s&&a==="text/plain"&&(i=s,s=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:s,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function sl(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function hg(e,t,n,r){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${r}`:a.pathname=`${a.pathname}.${r}`:a.pathname==="/"?a.pathname=`_root.${r}`:t&&Ft(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${r}`,a}async function gg(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function yg(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function vg(e,t,n){let r=await Promise.all(e.map(async a=>{let s=t.routes[a.route.id];if(s){let i=await gg(s,n);return i.links?i.links():[]}return[]}));return jg(r.flat(1).filter(yg).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Ec(e,t,n,r,a,s){let i=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var h;return n[u].pathname!==c.pathname||((h=n[u].route.path)==null?void 0:h.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return s==="assets"?t.filter((c,u)=>i(c,u)||l(c,u)):s==="data"?t.filter((c,u)=>{var f;let h=r.routes[c.route.id];if(!h||!h.hasLoader)return!1;if(i(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let g=c.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function xg(e,t,{includeHydrateFallback:n}={}){return wg(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function wg(e){return[...new Set(e)]}function Sg(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function jg(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let s=JSON.stringify(Sg(a));return n.has(s)||(n.add(s),r.push({key:s,link:a})),r},[])}function uf(){let e=d.useContext(rr);return sl(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function kg(){let e=d.useContext(bo);return sl(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var il=d.createContext(void 0);il.displayName="FrameworkContext";function df(){let e=d.useContext(il);return sl(e,"You must render this element inside a <HydratedRouter> element"),e}function Cg(e,t){let n=d.useContext(il),[r,a]=d.useState(!1),[s,i]=d.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:h,onTouchStart:f}=t,g=d.useRef(null);d.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let w=m=>{m.forEach(p=>{i(p.isIntersecting)})},j=new IntersectionObserver(w,{threshold:.5});return g.current&&j.observe(g.current),()=>{j.disconnect()}}},[e]),d.useEffect(()=>{if(r){let w=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(w)}}},[r]);let v=()=>{a(!0)},x=()=>{a(!1),i(!1)};return n?e!=="intent"?[s,g,{}]:[s,g,{onFocus:pr(l,v),onBlur:pr(c,x),onMouseEnter:pr(u,v),onMouseLeave:pr(h,x),onTouchStart:pr(f,v)}]:[!1,g,{}]}function pr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Ng({page:e,...t}){let{router:n}=uf(),r=d.useMemo(()=>Jd(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?d.createElement(bg,{page:e,matches:r,...t}):null}function Eg(e){let{manifest:t,routeModules:n}=df(),[r,a]=d.useState([]);return d.useEffect(()=>{let s=!1;return vg(e,t,n).then(i=>{s||a(i)}),()=>{s=!0}},[e,t,n]),r}function bg({page:e,matches:t,...n}){let r=lt(),{future:a,manifest:s,routeModules:i}=df(),{basename:l}=uf(),{loaderData:c,matches:u}=kg(),h=d.useMemo(()=>Ec(e,t,u,s,r,"data"),[e,t,u,s,r]),f=d.useMemo(()=>Ec(e,t,u,s,r,"assets"),[e,t,u,s,r]),g=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,j=!1;if(t.forEach(p=>{var S;let y=s.routes[p.route.id];!y||!y.hasLoader||(!h.some(b=>b.route.id===p.route.id)&&p.route.id in c&&((S=i[p.route.id])!=null&&S.shouldRevalidate)||y.hasClientLoader?j=!0:w.add(p.route.id))}),w.size===0)return[];let m=hg(e,l,a.unstable_trailingSlashAwareDataRequests,"data");return j&&w.size>0&&m.searchParams.set("_routes",t.filter(p=>w.has(p.route.id)).map(p=>p.route.id).join(",")),[m.pathname+m.search]},[l,a.unstable_trailingSlashAwareDataRequests,c,r,s,h,t,e,i]),v=d.useMemo(()=>xg(f,s),[f,s]),x=Eg(f);return d.createElement(d.Fragment,null,g.map(w=>d.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),v.map(w=>d.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),x.map(({key:w,link:j})=>d.createElement("link",{key:w,nonce:n.nonce,...j,crossOrigin:j.crossOrigin??n.crossOrigin})))}function Pg(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Tg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Tg&&(window.__reactRouterVersion="7.13.1")}catch{}function Ig({basename:e,children:t,unstable_useTransitions:n,window:r}){let a=d.useRef();a.current==null&&(a.current=sh({window:r,v5Compat:!0}));let s=a.current,[i,l]=d.useState({action:s.action,location:s.location}),c=d.useCallback(u=>{n===!1?l(u):d.startTransition(()=>l(u))},[n]);return d.useLayoutEffect(()=>s.listen(c),[s,c]),d.createElement(ag,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:s,unstable_useTransitions:n})}var ff=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ge=d.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:s,replace:i,unstable_mask:l,state:c,target:u,to:h,preventScrollReset:f,viewTransition:g,unstable_defaultShouldRevalidate:v,...x},w){let{basename:j,navigator:m,unstable_useTransitions:p}=d.useContext(Ze),y=typeof h=="string"&&ff.test(h),S=ef(h,j);h=S.to;let b=Bh(h,{relative:a}),T=lt(),k=null;if(l){let R=Eo(l,[],T.unstable_mask?T.unstable_mask.pathname:"/",!0);j!=="/"&&(R.pathname=R.pathname==="/"?j:Et([j,R.pathname])),k=m.createHref(R)}let[E,N,I]=Cg(r,x),D=zg(h,{replace:i,unstable_mask:l,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:g,unstable_defaultShouldRevalidate:v,unstable_useTransitions:p});function V(R){t&&t(R),R.defaultPrevented||D(R)}let M=!(S.isExternal||s),$=d.createElement("a",{...x,...I,href:(M?k:void 0)||S.absoluteURL||b,onClick:M?V:t,ref:Pg(w,N),target:u,"data-discover":!y&&n==="render"?"true":void 0});return E&&!y?d.createElement(d.Fragment,null,$,d.createElement(Ng,{page:b})):$});Ge.displayName="Link";var ll=d.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:s,to:i,viewTransition:l,children:c,...u},h){let f=Zr(i,{relative:u.relative}),g=lt(),v=d.useContext(bo),{navigator:x,basename:w}=d.useContext(Ze),j=v!=null&&Fg(f)&&l===!0,m=x.encodeLocation?x.encodeLocation(f).pathname:f.pathname,p=g.pathname,y=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(p=p.toLowerCase(),y=y?y.toLowerCase():null,m=m.toLowerCase()),y&&w&&(y=Ft(y,w)||y);const S=m!=="/"&&m.endsWith("/")?m.length-1:m.length;let b=p===m||!a&&p.startsWith(m)&&p.charAt(S)==="/",T=y!=null&&(y===m||!a&&y.startsWith(m)&&y.charAt(m.length)==="/"),k={isActive:b,isPending:T,isTransitioning:j},E=b?t:void 0,N;typeof r=="function"?N=r(k):N=[r,b?"active":null,T?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let I=typeof s=="function"?s(k):s;return d.createElement(Ge,{...u,"aria-current":E,className:N,ref:h,style:I,to:i,viewTransition:l},typeof c=="function"?c(k):c)});ll.displayName="NavLink";var _g=d.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:s,method:i=za,action:l,onSubmit:c,relative:u,preventScrollReset:h,viewTransition:f,unstable_defaultShouldRevalidate:g,...v},x)=>{let{unstable_useTransitions:w}=d.useContext(Ze),j=Lg(),m=Mg(l,{relative:u}),p=i.toLowerCase()==="get"?"get":"post",y=typeof l=="string"&&ff.test(l),S=b=>{if(c&&c(b),b.defaultPrevented)return;b.preventDefault();let T=b.nativeEvent.submitter,k=(T==null?void 0:T.getAttribute("formmethod"))||i,E=()=>j(T||b.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:a,state:s,relative:u,preventScrollReset:h,viewTransition:f,unstable_defaultShouldRevalidate:g});w&&n!==!1?d.startTransition(()=>E()):E()};return d.createElement("form",{ref:x,method:p,action:m,onSubmit:r?c:S,...v,"data-discover":!y&&e==="render"?"true":void 0})});_g.displayName="Form";function Rg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pf(e){let t=d.useContext(rr);return ce(t,Rg(e)),t}function zg(e,{target:t,replace:n,unstable_mask:r,state:a,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c,unstable_useTransitions:u}={}){let h=Bt(),f=lt(),g=Zr(e,{relative:i});return d.useCallback(v=>{if(ug(v,t)){v.preventDefault();let x=n!==void 0?n:Kr(f)===Kr(g),w=()=>h(e,{replace:x,unstable_mask:r,state:a,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c});u?d.startTransition(()=>w()):w()}},[f,h,g,n,r,a,t,e,s,i,l,c,u])}function mf(e){it(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=d.useRef(ni(e)),n=d.useRef(!1),r=lt(),a=d.useMemo(()=>dg(r.search,n.current?null:t.current),[r.search]),s=Bt(),i=d.useCallback((l,c)=>{const u=ni(typeof l=="function"?l(new URLSearchParams(a)):l);n.current=!0,s("?"+u,c)},[s,a]);return[a,i]}var Ag=0,$g=()=>`__${String(++Ag)}__`;function Lg(){let{router:e}=pf("useSubmit"),{basename:t}=d.useContext(Ze),n=Zh(),r=e.fetch,a=e.navigate;return d.useCallback(async(s,i={})=>{let{action:l,method:c,encType:u,formData:h,body:f}=mg(s,t);if(i.navigate===!1){let g=i.fetcherKey||$g();await r(g,n,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:f,formMethod:i.method||c,formEncType:i.encType||u,flushSync:i.flushSync})}else await a(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:f,formMethod:i.method||c,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,a,t,n])}function Mg(e,{relative:t}={}){let{basename:n}=d.useContext(Ze),r=d.useContext(yt);ce(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),s={...Zr(e||".",{relative:t})},i=lt();if(e==null){s.search=i.search;let l=new URLSearchParams(s.search),c=l.getAll("index");if(c.some(h=>h==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let h=l.toString();s.search=h?`?${h}`:""}}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Et([n,s.pathname])),Kr(s)}function Fg(e,{relative:t}={}){let n=d.useContext(nf);ce(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=pf("useViewTransitionState"),a=Zr(e,{relative:t});if(!n.isTransitioning)return!1;let s=Ft(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Ft(n.nextLocation.pathname,r)||n.nextLocation.pathname;return oo(a.pathname,i)!=null||oo(a.pathname,s)!=null}class hf extends Error{constructor(n){super("different_account");To(this,"summary");this.name="DifferentAccountError",this.summary=n}}class Og{constructor(){To(this,"apiKey",null)}setApiKey(t){this.apiKey=t}clearApiKey(){this.apiKey=null}getApiKey(){return this.apiKey}async fetch(t,n){return globalThis.fetch(t,{...n,headers:{"Content-Type":"application/json",...this.apiKey?{"X-API-Key":this.apiKey}:{},...n==null?void 0:n.headers}})}async login(t,n={}){const r=await this.fetch("/auth/login",{method:"POST",headers:{"X-API-Key":t,"Content-Type":"application/json"},body:JSON.stringify({confirmWipe:n.confirmWipe===!0})});if(r.status===409){const s=await r.json().catch(()=>({}));if(s!=null&&s.wouldWipe)throw new hf(s.summary??{credentialCount:0,serviceCount:0,credentialIds:[]})}if(!r.ok){const s=await r.json().catch(()=>({error:"Invalid API key"}));throw new Error(s.error||`Login failed: ${r.status}`)}return(await r.json()).user}async logout(){await this.fetch("/auth/logout",{method:"POST"})}async getGroups(){const t=await this.fetch("/api/groups");if(!t.ok)throw new Error(`Failed to fetch groups: ${t.status}`);const n=await t.json();return n.groups??n}async listProfiles(){const t=await this.fetch("/api/profiles");if(!t.ok)throw new Error(`Failed to fetch profiles: ${t.status}`);return(await t.json()).profiles}async getProfile(t){const n=await this.fetch(`/api/profiles/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch profile: ${n.status}`);return n.json()}async attest(t){const n=await this.fetch("/api/as/attest",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(r.error||`Attest failed: ${n.status}`)}return n.json()}async getPending(t){const n=await this.fetch(`/api/attestations/pending?domain=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch pending: ${n.status}`);const r=await n.json();return r.pending??r}async getMyAttestations(t){const n=t?`?status=${encodeURIComponent(t)}`:"",r=await this.fetch(`/api/attestations/mine${n}`);if(!r.ok)throw new Error(`Failed to fetch attestations: ${r.status}`);return((await r.json()).attestations??[]).map(s=>{var i,l;return{frame_hash:s.frameHash??s.boundsHash,profile_id:s.profileId,path:s.path,title:s.title??null,sp_status:s.status??null,frame:s.bounds??s.frame??{},required_domains:s.requiredDomains??[],attested_domains:s.attestedDomains??[],missing_domains:(s.requiredDomains??[]).filter(c=>!(s.attestedDomains??[]).includes(c)),deferred_commitment_domains:s.deferredCommitmentDomains??[],approvers_frozen:s.approversFrozen??[],above_cap:s.aboveCap??!1,created_at:s.createdAt?new Date(s.createdAt*1e3).toISOString():"",earliest_expiry:(i=s.attestations)!=null&&i.length?new Date(Math.min(...s.attestations.map(c=>c.expiresAt))*1e3).toISOString():null,remaining_seconds:(l=s.attestations)!=null&&l.length?Math.max(0,Math.min(...s.attestations.map(c=>c.expiresAt))-Math.floor(Date.now()/1e3)):null}})}async getMyReceipts(t){const n=new URLSearchParams;t!=null&&t.date&&n.set("date",t.date),t!=null&&t.profile&&n.set("profile",t.profile),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString(),a=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!a.ok)throw new Error(`Failed to fetch receipts: ${a.status}`);return(await a.json()).receipts??[]}async revokeAttestation(t,n){const r=await this.fetch(`/api/attestations/${encodeURIComponent(t)}/revoke`,{method:"POST",body:JSON.stringify({reason:n??"Revoked by user"})});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed to revoke"}));throw new Error(a.error||`Revoke failed: ${r.status}`)}}async getAttestations(t){const n=await this.fetch(`/api/attestations?frame_hash=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch attestations: ${n.status}`);return n.json()}async getGroupById(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch group: ${n.status}`);return n.json()}async createGroup(t){const n=await this.fetch("/api/groups",{method:"POST",body:JSON.stringify({name:t})});if(!n.ok){const s=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(s.error||`Create group failed: ${n.status}`)}const r=await n.json(),a=r.group||r;return{id:a.id,name:a.name,myDomains:a.myDomains||[],isAdmin:!0}}async joinGroup(t){const n=await this.fetch("/api/groups/join",{method:"POST",body:JSON.stringify({inviteCode:t})});if(!n.ok){const s=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(s.error||`Join group failed: ${n.status}`)}const r=await n.json(),a=r.group||r;return{id:a.id,name:a.name,myDomains:a.myDomains||[],isAdmin:a.isAdmin||!1}}async inviteToGroup(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/invite`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(r.error||`Invite failed: ${n.status}`)}return n.json()}async getMyTeam(){const t=await this.fetch("/api/groups/me");if(!t.ok)return null;const n=await t.json();return n.group?{group:n.group,membership:n.membership}:null}async listUsers(){const t=await this.fetch("/api/users");return t.ok?(await t.json()).users??[]:[]}async setPubkey(t){const n=await this.fetch("/api/users/me/pubkey",{method:"PUT",body:JSON.stringify({pubkey:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to set pubkey"}));throw new Error(r.error||`setPubkey failed: ${n.status}`)}}async getPubkey(t){const n=await this.fetch(`/api/users/${encodeURIComponent(t)}/pubkey`);return n.status===404||!n.ok?null:(await n.json()).pubkey??null}async leaveTeam(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/leave`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to leave team"}));throw new Error(r.error||`Leave failed: ${n.status}`)}}async getVaultStatus(){const t=await this.fetch("/vault/status");if(!t.ok)throw new Error(`Failed to fetch vault status: ${t.status}`);return t.json()}async getCredential(t){const n=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to check credential: ${n.status}`);return n.json()}async setCredential(t,n){const r=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to save credential: ${r.status}`)}async testCredential(t){const n=await this.fetch(`/vault/test/${encodeURIComponent(t)}`,{method:"POST"});if(!n.ok)throw new Error(`Test failed: ${n.status}`);return n.json()}async aiAssist(t){const n=await this.fetch("/ai/assist",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI request failed"}))).error,disclaimer:"AI surfaces reality. You supply intent."}}async aiTest(t){const n=await this.fetch("/ai/test",{method:"POST",body:JSON.stringify(t??{})});if(!n.ok)throw new Error(`AI test failed: ${n.status}`);return n.json()}async getMcpHealth(){const t=await this.fetch("/mcp/health");if(!t.ok)throw new Error(`MCP server unreachable: ${t.status}`);return t.json()}async getMcpIntegrations(){const t=await this.fetch("/mcp/integrations");if(!t.ok)throw new Error(`Failed to fetch integrations: ${t.status}`);return t.json()}async getOAuthHealth(t){try{const n=await this.fetch(`/auth/oauth/${encodeURIComponent(t)}/health`);return n.ok?await n.json():{status:"unverified"}}catch{return{status:"unverified"}}}async getIntegrationManifests(){const t=await this.fetch("/mcp/integrations/manifests");if(!t.ok)throw new Error(`Failed to fetch manifests: ${t.status}`);return t.json()}async discoverScopeField(t,n){const r=await this.fetch(`/integrations/${encodeURIComponent(t)}/discover/${encodeURIComponent(n)}`);if(!r.ok){const a=await r.json().catch(()=>({error:`Discovery failed: ${r.status}`}));throw new Error(a.error)}return r.json()}async activateIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}/activate`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`Failed: ${n.status}`)}return n.json()}async removeMcpIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to remove integration: ${n.status}`)}async getTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`);if(r.status===404||!r.ok)return null;const a=await r.json();return(a==null?void 0:a.config)??null}async setTeamProfileConfig(t,n,r){const a=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(r)});if(!a.ok){const s=await a.json().catch(()=>({error:"Failed to set profile config"}));throw new Error(s.error||`setTeamProfileConfig failed: ${a.status}`)}}async encryptIntent(t,n){const r=await this.fetch("/api/encrypt-intent",{method:"POST",body:JSON.stringify({intent:t,recipients:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Encryption failed"}));throw new Error(a.error||`encryptIntent failed: ${r.status}`)}return r.json()}async getApproversPubkeys(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}/approvers/pubkeys`);return r.ok?(await r.json()).approvers??[]:[]}async deleteTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"DELETE"});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed to delete profile config"}));throw new Error(a.error||`deleteTeamProfileConfig failed: ${r.status}`)}}async getProposals(t){const n=await this.fetch(`/api/proposals?domain=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch proposals: ${n.status}`);return(await n.json()).proposals??[]}async resolveProposal(t,n,r){const a=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/resolve`,{method:"POST",body:JSON.stringify({action:n,domain:r})});if(!a.ok){const s=await a.json().catch(()=>({error:"Failed"}));throw new Error(s.error||`Failed: ${a.status}`)}return a.json()}async getProposalsForApprover(){const t=await this.fetch("/api/proposals?approver=me");if(!t.ok)throw new Error(`Failed to fetch approver proposals: ${t.status}`);return(await t.json()).proposals??[]}async approveProposal(t){const n=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/approve`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`approveProposal failed: ${n.status}`)}return n.json()}async rejectProposal(t,n){const r=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/reject`,{method:"POST",body:JSON.stringify({reason:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed"}));throw new Error(a.error||`rejectProposal failed: ${r.status}`)}return r.json()}async getAttestationIntent(t){const n=await this.fetch(`/api/attestations/${encodeURIComponent(t)}/intent`);return n.status===404||n.status===403||!n.ok?null:n.json()}async decryptIntent(t){const n=await this.fetch("/api/decrypt-intent",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const a=await n.json().catch(()=>({error:"Decryption failed"}));throw new Error(a.error||`decryptIntent failed: ${n.status}`)}return(await n.json()).intent}async storeApprovedIntent(t,n){const r=await this.fetch("/api/approved-intents",{method:"POST",body:JSON.stringify({authorityId:t,intent:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed"}));throw new Error(a.error||`storeApprovedIntent failed: ${r.status}`)}}async listTeamAuthorizations(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/attestations`);if(!n.ok)throw new Error(`Failed to fetch team authorizations: ${n.status}`);return((await n.json()).items??[]).map(a=>{var l,c;const s=a.owner??{userId:""};return{frame_hash:a.boundsHash??a.frameHash??a.frame_hash,profile_id:a.profileId??a.profile_id,path:a.path??"",title:a.title??null,sp_status:a.status??a.sp_status??null,frame:a.bounds??a.frame??{},required_domains:a.requiredDomains??a.required_domains??[],attested_domains:a.attestedDomains??a.attested_domains??[],missing_domains:(a.requiredDomains??a.required_domains??[]).filter(u=>!(a.attestedDomains??a.attested_domains??[]).includes(u)),deferred_commitment_domains:a.deferredCommitmentDomains??a.deferred_commitment_domains??[],approvers_frozen:a.approversFrozen??a.approvers_frozen??[],above_cap:a.aboveCap??a.above_cap??!1,created_at:a.createdAt?new Date(a.createdAt*1e3).toISOString():a.created_at??"",earliest_expiry:(l=a.attestations)!=null&&l.length?new Date(Math.min(...a.attestations.map(u=>u.expiresAt))*1e3).toISOString():null,remaining_seconds:(c=a.attestations)!=null&&c.length?Math.max(0,Math.min(...a.attestations.map(u=>u.expiresAt))-Math.floor(Date.now()/1e3)):null,owner:s}})}async listTeamReceipts(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/receipts`);if(!n.ok)throw new Error(`Failed to fetch team receipts: ${n.status}`);return(await n.json()).receipts??[]}async getThread(t){const n=t.sinceDays??7,r=t.status??"pending",a=t.domain||"owner",s=await this.getProposals(a);let i=[];if(r==="all"){const l=[],c=new Date;for(let h=0;h<n;h++){const f=new Date(c);f.setUTCDate(c.getUTCDate()-h),l.push(f.toISOString().slice(0,10))}i=(await Promise.all(l.map(h=>this.getMyReceipts({date:h,profile:t.profile})))).flat()}return{proposals:s,receipts:i}}async getGateContent(t){const n=await this.fetch(`/gate-content?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch gate content: ${n.status}`);return(await n.json()).entry??null}async pushGateContent(t){const n=await this.fetch("/gate-content",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to push gate content"}));throw new Error(r.error||`Push gate content failed: ${n.status}`)}}async getAgentContext(){const t=await this.fetch("/agent-brief/context");if(!t.ok)throw new Error(`Failed to fetch agent context: ${t.status}`);return(await t.json()).content}async saveAgentContext(t){const n=await this.fetch("/agent-brief/context",{method:"PUT",body:JSON.stringify({content:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to save agent context"}));throw new Error(r.error||`Save failed: ${n.status}`)}}async aiChat(t){const n=await this.fetch("/ai/chat",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI chat failed"}))).error||`Chat failed: ${n.status}`}}async getAIPrompts(){const t=await this.fetch("/ai-prompts");if(!t.ok)throw new Error(`Failed to load AI prompts: ${t.status}`);return t.json()}async setAIPrompt(t,n){const r=await this.fetch(`/ai-prompts/${t}`,{method:"PUT",body:JSON.stringify({value:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Save failed"}));throw new Error(a.error||`Save failed: ${r.status}`)}}}const F=new Og,gf=d.createContext(null);function Bg({children:e}){const[t,n]=d.useState(null),[r,a]=d.useState("personal"),[s,i]=d.useState(null),[l,c]=d.useState(""),[u,h]=d.useState(null),[f,g]=d.useState(null),[v,x]=d.useState(!1),[w,j]=d.useState(""),m=d.useRef(!1),p=d.useRef(null),y=d.useCallback(async()=>{if(m.current)try{const E=await F.getMyTeam();if(E){const{group:N,membership:I}=E;h(N),g(I),a("team"),i(N);const D=p.current??I.domains[0]??"owner";c(D)}else h(null),g(null),a("personal")}catch{}},[]);d.useEffect(()=>{const E=()=>{document.visibilityState==="visible"&&y()};return document.addEventListener("visibilitychange",E),()=>document.removeEventListener("visibilitychange",E)},[y]);const S=d.useCallback(async(E,N={})=>{x(!0),j("");try{F.setApiKey(E),m.current=!0;const I=await F.login(E,N);n(I),p.current=I.id;const D=await F.getGroups(),V=D.find(M=>M.isPersonal)??D[0]??null;i(V),c("owner"),await y()}catch(I){throw F.clearApiKey(),m.current=!1,j(I instanceof Error?I.message:"Login failed"),I}finally{x(!1)}},[y]),b=d.useCallback(async()=>{await F.logout(),F.clearApiKey(),m.current=!1,p.current=null,n(null),i(null),c(""),h(null),g(null),a("personal"),j("")},[]),T=d.useCallback(()=>j(""),[]),k=d.useCallback((E,N)=>{i(E),c(N)},[]);return o.jsx(gf.Provider,{value:{user:t,mode:r,group:s,domain:l,groupId:(s==null?void 0:s.id)??null,activeTeam:u,activeMembership:f,isLoading:v,error:w,login:S,logout:b,clearError:T,activeGroup:s,activeDomain:l,groups:s?[s]:[],setActiveContext:k,refreshGroups:y},children:e})}function Ce(){const e=d.useContext(gf);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const yf=d.createContext(null);function Dg({children:e}){const{user:t}=Ce(),n=d.useRef(null),[r,a]=d.useState(!1),s=d.useRef(new Map),i=d.useCallback((l,c)=>{const u=s.current;return u.has(l)||u.set(l,new Set),u.get(l).add(c),()=>{var h;(h=u.get(l))==null||h.delete(c)}},[]);return d.useEffect(()=>{if(!t){n.current&&(n.current.close(),n.current=null,a(!1));return}if(n.current)return;const l=F.getApiKey();if(!l)return;const c=new EventSource(`/events?key=${encodeURIComponent(l)}`);n.current=c,c.onopen=()=>a(!0),c.onerror=()=>a(!1);const u=["integration-changed","attestation-changed","proposal-added","proposal-resolved","team-membership-changed","action-approval-needed","action-resolved","proposal-approved","proposal-rejected"];for(const h of u)c.addEventListener(h,f=>{let g;try{g=JSON.parse(f.data)}catch{g=null}const v=s.current.get(h);if(v)for(const x of v)try{x(g)}catch(w){console.error(`[EventSource] handler for "${h}" threw:`,w)}});return()=>{c.close(),n.current=null,a(!1)}},[t]),o.jsx(yf.Provider,{value:{connected:r,addListener:i},children:e})}function ue(e,t){const n=d.useContext(yf);if(!n)return;const{addListener:r}=n;d.useEffect(()=>r(e,t),[e,t,r])}const Pr="suveren-theme",bc="hap-theme";function xa(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}(function(){const t=localStorage.getItem(bc);t!==null&&localStorage.getItem(Pr)===null&&localStorage.setItem(Pr,t),t!==null&&localStorage.removeItem(bc)})();function vf(){const[e,t]=d.useState(()=>{const s=localStorage.getItem(Pr);return s==="light"||s==="dark"?s:"system"}),[n,r]=d.useState(()=>xa(e));d.useEffect(()=>{const s=document.documentElement,i=xa(e);s.setAttribute("data-theme",i),e==="system"?localStorage.removeItem(Pr):localStorage.setItem(Pr,e),r(xa(e))},[e]),d.useEffect(()=>{if(e!=="system")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>r(xa("system"));return s.addEventListener("change",i),()=>s.removeEventListener("change",i)},[e]);const a=d.useCallback(()=>{t(s=>s==="system"?"light":s==="light"?"dark":"system")},[]);return{theme:e,effectiveTheme:n,toggle:a}}const Ug=5*60*1e3;function xf(){const[e,t]=d.useState(!1),[n,r]=d.useState("docker"),[a,s]=d.useState(""),[i,l]=d.useState(!1);return d.useEffect(()=>{const c=(h=!1)=>{fetch(h?"/health?refresh=1":"/health").then(f=>f.json()).then(f=>{f.updateAvailable&&t(!0),f.installMethod&&r(f.installMethod),f.version&&s(f.version)}).catch(()=>{})};c(!0);const u=setInterval(()=>c(!1),Ug);return()=>clearInterval(u)},[]),{updateAvailable:e&&!i,installMethod:n,version:a,dismiss:()=>l(!0)}}function Wg(e){return e?e==="dev"?"dev":/^[0-9a-f]{40}$/i.test(e)?e.slice(0,7):e:""}const Pc={system:"◑",light:"☀",dark:"☾"};function Hg(){const{mode:e,group:t,domain:n}=Ce();return e==="personal"?o.jsx("span",{children:"personal"}):t?o.jsxs("span",{children:[t.name," / ",n]}):o.jsx("span",{children:n})}function cl({onMenuToggle:e}){const{user:t,logout:n}=Ce(),{theme:r,toggle:a}=vf(),{version:s}=xf(),i=Wg(s);return o.jsx("nav",{className:"top-nav",children:o.jsxs("div",{className:"top-nav-inner",children:[o.jsxs("div",{className:"logo-group",children:[o.jsx("span",{className:"logo",children:"Suveren"}),o.jsx("span",{className:"version-badge",children:"Local Gateway"})]}),o.jsx("div",{className:"nav-spacer"}),o.jsx("div",{className:"nav-actions nav-actions-desktop",children:t?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"user-chip",children:[o.jsx("strong",{children:t.name}),o.jsx("span",{className:"dot"}),o.jsx(Hg,{})]}),o.jsx("button",{className:"theme-toggle",onClick:a,title:`Theme: ${r}`,children:Pc[r]}),o.jsx("button",{className:"nav-logout",onClick:n,children:"Logout"})]}):o.jsxs(o.Fragment,{children:[i&&o.jsxs("span",{title:"Running gateway version",style:{fontSize:"0.8rem",color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums"},children:["v",i]}),o.jsx("button",{className:"theme-toggle",onClick:a,title:`Theme: ${r}`,children:Pc[r]})]})}),t&&e&&o.jsx("button",{className:"mobile-menu-btn",onClick:e,"aria-label":"Menu",children:"☰"})]})})}function jt(e,t){var n;return(n=t==null?void 0:t.revokedSet)!=null&&n.has(e.frame_hash)||e.sp_status==="revoked"?"revoked":e.sp_status==="expired"||e.remaining_seconds===null||e.remaining_seconds<=0?"expired":e.missing_domains.length>0?"pending":"active"}function wf(e,t){const n={active:[],pending:[],expired:[],revoked:[]};for(const r of e)n[jt(r,t)].push(r);return n}function Rt(e,t,n){const r=d.useRef(e);r.current=e,d.useEffect(()=>{let a=null;const s=()=>typeof document>"u"?!0:document.visibilityState==="visible",i=()=>{s()&&r.current()},l=()=>{a===null&&(a=setInterval(i,t))},c=()=>{a!==null&&(clearInterval(a),a=null)},u=()=>{s()?(r.current(),l()):c()};return s()&&(r.current(),l()),document.addEventListener("visibilitychange",u),()=>{c(),document.removeEventListener("visibilitychange",u)}},[t,n])}const Sf=d.createContext(null),Vg=3e4;function Kg({children:e}){const[t,n]=d.useState({manifests:[],integrations:[],activeSessions:0,mcpServerUp:null,manifestsError:!1,fetchCount:0}),r=d.useRef(null),a=d.useCallback(async()=>{let c=!1;const[u,h]=await Promise.all([F.getIntegrationManifests().catch(()=>(c=!0,{manifests:[]})),F.getMcpHealth().catch(()=>null)]);n(f=>({manifests:u.manifests,integrations:(h==null?void 0:h.integrations)??f.integrations,activeSessions:(h==null?void 0:h.activeSessions)??f.activeSessions,mcpServerUp:!!h,manifestsError:c,fetchCount:f.fetchCount+1}))},[]);ue("integration-changed",a),Rt(a,3e5);const s=d.useMemo(()=>{const c=new Map(t.integrations.map(g=>[g.id,g])),u=Date.now(),h=t.fetchCount>0&&t.manifests.some(g=>{const v=c.get(g.id);return v&&!v.running});h&&r.current===null?r.current=u:h||(r.current=null);const f=r.current!==null&&u-r.current<Vg;return t.manifests.map(g=>{const v=c.get(g.id);let x;return t.fetchCount===0?x="loading":v!=null&&v.running?x="running":v!=null&&v.error?x="error":v&&f?x="starting":x="not-running",{id:g.id,manifest:g,integration:v,state:x}})},[t]),i=d.useMemo(()=>s.filter(c=>c.state==="not-running"||c.state==="error").length,[s]),l={loading:t.fetchCount===0,mcpServerUp:t.mcpServerUp,manifestsError:t.manifestsError,entries:s,attentionCount:i,activeSessions:t.activeSessions,refresh:a};return o.jsx(Sf.Provider,{value:l,children:e})}function ul(){const e=d.useContext(Sf);if(!e)throw new Error("useIntegrationStatus must be used inside IntegrationStatusProvider");return e}const Gg=[{to:"/",icon:"□",label:"Dashboard"},{to:"/proposals",icon:"▷",label:"Pending Approvals",statusKey:"proposals"},{to:"/authorizations",icon:"☰",label:"Authorizations",statusKey:"authorizations"},{to:"/agent-brief",icon:"▤",label:"Agent Brief",statusKey:"brief"},{to:"/audit",icon:"▣",label:"Receipts"},{to:"/groups",icon:"◉",label:"Team",teamOnly:!0},{to:"/integrations",icon:"⧗",label:"Integrations",statusKey:"integrations"},{to:"/settings",icon:"⚙",label:"AI Assistant",statusKey:"assistant"}];function Qg(){const{activeDomain:e}=Ce(),[t,n]=d.useState({}),r=d.useCallback(async()=>{try{const[a,s,i,l,c]=await Promise.all([F.getCredential("ai-config").catch(()=>null),F.getMyAttestations().catch(()=>null),F.getProposals(e||"owner").catch(()=>null),F.getProposalsForApprover().catch(()=>null),F.getAgentContext().catch(()=>"")]),u={};if(a&&!a.configured&&(u.assistant=1),s){const v=wf(s).expired.length;v>0&&(u.authorizations=v)}const h=(i==null?void 0:i.length)??0,f=(l==null?void 0:l.length)??0,g=h+f;g>0&&(u.proposals=g),(!c||!c.trim())&&(u.brief=1),n(u)}catch{}},[e]);return ue("attestation-changed",r),ue("proposal-added",r),ue("proposal-resolved",r),ue("proposal-approved",r),ue("proposal-rejected",r),ue("team-membership-changed",r),Rt(r,3e5,e),t}const Yg={marginLeft:"auto",minWidth:"1.25rem",height:"1.25rem",padding:"0 0.375rem",borderRadius:"0.625rem",background:"var(--warning)",color:"var(--bg-elevated)",fontSize:"0.7rem",fontWeight:600,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},Jg={position:"fixed",bottom:"1.5rem",left:"50%",transform:"translateX(-50%)",background:"var(--bg-elevated, #1e1e2e)",color:"var(--text-primary, #e2e8f0)",border:"1px solid var(--border)",borderRadius:"0.5rem",padding:"0.625rem 1rem",fontSize:"0.85rem",boxShadow:"0 4px 16px rgba(0,0,0,0.3)",zIndex:9999,whiteSpace:"nowrap",pointerEvents:"none"};function Xg(){const{mode:e,group:t,domain:n,activeTeam:r}=Ce(),a=Qg(),{attentionCount:s}=ul(),i={...a};s>0&&(i.integrations=s);const l=Gg.filter(g=>!g.teamOnly||e==="team"),c=d.useRef(null),[u,h]=d.useState(null),f=lt();return d.useEffect(()=>{if(c.current===null){c.current=e;return}c.current!==e&&(e==="team"&&r?h(`You are now acting in team context — ${r.name}`):e==="personal"&&h("You have left the team — back to personal context"),c.current=e)},[e,r]),d.useEffect(()=>{h(null)},[f.pathname]),o.jsxs("div",{className:"sidebar",children:[o.jsx("ul",{className:"sidebar-nav",children:l.map(g=>{const v=g.statusKey?i[g.statusKey]:0;return o.jsx("li",{children:o.jsxs(ll,{to:g.to,end:g.to==="/",className:({isActive:x})=>`sidebar-item${x?" active":""}`,children:[o.jsx("span",{className:"icon",children:g.icon}),g.label,v?o.jsx("span",{style:Yg,children:v}):null]})},g.to)})}),o.jsxs("div",{className:"sidebar-context",children:[o.jsx("div",{className:"ctx-label",children:"Active context"}),o.jsx("div",{className:"ctx-value",children:e==="personal"?"personal":t?`${t.name} / ${n}`:n})]}),u&&o.jsx("div",{style:Jg,role:"status","aria-live":"polite",children:u})]})}function qg(e){return e==="npm"?"suveren-gateway stop; npm install -g @suveren/gateway@latest && suveren-gateway start --detach":e==="dev"?"git pull && pnpm install":"docker rm -f suveren-gateway 2>/dev/null; docker ps -q --filter publish=7400 --filter publish=7430 | xargs -r docker rm -f; docker pull ghcr.io/suverenai/suveren-gateway:latest && docker run -d --name suveren-gateway -p 7400:3000 -p 7430:3030 -v $HOME/.suveren:/app/data ghcr.io/suverenai/suveren-gateway"}function Zg(){const{updateAvailable:e,installMethod:t}=xf(),n=qg(t),r=e,[a,s]=d.useState(!1),[i,l]=d.useState(!1),c=d.useRef(null);if(d.useEffect(()=>{if(!r){document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner");return}document.body.classList.add("has-update-banner");const h=()=>{var v;const g=((v=c.current)==null?void 0:v.offsetHeight)??0;document.documentElement.style.setProperty("--update-banner-h",`${g}px`)};h();const f=new ResizeObserver(h);return c.current&&f.observe(c.current),()=>{f.disconnect(),document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner")}},[r,a]),!r)return null;const u=async()=>{try{await navigator.clipboard.writeText(n),l(!0),setTimeout(()=>l(!1),1800)}catch{}};return o.jsxs("div",{ref:c,className:"update-banner",role:"status","aria-live":"polite",children:[o.jsxs("div",{className:"update-banner-row",children:[o.jsx("span",{className:"update-banner-text",children:"Update available."}),o.jsx("button",{type:"button",className:`btn btn-sm ${a?"btn-secondary":"btn-primary"}`,onClick:()=>s(h=>!h),children:a?"Hide":"Update"})]}),a&&o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"update-banner-hint",children:"Paste this into your terminal (Terminal on macOS/Linux, PowerShell on Windows) to update:"}),o.jsxs("div",{className:"update-banner-row update-banner-cmd-row",children:[o.jsx("code",{className:"update-banner-cmd",children:n}),o.jsx("button",{type:"button",className:"btn btn-sm btn-primary",onClick:u,children:i?"Copied":"Copy Command"})]})]})]})}const ey={system:"◑",light:"☀",dark:"☾"},ty=[{to:"/",icon:"□",label:"Dashboard"},{to:"/proposals",icon:"▷",label:"Pending Approvals"},{to:"/authorizations",icon:"☰",label:"Authorizations"},{to:"/agent-brief",icon:"▤",label:"Agent Brief"},{to:"/audit",icon:"▣",label:"Receipts"},{to:"/groups",icon:"◉",label:"Team"},{to:"/integrations",icon:"⧗",label:"Integrations"},{to:"/settings",icon:"⚙",label:"AI Assistant"}];function ny({open:e,onClose:t}){const{user:n,activeGroup:r,activeDomain:a,logout:s}=Ce(),{theme:i,toggle:l}=vf(),c=lt();return d.useEffect(()=>{t()},[c.pathname]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mobile-menu-backdrop",onClick:t}),o.jsxs("div",{className:"mobile-menu-panel",children:[n&&o.jsxs("div",{className:"mobile-menu-header",children:[o.jsx("strong",{children:n.name}),o.jsx("span",{style:{fontSize:"0.8rem",color:"var(--text-secondary)"},children:r?`${r.name} / ${a}`:a||"personal"})]}),o.jsx("nav",{className:"mobile-menu-nav",children:ty.map(u=>o.jsxs(ll,{to:u.to,end:u.to==="/",className:({isActive:h})=>`mobile-menu-item${h?" active":""}`,onClick:t,children:[o.jsx("span",{className:"icon",children:u.icon}),u.label]},u.to))}),o.jsxs("div",{className:"mobile-menu-footer",children:[o.jsxs("button",{className:"mobile-menu-action",onClick:()=>{l()},children:[o.jsx("span",{className:"icon",children:ey[i]}),"Theme: ",i]}),o.jsx("button",{className:"mobile-menu-action",onClick:()=>{s(),t()},children:"Logout"})]})]})]}):null}function ry(){const[e,t]=d.useState(!1);return o.jsxs(Kg,{children:[o.jsx(cl,{onMenuToggle:()=>t(!e)}),o.jsx(Zg,{}),o.jsx(Xg,{}),o.jsx(ny,{open:e,onClose:()=>t(!1)}),o.jsx("div",{className:"main-content",children:o.jsx("div",{className:"page-inner",children:o.jsx(rg,{})})})]})}function ay(){const[e,t]=d.useState(""),{login:n,isLoading:r,error:a,clearError:s}=Ce(),[i,l]=d.useState(null),c=async()=>{if(e.trim()){s();try{await n(e)}catch(f){if(f instanceof hf){l(f.summary);return}}}},u=async()=>{l(null),s();try{await n(e,{confirmWipe:!0})}catch{}},h=()=>{l(null)};return o.jsxs(o.Fragment,{children:[o.jsx(cl,{}),o.jsxs("div",{className:"login-split",children:[o.jsx("div",{className:"login-split-left",children:o.jsxs("div",{style:{maxWidth:"28rem"},children:[o.jsx("h1",{style:{fontSize:"clamp(2.25rem, 4vw, 3.25rem)",letterSpacing:"-0.03em",lineHeight:1.1,marginBottom:"1.25rem"},children:"Your agents, your intent, your rules."}),o.jsx("p",{style:{fontSize:"1.125rem",color:"var(--text-secondary)",lineHeight:1.6,marginBottom:"3rem"},children:"The gateway runs on your machine, between your agents and the tools they use. Your signature. Your bounds. Your receipts."})]})}),o.jsx("div",{className:"login-split-right",children:o.jsxs("div",{style:{width:"100%",maxWidth:"24rem"},children:[o.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[o.jsx("div",{style:{fontSize:"1.75rem",fontWeight:700,marginBottom:"0.5rem"},children:"Sign In"}),o.jsx("div",{style:{fontSize:"0.95rem",color:"var(--text-secondary)",lineHeight:1.5},children:"Enter your API key to manage authorizations."})]}),a&&o.jsx("div",{className:"error-message",children:a}),o.jsxs("div",{className:"form-group",style:{marginBottom:"1.5rem"},children:[o.jsx("label",{className:"form-label",children:"API Key"}),o.jsx("input",{className:"form-input",type:"password",placeholder:"hap_sk_...",value:e,onChange:f=>t(f.target.value),onKeyDown:f=>f.key==="Enter"&&c(),disabled:r,style:{padding:"0.75rem"}}),o.jsx("div",{className:"form-hint",children:"From your Suveren account."})]}),o.jsx("button",{className:"btn btn-primary btn-full btn-lg",onClick:c,disabled:r,style:{marginBottom:"2rem"},children:r?"Signing in...":"Sign In"}),o.jsx("div",{className:"login-divider",children:"New here?"}),o.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[o.jsxs("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary)",marginBottom:"1rem",lineHeight:1.5},children:["Create an account on Suveren,",o.jsx("br",{}),"then come back to sign in."]}),o.jsx("a",{href:"https://www.suveren.ai/get-started",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-full",style:{textDecoration:"none"},children:"Create Account"})]}),o.jsxs("div",{style:{paddingTop:"1.75rem",borderTop:"1px solid var(--border)"},children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",marginBottom:"0.875rem"},children:"Getting started"}),o.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.8},children:[o.jsxs(o.Fragment,{children:["Create an account at ",o.jsx("a",{href:"https://www.suveren.ai/get-started",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)"},children:"Suveren"})]}),"Join or create a team to get domain authority","Sign in here with your API key to start authorizing agents"].map((f,g)=>o.jsxs("div",{style:{display:"flex",gap:"0.625rem",alignItems:"baseline",marginBottom:g<2?"0.5rem":0},children:[o.jsxs("span",{style:{color:"var(--accent)",fontWeight:700,fontSize:"0.95rem"},children:[g+1,"."]}),f]},g))})]})]})})]}),i&&o.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"wipe-warning-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:"1rem"},onClick:h,children:o.jsxs("div",{className:"card",onClick:f=>f.stopPropagation(),style:{maxWidth:520,width:"100%",margin:0},children:[o.jsx("h3",{id:"wipe-warning-title",className:"card-title",style:{marginBottom:"0.5rem"},children:"Sign in with a different account?"}),o.jsxs("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["This gateway already holds data for another account. Signing in with this API key will ",o.jsx("strong",{children:"permanently wipe"})," the following local data:"]}),o.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[o.jsxs("li",{children:[i.credentialCount," stored service credential",i.credentialCount===1?"":"s",i.credentialIds.length>0&&o.jsxs("span",{style:{color:"var(--text-tertiary)",fontSize:"0.825rem"},children:[" ","(",i.credentialIds.slice(0,5).join(", "),i.credentialIds.length>5?`, +${i.credentialIds.length-5} more`:"",")"]})]}),o.jsxs("li",{children:[i.serviceCount," configured integration",i.serviceCount===1?"":"s"]}),o.jsx("li",{children:"The local E2EE keypair (a new one will be generated for this account)"}),o.jsx("li",{children:"Any unsynchronised gate content stored locally"})]}),o.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Authorizations and receipts on the Service Provider are NOT affected — only this gateway's local state is wiped."}),o.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-tertiary)",marginBottom:"1rem"},children:"If this isn't what you wanted, cancel and sign back in with the original API key, or use a different gateway instance for this account."}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end"},children:[o.jsx("button",{className:"btn btn-ghost",onClick:h,disabled:r,children:"Cancel"}),o.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:u,disabled:r,children:r?"Signing in...":"Wipe local data and sign in"})]})]})})]})}function oy(){const{setActiveContext:e}=Ce(),t=Bt(),[n,r]=d.useState(""),[a,s]=d.useState(""),[i,l]=d.useState(""),[c,u]=d.useState(!1),h=async()=>{if(n.trim()){u(!0),l("");try{const g=await F.joinGroup(n.trim());e(g,g.myDomains[0]||""),t("/")}catch(g){l(g instanceof Error?g.message:"Failed to join group")}finally{u(!1)}}},f=async()=>{if(a.trim()){u(!0),l("");try{const g=await F.createGroup(a.trim());e(g,g.myDomains[0]||""),t("/")}catch(g){l(g instanceof Error?g.message:"Failed to create group")}finally{u(!1)}}};return o.jsxs(o.Fragment,{children:[o.jsx(cl,{}),o.jsx("div",{className:"main-content no-sidebar",style:{marginTop:"var(--nav-height)"},children:o.jsxs("div",{style:{maxWidth:"30rem",margin:"3rem auto",padding:"0 1rem"},children:[o.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[o.jsx("h2",{style:{fontSize:"1.5rem",marginBottom:"0.5rem"},children:"Join Your Team"}),o.jsx("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary)",lineHeight:1.6},children:"Join an existing team or create a new one to share authority across domains."})]}),i&&o.jsx("div",{className:"error-message",children:i}),o.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[o.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Join an existing group"}),o.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Ask your team admin for an invite code."}),o.jsxs("div",{className:"invite-input-row",children:[o.jsx("input",{className:"form-input",placeholder:"Paste invite code...",value:n,onChange:g=>r(g.target.value),onKeyDown:g=>g.key==="Enter"&&h(),style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem"},disabled:c}),o.jsx("button",{className:"btn btn-primary",onClick:h,disabled:c,children:"Join"})]})]}),o.jsxs("div",{className:"card",children:[o.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Create a new group"}),o.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Start a new team and invite members. Assign domains after creation."}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("input",{className:"form-input",placeholder:"Group name (e.g., Acme Corp)",value:a,onChange:g=>s(g.target.value),onKeyDown:g=>g.key==="Enter"&&f(),style:{flex:1},disabled:c}),o.jsx("button",{className:"btn btn-secondary",onClick:f,disabled:c,children:"Create"})]})]})]})})]})}const ri="suveren-setup-ai-skipped",ai="suveren-setup-agent-done",oi="suveren-setup-dismissed",sy={"hap-setup-ai-skipped":ri,"hap-setup-agent-done":ai,"hap-setup-dismissed":oi};function iy(){for(const[e,t]of Object.entries(sy)){const n=localStorage.getItem(e);n!==null&&localStorage.getItem(t)===null&&localStorage.setItem(t,n),n!==null&&localStorage.removeItem(e)}}iy();const os={"claude-code":{label:"Claude Code",snippet:e=>JSON.stringify({mcpServers:{"suveren-gateway":{url:`${e}/sse`}}},null,2)},"claude-desktop":{label:"Claude Desktop",snippet:e=>`Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
51
+ Please change the parent <Route path="${m}"> to <Route path="${m==="/"?"*":`${m}/*`}">.`)}let h=lt(),f;if(t){let m=typeof t=="string"?nr(t):t;ce(c==="/"||((j=m.pathname)==null?void 0:j.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${m.pathname}" was given in the \`location\` prop.`),f=m}else f=h;let v=f.pathname||"/",y=v;if(c!=="/"){let m=c.replace(/^\//,"").split("/");y="/"+v.replace(/^\//,"").split("/").slice(m.length).join("/")}let x=Xd(e,{pathname:y});it(u||x!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),it(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=Jh(x&&x.map(m=>Object.assign({},m,{params:Object.assign({},i,m.params),pathname:bt([c,r.encodeLocation?r.encodeLocation(m.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?c:bt([c,r.encodeLocation?r.encodeLocation(m.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathnameBase])})),a,n);return t&&w?d.createElement(qr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...f},navigationType:"POP"}},w):w}function Kh(){let e=tg(),t=Rh(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=d.createElement(d.Fragment,null,d.createElement("p",null,"💿 Hey developer 👋"),d.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",d.createElement("code",{style:s},"ErrorBoundary")," or"," ",d.createElement("code",{style:s},"errorElement")," prop on your route.")),d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},t),n?d.createElement("pre",{style:a},n):null,i)}var Gh=d.createElement(Kh,null),cf=class extends d.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Bh(e.digest);n&&(e=n)}let t=e!==void 0?d.createElement(vt.Provider,{value:this.props.routeContext},d.createElement(al.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?d.createElement(Yh,{error:e},t):t}};cf.contextType=Ah;var rs=new WeakMap;function Yh({children:e,error:t}){let{basename:n}=d.useContext(Ze);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Oh(t.digest);if(r){let a=rs.get(t);if(a)throw a;let s=tf(r.location,n);if(ef&&!rs.get(t))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw rs.set(t,i),i}return d.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function Qh({routeContext:e,match:t,children:n}){let r=d.useContext(rr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(vt.Provider,{value:e},n)}function Jh(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,s=r==null?void 0:r.errors;if(s!=null){let h=a.findIndex(f=>f.route.id&&(s==null?void 0:s[f.route.id])!==void 0);ce(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),a=a.slice(0,Math.min(a.length,h+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let h=0;h<a.length;h++){let f=a[h];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=h),f.route.id){let{loaderData:v,errors:y}=r,x=f.route.loader&&!v.hasOwnProperty(f.route.id)&&(!y||y[f.route.id]===void 0);if(f.route.lazy||x){n.isStatic&&(i=!0),l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,u=r&&c?(h,f)=>{var v,y;c(h,{location:r.location,params:((y=(v=r.matches)==null?void 0:v[0])==null?void 0:y.params)??{},unstable_pattern:_h(r.matches),errorInfo:f})}:void 0;return a.reduceRight((h,f,v)=>{let y,x=!1,w=null,j=null;r&&(y=s&&f.route.id?s[f.route.id]:void 0,w=f.route.errorElement||Gh,i&&(l<0&&v===0?(uf("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,j=null):l===v&&(x=!0,j=f.route.hydrateFallbackElement||null)));let m=t.concat(a.slice(0,v+1)),p=()=>{let g;return y?g=w:x?g=j:f.route.Component?g=d.createElement(f.route.Component,null):f.route.element?g=f.route.element:g=h,d.createElement(Qh,{match:f,routeContext:{outlet:h,matches:m,isDataRoute:r!=null},children:g})};return r&&(f.route.ErrorBoundary||f.route.errorElement||v===0)?d.createElement(cf,{location:r.location,revalidation:r.revalidation,component:w,error:y,children:p(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:u}):p()},null)}function ol(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Xh(e){let t=d.useContext(rr);return ce(t,ol(e)),t}function qh(e){let t=d.useContext(Eo);return ce(t,ol(e)),t}function Zh(e){let t=d.useContext(vt);return ce(t,ol(e)),t}function sl(e){let t=Zh(e),n=t.matches[t.matches.length-1];return ce(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function eg(){return sl("useRouteId")}function tg(){var r;let e=d.useContext(al),t=qh("useRouteError"),n=sl("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function ng(){let{router:e}=Xh("useNavigate"),t=sl("useNavigate"),n=d.useRef(!1);return sf(()=>{n.current=!0}),d.useCallback(async(a,s={})=>{it(n.current,of),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...s}))},[e,t])}var bc={};function uf(e,t,n){!t&&!bc[e]&&(bc[e]=!0,it(!1,n))}d.memo(rg);function rg({routes:e,future:t,state:n,isStatic:r,onError:a}){return lf(e,void 0,{state:n,isStatic:r,onError:a})}function Vt({to:e,replace:t,state:n,relative:r}){ce(ar(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=d.useContext(Ze);it(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=d.useContext(vt),{pathname:i}=lt(),l=Bt(),c=bo(e,rl(s),i,r==="path"),u=JSON.stringify(c);return d.useEffect(()=>{l(JSON.parse(u),{replace:t,state:n,relative:r})},[l,u,r,t,n]),null}function ag(e){return Hh(e.context)}function Se(e){ce(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function og({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:s=!1,unstable_useTransitions:i}){ce(!ar(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=d.useMemo(()=>({basename:l,navigator:a,static:s,unstable_useTransitions:i,future:{}}),[l,a,s,i]);typeof n=="string"&&(n=nr(n));let{pathname:u="/",search:h="",hash:f="",state:v=null,key:y="default",unstable_mask:x}=n,w=d.useMemo(()=>{let j=Ft(u,l);return j==null?null:{location:{pathname:j,search:h,hash:f,state:v,key:y,unstable_mask:x},navigationType:r}},[l,u,h,f,v,y,r,x]);return it(w!=null,`<Router basename="${l}"> is not able to match the URL "${u}${h}${f}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:d.createElement(Ze.Provider,{value:c},d.createElement(qr.Provider,{children:t,value:w}))}function sg({children:e,location:t}){return Vh(ni(e),t)}function ni(e,t=[]){let n=[];return d.Children.forEach(e,(r,a)=>{if(!d.isValidElement(r))return;let s=[...t,a];if(r.type===d.Fragment){n.push.apply(n,ni(r.props.children,s));return}ce(r.type===Se,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ce(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=ni(r.props.children,s)),n.push(i)}),n}var za="get",Aa="application/x-www-form-urlencoded";function Po(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function ig(e){return Po(e)&&e.tagName.toLowerCase()==="button"}function lg(e){return Po(e)&&e.tagName.toLowerCase()==="form"}function cg(e){return Po(e)&&e.tagName.toLowerCase()==="input"}function ug(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function dg(e,t){return e.button===0&&(!t||t==="_self")&&!ug(e)}function ri(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function fg(e,t){let n=ri(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(s=>{n.append(a,s)})}),n}var ya=null;function pg(){if(ya===null)try{new FormData(document.createElement("form"),0),ya=!1}catch{ya=!0}return ya}var mg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function as(e){return e!=null&&!mg.has(e)?(it(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Aa}"`),null):e}function hg(e,t){let n,r,a,s,i;if(lg(e)){let l=e.getAttribute("action");r=l?Ft(l,t):null,n=e.getAttribute("method")||za,a=as(e.getAttribute("enctype"))||Aa,s=new FormData(e)}else if(ig(e)||cg(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let c=e.getAttribute("formaction")||l.getAttribute("action");if(r=c?Ft(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||za,a=as(e.getAttribute("formenctype"))||as(l.getAttribute("enctype"))||Aa,s=new FormData(l,e),!pg()){let{name:u,type:h,value:f}=e;if(h==="image"){let v=u?`${u}.`:"";s.append(`${v}x`,"0"),s.append(`${v}y`,"0")}else u&&s.append(u,f)}}else{if(Po(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=za,r=null,a=Aa,i=e}return s&&a==="text/plain"&&(i=s,s=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:s,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function il(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function gg(e,t,n,r){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${r}`:a.pathname=`${a.pathname}.${r}`:a.pathname==="/"?a.pathname=`_root.${r}`:t&&Ft(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${r}`,a}async function vg(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function yg(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function xg(e,t,n){let r=await Promise.all(e.map(async a=>{let s=t.routes[a.route.id];if(s){let i=await vg(s,n);return i.links?i.links():[]}return[]}));return kg(r.flat(1).filter(yg).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Ec(e,t,n,r,a,s){let i=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var h;return n[u].pathname!==c.pathname||((h=n[u].route.path)==null?void 0:h.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return s==="assets"?t.filter((c,u)=>i(c,u)||l(c,u)):s==="data"?t.filter((c,u)=>{var f;let h=r.routes[c.route.id];if(!h||!h.hasLoader)return!1;if(i(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let v=c.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function wg(e,t,{includeHydrateFallback:n}={}){return Sg(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let s=[a.module];return a.clientActionModule&&(s=s.concat(a.clientActionModule)),a.clientLoaderModule&&(s=s.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(s=s.concat(a.hydrateFallbackModule)),a.imports&&(s=s.concat(a.imports)),s}).flat(1))}function Sg(e){return[...new Set(e)]}function jg(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function kg(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let s=JSON.stringify(jg(a));return n.has(s)||(n.add(s),r.push({key:s,link:a})),r},[])}function df(){let e=d.useContext(rr);return il(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Cg(){let e=d.useContext(Eo);return il(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ll=d.createContext(void 0);ll.displayName="FrameworkContext";function ff(){let e=d.useContext(ll);return il(e,"You must render this element inside a <HydratedRouter> element"),e}function Ng(e,t){let n=d.useContext(ll),[r,a]=d.useState(!1),[s,i]=d.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:h,onTouchStart:f}=t,v=d.useRef(null);d.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let w=m=>{m.forEach(p=>{i(p.isIntersecting)})},j=new IntersectionObserver(w,{threshold:.5});return v.current&&j.observe(v.current),()=>{j.disconnect()}}},[e]),d.useEffect(()=>{if(r){let w=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(w)}}},[r]);let y=()=>{a(!0)},x=()=>{a(!1),i(!1)};return n?e!=="intent"?[s,v,{}]:[s,v,{onFocus:pr(l,y),onBlur:pr(c,x),onMouseEnter:pr(u,y),onMouseLeave:pr(h,x),onTouchStart:pr(f,y)}]:[!1,v,{}]}function pr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function bg({page:e,...t}){let{router:n}=df(),r=d.useMemo(()=>Xd(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?d.createElement(Pg,{page:e,matches:r,...t}):null}function Eg(e){let{manifest:t,routeModules:n}=ff(),[r,a]=d.useState([]);return d.useEffect(()=>{let s=!1;return xg(e,t,n).then(i=>{s||a(i)}),()=>{s=!0}},[e,t,n]),r}function Pg({page:e,matches:t,...n}){let r=lt(),{future:a,manifest:s,routeModules:i}=ff(),{basename:l}=df(),{loaderData:c,matches:u}=Cg(),h=d.useMemo(()=>Ec(e,t,u,s,r,"data"),[e,t,u,s,r]),f=d.useMemo(()=>Ec(e,t,u,s,r,"assets"),[e,t,u,s,r]),v=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,j=!1;if(t.forEach(p=>{var S;let g=s.routes[p.route.id];!g||!g.hasLoader||(!h.some(E=>E.route.id===p.route.id)&&p.route.id in c&&((S=i[p.route.id])!=null&&S.shouldRevalidate)||g.hasClientLoader?j=!0:w.add(p.route.id))}),w.size===0)return[];let m=gg(e,l,a.unstable_trailingSlashAwareDataRequests,"data");return j&&w.size>0&&m.searchParams.set("_routes",t.filter(p=>w.has(p.route.id)).map(p=>p.route.id).join(",")),[m.pathname+m.search]},[l,a.unstable_trailingSlashAwareDataRequests,c,r,s,h,t,e,i]),y=d.useMemo(()=>wg(f,s),[f,s]),x=Eg(f);return d.createElement(d.Fragment,null,v.map(w=>d.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),y.map(w=>d.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),x.map(({key:w,link:j})=>d.createElement("link",{key:w,nonce:n.nonce,...j,crossOrigin:j.crossOrigin??n.crossOrigin})))}function Tg(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Ig=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Ig&&(window.__reactRouterVersion="7.13.1")}catch{}function Rg({basename:e,children:t,unstable_useTransitions:n,window:r}){let a=d.useRef();a.current==null&&(a.current=ih({window:r,v5Compat:!0}));let s=a.current,[i,l]=d.useState({action:s.action,location:s.location}),c=d.useCallback(u=>{n===!1?l(u):d.startTransition(()=>l(u))},[n]);return d.useLayoutEffect(()=>s.listen(c),[s,c]),d.createElement(og,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:s,unstable_useTransitions:n})}var pf=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ge=d.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:s,replace:i,unstable_mask:l,state:c,target:u,to:h,preventScrollReset:f,viewTransition:v,unstable_defaultShouldRevalidate:y,...x},w){let{basename:j,navigator:m,unstable_useTransitions:p}=d.useContext(Ze),g=typeof h=="string"&&pf.test(h),S=tf(h,j);h=S.to;let E=Dh(h,{relative:a}),T=lt(),k=null;if(l){let _=bo(l,[],T.unstable_mask?T.unstable_mask.pathname:"/",!0);j!=="/"&&(_.pathname=_.pathname==="/"?j:bt([j,_.pathname])),k=m.createHref(_)}let[b,N,I]=Ng(r,x),D=Ag(h,{replace:i,unstable_mask:l,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:v,unstable_defaultShouldRevalidate:y,unstable_useTransitions:p});function V(_){t&&t(_),_.defaultPrevented||D(_)}let M=!(S.isExternal||s),$=d.createElement("a",{...x,...I,href:(M?k:void 0)||S.absoluteURL||E,onClick:M?V:t,ref:Tg(w,N),target:u,"data-discover":!g&&n==="render"?"true":void 0});return b&&!g?d.createElement(d.Fragment,null,$,d.createElement(bg,{page:E})):$});Ge.displayName="Link";var cl=d.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:s,to:i,viewTransition:l,children:c,...u},h){let f=Zr(i,{relative:u.relative}),v=lt(),y=d.useContext(Eo),{navigator:x,basename:w}=d.useContext(Ze),j=y!=null&&Og(f)&&l===!0,m=x.encodeLocation?x.encodeLocation(f).pathname:f.pathname,p=v.pathname,g=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(p=p.toLowerCase(),g=g?g.toLowerCase():null,m=m.toLowerCase()),g&&w&&(g=Ft(g,w)||g);const S=m!=="/"&&m.endsWith("/")?m.length-1:m.length;let E=p===m||!a&&p.startsWith(m)&&p.charAt(S)==="/",T=g!=null&&(g===m||!a&&g.startsWith(m)&&g.charAt(m.length)==="/"),k={isActive:E,isPending:T,isTransitioning:j},b=E?t:void 0,N;typeof r=="function"?N=r(k):N=[r,E?"active":null,T?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let I=typeof s=="function"?s(k):s;return d.createElement(Ge,{...u,"aria-current":b,className:N,ref:h,style:I,to:i,viewTransition:l},typeof c=="function"?c(k):c)});cl.displayName="NavLink";var _g=d.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:s,method:i=za,action:l,onSubmit:c,relative:u,preventScrollReset:h,viewTransition:f,unstable_defaultShouldRevalidate:v,...y},x)=>{let{unstable_useTransitions:w}=d.useContext(Ze),j=Mg(),m=Fg(l,{relative:u}),p=i.toLowerCase()==="get"?"get":"post",g=typeof l=="string"&&pf.test(l),S=E=>{if(c&&c(E),E.defaultPrevented)return;E.preventDefault();let T=E.nativeEvent.submitter,k=(T==null?void 0:T.getAttribute("formmethod"))||i,b=()=>j(T||E.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:a,state:s,relative:u,preventScrollReset:h,viewTransition:f,unstable_defaultShouldRevalidate:v});w&&n!==!1?d.startTransition(()=>b()):b()};return d.createElement("form",{ref:x,method:p,action:m,onSubmit:r?c:S,...y,"data-discover":!g&&e==="render"?"true":void 0})});_g.displayName="Form";function zg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function mf(e){let t=d.useContext(rr);return ce(t,zg(e)),t}function Ag(e,{target:t,replace:n,unstable_mask:r,state:a,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c,unstable_useTransitions:u}={}){let h=Bt(),f=lt(),v=Zr(e,{relative:i});return d.useCallback(y=>{if(dg(y,t)){y.preventDefault();let x=n!==void 0?n:Kr(f)===Kr(v),w=()=>h(e,{replace:x,unstable_mask:r,state:a,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c});u?d.startTransition(()=>w()):w()}},[f,h,v,n,r,a,t,e,s,i,l,c,u])}function hf(e){it(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=d.useRef(ri(e)),n=d.useRef(!1),r=lt(),a=d.useMemo(()=>fg(r.search,n.current?null:t.current),[r.search]),s=Bt(),i=d.useCallback((l,c)=>{const u=ri(typeof l=="function"?l(new URLSearchParams(a)):l);n.current=!0,s("?"+u,c)},[s,a]);return[a,i]}var $g=0,Lg=()=>`__${String(++$g)}__`;function Mg(){let{router:e}=mf("useSubmit"),{basename:t}=d.useContext(Ze),n=eg(),r=e.fetch,a=e.navigate;return d.useCallback(async(s,i={})=>{let{action:l,method:c,encType:u,formData:h,body:f}=hg(s,t);if(i.navigate===!1){let v=i.fetcherKey||Lg();await r(v,n,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:f,formMethod:i.method||c,formEncType:i.encType||u,flushSync:i.flushSync})}else await a(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:f,formMethod:i.method||c,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,a,t,n])}function Fg(e,{relative:t}={}){let{basename:n}=d.useContext(Ze),r=d.useContext(vt);ce(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),s={...Zr(e||".",{relative:t})},i=lt();if(e==null){s.search=i.search;let l=new URLSearchParams(s.search),c=l.getAll("index");if(c.some(h=>h==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let h=l.toString();s.search=h?`?${h}`:""}}return(!e||e===".")&&a.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:bt([n,s.pathname])),Kr(s)}function Og(e,{relative:t}={}){let n=d.useContext(rf);ce(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=mf("useViewTransitionState"),a=Zr(e,{relative:t});if(!n.isTransitioning)return!1;let s=Ft(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Ft(n.nextLocation.pathname,r)||n.nextLocation.pathname;return oo(a.pathname,i)!=null||oo(a.pathname,s)!=null}class gf extends Error{constructor(n){super("different_account");To(this,"summary");this.name="DifferentAccountError",this.summary=n}}class Bg{constructor(){To(this,"apiKey",null)}setApiKey(t){this.apiKey=t}clearApiKey(){this.apiKey=null}getApiKey(){return this.apiKey}async fetch(t,n){return globalThis.fetch(t,{...n,headers:{"Content-Type":"application/json",...this.apiKey?{"X-API-Key":this.apiKey}:{},...n==null?void 0:n.headers}})}async login(t,n={}){const r=await this.fetch("/auth/login",{method:"POST",headers:{"X-API-Key":t,"Content-Type":"application/json"},body:JSON.stringify({confirmWipe:n.confirmWipe===!0})});if(r.status===409){const s=await r.json().catch(()=>({}));if(s!=null&&s.wouldWipe)throw new gf(s.summary??{credentialCount:0,serviceCount:0,credentialIds:[]})}if(!r.ok){const s=await r.json().catch(()=>({error:"Invalid API key"}));throw new Error(s.error||`Login failed: ${r.status}`)}return(await r.json()).user}async logout(){await this.fetch("/auth/logout",{method:"POST"})}async getGroups(){const t=await this.fetch("/api/groups");if(!t.ok)throw new Error(`Failed to fetch groups: ${t.status}`);const n=await t.json();return n.groups??n}async listProfiles(){const t=await this.fetch("/api/profiles");if(!t.ok)throw new Error(`Failed to fetch profiles: ${t.status}`);return(await t.json()).profiles}async getProfile(t){const n=await this.fetch(`/api/profiles/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch profile: ${n.status}`);return n.json()}async attest(t){const n=await this.fetch("/api/as/attest",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(r.error||`Attest failed: ${n.status}`)}return n.json()}async getPending(t){const n=await this.fetch(`/api/attestations/pending?domain=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch pending: ${n.status}`);const r=await n.json();return r.pending??r}async getMyAttestations(t){const n=t?`?status=${encodeURIComponent(t)}`:"",r=await this.fetch(`/api/attestations/mine${n}`);if(!r.ok)throw new Error(`Failed to fetch attestations: ${r.status}`);return((await r.json()).attestations??[]).map(s=>{var i,l;return{frame_hash:s.frameHash??s.boundsHash,profile_id:s.profileId,path:s.path,title:s.title??null,sp_status:s.status??null,frame:s.bounds??s.frame??{},required_domains:s.requiredDomains??[],attested_domains:s.attestedDomains??[],missing_domains:(s.requiredDomains??[]).filter(c=>!(s.attestedDomains??[]).includes(c)),deferred_commitment_domains:s.deferredCommitmentDomains??[],approvers_frozen:s.approversFrozen??[],above_cap:s.aboveCap??!1,created_at:s.createdAt?new Date(s.createdAt*1e3).toISOString():"",earliest_expiry:(i=s.attestations)!=null&&i.length?new Date(Math.min(...s.attestations.map(c=>c.expiresAt))*1e3).toISOString():null,remaining_seconds:(l=s.attestations)!=null&&l.length?Math.max(0,Math.min(...s.attestations.map(c=>c.expiresAt))-Math.floor(Date.now()/1e3)):null}})}async getMyReceipts(t){const n=new URLSearchParams;t!=null&&t.date&&n.set("date",t.date),t!=null&&t.profile&&n.set("profile",t.profile),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString(),a=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!a.ok)throw new Error(`Failed to fetch receipts: ${a.status}`);return(await a.json()).receipts??[]}async revokeAttestation(t,n){const r=await this.fetch(`/api/attestations/${encodeURIComponent(t)}/revoke`,{method:"POST",body:JSON.stringify({reason:n??"Revoked by user"})});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed to revoke"}));throw new Error(a.error||`Revoke failed: ${r.status}`)}}async getAttestations(t){const n=await this.fetch(`/api/attestations?frame_hash=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch attestations: ${n.status}`);return n.json()}async getGroupById(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch group: ${n.status}`);return n.json()}async createGroup(t){const n=await this.fetch("/api/groups",{method:"POST",body:JSON.stringify({name:t})});if(!n.ok){const s=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(s.error||`Create group failed: ${n.status}`)}const r=await n.json(),a=r.group||r;return{id:a.id,name:a.name,myDomains:a.myDomains||[],isAdmin:!0}}async joinGroup(t){const n=await this.fetch("/api/groups/join",{method:"POST",body:JSON.stringify({inviteCode:t})});if(!n.ok){const s=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(s.error||`Join group failed: ${n.status}`)}const r=await n.json(),a=r.group||r;return{id:a.id,name:a.name,myDomains:a.myDomains||[],isAdmin:a.isAdmin||!1}}async inviteToGroup(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/invite`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(r.error||`Invite failed: ${n.status}`)}return n.json()}async getMyTeam(){const t=await this.fetch("/api/groups/me");if(!t.ok)return null;const n=await t.json();return n.group?{group:n.group,membership:n.membership}:null}async listUsers(){const t=await this.fetch("/api/users");return t.ok?(await t.json()).users??[]:[]}async setPubkey(t){const n=await this.fetch("/api/users/me/pubkey",{method:"PUT",body:JSON.stringify({pubkey:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to set pubkey"}));throw new Error(r.error||`setPubkey failed: ${n.status}`)}}async getPubkey(t){const n=await this.fetch(`/api/users/${encodeURIComponent(t)}/pubkey`);return n.status===404||!n.ok?null:(await n.json()).pubkey??null}async leaveTeam(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/leave`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to leave team"}));throw new Error(r.error||`Leave failed: ${n.status}`)}}async getVaultStatus(){const t=await this.fetch("/vault/status");if(!t.ok)throw new Error(`Failed to fetch vault status: ${t.status}`);return t.json()}async getCredential(t){const n=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to check credential: ${n.status}`);return n.json()}async setCredential(t,n){const r=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to save credential: ${r.status}`)}async testCredential(t){const n=await this.fetch(`/vault/test/${encodeURIComponent(t)}`,{method:"POST"});if(!n.ok)throw new Error(`Test failed: ${n.status}`);return n.json()}async aiAssist(t){const n=await this.fetch("/ai/assist",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI request failed"}))).error,disclaimer:"AI surfaces reality. You supply intent."}}async aiTest(t){const n=await this.fetch("/ai/test",{method:"POST",body:JSON.stringify(t??{})});if(!n.ok)throw new Error(`AI test failed: ${n.status}`);return n.json()}async getMcpHealth(){const t=await this.fetch("/mcp/health");if(!t.ok)throw new Error(`MCP server unreachable: ${t.status}`);return t.json()}async getMcpIntegrations(){const t=await this.fetch("/mcp/integrations");if(!t.ok)throw new Error(`Failed to fetch integrations: ${t.status}`);return t.json()}async getOAuthHealth(t){try{const n=await this.fetch(`/auth/oauth/${encodeURIComponent(t)}/health`);return n.ok?await n.json():{status:"unverified"}}catch{return{status:"unverified"}}}async getIntegrationManifests(){const t=await this.fetch("/mcp/integrations/manifests");if(!t.ok)throw new Error(`Failed to fetch manifests: ${t.status}`);return t.json()}async discoverScopeField(t,n){const r=await this.fetch(`/integrations/${encodeURIComponent(t)}/discover/${encodeURIComponent(n)}`);if(!r.ok){const a=await r.json().catch(()=>({error:`Discovery failed: ${r.status}`}));throw new Error(a.error)}return r.json()}async activateIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}/activate`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`Failed: ${n.status}`)}return n.json()}async removeMcpIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to remove integration: ${n.status}`)}async getTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`);if(r.status===404||!r.ok)return null;const a=await r.json();return(a==null?void 0:a.config)??null}async setTeamProfileConfig(t,n,r){const a=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(r)});if(!a.ok){const s=await a.json().catch(()=>({error:"Failed to set profile config"}));throw new Error(s.error||`setTeamProfileConfig failed: ${a.status}`)}}async encryptIntent(t,n){const r=await this.fetch("/api/encrypt-intent",{method:"POST",body:JSON.stringify({intent:t,recipients:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Encryption failed"}));throw new Error(a.error||`encryptIntent failed: ${r.status}`)}return r.json()}async getApproversPubkeys(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}/approvers/pubkeys`);return r.ok?(await r.json()).approvers??[]:[]}async deleteTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"DELETE"});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed to delete profile config"}));throw new Error(a.error||`deleteTeamProfileConfig failed: ${r.status}`)}}async getProposals(t){const n=await this.fetch(`/api/proposals?domain=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch proposals: ${n.status}`);return(await n.json()).proposals??[]}async resolveProposal(t,n,r){const a=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/resolve`,{method:"POST",body:JSON.stringify({action:n,domain:r})});if(!a.ok){const s=await a.json().catch(()=>({error:"Failed"}));throw new Error(s.error||`Failed: ${a.status}`)}return a.json()}async getProposalsForApprover(){const t=await this.fetch("/api/proposals?approver=me");if(!t.ok)throw new Error(`Failed to fetch approver proposals: ${t.status}`);return(await t.json()).proposals??[]}async approveProposal(t){const n=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/approve`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`approveProposal failed: ${n.status}`)}return n.json()}async rejectProposal(t,n){const r=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/reject`,{method:"POST",body:JSON.stringify({reason:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed"}));throw new Error(a.error||`rejectProposal failed: ${r.status}`)}return r.json()}async getAttestationIntent(t){const n=await this.fetch(`/api/attestations/${encodeURIComponent(t)}/intent`);return n.status===404||n.status===403||!n.ok?null:n.json()}async decryptIntent(t){const n=await this.fetch("/api/decrypt-intent",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const a=await n.json().catch(()=>({error:"Decryption failed"}));throw new Error(a.error||`decryptIntent failed: ${n.status}`)}return(await n.json()).intent}async storeApprovedIntent(t,n){const r=await this.fetch("/api/approved-intents",{method:"POST",body:JSON.stringify({authorityId:t,intent:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed"}));throw new Error(a.error||`storeApprovedIntent failed: ${r.status}`)}}async listTeamAuthorizations(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/attestations`);if(!n.ok)throw new Error(`Failed to fetch team authorizations: ${n.status}`);return((await n.json()).items??[]).map(a=>{var l,c;const s=a.owner??{userId:""};return{frame_hash:a.boundsHash??a.frameHash??a.frame_hash,profile_id:a.profileId??a.profile_id,path:a.path??"",title:a.title??null,sp_status:a.status??a.sp_status??null,frame:a.bounds??a.frame??{},required_domains:a.requiredDomains??a.required_domains??[],attested_domains:a.attestedDomains??a.attested_domains??[],missing_domains:(a.requiredDomains??a.required_domains??[]).filter(u=>!(a.attestedDomains??a.attested_domains??[]).includes(u)),deferred_commitment_domains:a.deferredCommitmentDomains??a.deferred_commitment_domains??[],approvers_frozen:a.approversFrozen??a.approvers_frozen??[],above_cap:a.aboveCap??a.above_cap??!1,created_at:a.createdAt?new Date(a.createdAt*1e3).toISOString():a.created_at??"",earliest_expiry:(l=a.attestations)!=null&&l.length?new Date(Math.min(...a.attestations.map(u=>u.expiresAt))*1e3).toISOString():null,remaining_seconds:(c=a.attestations)!=null&&c.length?Math.max(0,Math.min(...a.attestations.map(u=>u.expiresAt))-Math.floor(Date.now()/1e3)):null,owner:s}})}async listTeamReceipts(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/receipts`);if(!n.ok)throw new Error(`Failed to fetch team receipts: ${n.status}`);return(await n.json()).receipts??[]}async getThread(t){const n=t.sinceDays??7,r=t.status??"pending",a=t.domain||"owner",s=await this.getProposals(a);let i=[];if(r==="all"){const l=[],c=new Date;for(let h=0;h<n;h++){const f=new Date(c);f.setUTCDate(c.getUTCDate()-h),l.push(f.toISOString().slice(0,10))}i=(await Promise.all(l.map(h=>this.getMyReceipts({date:h,profile:t.profile})))).flat()}return{proposals:s,receipts:i}}async getGateContent(t){const n=await this.fetch(`/gate-content?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch gate content: ${n.status}`);return(await n.json()).entry??null}async pushGateContent(t){const n=await this.fetch("/gate-content",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to push gate content"}));throw new Error(r.error||`Push gate content failed: ${n.status}`)}}async getAgentContext(){const t=await this.fetch("/agent-brief/context");if(!t.ok)throw new Error(`Failed to fetch agent context: ${t.status}`);return(await t.json()).content}async saveAgentContext(t){const n=await this.fetch("/agent-brief/context",{method:"PUT",body:JSON.stringify({content:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to save agent context"}));throw new Error(r.error||`Save failed: ${n.status}`)}}async aiChat(t){const n=await this.fetch("/ai/chat",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI chat failed"}))).error||`Chat failed: ${n.status}`}}async getAIPrompts(){const t=await this.fetch("/ai-prompts");if(!t.ok)throw new Error(`Failed to load AI prompts: ${t.status}`);return t.json()}async setAIPrompt(t,n){const r=await this.fetch(`/ai-prompts/${t}`,{method:"PUT",body:JSON.stringify({value:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Save failed"}));throw new Error(a.error||`Save failed: ${r.status}`)}}}const F=new Bg,vf=d.createContext(null);function Dg({children:e}){const[t,n]=d.useState(null),[r,a]=d.useState("personal"),[s,i]=d.useState(null),[l,c]=d.useState(""),[u,h]=d.useState(null),[f,v]=d.useState(null),[y,x]=d.useState(!1),[w,j]=d.useState(""),m=d.useRef(!1),p=d.useRef(null),g=d.useCallback(async()=>{if(m.current)try{const b=await F.getMyTeam();if(b){const{group:N,membership:I}=b;h(N),v(I),a("team"),i(N);const D=p.current??I.domains[0]??"owner";c(D)}else h(null),v(null),a("personal")}catch{}},[]);d.useEffect(()=>{const b=()=>{document.visibilityState==="visible"&&g()};return document.addEventListener("visibilitychange",b),()=>document.removeEventListener("visibilitychange",b)},[g]);const S=d.useCallback(async(b,N={})=>{x(!0),j("");try{F.setApiKey(b),m.current=!0;const I=await F.login(b,N);n(I),p.current=I.id;const D=await F.getGroups(),V=D.find(M=>M.isPersonal)??D[0]??null;i(V),c("owner"),await g()}catch(I){throw F.clearApiKey(),m.current=!1,j(I instanceof Error?I.message:"Login failed"),I}finally{x(!1)}},[g]),E=d.useCallback(async()=>{await F.logout(),F.clearApiKey(),m.current=!1,p.current=null,n(null),i(null),c(""),h(null),v(null),a("personal"),j("")},[]),T=d.useCallback(()=>j(""),[]),k=d.useCallback((b,N)=>{i(b),c(N)},[]);return o.jsx(vf.Provider,{value:{user:t,mode:r,group:s,domain:l,groupId:(s==null?void 0:s.id)??null,activeTeam:u,activeMembership:f,isLoading:y,error:w,login:S,logout:E,clearError:T,activeGroup:s,activeDomain:l,groups:s?[s]:[],setActiveContext:k,refreshGroups:g},children:e})}function Ce(){const e=d.useContext(vf);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const yf=d.createContext(null);function Ug({children:e}){const{user:t}=Ce(),n=d.useRef(null),[r,a]=d.useState(!1),s=d.useRef(new Map),i=d.useCallback((l,c)=>{const u=s.current;return u.has(l)||u.set(l,new Set),u.get(l).add(c),()=>{var h;(h=u.get(l))==null||h.delete(c)}},[]);return d.useEffect(()=>{if(!t){n.current&&(n.current.close(),n.current=null,a(!1));return}if(n.current)return;const l=F.getApiKey();if(!l)return;const c=new EventSource(`/events?key=${encodeURIComponent(l)}`);n.current=c,c.onopen=()=>a(!0),c.onerror=()=>a(!1);const u=["integration-changed","attestation-changed","proposal-added","proposal-resolved","team-membership-changed","action-approval-needed","action-resolved","proposal-approved","proposal-rejected"];for(const h of u)c.addEventListener(h,f=>{let v;try{v=JSON.parse(f.data)}catch{v=null}const y=s.current.get(h);if(y)for(const x of y)try{x(v)}catch(w){console.error(`[EventSource] handler for "${h}" threw:`,w)}});return()=>{c.close(),n.current=null,a(!1)}},[t]),o.jsx(yf.Provider,{value:{connected:r,addListener:i},children:e})}function ue(e,t){const n=d.useContext(yf);if(!n)return;const{addListener:r}=n;d.useEffect(()=>r(e,t),[e,t,r])}const Pr="suveren-theme",Pc="hap-theme";function xa(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}(function(){const t=localStorage.getItem(Pc);t!==null&&localStorage.getItem(Pr)===null&&localStorage.setItem(Pr,t),t!==null&&localStorage.removeItem(Pc)})();function xf(){const[e,t]=d.useState(()=>{const s=localStorage.getItem(Pr);return s==="light"||s==="dark"?s:"system"}),[n,r]=d.useState(()=>xa(e));d.useEffect(()=>{const s=document.documentElement,i=xa(e);s.setAttribute("data-theme",i),e==="system"?localStorage.removeItem(Pr):localStorage.setItem(Pr,e),r(xa(e))},[e]),d.useEffect(()=>{if(e!=="system")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>r(xa("system"));return s.addEventListener("change",i),()=>s.removeEventListener("change",i)},[e]);const a=d.useCallback(()=>{t(s=>s==="system"?"light":s==="light"?"dark":"system")},[]);return{theme:e,effectiveTheme:n,toggle:a}}const Wg=5*60*1e3,Hg=2e3;function wf(){const[e,t]=d.useState(!1),[n,r]=d.useState("docker"),[a,s]=d.useState(""),[i,l]=d.useState(null),[c,u]=d.useState(!1),[h,f]=d.useState(!1),[v,y]=d.useState(!1),x=d.useRef(null);return d.useEffect(()=>{let w=!1;const j=(g=!1)=>{fetch(g?"/health?refresh=1":"/health").then(S=>S.json()).then(S=>{w||(S.installMethod&&r(S.installMethod),typeof S.latestVersion<"u"&&l(S.latestVersion),S.updateAvailable&&t(!0),S.version&&(s(S.version),x.current===null?x.current=S.version:S.version!==x.current&&S.version!=="dev"&&u(!0)))}).catch(()=>{})};j(!0);const m=setInterval(()=>j(!1),v?Hg:Wg),p=()=>{document.visibilityState==="visible"&&j(!1)};return document.addEventListener("visibilitychange",p),window.addEventListener("focus",p),()=>{w=!0,clearInterval(m),document.removeEventListener("visibilitychange",p),window.removeEventListener("focus",p)}},[v]),{updateAvailable:e&&!h,installMethod:n,version:a,latestVersion:i,serverRestarted:c,startFastPolling:()=>y(!0),dismiss:()=>f(!0)}}function Vg(e){return e?e==="dev"?"dev":/^[0-9a-f]{40}$/i.test(e)?e.slice(0,7):e:""}const Tc={system:"◑",light:"☀",dark:"☾"};function Kg(){const{mode:e,group:t,domain:n}=Ce();return e==="personal"?o.jsx("span",{children:"personal"}):t?o.jsxs("span",{children:[t.name," / ",n]}):o.jsx("span",{children:n})}function ul({onMenuToggle:e}){const{user:t,logout:n}=Ce(),{theme:r,toggle:a}=xf(),{version:s}=wf(),i=Vg(s);return o.jsx("nav",{className:"top-nav",children:o.jsxs("div",{className:"top-nav-inner",children:[o.jsxs("div",{className:"logo-group",children:[o.jsx("span",{className:"logo",children:"Suveren"}),o.jsx("span",{className:"version-badge",children:"Local Gateway"})]}),o.jsx("div",{className:"nav-spacer"}),o.jsx("div",{className:"nav-actions nav-actions-desktop",children:t?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"user-chip",children:[o.jsx("strong",{children:t.name}),o.jsx("span",{className:"dot"}),o.jsx(Kg,{})]}),o.jsx("button",{className:"theme-toggle",onClick:a,title:`Theme: ${r}`,children:Tc[r]}),o.jsx("button",{className:"nav-logout",onClick:n,children:"Logout"})]}):o.jsxs(o.Fragment,{children:[i&&o.jsxs("span",{title:"Running gateway version",style:{fontSize:"0.8rem",color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums"},children:["v",i]}),o.jsx("button",{className:"theme-toggle",onClick:a,title:`Theme: ${r}`,children:Tc[r]})]})}),t&&e&&o.jsx("button",{className:"mobile-menu-btn",onClick:e,"aria-label":"Menu",children:"☰"})]})})}function jt(e,t){var n;return(n=t==null?void 0:t.revokedSet)!=null&&n.has(e.frame_hash)||e.sp_status==="revoked"?"revoked":e.sp_status==="expired"||e.remaining_seconds===null||e.remaining_seconds<=0?"expired":e.missing_domains.length>0?"pending":"active"}function Sf(e,t){const n={active:[],pending:[],expired:[],revoked:[]};for(const r of e)n[jt(r,t)].push(r);return n}function _t(e,t,n){const r=d.useRef(e);r.current=e,d.useEffect(()=>{let a=null;const s=()=>typeof document>"u"?!0:document.visibilityState==="visible",i=()=>{s()&&r.current()},l=()=>{a===null&&(a=setInterval(i,t))},c=()=>{a!==null&&(clearInterval(a),a=null)},u=()=>{s()?(r.current(),l()):c()};return s()&&(r.current(),l()),document.addEventListener("visibilitychange",u),()=>{c(),document.removeEventListener("visibilitychange",u)}},[t,n])}const jf=d.createContext(null),Gg=3e4;function Yg({children:e}){const[t,n]=d.useState({manifests:[],integrations:[],activeSessions:0,mcpServerUp:null,manifestsError:!1,fetchCount:0}),r=d.useRef(null),a=d.useCallback(async()=>{let c=!1;const[u,h]=await Promise.all([F.getIntegrationManifests().catch(()=>(c=!0,{manifests:[]})),F.getMcpHealth().catch(()=>null)]);n(f=>({manifests:u.manifests,integrations:(h==null?void 0:h.integrations)??f.integrations,activeSessions:(h==null?void 0:h.activeSessions)??f.activeSessions,mcpServerUp:!!h,manifestsError:c,fetchCount:f.fetchCount+1}))},[]);ue("integration-changed",a),_t(a,3e5);const s=d.useMemo(()=>{const c=new Map(t.integrations.map(v=>[v.id,v])),u=Date.now(),h=t.fetchCount>0&&t.manifests.some(v=>{const y=c.get(v.id);return y&&!y.running});h&&r.current===null?r.current=u:h||(r.current=null);const f=r.current!==null&&u-r.current<Gg;return t.manifests.map(v=>{const y=c.get(v.id);let x;return t.fetchCount===0?x="loading":y!=null&&y.running?x="running":y!=null&&y.error?x="error":y&&f?x="starting":x="not-running",{id:v.id,manifest:v,integration:y,state:x}})},[t]),i=d.useMemo(()=>s.filter(c=>c.state==="not-running"||c.state==="error").length,[s]),l={loading:t.fetchCount===0,mcpServerUp:t.mcpServerUp,manifestsError:t.manifestsError,entries:s,attentionCount:i,activeSessions:t.activeSessions,refresh:a};return o.jsx(jf.Provider,{value:l,children:e})}function dl(){const e=d.useContext(jf);if(!e)throw new Error("useIntegrationStatus must be used inside IntegrationStatusProvider");return e}const Qg=[{to:"/",icon:"□",label:"Dashboard"},{to:"/proposals",icon:"▷",label:"Pending Approvals",statusKey:"proposals"},{to:"/authorizations",icon:"☰",label:"Authorizations",statusKey:"authorizations"},{to:"/agent-brief",icon:"▤",label:"Agent Brief",statusKey:"brief"},{to:"/audit",icon:"▣",label:"Receipts"},{to:"/groups",icon:"◉",label:"Team",teamOnly:!0},{to:"/integrations",icon:"⧗",label:"Integrations",statusKey:"integrations"},{to:"/settings",icon:"⚙",label:"AI Assistant",statusKey:"assistant"}];function Jg(){const{activeDomain:e}=Ce(),[t,n]=d.useState({}),r=d.useCallback(async()=>{try{const[a,s,i,l,c]=await Promise.all([F.getCredential("ai-config").catch(()=>null),F.getMyAttestations().catch(()=>null),F.getProposals(e||"owner").catch(()=>null),F.getProposalsForApprover().catch(()=>null),F.getAgentContext().catch(()=>"")]),u={};if(a&&!a.configured&&(u.assistant=1),s){const y=Sf(s).expired.length;y>0&&(u.authorizations=y)}const h=(i==null?void 0:i.length)??0,f=(l==null?void 0:l.length)??0,v=h+f;v>0&&(u.proposals=v),(!c||!c.trim())&&(u.brief=1),n(u)}catch{}},[e]);return ue("attestation-changed",r),ue("proposal-added",r),ue("proposal-resolved",r),ue("proposal-approved",r),ue("proposal-rejected",r),ue("team-membership-changed",r),_t(r,3e5,e),t}const Xg={marginLeft:"auto",minWidth:"1.25rem",height:"1.25rem",padding:"0 0.375rem",borderRadius:"0.625rem",background:"var(--warning)",color:"var(--bg-elevated)",fontSize:"0.7rem",fontWeight:600,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},qg={position:"fixed",bottom:"1.5rem",left:"50%",transform:"translateX(-50%)",background:"var(--bg-elevated, #1e1e2e)",color:"var(--text-primary, #e2e8f0)",border:"1px solid var(--border)",borderRadius:"0.5rem",padding:"0.625rem 1rem",fontSize:"0.85rem",boxShadow:"0 4px 16px rgba(0,0,0,0.3)",zIndex:9999,whiteSpace:"nowrap",pointerEvents:"none"};function Zg(){const{mode:e,group:t,domain:n,activeTeam:r}=Ce(),a=Jg(),{attentionCount:s}=dl(),i={...a};s>0&&(i.integrations=s);const l=Qg.filter(v=>!v.teamOnly||e==="team"),c=d.useRef(null),[u,h]=d.useState(null),f=lt();return d.useEffect(()=>{if(c.current===null){c.current=e;return}c.current!==e&&(e==="team"&&r?h(`You are now acting in team context — ${r.name}`):e==="personal"&&h("You have left the team — back to personal context"),c.current=e)},[e,r]),d.useEffect(()=>{h(null)},[f.pathname]),o.jsxs("div",{className:"sidebar",children:[o.jsx("ul",{className:"sidebar-nav",children:l.map(v=>{const y=v.statusKey?i[v.statusKey]:0;return o.jsx("li",{children:o.jsxs(cl,{to:v.to,end:v.to==="/",className:({isActive:x})=>`sidebar-item${x?" active":""}`,children:[o.jsx("span",{className:"icon",children:v.icon}),v.label,y?o.jsx("span",{style:Xg,children:y}):null]})},v.to)})}),o.jsxs("div",{className:"sidebar-context",children:[o.jsx("div",{className:"ctx-label",children:"Active context"}),o.jsx("div",{className:"ctx-value",children:e==="personal"?"personal":t?`${t.name} / ${n}`:n})]}),u&&o.jsx("div",{style:qg,role:"status","aria-live":"polite",children:u})]})}const os="suveren:updatedTo";function ev(e){return e==="npm"?"suveren-gateway stop; npm install -g @suveren/gateway@latest && suveren-gateway start --detach":e==="dev"?"git pull && pnpm install":"docker rm -f suveren-gateway 2>/dev/null; docker ps -q --filter publish=7400 --filter publish=7430 | xargs -r docker rm -f; docker pull ghcr.io/suverenai/suveren-gateway:latest && docker run -d --name suveren-gateway -p 7400:3000 -p 7430:3030 -v $HOME/.suveren:/app/data ghcr.io/suverenai/suveren-gateway"}function tv(){const e=document.querySelectorAll('[role="dialog"], .modal-overlay, .modal');for(const n of e)if(!n.closest(".update-overlay"))return!0;const t=document.activeElement;if(t&&(t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable)){const n=t.value;if(n&&n.trim())return!0}return!1}function nv(){const{updateAvailable:e,installMethod:t,version:n,latestVersion:r,serverRestarted:a,startFastPolling:s,dismiss:i}=wf(),[l,c]=d.useState(!1),[u,h]=d.useState(!1),[f,v]=d.useState(()=>{try{const g=sessionStorage.getItem(os);if(g)return sessionStorage.removeItem(os),g}catch{}return null}),y=ev(t),x=d.useRef(null),w=g=>{try{sessionStorage.setItem(os,g||r||"✓")}catch{}window.location.reload()};d.useEffect(()=>{if(!f)return;const g=setTimeout(()=>v(null),6e3);return()=>clearTimeout(g)},[f]),d.useEffect(()=>{if(!l||!a)return;const g=()=>tv()?!1:(w(n),!0);if(g())return;const S=setInterval(g,1500);return()=>clearInterval(S)},[l,a,n]),d.useEffect(()=>(document.body.classList.toggle("is-updating",l),()=>document.body.classList.remove("is-updating")),[l]);const j=e&&!l&&!f||!!f&&!l;d.useEffect(()=>{if(!j){document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner");return}document.body.classList.add("has-update-banner");const g=()=>{var T;const E=((T=x.current)==null?void 0:T.offsetHeight)??0;document.documentElement.style.setProperty("--update-banner-h",`${E}px`)};g();const S=new ResizeObserver(g);return x.current&&S.observe(x.current),()=>{S.disconnect(),document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner")}},[j]);const m=()=>{c(!0),s()},p=async()=>{try{await navigator.clipboard.writeText(y),h(!0),setTimeout(()=>h(!1),1800)}catch{}};return o.jsxs(o.Fragment,{children:[f&&!l&&o.jsx("div",{ref:x,className:"update-banner is-live",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"update-banner-row",children:[o.jsxs("span",{className:"update-banner-text",children:["✓"," You","’","re on the latest version",f&&f!=="✓"?` — ${f} is live`:" — now live","."]}),o.jsx("button",{className:"update-banner-x",onClick:()=>v(null),"aria-label":"Dismiss",children:"×"})]})}),e&&!l&&!f&&o.jsx("div",{ref:x,className:"update-banner",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"update-banner-row",children:[o.jsx("span",{className:"update-banner-text",children:"Update available."}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[o.jsx("button",{className:"btn btn-sm btn-secondary",onClick:m,children:"Update"}),o.jsx("button",{className:"update-banner-x",onClick:i,"aria-label":"Dismiss",children:"×"})]})]})}),l&&o.jsx("div",{className:"update-overlay",children:o.jsxs("div",{className:"update-overlay-card",role:"dialog","aria-modal":"true","aria-label":"Finishing the update",children:[o.jsx("div",{className:"update-spinner"}),o.jsxs("h2",{children:["Finishing the update","…"]}),o.jsxs("p",{children:["Copy this command and run it in your terminal. The gateway will restart, and"," ",o.jsx("strong",{children:"this page updates automatically"})," when it comes back ","—"," no need to refresh."]}),o.jsxs("div",{className:"update-cmd-row",children:[o.jsx("code",{className:"update-cmd",children:y}),o.jsx("button",{className:"btn btn-sm btn-primary",onClick:p,children:u?"Copied":"Copy"})]}),o.jsxs("div",{className:"update-status",children:[o.jsx("span",{className:"update-pulse"})," Waiting for the gateway to restart","…"]}),o.jsxs("div",{className:"update-overlay-actions",children:[o.jsx("button",{className:"btn btn-primary",onClick:()=>w(n),children:"Reload now"}),o.jsx("button",{className:"btn btn-secondary",onClick:()=>c(!1),children:"Cancel"})]})]})})]})}const rv={system:"◑",light:"☀",dark:"☾"},av=[{to:"/",icon:"□",label:"Dashboard"},{to:"/proposals",icon:"▷",label:"Pending Approvals"},{to:"/authorizations",icon:"☰",label:"Authorizations"},{to:"/agent-brief",icon:"▤",label:"Agent Brief"},{to:"/audit",icon:"▣",label:"Receipts"},{to:"/groups",icon:"◉",label:"Team"},{to:"/integrations",icon:"⧗",label:"Integrations"},{to:"/settings",icon:"⚙",label:"AI Assistant"}];function ov({open:e,onClose:t}){const{user:n,activeGroup:r,activeDomain:a,logout:s}=Ce(),{theme:i,toggle:l}=xf(),c=lt();return d.useEffect(()=>{t()},[c.pathname]),e?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mobile-menu-backdrop",onClick:t}),o.jsxs("div",{className:"mobile-menu-panel",children:[n&&o.jsxs("div",{className:"mobile-menu-header",children:[o.jsx("strong",{children:n.name}),o.jsx("span",{style:{fontSize:"0.8rem",color:"var(--text-secondary)"},children:r?`${r.name} / ${a}`:a||"personal"})]}),o.jsx("nav",{className:"mobile-menu-nav",children:av.map(u=>o.jsxs(cl,{to:u.to,end:u.to==="/",className:({isActive:h})=>`mobile-menu-item${h?" active":""}`,onClick:t,children:[o.jsx("span",{className:"icon",children:u.icon}),u.label]},u.to))}),o.jsxs("div",{className:"mobile-menu-footer",children:[o.jsxs("button",{className:"mobile-menu-action",onClick:()=>{l()},children:[o.jsx("span",{className:"icon",children:rv[i]}),"Theme: ",i]}),o.jsx("button",{className:"mobile-menu-action",onClick:()=>{s(),t()},children:"Logout"})]})]})]}):null}function sv(){const[e,t]=d.useState(!1);return o.jsxs(Yg,{children:[o.jsx(ul,{onMenuToggle:()=>t(!e)}),o.jsx(nv,{}),o.jsx(Zg,{}),o.jsx(ov,{open:e,onClose:()=>t(!1)}),o.jsx("div",{className:"main-content",children:o.jsx("div",{className:"page-inner",children:o.jsx(ag,{})})})]})}function iv(){const[e,t]=d.useState(""),{login:n,isLoading:r,error:a,clearError:s}=Ce(),[i,l]=d.useState(null),c=async()=>{if(e.trim()){s();try{await n(e)}catch(f){if(f instanceof gf){l(f.summary);return}}}},u=async()=>{l(null),s();try{await n(e,{confirmWipe:!0})}catch{}},h=()=>{l(null)};return o.jsxs(o.Fragment,{children:[o.jsx(ul,{}),o.jsxs("div",{className:"login-split",children:[o.jsx("div",{className:"login-split-left",children:o.jsxs("div",{style:{maxWidth:"28rem"},children:[o.jsx("h1",{style:{fontSize:"clamp(2.25rem, 4vw, 3.25rem)",letterSpacing:"-0.03em",lineHeight:1.1,marginBottom:"1.25rem"},children:"Your agents, your intent, your rules."}),o.jsx("p",{style:{fontSize:"1.125rem",color:"var(--text-secondary)",lineHeight:1.6,marginBottom:"3rem"},children:"The gateway runs on your machine, between your agents and the tools they use. Your signature. Your bounds. Your receipts."})]})}),o.jsx("div",{className:"login-split-right",children:o.jsxs("div",{style:{width:"100%",maxWidth:"24rem"},children:[o.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[o.jsx("div",{style:{fontSize:"1.75rem",fontWeight:700,marginBottom:"0.5rem"},children:"Sign In"}),o.jsx("div",{style:{fontSize:"0.95rem",color:"var(--text-secondary)",lineHeight:1.5},children:"Enter your API key to manage authorizations."})]}),a&&o.jsx("div",{className:"error-message",children:a}),o.jsxs("div",{className:"form-group",style:{marginBottom:"1.5rem"},children:[o.jsx("label",{className:"form-label",children:"API Key"}),o.jsx("input",{className:"form-input",type:"password",placeholder:"hap_sk_...",value:e,onChange:f=>t(f.target.value),onKeyDown:f=>f.key==="Enter"&&c(),disabled:r,style:{padding:"0.75rem"}}),o.jsx("div",{className:"form-hint",children:"From your Suveren account."})]}),o.jsx("button",{className:"btn btn-primary btn-full btn-lg",onClick:c,disabled:r,style:{marginBottom:"2rem"},children:r?"Signing in...":"Sign In"}),o.jsx("div",{className:"login-divider",children:"New here?"}),o.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[o.jsxs("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary)",marginBottom:"1rem",lineHeight:1.5},children:["Create an account on Suveren,",o.jsx("br",{}),"then come back to sign in."]}),o.jsx("a",{href:"https://www.suveren.ai/get-started",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-full",style:{textDecoration:"none"},children:"Create Account"})]}),o.jsxs("div",{style:{paddingTop:"1.75rem",borderTop:"1px solid var(--border)"},children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",marginBottom:"0.875rem"},children:"Getting started"}),o.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.8},children:[o.jsxs(o.Fragment,{children:["Create an account at ",o.jsx("a",{href:"https://www.suveren.ai/get-started",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)"},children:"Suveren"})]}),"Join or create a team to get domain authority","Sign in here with your API key to start authorizing agents"].map((f,v)=>o.jsxs("div",{style:{display:"flex",gap:"0.625rem",alignItems:"baseline",marginBottom:v<2?"0.5rem":0},children:[o.jsxs("span",{style:{color:"var(--accent)",fontWeight:700,fontSize:"0.95rem"},children:[v+1,"."]}),f]},v))})]})]})})]}),i&&o.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"wipe-warning-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:"1rem"},onClick:h,children:o.jsxs("div",{className:"card",onClick:f=>f.stopPropagation(),style:{maxWidth:520,width:"100%",margin:0},children:[o.jsx("h3",{id:"wipe-warning-title",className:"card-title",style:{marginBottom:"0.5rem"},children:"Sign in with a different account?"}),o.jsxs("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["This gateway already holds data for another account. Signing in with this API key will ",o.jsx("strong",{children:"permanently wipe"})," the following local data:"]}),o.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[o.jsxs("li",{children:[i.credentialCount," stored service credential",i.credentialCount===1?"":"s",i.credentialIds.length>0&&o.jsxs("span",{style:{color:"var(--text-tertiary)",fontSize:"0.825rem"},children:[" ","(",i.credentialIds.slice(0,5).join(", "),i.credentialIds.length>5?`, +${i.credentialIds.length-5} more`:"",")"]})]}),o.jsxs("li",{children:[i.serviceCount," configured integration",i.serviceCount===1?"":"s"]}),o.jsx("li",{children:"The local E2EE keypair (a new one will be generated for this account)"}),o.jsx("li",{children:"Any unsynchronised gate content stored locally"})]}),o.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Authorizations and receipts on the Service Provider are NOT affected — only this gateway's local state is wiped."}),o.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-tertiary)",marginBottom:"1rem"},children:"If this isn't what you wanted, cancel and sign back in with the original API key, or use a different gateway instance for this account."}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end"},children:[o.jsx("button",{className:"btn btn-ghost",onClick:h,disabled:r,children:"Cancel"}),o.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:u,disabled:r,children:r?"Signing in...":"Wipe local data and sign in"})]})]})})]})}function lv(){const{setActiveContext:e}=Ce(),t=Bt(),[n,r]=d.useState(""),[a,s]=d.useState(""),[i,l]=d.useState(""),[c,u]=d.useState(!1),h=async()=>{if(n.trim()){u(!0),l("");try{const v=await F.joinGroup(n.trim());e(v,v.myDomains[0]||""),t("/")}catch(v){l(v instanceof Error?v.message:"Failed to join group")}finally{u(!1)}}},f=async()=>{if(a.trim()){u(!0),l("");try{const v=await F.createGroup(a.trim());e(v,v.myDomains[0]||""),t("/")}catch(v){l(v instanceof Error?v.message:"Failed to create group")}finally{u(!1)}}};return o.jsxs(o.Fragment,{children:[o.jsx(ul,{}),o.jsx("div",{className:"main-content no-sidebar",style:{marginTop:"var(--nav-height)"},children:o.jsxs("div",{style:{maxWidth:"30rem",margin:"3rem auto",padding:"0 1rem"},children:[o.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[o.jsx("h2",{style:{fontSize:"1.5rem",marginBottom:"0.5rem"},children:"Join Your Team"}),o.jsx("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary)",lineHeight:1.6},children:"Join an existing team or create a new one to share authority across domains."})]}),i&&o.jsx("div",{className:"error-message",children:i}),o.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[o.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Join an existing group"}),o.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Ask your team admin for an invite code."}),o.jsxs("div",{className:"invite-input-row",children:[o.jsx("input",{className:"form-input",placeholder:"Paste invite code...",value:n,onChange:v=>r(v.target.value),onKeyDown:v=>v.key==="Enter"&&h(),style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem"},disabled:c}),o.jsx("button",{className:"btn btn-primary",onClick:h,disabled:c,children:"Join"})]})]}),o.jsxs("div",{className:"card",children:[o.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Create a new group"}),o.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Start a new team and invite members. Assign domains after creation."}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("input",{className:"form-input",placeholder:"Group name (e.g., Acme Corp)",value:a,onChange:v=>s(v.target.value),onKeyDown:v=>v.key==="Enter"&&f(),style:{flex:1},disabled:c}),o.jsx("button",{className:"btn btn-secondary",onClick:f,disabled:c,children:"Create"})]})]})]})})]})}const ai="suveren-setup-ai-skipped",oi="suveren-setup-agent-done",si="suveren-setup-dismissed",cv={"hap-setup-ai-skipped":ai,"hap-setup-agent-done":oi,"hap-setup-dismissed":si};function uv(){for(const[e,t]of Object.entries(cv)){const n=localStorage.getItem(e);n!==null&&localStorage.getItem(t)===null&&localStorage.setItem(t,n),n!==null&&localStorage.removeItem(e)}}uv();const ss={"claude-code":{label:"Claude Code",snippet:e=>JSON.stringify({mcpServers:{"suveren-gateway":{url:`${e}/sse`}}},null,2)},"claude-desktop":{label:"Claude Desktop",snippet:e=>`Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
52
52
 
53
53
  ${JSON.stringify({mcpServers:{"suveren-gateway":{url:`${e}/sse`}}},null,2)}`},other:{label:"Other",snippet:e=>`Streamable HTTP: POST ${e}/mcp
54
54
  SSE transport: GET ${e}/sse
55
- Health check: GET ${e}/health`}};function ly({aiConfigured:e,hasRunningIntegration:t,hasActiveAuth:n,hasAgentConnected:r,mcpEndpoint:a}){const[s,i]=d.useState(()=>localStorage.getItem(ri)==="true"),[l,c]=d.useState(()=>localStorage.getItem(ai)==="true"),[u,h]=d.useState(()=>localStorage.getItem(oi)==="true"),[f,g]=d.useState(null),[v,x]=d.useState("claude-code"),[w,j]=d.useState(!1),m=[{label:"AI Assistant",detail:"A trusted AI helps you think through authorizations — surfacing risks and asking the right questions.",to:"/settings",status:e?"done":s?"skipped":"pending",optional:!0},{label:"Connect a service",to:"/integrations",status:t?"done":"pending"},{label:"Authorize your agent",to:"/agent/new",status:n?"done":"pending"},{label:"Connect your agent",status:r||l?"done":"pending"}],p=m.filter(N=>N.status==="done"||N.status==="skipped").length,y=p===m.length,S=d.useCallback(()=>{localStorage.setItem(ri,"true"),i(!0)},[]),b=d.useCallback(()=>{localStorage.setItem(ai,"true"),c(!0),g(null)},[]),T=d.useCallback(()=>{localStorage.setItem(oi,"true"),h(!0)},[]),k=d.useCallback(async N=>{try{await navigator.clipboard.writeText(N),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},[]);if(u||y)return null;const E=m.findIndex(N=>N.status==="pending");return o.jsxs("div",{style:{border:"2px solid var(--accent)",borderRadius:"0.75rem",padding:"1.5rem",marginBottom:"1.5rem",background:"var(--bg-elevated)"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"1.25rem"},children:[o.jsx("h2",{style:{fontSize:"1.1rem",fontWeight:700,margin:0},children:"Get Started"}),o.jsx("button",{onClick:T,style:{background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:"1.1rem",padding:"0 0.25rem",lineHeight:1},title:"Hide setup guide",children:"×"})]}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:m.map((N,I)=>{const D=I===E,V=N.status==="done"||N.status==="skipped"?"●":"○",M=N.status==="done"?"var(--success)":N.status==="skipped"?"var(--text-tertiary)":D?"var(--accent)":"var(--text-tertiary)";return o.jsxs("div",{children:[o.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:D?"0.75rem":"0.25rem 0",borderRadius:D?"0.5rem":void 0,background:D?"var(--accent-subtle)":void 0},children:[o.jsx("span",{style:{color:M,fontSize:"0.75rem",marginTop:"0.2rem",flexShrink:0},children:V}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[N.to&&N.status==="pending"?o.jsx(Ge,{to:N.to,style:{fontSize:"0.9rem",fontWeight:D?600:500,color:D?"var(--accent)":"var(--text-primary)",textDecoration:"none"},children:N.label}):N.status==="pending"&&I===3?o.jsx("button",{onClick:()=>g(f===3?null:3),style:{background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"0.9rem",fontWeight:D?600:500,color:D?"var(--accent)":"var(--text-primary)"},children:N.label}):o.jsx("span",{style:{fontSize:"0.9rem",fontWeight:500,color:N.status==="done"?"var(--text-secondary)":"var(--text-tertiary)"},children:N.label}),N.optional&&N.status==="pending"&&o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontStyle:"italic"},children:"optional"}),N.status==="skipped"&&o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:"skipped"})]}),N.detail&&N.status==="pending"&&D&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.25rem",lineHeight:1.5},children:N.detail})]}),N.optional&&N.status==="pending"&&o.jsx("button",{onClick:S,style:{background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:"0.75rem",padding:"0.125rem 0.5rem",flexShrink:0},children:"Skip"}),N.to&&N.status==="pending"&&o.jsx(Ge,{to:N.to,style:{color:"var(--text-tertiary)",textDecoration:"none",fontSize:"0.8rem",flexShrink:0},children:"›"})]}),I===3&&f===3&&o.jsxs("div",{style:{marginTop:"0.75rem",marginLeft:"1.5rem",padding:"1rem",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:"0.5rem"},children:[o.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,marginBottom:"0.75rem",color:"var(--text-primary)"},children:"MCP Endpoint"}),o.jsx("div",{style:{fontFamily:"monospace",fontSize:"0.85rem",padding:"0.5rem 0.75rem",background:"var(--bg-elevated)",border:"1px solid var(--border)",borderRadius:"0.375rem",marginBottom:"1rem",wordBreak:"break-all"},children:a}),o.jsx("div",{style:{display:"flex",gap:"0.25rem",marginBottom:"0.75rem"},children:Object.entries(os).map(([$,R])=>o.jsx("button",{onClick:()=>x($),style:{padding:"0.375rem 0.75rem",fontSize:"0.75rem",fontWeight:v===$?600:400,background:v===$?"var(--accent-subtle)":"transparent",color:v===$?"var(--accent)":"var(--text-secondary)",border:`1px solid ${v===$?"var(--accent)":"var(--border)"}`,borderRadius:"0.375rem",cursor:"pointer"},children:R.label},$))}),o.jsx("pre",{style:{fontFamily:"monospace",fontSize:"0.78rem",lineHeight:1.6,padding:"0.75rem",background:"var(--bg-elevated)",border:"1px solid var(--border)",borderRadius:"0.375rem",overflow:"auto",whiteSpace:"pre-wrap",margin:0,marginBottom:"0.75rem"},children:os[v].snippet(a)}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>k(os[v].snippet(a)),children:w?"Copied":"Copy"}),o.jsx("button",{className:"btn btn-primary btn-sm",onClick:b,children:"Done"})]})]})]},I)})}),o.jsxs("div",{style:{marginTop:"1.25rem"},children:[o.jsx("div",{style:{height:"4px",background:"var(--border)",borderRadius:"2px",overflow:"hidden"},children:o.jsx("div",{style:{height:"100%",width:`${p/m.length*100}%`,background:"var(--accent)",borderRadius:"2px",transition:"width 0.3s ease"}})}),o.jsxs("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.375rem"},children:[p," of ",m.length," complete"]})]})]})}function yn({variant:e="base",style:t,className:n,...r}){const a=e==="title"?"skeleton skeleton-title":e==="line"?"skeleton skeleton-line":e==="line-sm"?"skeleton skeleton-line-sm":"skeleton";return o.jsx("span",{className:`${a}${n?` ${n}`:""}`,style:t,role:"status","aria-busy":"true","aria-label":r["aria-label"]??"Loading"})}function ss(){return o.jsxs("div",{className:"skeleton-card",role:"status","aria-busy":"true","aria-label":"Loading",children:[o.jsx(yn,{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",flexShrink:0}}),o.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"0.35rem"},children:[o.jsx(yn,{variant:"line",style:{width:"35%"}}),o.jsx(yn,{variant:"line-sm",style:{width:"65%"}})]})]})}const cy=30*60;function is(e){return e.replace(/@.*$/,"").split("/").pop()??e}function uy(){var $;const{domain:e}=Ce(),[t,n]=d.useState([]),[r,a]=d.useState([]),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,h]=d.useState(!1),[f,g]=d.useState(!1),[v,x]=d.useState(!1),{entries:w,activeSessions:j,loading:m}=ul(),p=!m,y=d.useCallback(()=>{F.getMyAttestations().then(R=>{n(R),h(!0)}).catch(()=>h(!0)),F.getProposals(e||"owner").then(R=>{a(R),g(!0)}).catch(()=>g(!0)),F.getProposalsForApprover().then(R=>i(R)).catch(()=>i([])),F.getCredential("ai-config").then(R=>{c(R.configured),x(!0)}).catch(()=>x(!0))},[e]);ue("attestation-changed",y),ue("proposal-added",y),ue("proposal-resolved",y),ue("proposal-approved",y),ue("proposal-rejected",y),Rt(y,3e5,e);const S=u&&f&&v&&p,b=wf(t),T=b.active,k=b.expired,E=T.filter(R=>R.remaining_seconds!==null&&R.remaining_seconds<=cy),N=r.filter(R=>R.status==="pending"),I=w.filter(R=>R.state==="running"),D=w.filter(R=>R.state==="starting"),V=w.filter(R=>R.state==="not-running"||R.state==="error"),M=[];for(const R of s)M.push({label:"Approval needed",detail:`${R.tool} — above-cap action under ${is(R.profileId)}`,to:"/proposals",color:"var(--warning)"});for(const R of N)M.push({label:"Approval pending",detail:`${R.tool} awaiting your approval`,to:"/proposals",color:"var(--warning)"});for(const R of E){const Y=Math.ceil((R.remaining_seconds??0)/60);M.push({label:"Expiring soon",detail:`${R.title??is(R.profile_id)} — ${Y} min remaining`,to:"/authorizations",color:"var(--warning)"})}for(const R of k)M.push({label:"Expired",detail:R.title??is(R.profile_id),to:"/authorizations",color:"var(--danger)"});for(const R of V)M.push({label:R.state==="error"?"Integration error":"Integration stopped",detail:R.state==="error"&&(($=R.integration)!=null&&$.error)?`${R.manifest.name}: ${R.integration.error}`:`${R.manifest.name} is not running`,to:"/integrations",color:"var(--danger)"});for(const R of D)M.push({label:"Integration starting",detail:`${R.manifest.name} is coming up…`,to:"/integrations",color:"var(--warning)"});return l||M.push({label:"AI Assistant",detail:"Not configured — needed for gate advisory",to:"/settings",color:"var(--text-tertiary)"}),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"page-header",children:o.jsx("h1",{className:"page-title",children:"Dashboard"})}),S&&o.jsx(ly,{aiConfigured:l,hasRunningIntegration:I.length>0,hasActiveAuth:T.length>0,hasAgentConnected:j>0,mcpEndpoint:`http://localhost:${window.location.port==="3400"?"3430":"7430"}`}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(8rem, 1fr))",gap:"0.75rem",marginBottom:"1.5rem"},children:[o.jsx(Ge,{to:"/authorizations",style:{textDecoration:"none"},children:o.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[u?o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:T.length>0?"var(--success)":"var(--text-tertiary)"},children:T.length}):o.jsx(yn,{variant:"title"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Active"})]})}),o.jsx(Ge,{to:"/proposals",style:{textDecoration:"none"},children:o.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[f?o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:N.length>0?"var(--warning)":"var(--text-tertiary)"},children:N.length}):o.jsx(yn,{variant:"title"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pending Approvals"})]})}),o.jsx(Ge,{to:"/authorizations",style:{textDecoration:"none"},children:o.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[u?o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:k.length>0?"var(--danger)":"var(--text-tertiary)"},children:k.length}):o.jsx(yn,{variant:"title"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Expired"})]})}),o.jsx(Ge,{to:"/integrations",style:{textDecoration:"none"},children:o.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[p?o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:I.length>0?"var(--success)":"var(--text-tertiary)"},children:I.length}):o.jsx(yn,{variant:"title"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Integrations Running"})]})})]}),M.length>0?o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:M.map((R,Y)=>o.jsx(Ge,{to:R.to,style:{textDecoration:"none"},children:o.jsxs("div",{className:"card",style:{padding:"0.75rem 1rem",display:"flex",alignItems:"center",gap:"0.75rem"},children:[o.jsx("span",{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",background:R.color,flexShrink:0}}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,color:"var(--text-primary)"},children:R.label}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:R.detail})]}),o.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"›"})]})},Y))}):S?o.jsx("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:o.jsx("div",{style:{fontSize:"0.9rem",color:"var(--text-secondary)"},children:"All clear. Nothing needs your attention."})}):o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[o.jsx(ss,{}),o.jsx(ss,{}),o.jsx(ss,{})]})]})}const dy=["Scope & Limits","Intent","Authorize"];function jf({currentStep:e,onStepClick:t}){const n=Bt();return o.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",marginBottom:"2.5rem"},children:[o.jsx("div",{style:{display:"flex",alignItems:"center",flex:1,overflow:"hidden"},children:dy.map((r,a)=>{const s=a+2,i=s<e,l=s===e;return o.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[a>0&&o.jsx("div",{style:{width:"1.5rem",height:"2px",background:i?"var(--accent)":"var(--border)",flexShrink:1}}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[o.jsx("div",{className:`step-circle${i?" completed":""}${l?" current":""}`,onClick:i&&t?()=>t(s):void 0,style:i&&t?{cursor:"pointer"}:void 0,children:i?"✓":a+1}),o.jsx("span",{className:"step-label-text",style:{fontSize:"0.6rem",marginTop:"0.3rem",color:l?"var(--accent)":i?"var(--text-secondary)":"var(--text-tertiary)",fontWeight:l?600:400,textAlign:"center"},children:r})]})]},s)})}),o.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>n("/agent/new"),style:{flexShrink:0,fontSize:"0.8rem",marginTop:"0.15rem"},children:"Cancel"})]})}const Tc=40;function Re(e,t){if(t)return t.slice(0,Tc);const n=e.lastIndexOf("/"),r=n>=0?e.slice(n+1):e,a=r.indexOf("@"),s=a>=0?r.slice(0,a):r;return(s.charAt(0).toUpperCase()+s.slice(1)).slice(0,Tc)}function fy({profileId:e,bounds:t,groupName:n,domain:r,onSwitch:a}){return o.jsxs("div",{className:"context-strip",children:[n&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"context-strip-label",children:"Team:"}),o.jsxs("span",{children:[o.jsx("strong",{children:n}),r?` / ${r}`:""]})]}),e&&o.jsxs("span",{children:[o.jsx("strong",{children:"Profile:"})," ",Re(e)]}),t&&o.jsxs("span",{children:[o.jsx("strong",{children:"Bounds:"})," ",t]}),a&&o.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginLeft:"auto",padding:"0.2rem 0.5rem",fontSize:"0.7rem"},onClick:a,children:"Switch"})]})}function py({integrationId:e,field:t,value:n,onChange:r,disabled:a}){const[s,i]=d.useState(null),[l,c]=d.useState(null),[u,h]=d.useState(!0);d.useEffect(()=>{let v=!1;return F.discoverScopeField(e,t).then(x=>{v||(i(x.options),h(!1))}).catch(x=>{v||(c(x instanceof Error?x.message:String(x)),h(!1))}),()=>{v=!0}},[e,t]);const f=new Set(n.split(",").map(v=>v.trim()).filter(Boolean)),g=v=>{const x=new Set(f);x.has(v)?x.delete(v):x.add(v),r(Array.from(x).join(","))};return u?o.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["Loading options from ",e,"…"]}):l||!s?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--warning)",marginBottom:"0.5rem"},children:["Couldn't fetch options (",l??"no response","). Enter values manually, separated by commas."]}),o.jsx("input",{className:"form-input",type:"text",value:n,onChange:v=>r(v.target.value),disabled:a})]}):s.length===0?o.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["No options available from ",e," for this field."]}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:s.map(v=>{const x=v.extras??{},w=typeof x.access=="string"?x.access:void 0,j=w==="reader",m=x.primary===!0;return o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.875rem",color:j?"var(--text-tertiary)":"var(--text-primary)",cursor:a||j?"not-allowed":"pointer"},title:j?"Read-only — you can authorize list/read but not writes":void 0,children:[o.jsx("input",{type:"checkbox",checked:f.has(String(v.value)),onChange:()=>g(String(v.value)),disabled:a||j}),o.jsx("span",{children:v.label||v.value}),m&&o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"primary"}),w&&o.jsxs("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["· ",w]})]},v.value)})})}function my(e){return e.replace(/@.*$/,"").split("/").pop()??e}function hy(e,t){return t.displayName?t.displayName:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function gy(e){return e.type==="string"&&(e.format==="email"||e.format==="domain")}function yy(e){var t;return!!(e.enum&&((t=e.constraint)!=null&&t.enforceable.includes("subset")))}function Ic(e,t){const n=e.trim();return n?t==="email"?n.includes("@")&&n.indexOf(".",n.indexOf("@"))>-1:t==="domain"?n.includes(".")&&!n.includes("@"):!0:!1}function vy(e){return!e||e==="count"?"":e==="minutes"?"min":e==="hours"?"hr":e==="days"?"days":e==="percent"?"%":e.startsWith("currency:")?e.slice(9):e}function xy(e){return e?e==="minutes"?15:e==="percent"?5:e.startsWith("currency:")?10:1:1}function wy(e){return e?e==="minutes"?[{value:15,label:"15m"},{value:30,label:"30m"},{value:60,label:"1h"},{value:120,label:"2h"},{value:240,label:"4h"}]:e==="hours"?[{value:1,label:"1h"},{value:4,label:"4h"},{value:8,label:"8h"},{value:24,label:"1d"}]:e==="days"?[{value:1,label:"1d"},{value:7,label:"1w"},{value:30,label:"1mo"},{value:90,label:"3mo"}]:e==="percent"?[{value:10,label:"10%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:100,label:"100%"}]:e.startsWith("currency:")?[{value:10,label:"10"},{value:50,label:"50"},{value:100,label:"100"},{value:500,label:"500"},{value:1e3,label:"1k"}]:[]:[]}function Sy(e,t){if(!e||!t)return"";const n=Number(e);if(!Number.isFinite(n)||n<=0)return"";if(t==="minutes"&&n>=60){const r=Math.floor(n/60),a=n%60;return a===0?`${r} hour${r!==1?"s":""}`:`${r}h ${a}m`}if(t==="hours"&&n>=24&&n%24===0){const r=n/24;return`${r} day${r!==1?"s":""}`}if(t==="days"){if(n>=30&&n%30===0)return`${n/30} month${n/30!==1?"s":""}`;if(n>=7&&n%7===0)return`${n/7} week${n/7!==1?"s":""}`}return""}function jy({id:e,value:t,onChange:n,disabled:r,placeholder:a,unit:s}){const i=xy(s),l=wy(s),c=vy(s),u=Sy(t,s),h=t===""?null:Number(t),f=()=>{const v=t===""?0:Number(t),x=v%i,w=x===0?v+i:v+(i-x);n(String(w))},g=()=>{const v=t===""?0:Number(t);if(v<=0)return;const x=v%i,w=x===0?v-i:v-x;n(String(Math.max(0,w)))};return o.jsxs("div",{className:"bounded-input",children:[o.jsxs("div",{className:"bounded-input-field",children:[o.jsx("button",{type:"button",className:"stepper-btn stepper-decrement",onClick:g,disabled:r||t===""||Number(t)<=0,"aria-label":"Decrease",children:"−"}),o.jsx("input",{id:e,className:"stepper-input",type:"number",min:0,step:i,value:t,placeholder:a??"0",onChange:v=>n(v.target.value),onFocus:v=>v.target.select(),disabled:r}),o.jsx("button",{type:"button",className:"stepper-btn stepper-increment",onClick:f,disabled:r,"aria-label":"Increase",children:"+"}),c&&o.jsx("span",{className:"bounded-input-unit","aria-hidden":"true",children:c})]}),l.length>0&&!r&&o.jsx("div",{className:"bounded-input-presets",role:"group","aria-label":"Quick presets",children:l.map(v=>o.jsx("button",{type:"button",className:`preset-chip${h===v.value?" preset-chip-selected":""}`,onClick:()=>n(String(v.value)),children:v.label},v.value))}),u&&o.jsxs("div",{className:"bounded-input-echo",children:["≈ ",u]})]})}function _c({htmlFor:e,label:t,description:n}){const[r,a]=d.useState(!1);return o.jsxs("div",{className:"field-label-with-tip",children:[o.jsx("label",{className:"form-label",htmlFor:e,children:t}),n&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"field-tip-trigger","aria-label":`What does "${t}" mean?`,"aria-expanded":r,onClick:()=>a(s=>!s),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onBlur:()=>a(!1),children:"i"}),r&&o.jsx("div",{className:"field-tip-bubble",role:"tooltip",children:n})]})]})}function ky({id:e,value:t,onChange:n,disabled:r,format:a,placeholder:s}){const[i,l]=d.useState(""),[c,u]=d.useState(!1),h=d.useRef(null),f=t?t.split(",").map(m=>m.trim()).filter(Boolean):[],g=m=>{const p=m.trim();if(!p)return;if(!Ic(p,a)){u(!0);return}u(!1);const y=f.includes(p)?f:[...f,p];n(y.join(",")),l("")},v=m=>{const p=f.filter((y,S)=>S!==m);n(p.join(","))},x=m=>{m.key==="Enter"||m.key===","||m.key==="Tab"?i.trim()&&(m.preventDefault(),g(i)):m.key==="Backspace"&&!i&&f.length>0&&v(f.length-1)},w=m=>{const p=m.clipboardData.getData("text");if(p.includes(",")){m.preventDefault();const S=p.split(",").map(T=>T.trim()).filter(Boolean).filter(T=>Ic(T,a)),b=[...new Set([...f,...S])];n(b.join(",")),l(""),u(!1)}},j=a==="email"?"Type email and press Enter...":"Type domain and press Enter...";return o.jsxs("div",{className:`tag-input${c?" tag-input-invalid":""}`,onClick:()=>{var m;return(m=h.current)==null?void 0:m.focus()},children:[f.map((m,p)=>o.jsxs("span",{className:"tag-pill",children:[m,!r&&o.jsx("button",{type:"button",className:"tag-remove",onClick:y=>{y.stopPropagation(),v(p)},"aria-label":`Remove ${m}`,children:"×"})]},m)),!r&&o.jsx("input",{ref:h,id:e,className:"tag-input-field",type:"text",value:i,onChange:m=>{l(m.target.value),u(!1)},onKeyDown:x,onPaste:w,onBlur:()=>{i.trim()&&g(i)},placeholder:f.length===0?s??j:""})]})}function Cy({id:e,options:t,value:n,onChange:r,disabled:a}){const s=n?n.split(",").map(l=>l.trim()).filter(Boolean):[],i=l=>{const c=s.includes(l)?s.filter(u=>u!==l):[...s,l];r(c.join(","))};return o.jsx("div",{className:"checkbox-group",id:e,children:t.map(l=>o.jsxs("label",{className:`checkbox-pill${s.includes(l)?" checkbox-pill-selected":""}`,children:[o.jsx("input",{type:"checkbox",checked:s.includes(l),onChange:()=>i(l),disabled:a}),o.jsx("span",{children:l})]},l))})}function Rc({fieldKey:e,fieldDef:t,value:n,onChange:r,prefix:a,readOnly:s,twoColumn:i,discoveryIntegrationId:l}){const c=hy(e,t),u=`${a}-field-${e}`,h=o.jsx(o.Fragment,{children:yy(t)?o.jsx(Cy,{id:u,options:t.enum,value:n,onChange:f=>r(e,f),disabled:s}):(()=>{const f=t.boundType;return(f==null?void 0:f.kind)==="enum"&&Array.isArray(f.values)})()?o.jsxs("select",{id:u,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:s,children:[o.jsx("option",{value:"",children:"Select..."}),t.boundType.values.map(f=>o.jsx("option",{value:f,children:f},f))]}):"enum"in t&&t.enum?o.jsxs("select",{id:u,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:s,children:[o.jsx("option",{value:"",children:"Select..."}),t.enum.map(f=>o.jsx("option",{value:f,children:f},f))]}):t.type==="number"?o.jsx(jy,{id:u,value:n,onChange:f=>r(e,f),disabled:s,unit:t.unit}):gy(t)?o.jsx(ky,{id:u,value:n,onChange:f=>r(e,f),disabled:s,format:t.format}):l?o.jsx(py,{integrationId:l,field:e,value:n,onChange:f=>r(e,f),disabled:s}):o.jsx("input",{id:u,className:"form-input",type:"text",value:n,onChange:f=>r(e,f.target.value),disabled:s})});return i?o.jsxs("div",{className:"bounds-field-row",children:[o.jsx("div",{className:"bounds-field-label",children:o.jsx(_c,{htmlFor:u,label:c,description:t.description})}),o.jsx("div",{className:"bounds-field-input",children:h})]},`${a}-${e}`):o.jsxs("div",{className:"form-group",children:[o.jsx(_c,{htmlFor:u,label:c,description:t.description}),h]},`${a}-${e}`)}function Ny(e,t){if(!t)return"no-config";const n=t.caps,r=Array.isArray(t.approvers)&&t.approvers.length>0;if(!(n&&Object.keys(n).length>0))return r?"approvers-dormant":"no-config";let s=!1;for(const[i,l]of Object.entries(n)){const c=e[i];if(c===""||c===void 0)continue;const u=Number(c);if(!isNaN(u)&&u>l){s=!0;break}}return s?r?"above-approvers":"hard-ceiling":"within-cap"}function Ey(e,t){const n=new Set;if(!t)return n;for(const[r,a]of Object.entries(t)){const s=e[r];if(s===""||s===void 0)continue;const i=Number(s);!isNaN(i)&&i>a&&n.add(r)}return n}function by({profile:e,onConfirm:t,onCancel:n,readOnly:r,initialBounds:a,initialContext:s,initialFrame:i,profileConfig:l,approverNames:c,adminName:u}){const h=e.boundsSchema??e.frameSchema,f=e.contextSchema,g=h?Object.entries(h.fields).filter(([C])=>!(C==="profile"||C==="path")):[],v=f&&f.keyOrder.length>0?Object.entries(f.fields):[],x=a??i??{},w=s??{},j={};for(const[C]of g)j[C]=x[C]!==void 0?String(x[C]):"";const m={};for(const[C]of v)m[C]=w[C]!==void 0?String(w[C]):"";const[p,y]=d.useState(j),[S,b]=d.useState(m),[T,k]=d.useState(null);d.useEffect(()=>{const C=my(e.id);F.getIntegrationManifests().then(({manifests:P})=>{const z=P.find(L=>L.profile===C&&L.contextDiscovery&&Object.keys(L.contextDiscovery).length>0);k(z??null)}).catch(()=>k(null))},[e.id]);const E=Ny(p,l),N=Ey(p,l==null?void 0:l.caps),I=(C,P)=>{y(z=>({...z,[C]:P}))},D=(C,P)=>{b(z=>({...z,[C]:P}))},V=()=>{const C={profile:e.id};for(const[z,L]of g)L.type==="number"?C[z]=p[z]===""?0:Number(p[z]):C[z]=p[z];const P={};for(const[z,L]of v)L.type==="number"?P[z]=S[z]===""?0:Number(S[z]):P[z]=S[z];return[C,P]},M=()=>{const[C,P]=V();t(C,P)},$=()=>{const C=(l==null?void 0:l.caps)??{},P={...p};for(const U of N)C[U]!==void 0&&(P[U]=String(C[U]));y(P);const z={profile:e.id};for(const[U,ne]of g)if(ne.type==="number"){const J=P[U]??"";z[U]=J===""?0:Number(J)}else z[U]=P[U]??"";const L={};for(const[U,ne]of v)ne.type==="number"?L[U]=S[U]===""?0:Number(S[U]):L[U]=S[U];t(z,L)},R=C=>{const P=l==null?void 0:l.caps;if(!P||P[C]===void 0)return null;const z=P[C],L=N.has(C);return E==="hard-ceiling"&&L?o.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--danger)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",z," — exceeds team ceiling"]}):E==="above-approvers"&&L?o.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--warning)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",z," — above cap"]}):o.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--success)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",z," ok"]})},Y=()=>{var C;if(E==="no-config")return null;if(E==="approvers-dormant"){const P=c&&c.length>0?c.join(", "):"the configured approvers";return o.jsxs("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--accent)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:[o.jsxs("div",{style:{fontWeight:600,color:"var(--accent)",marginBottom:"0.25rem"},children:["Profile approvers: ",P]}),o.jsxs("div",{children:["No caps are set on this profile, so ",P," won't gate any action under this authority. Your intent will still be encrypted and shared with them as an accountability record — they can read what you authorised, even though they aren't reviewing individual actions."]})]})}if(E==="within-cap")return o.jsx("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--border)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:o.jsx("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:"Within all team caps — your responsibility."})});if(E==="above-approvers"){const P=c&&c.length>0?c.join(", "):"the required approvers";return o.jsxs("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--warning)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:[o.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.25rem"},children:"Above team cap."}),o.jsxs("div",{children:[o.jsx("strong",{children:"Over-cap actions"})," will require approval from you and ",P,". Within-cap actions run per the mode you choose."]})]})}if(E==="hard-ceiling"){const P=Array.from(N)[0],z=P?(C=l==null?void 0:l.caps)==null?void 0:C[P]:void 0,L=u??"the team admin";return o.jsxs("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--danger)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:[o.jsx("div",{style:{fontWeight:600,color:"var(--danger)",marginBottom:"0.25rem"},children:"Hard team ceiling."}),o.jsxs("div",{style:{marginBottom:"0.75rem"},children:["Team policy caps this at ",z??"the configured limit",". Lower your bound or ask ",L," to add an approver path above the cap."]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:$,children:"Save below cap"}),n&&o.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"})]})]})}return null},_=E==="hard-ceiling";return o.jsxs("div",{children:[v.length>0&&o.jsxs("div",{className:"context-section",children:[o.jsxs("div",{className:"bounds-section-header",children:[o.jsx("span",{className:"bounds-section-icon",children:"🛡"}),o.jsxs("div",{children:[o.jsx("div",{className:"bounds-section-title",children:"Allowed scope"}),o.jsx("div",{className:"bounds-section-subtitle",children:"Encrypted on your device, never sent to the SP"})]})]}),v.map(([C,P])=>{var L;const z=!!((L=T==null?void 0:T.contextDiscovery)!=null&&L[C]);return o.jsx(Rc,{fieldKey:C,fieldDef:P,value:S[C],onChange:D,prefix:"context",readOnly:r,discoveryIntegrationId:z?T.id:void 0},`context-${C}`)})]}),g.length>0&&o.jsxs("div",{className:"bounds-section",children:[o.jsxs("div",{className:"bounds-section-header",children:[o.jsx("span",{className:"bounds-section-icon",children:"🔒"}),o.jsxs("div",{children:[o.jsx("div",{className:"bounds-section-title",children:"Limits"}),o.jsx("div",{className:"bounds-section-subtitle",children:"Enforced by the Service Provider"})]})]}),o.jsx("div",{className:"bounds-fields-grid",children:g.map(([C,P])=>{var z;return o.jsxs("div",{style:{display:"contents"},children:[o.jsx(Rc,{fieldKey:C,fieldDef:P,value:p[C],onChange:I,prefix:"bounds",readOnly:r,twoColumn:!0}),E!=="no-config"&&((z=l==null?void 0:l.caps)==null?void 0:z[C])!==void 0&&o.jsx("div",{style:{gridColumn:"2 / 3",display:"flex",alignItems:"center",paddingBottom:"0.5rem"},children:R(C)})]},`bounds-${C}`)})}),Y()]}),o.jsx("button",{className:"btn btn-primary",onClick:M,disabled:_,style:{marginTop:"0.5rem"},children:r?"Next: Gates":"Next: Problem Statement"})]})}function Py(e){var n;const t=e.match(/```(?:markdown|md)?\s*\n([\s\S]*?)```/);return((n=t==null?void 0:t[1])==null?void 0:n.trim())??null}function Ty(e){return e.replace(/```(?:markdown|md)?\s*\n[\s\S]*?```/,"").trim()}const Iy="Tell me what your agent should do — I'll help shape it. Or ask me to draft a full intent and we'll iterate.";function so({target:e,currentText:t,onApply:n,greeting:r,placeholder:a,title:s}){const[i,l]=d.useState([{role:"assistant",content:r??Iy}]),[c,u]=d.useState(""),[h,f]=d.useState(!1),[g,v]=d.useState(null),x=d.useRef(null);d.useEffect(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[i,h]);const w=async()=>{const m=c.trim();if(!m||h)return;const p=[...i,{role:"user",content:m}];l(p),u(""),v(null),f(!0);try{const y=await F.aiChat({target:e,currentText:t,messages:p.filter((S,b)=>!(b===0&&S.role==="assistant"))});y.success&&y.reply?l(S=>[...S,{role:"assistant",content:y.reply}]):v(y.error??"AI returned no reply")}catch(y){v(y instanceof Error?y.message:"Chat failed")}finally{f(!1)}},j=m=>{m.key==="Enter"&&!m.shiftKey&&!m.nativeEvent.isComposing&&(m.preventDefault(),w())};return o.jsxs("div",{className:"intent-chat",children:[o.jsx("h3",{className:"card-title",children:s??"AI Assistant"}),o.jsxs("div",{ref:x,className:"chat-messages",children:[i.map((m,p)=>{const y=m.role==="assistant"?Py(m.content):null,S=y?Ty(m.content):m.content;return o.jsx("div",{className:`chat-msg ${m.role}`,children:o.jsxs("div",{className:"chat-msg-body",children:[S&&o.jsx("div",{className:"chat-msg-prose",children:S}),y!==null&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:"chat-fenced-block",children:y}),o.jsx("button",{type:"button",className:"btn btn-primary btn-sm chat-apply-btn",onClick:()=>n(y),children:"Apply this draft"})]})]})},p)}),h&&o.jsx("div",{className:"chat-msg assistant",children:o.jsx("div",{className:"chat-msg-body chat-msg-thinking",children:"Thinking…"})})]}),g&&o.jsx("div",{className:"error-message",children:g}),o.jsxs("div",{className:"chat-composer",children:[o.jsxs("div",{className:"chat-composer-pill",children:[o.jsx("textarea",{className:"chat-input",value:c,onChange:m=>u(m.target.value),onKeyDown:j,placeholder:a??"Ask for help articulating the intent…",rows:1,disabled:h}),o.jsx("button",{type:"button",className:"chat-send-btn",onClick:w,disabled:h||!c.trim(),"aria-label":"Send",children:"↑"})]}),o.jsx("div",{className:"chat-composer-hint",children:"Enter to send · Shift+Enter for newline"})]})]})}function kf({open:e,onClose:t,children:n,ariaLabel:r}){const a=d.useRef(null),s=d.useRef(null);return d.useEffect(()=>{var l;if(!e)return;s.current=document.activeElement,document.body.style.overflow="hidden";const i=c=>{c.key==="Escape"&&t()};return document.addEventListener("keydown",i),(l=a.current)==null||l.focus(),()=>{document.removeEventListener("keydown",i),document.body.style.overflow="",s.current instanceof HTMLElement&&s.current.focus()}},[e,t]),Qd.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`bottom-sheet-backdrop${e?" is-open":""}`,onClick:t,"aria-hidden":"true"}),o.jsxs("aside",{ref:a,className:`bottom-sheet${e?" is-open":""}`,role:"dialog","aria-modal":"true","aria-label":r,tabIndex:-1,children:[o.jsx("div",{className:"bottom-sheet-handle","aria-hidden":"true"}),o.jsx("button",{type:"button",className:"bottom-sheet-close",onClick:t,"aria-label":"Close",children:"×"}),n]})]}),document.body)}const zc=`Why — What's the situation? Why does this need to happen?
55
+ Health check: GET ${e}/health`}};function dv({aiConfigured:e,hasRunningIntegration:t,hasActiveAuth:n,hasAgentConnected:r,mcpEndpoint:a}){const[s,i]=d.useState(()=>localStorage.getItem(ai)==="true"),[l,c]=d.useState(()=>localStorage.getItem(oi)==="true"),[u,h]=d.useState(()=>localStorage.getItem(si)==="true"),[f,v]=d.useState(null),[y,x]=d.useState("claude-code"),[w,j]=d.useState(!1),m=[{label:"AI Assistant",detail:"A trusted AI helps you think through authorizations — surfacing risks and asking the right questions.",to:"/settings",status:e?"done":s?"skipped":"pending",optional:!0},{label:"Connect a service",to:"/integrations",status:t?"done":"pending"},{label:"Authorize your agent",to:"/agent/new",status:n?"done":"pending"},{label:"Connect your agent",status:r||l?"done":"pending"}],p=m.filter(N=>N.status==="done"||N.status==="skipped").length,g=p===m.length,S=d.useCallback(()=>{localStorage.setItem(ai,"true"),i(!0)},[]),E=d.useCallback(()=>{localStorage.setItem(oi,"true"),c(!0),v(null)},[]),T=d.useCallback(()=>{localStorage.setItem(si,"true"),h(!0)},[]),k=d.useCallback(async N=>{try{await navigator.clipboard.writeText(N),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},[]);if(u||g)return null;const b=m.findIndex(N=>N.status==="pending");return o.jsxs("div",{style:{border:"2px solid var(--accent)",borderRadius:"0.75rem",padding:"1.5rem",marginBottom:"1.5rem",background:"var(--bg-elevated)"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"1.25rem"},children:[o.jsx("h2",{style:{fontSize:"1.1rem",fontWeight:700,margin:0},children:"Get Started"}),o.jsx("button",{onClick:T,style:{background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:"1.1rem",padding:"0 0.25rem",lineHeight:1},title:"Hide setup guide",children:"×"})]}),o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:m.map((N,I)=>{const D=I===b,V=N.status==="done"||N.status==="skipped"?"●":"○",M=N.status==="done"?"var(--success)":N.status==="skipped"?"var(--text-tertiary)":D?"var(--accent)":"var(--text-tertiary)";return o.jsxs("div",{children:[o.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:D?"0.75rem":"0.25rem 0",borderRadius:D?"0.5rem":void 0,background:D?"var(--accent-subtle)":void 0},children:[o.jsx("span",{style:{color:M,fontSize:"0.75rem",marginTop:"0.2rem",flexShrink:0},children:V}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[N.to&&N.status==="pending"?o.jsx(Ge,{to:N.to,style:{fontSize:"0.9rem",fontWeight:D?600:500,color:D?"var(--accent)":"var(--text-primary)",textDecoration:"none"},children:N.label}):N.status==="pending"&&I===3?o.jsx("button",{onClick:()=>v(f===3?null:3),style:{background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"0.9rem",fontWeight:D?600:500,color:D?"var(--accent)":"var(--text-primary)"},children:N.label}):o.jsx("span",{style:{fontSize:"0.9rem",fontWeight:500,color:N.status==="done"?"var(--text-secondary)":"var(--text-tertiary)"},children:N.label}),N.optional&&N.status==="pending"&&o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontStyle:"italic"},children:"optional"}),N.status==="skipped"&&o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:"skipped"})]}),N.detail&&N.status==="pending"&&D&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.25rem",lineHeight:1.5},children:N.detail})]}),N.optional&&N.status==="pending"&&o.jsx("button",{onClick:S,style:{background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:"0.75rem",padding:"0.125rem 0.5rem",flexShrink:0},children:"Skip"}),N.to&&N.status==="pending"&&o.jsx(Ge,{to:N.to,style:{color:"var(--text-tertiary)",textDecoration:"none",fontSize:"0.8rem",flexShrink:0},children:"›"})]}),I===3&&f===3&&o.jsxs("div",{style:{marginTop:"0.75rem",marginLeft:"1.5rem",padding:"1rem",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:"0.5rem"},children:[o.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,marginBottom:"0.75rem",color:"var(--text-primary)"},children:"MCP Endpoint"}),o.jsx("div",{style:{fontFamily:"monospace",fontSize:"0.85rem",padding:"0.5rem 0.75rem",background:"var(--bg-elevated)",border:"1px solid var(--border)",borderRadius:"0.375rem",marginBottom:"1rem",wordBreak:"break-all"},children:a}),o.jsx("div",{style:{display:"flex",gap:"0.25rem",marginBottom:"0.75rem"},children:Object.entries(ss).map(([$,_])=>o.jsx("button",{onClick:()=>x($),style:{padding:"0.375rem 0.75rem",fontSize:"0.75rem",fontWeight:y===$?600:400,background:y===$?"var(--accent-subtle)":"transparent",color:y===$?"var(--accent)":"var(--text-secondary)",border:`1px solid ${y===$?"var(--accent)":"var(--border)"}`,borderRadius:"0.375rem",cursor:"pointer"},children:_.label},$))}),o.jsx("pre",{style:{fontFamily:"monospace",fontSize:"0.78rem",lineHeight:1.6,padding:"0.75rem",background:"var(--bg-elevated)",border:"1px solid var(--border)",borderRadius:"0.375rem",overflow:"auto",whiteSpace:"pre-wrap",margin:0,marginBottom:"0.75rem"},children:ss[y].snippet(a)}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>k(ss[y].snippet(a)),children:w?"Copied":"Copy"}),o.jsx("button",{className:"btn btn-primary btn-sm",onClick:E,children:"Done"})]})]})]},I)})}),o.jsxs("div",{style:{marginTop:"1.25rem"},children:[o.jsx("div",{style:{height:"4px",background:"var(--border)",borderRadius:"2px",overflow:"hidden"},children:o.jsx("div",{style:{height:"100%",width:`${p/m.length*100}%`,background:"var(--accent)",borderRadius:"2px",transition:"width 0.3s ease"}})}),o.jsxs("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.375rem"},children:[p," of ",m.length," complete"]})]})]})}function vn({variant:e="base",style:t,className:n,...r}){const a=e==="title"?"skeleton skeleton-title":e==="line"?"skeleton skeleton-line":e==="line-sm"?"skeleton skeleton-line-sm":"skeleton";return o.jsx("span",{className:`${a}${n?` ${n}`:""}`,style:t,role:"status","aria-busy":"true","aria-label":r["aria-label"]??"Loading"})}function is(){return o.jsxs("div",{className:"skeleton-card",role:"status","aria-busy":"true","aria-label":"Loading",children:[o.jsx(vn,{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",flexShrink:0}}),o.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"0.35rem"},children:[o.jsx(vn,{variant:"line",style:{width:"35%"}}),o.jsx(vn,{variant:"line-sm",style:{width:"65%"}})]})]})}const fv=30*60;function ls(e){return e.replace(/@.*$/,"").split("/").pop()??e}function pv(){var $;const{domain:e}=Ce(),[t,n]=d.useState([]),[r,a]=d.useState([]),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,h]=d.useState(!1),[f,v]=d.useState(!1),[y,x]=d.useState(!1),{entries:w,activeSessions:j,loading:m}=dl(),p=!m,g=d.useCallback(()=>{F.getMyAttestations().then(_=>{n(_),h(!0)}).catch(()=>h(!0)),F.getProposals(e||"owner").then(_=>{a(_),v(!0)}).catch(()=>v(!0)),F.getProposalsForApprover().then(_=>i(_)).catch(()=>i([])),F.getCredential("ai-config").then(_=>{c(_.configured),x(!0)}).catch(()=>x(!0))},[e]);ue("attestation-changed",g),ue("proposal-added",g),ue("proposal-resolved",g),ue("proposal-approved",g),ue("proposal-rejected",g),_t(g,3e5,e);const S=u&&f&&y&&p,E=Sf(t),T=E.active,k=E.expired,b=T.filter(_=>_.remaining_seconds!==null&&_.remaining_seconds<=fv),N=r.filter(_=>_.status==="pending"),I=w.filter(_=>_.state==="running"),D=w.filter(_=>_.state==="starting"),V=w.filter(_=>_.state==="not-running"||_.state==="error"),M=[];for(const _ of s)M.push({label:"Approval needed",detail:`${_.tool} — above-cap action under ${ls(_.profileId)}`,to:"/proposals",color:"var(--warning)"});for(const _ of N)M.push({label:"Approval pending",detail:`${_.tool} awaiting your approval`,to:"/proposals",color:"var(--warning)"});for(const _ of b){const Q=Math.ceil((_.remaining_seconds??0)/60);M.push({label:"Expiring soon",detail:`${_.title??ls(_.profile_id)} — ${Q} min remaining`,to:"/authorizations",color:"var(--warning)"})}for(const _ of k)M.push({label:"Expired",detail:_.title??ls(_.profile_id),to:"/authorizations",color:"var(--danger)"});for(const _ of V)M.push({label:_.state==="error"?"Integration error":"Integration stopped",detail:_.state==="error"&&(($=_.integration)!=null&&$.error)?`${_.manifest.name}: ${_.integration.error}`:`${_.manifest.name} is not running`,to:"/integrations",color:"var(--danger)"});for(const _ of D)M.push({label:"Integration starting",detail:`${_.manifest.name} is coming up…`,to:"/integrations",color:"var(--warning)"});return l||M.push({label:"AI Assistant",detail:"Not configured — needed for gate advisory",to:"/settings",color:"var(--text-tertiary)"}),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"page-header",children:o.jsx("h1",{className:"page-title",children:"Dashboard"})}),S&&o.jsx(dv,{aiConfigured:l,hasRunningIntegration:I.length>0,hasActiveAuth:T.length>0,hasAgentConnected:j>0,mcpEndpoint:`http://localhost:${window.location.port==="3400"?"3430":"7430"}`}),o.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(8rem, 1fr))",gap:"0.75rem",marginBottom:"1.5rem"},children:[o.jsx(Ge,{to:"/authorizations",style:{textDecoration:"none"},children:o.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[u?o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:T.length>0?"var(--success)":"var(--text-tertiary)"},children:T.length}):o.jsx(vn,{variant:"title"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Active"})]})}),o.jsx(Ge,{to:"/proposals",style:{textDecoration:"none"},children:o.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[f?o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:N.length>0?"var(--warning)":"var(--text-tertiary)"},children:N.length}):o.jsx(vn,{variant:"title"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pending Approvals"})]})}),o.jsx(Ge,{to:"/authorizations",style:{textDecoration:"none"},children:o.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[u?o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:k.length>0?"var(--danger)":"var(--text-tertiary)"},children:k.length}):o.jsx(vn,{variant:"title"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Expired"})]})}),o.jsx(Ge,{to:"/integrations",style:{textDecoration:"none"},children:o.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[p?o.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:I.length>0?"var(--success)":"var(--text-tertiary)"},children:I.length}):o.jsx(vn,{variant:"title"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Integrations Running"})]})})]}),M.length>0?o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:M.map((_,Q)=>o.jsx(Ge,{to:_.to,style:{textDecoration:"none"},children:o.jsxs("div",{className:"card",style:{padding:"0.75rem 1rem",display:"flex",alignItems:"center",gap:"0.75rem"},children:[o.jsx("span",{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",background:_.color,flexShrink:0}}),o.jsxs("div",{style:{flex:1,minWidth:0},children:[o.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,color:"var(--text-primary)"},children:_.label}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:_.detail})]}),o.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"›"})]})},Q))}):S?o.jsx("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:o.jsx("div",{style:{fontSize:"0.9rem",color:"var(--text-secondary)"},children:"All clear. Nothing needs your attention."})}):o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[o.jsx(is,{}),o.jsx(is,{}),o.jsx(is,{})]})]})}const mv=["Scope & Limits","Intent","Authorize"];function kf({currentStep:e,onStepClick:t}){const n=Bt();return o.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",marginBottom:"2.5rem"},children:[o.jsx("div",{style:{display:"flex",alignItems:"center",flex:1,overflow:"hidden"},children:mv.map((r,a)=>{const s=a+2,i=s<e,l=s===e;return o.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[a>0&&o.jsx("div",{style:{width:"1.5rem",height:"2px",background:i?"var(--accent)":"var(--border)",flexShrink:1}}),o.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[o.jsx("div",{className:`step-circle${i?" completed":""}${l?" current":""}`,onClick:i&&t?()=>t(s):void 0,style:i&&t?{cursor:"pointer"}:void 0,children:i?"✓":a+1}),o.jsx("span",{className:"step-label-text",style:{fontSize:"0.6rem",marginTop:"0.3rem",color:l?"var(--accent)":i?"var(--text-secondary)":"var(--text-tertiary)",fontWeight:l?600:400,textAlign:"center"},children:r})]})]},s)})}),o.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>n("/agent/new"),style:{flexShrink:0,fontSize:"0.8rem",marginTop:"0.15rem"},children:"Cancel"})]})}const Ic=40;function _e(e,t){if(t)return t.slice(0,Ic);const n=e.lastIndexOf("/"),r=n>=0?e.slice(n+1):e,a=r.indexOf("@"),s=a>=0?r.slice(0,a):r;return(s.charAt(0).toUpperCase()+s.slice(1)).slice(0,Ic)}function hv({profileId:e,bounds:t,groupName:n,domain:r,onSwitch:a}){return o.jsxs("div",{className:"context-strip",children:[n&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"context-strip-label",children:"Team:"}),o.jsxs("span",{children:[o.jsx("strong",{children:n}),r?` / ${r}`:""]})]}),e&&o.jsxs("span",{children:[o.jsx("strong",{children:"Profile:"})," ",_e(e)]}),t&&o.jsxs("span",{children:[o.jsx("strong",{children:"Bounds:"})," ",t]}),a&&o.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginLeft:"auto",padding:"0.2rem 0.5rem",fontSize:"0.7rem"},onClick:a,children:"Switch"})]})}function gv({integrationId:e,field:t,value:n,onChange:r,disabled:a}){const[s,i]=d.useState(null),[l,c]=d.useState(null),[u,h]=d.useState(!0);d.useEffect(()=>{let y=!1;return F.discoverScopeField(e,t).then(x=>{y||(i(x.options),h(!1))}).catch(x=>{y||(c(x instanceof Error?x.message:String(x)),h(!1))}),()=>{y=!0}},[e,t]);const f=new Set(n.split(",").map(y=>y.trim()).filter(Boolean)),v=y=>{const x=new Set(f);x.has(y)?x.delete(y):x.add(y),r(Array.from(x).join(","))};return u?o.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["Loading options from ",e,"…"]}):l||!s?o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--warning)",marginBottom:"0.5rem"},children:["Couldn't fetch options (",l??"no response","). Enter values manually, separated by commas."]}),o.jsx("input",{className:"form-input",type:"text",value:n,onChange:y=>r(y.target.value),disabled:a})]}):s.length===0?o.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["No options available from ",e," for this field."]}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:s.map(y=>{const x=y.extras??{},w=typeof x.access=="string"?x.access:void 0,j=w==="reader",m=x.primary===!0;return o.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.875rem",color:j?"var(--text-tertiary)":"var(--text-primary)",cursor:a||j?"not-allowed":"pointer"},title:j?"Read-only — you can authorize list/read but not writes":void 0,children:[o.jsx("input",{type:"checkbox",checked:f.has(String(y.value)),onChange:()=>v(String(y.value)),disabled:a||j}),o.jsx("span",{children:y.label||y.value}),m&&o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"primary"}),w&&o.jsxs("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["· ",w]})]},y.value)})})}function vv(e){return e.replace(/@.*$/,"").split("/").pop()??e}function yv(e,t){return t.displayName?t.displayName:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function xv(e){return e.type==="string"&&(e.format==="email"||e.format==="domain")}function wv(e){var t;return!!(e.enum&&((t=e.constraint)!=null&&t.enforceable.includes("subset")))}function Rc(e,t){const n=e.trim();return n?t==="email"?n.includes("@")&&n.indexOf(".",n.indexOf("@"))>-1:t==="domain"?n.includes(".")&&!n.includes("@"):!0:!1}function Sv(e){return!e||e==="count"?"":e==="minutes"?"min":e==="hours"?"hr":e==="days"?"days":e==="percent"?"%":e.startsWith("currency:")?e.slice(9):e}function jv(e){return e?e==="minutes"?15:e==="percent"?5:e.startsWith("currency:")?10:1:1}function kv(e){return e?e==="minutes"?[{value:15,label:"15m"},{value:30,label:"30m"},{value:60,label:"1h"},{value:120,label:"2h"},{value:240,label:"4h"}]:e==="hours"?[{value:1,label:"1h"},{value:4,label:"4h"},{value:8,label:"8h"},{value:24,label:"1d"}]:e==="days"?[{value:1,label:"1d"},{value:7,label:"1w"},{value:30,label:"1mo"},{value:90,label:"3mo"}]:e==="percent"?[{value:10,label:"10%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:100,label:"100%"}]:e.startsWith("currency:")?[{value:10,label:"10"},{value:50,label:"50"},{value:100,label:"100"},{value:500,label:"500"},{value:1e3,label:"1k"}]:[]:[]}function Cv(e,t){if(!e||!t)return"";const n=Number(e);if(!Number.isFinite(n)||n<=0)return"";if(t==="minutes"&&n>=60){const r=Math.floor(n/60),a=n%60;return a===0?`${r} hour${r!==1?"s":""}`:`${r}h ${a}m`}if(t==="hours"&&n>=24&&n%24===0){const r=n/24;return`${r} day${r!==1?"s":""}`}if(t==="days"){if(n>=30&&n%30===0)return`${n/30} month${n/30!==1?"s":""}`;if(n>=7&&n%7===0)return`${n/7} week${n/7!==1?"s":""}`}return""}function Nv({id:e,value:t,onChange:n,disabled:r,placeholder:a,unit:s}){const i=jv(s),l=kv(s),c=Sv(s),u=Cv(t,s),h=t===""?null:Number(t),f=()=>{const y=t===""?0:Number(t),x=y%i,w=x===0?y+i:y+(i-x);n(String(w))},v=()=>{const y=t===""?0:Number(t);if(y<=0)return;const x=y%i,w=x===0?y-i:y-x;n(String(Math.max(0,w)))};return o.jsxs("div",{className:"bounded-input",children:[o.jsxs("div",{className:"bounded-input-field",children:[o.jsx("button",{type:"button",className:"stepper-btn stepper-decrement",onClick:v,disabled:r||t===""||Number(t)<=0,"aria-label":"Decrease",children:"−"}),o.jsx("input",{id:e,className:"stepper-input",type:"number",min:0,step:i,value:t,placeholder:a??"0",onChange:y=>n(y.target.value),onFocus:y=>y.target.select(),disabled:r}),o.jsx("button",{type:"button",className:"stepper-btn stepper-increment",onClick:f,disabled:r,"aria-label":"Increase",children:"+"}),c&&o.jsx("span",{className:"bounded-input-unit","aria-hidden":"true",children:c})]}),l.length>0&&!r&&o.jsx("div",{className:"bounded-input-presets",role:"group","aria-label":"Quick presets",children:l.map(y=>o.jsx("button",{type:"button",className:`preset-chip${h===y.value?" preset-chip-selected":""}`,onClick:()=>n(String(y.value)),children:y.label},y.value))}),u&&o.jsxs("div",{className:"bounded-input-echo",children:["≈ ",u]})]})}function _c({htmlFor:e,label:t,description:n}){const[r,a]=d.useState(!1);return o.jsxs("div",{className:"field-label-with-tip",children:[o.jsx("label",{className:"form-label",htmlFor:e,children:t}),n&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"field-tip-trigger","aria-label":`What does "${t}" mean?`,"aria-expanded":r,onClick:()=>a(s=>!s),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onBlur:()=>a(!1),children:"i"}),r&&o.jsx("div",{className:"field-tip-bubble",role:"tooltip",children:n})]})]})}function bv({id:e,value:t,onChange:n,disabled:r,format:a,placeholder:s}){const[i,l]=d.useState(""),[c,u]=d.useState(!1),h=d.useRef(null),f=t?t.split(",").map(m=>m.trim()).filter(Boolean):[],v=m=>{const p=m.trim();if(!p)return;if(!Rc(p,a)){u(!0);return}u(!1);const g=f.includes(p)?f:[...f,p];n(g.join(",")),l("")},y=m=>{const p=f.filter((g,S)=>S!==m);n(p.join(","))},x=m=>{m.key==="Enter"||m.key===","||m.key==="Tab"?i.trim()&&(m.preventDefault(),v(i)):m.key==="Backspace"&&!i&&f.length>0&&y(f.length-1)},w=m=>{const p=m.clipboardData.getData("text");if(p.includes(",")){m.preventDefault();const S=p.split(",").map(T=>T.trim()).filter(Boolean).filter(T=>Rc(T,a)),E=[...new Set([...f,...S])];n(E.join(",")),l(""),u(!1)}},j=a==="email"?"Type email and press Enter...":"Type domain and press Enter...";return o.jsxs("div",{className:`tag-input${c?" tag-input-invalid":""}`,onClick:()=>{var m;return(m=h.current)==null?void 0:m.focus()},children:[f.map((m,p)=>o.jsxs("span",{className:"tag-pill",children:[m,!r&&o.jsx("button",{type:"button",className:"tag-remove",onClick:g=>{g.stopPropagation(),y(p)},"aria-label":`Remove ${m}`,children:"×"})]},m)),!r&&o.jsx("input",{ref:h,id:e,className:"tag-input-field",type:"text",value:i,onChange:m=>{l(m.target.value),u(!1)},onKeyDown:x,onPaste:w,onBlur:()=>{i.trim()&&v(i)},placeholder:f.length===0?s??j:""})]})}function Ev({id:e,options:t,value:n,onChange:r,disabled:a}){const s=n?n.split(",").map(l=>l.trim()).filter(Boolean):[],i=l=>{const c=s.includes(l)?s.filter(u=>u!==l):[...s,l];r(c.join(","))};return o.jsx("div",{className:"checkbox-group",id:e,children:t.map(l=>o.jsxs("label",{className:`checkbox-pill${s.includes(l)?" checkbox-pill-selected":""}`,children:[o.jsx("input",{type:"checkbox",checked:s.includes(l),onChange:()=>i(l),disabled:a}),o.jsx("span",{children:l})]},l))})}function zc({fieldKey:e,fieldDef:t,value:n,onChange:r,prefix:a,readOnly:s,twoColumn:i,discoveryIntegrationId:l}){const c=yv(e,t),u=`${a}-field-${e}`,h=o.jsx(o.Fragment,{children:wv(t)?o.jsx(Ev,{id:u,options:t.enum,value:n,onChange:f=>r(e,f),disabled:s}):(()=>{const f=t.boundType;return(f==null?void 0:f.kind)==="enum"&&Array.isArray(f.values)})()?o.jsxs("select",{id:u,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:s,children:[o.jsx("option",{value:"",children:"Select..."}),t.boundType.values.map(f=>o.jsx("option",{value:f,children:f},f))]}):"enum"in t&&t.enum?o.jsxs("select",{id:u,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:s,children:[o.jsx("option",{value:"",children:"Select..."}),t.enum.map(f=>o.jsx("option",{value:f,children:f},f))]}):t.type==="number"?o.jsx(Nv,{id:u,value:n,onChange:f=>r(e,f),disabled:s,unit:t.unit}):xv(t)?o.jsx(bv,{id:u,value:n,onChange:f=>r(e,f),disabled:s,format:t.format}):l?o.jsx(gv,{integrationId:l,field:e,value:n,onChange:f=>r(e,f),disabled:s}):o.jsx("input",{id:u,className:"form-input",type:"text",value:n,onChange:f=>r(e,f.target.value),disabled:s})});return i?o.jsxs("div",{className:"bounds-field-row",children:[o.jsx("div",{className:"bounds-field-label",children:o.jsx(_c,{htmlFor:u,label:c,description:t.description})}),o.jsx("div",{className:"bounds-field-input",children:h})]},`${a}-${e}`):o.jsxs("div",{className:"form-group",children:[o.jsx(_c,{htmlFor:u,label:c,description:t.description}),h]},`${a}-${e}`)}function Pv(e,t){if(!t)return"no-config";const n=t.caps,r=Array.isArray(t.approvers)&&t.approvers.length>0;if(!(n&&Object.keys(n).length>0))return r?"approvers-dormant":"no-config";let s=!1;for(const[i,l]of Object.entries(n)){const c=e[i];if(c===""||c===void 0)continue;const u=Number(c);if(!isNaN(u)&&u>l){s=!0;break}}return s?r?"above-approvers":"hard-ceiling":"within-cap"}function Tv(e,t){const n=new Set;if(!t)return n;for(const[r,a]of Object.entries(t)){const s=e[r];if(s===""||s===void 0)continue;const i=Number(s);!isNaN(i)&&i>a&&n.add(r)}return n}function Iv({profile:e,onConfirm:t,onCancel:n,readOnly:r,initialBounds:a,initialContext:s,initialFrame:i,profileConfig:l,approverNames:c,adminName:u}){const h=e.boundsSchema??e.frameSchema,f=e.contextSchema,v=h?Object.entries(h.fields).filter(([C])=>!(C==="profile"||C==="path")):[],y=f&&f.keyOrder.length>0?Object.entries(f.fields):[],x=a??i??{},w=s??{},j={};for(const[C]of v)j[C]=x[C]!==void 0?String(x[C]):"";const m={};for(const[C]of y)m[C]=w[C]!==void 0?String(w[C]):"";const[p,g]=d.useState(j),[S,E]=d.useState(m),[T,k]=d.useState(null);d.useEffect(()=>{const C=vv(e.id);F.getIntegrationManifests().then(({manifests:P})=>{const z=P.find(L=>L.profile===C&&L.contextDiscovery&&Object.keys(L.contextDiscovery).length>0);k(z??null)}).catch(()=>k(null))},[e.id]);const b=Pv(p,l),N=Tv(p,l==null?void 0:l.caps),I=(C,P)=>{g(z=>({...z,[C]:P}))},D=(C,P)=>{E(z=>({...z,[C]:P}))},V=()=>{const C={profile:e.id};for(const[z,L]of v)L.type==="number"?C[z]=p[z]===""?0:Number(p[z]):C[z]=p[z];const P={};for(const[z,L]of y)L.type==="number"?P[z]=S[z]===""?0:Number(S[z]):P[z]=S[z];return[C,P]},M=()=>{const[C,P]=V();t(C,P)},$=()=>{const C=(l==null?void 0:l.caps)??{},P={...p};for(const U of N)C[U]!==void 0&&(P[U]=String(C[U]));g(P);const z={profile:e.id};for(const[U,ne]of v)if(ne.type==="number"){const J=P[U]??"";z[U]=J===""?0:Number(J)}else z[U]=P[U]??"";const L={};for(const[U,ne]of y)ne.type==="number"?L[U]=S[U]===""?0:Number(S[U]):L[U]=S[U];t(z,L)},_=C=>{const P=l==null?void 0:l.caps;if(!P||P[C]===void 0)return null;const z=P[C],L=N.has(C);return b==="hard-ceiling"&&L?o.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--danger)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",z," — exceeds team ceiling"]}):b==="above-approvers"&&L?o.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--warning)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",z," — above cap"]}):o.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--success)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",z," ok"]})},Q=()=>{var C;if(b==="no-config")return null;if(b==="approvers-dormant"){const P=c&&c.length>0?c.join(", "):"the configured approvers";return o.jsxs("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--accent)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:[o.jsxs("div",{style:{fontWeight:600,color:"var(--accent)",marginBottom:"0.25rem"},children:["Profile approvers: ",P]}),o.jsxs("div",{children:["No caps are set on this profile, so ",P," won't gate any action under this authority. Your intent will still be encrypted and shared with them as an accountability record — they can read what you authorised, even though they aren't reviewing individual actions."]})]})}if(b==="within-cap")return o.jsx("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--border)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:o.jsx("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:"Within all team caps — your responsibility."})});if(b==="above-approvers"){const P=c&&c.length>0?c.join(", "):"the required approvers";return o.jsxs("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--warning)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:[o.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.25rem"},children:"Above team cap."}),o.jsxs("div",{children:[o.jsx("strong",{children:"Over-cap actions"})," will require approval from you and ",P,". Within-cap actions run per the mode you choose."]})]})}if(b==="hard-ceiling"){const P=Array.from(N)[0],z=P?(C=l==null?void 0:l.caps)==null?void 0:C[P]:void 0,L=u??"the team admin";return o.jsxs("div",{style:{marginTop:"0.75rem",padding:"0.75rem 1rem",border:"1px solid var(--danger)",borderRadius:"0.375rem",background:"var(--bg-elevated)",fontSize:"0.82rem"},children:[o.jsx("div",{style:{fontWeight:600,color:"var(--danger)",marginBottom:"0.25rem"},children:"Hard team ceiling."}),o.jsxs("div",{style:{marginBottom:"0.75rem"},children:["Team policy caps this at ",z??"the configured limit",". Lower your bound or ask ",L," to add an approver path above the cap."]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:$,children:"Save below cap"}),n&&o.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"})]})]})}return null},R=b==="hard-ceiling";return o.jsxs("div",{children:[y.length>0&&o.jsxs("div",{className:"context-section",children:[o.jsxs("div",{className:"bounds-section-header",children:[o.jsx("span",{className:"bounds-section-icon",children:"🛡"}),o.jsxs("div",{children:[o.jsx("div",{className:"bounds-section-title",children:"Allowed scope"}),o.jsx("div",{className:"bounds-section-subtitle",children:"Encrypted on your device, never sent to the SP"})]})]}),y.map(([C,P])=>{var L;const z=!!((L=T==null?void 0:T.contextDiscovery)!=null&&L[C]);return o.jsx(zc,{fieldKey:C,fieldDef:P,value:S[C],onChange:D,prefix:"context",readOnly:r,discoveryIntegrationId:z?T.id:void 0},`context-${C}`)})]}),v.length>0&&o.jsxs("div",{className:"bounds-section",children:[o.jsxs("div",{className:"bounds-section-header",children:[o.jsx("span",{className:"bounds-section-icon",children:"🔒"}),o.jsxs("div",{children:[o.jsx("div",{className:"bounds-section-title",children:"Limits"}),o.jsx("div",{className:"bounds-section-subtitle",children:"Enforced by the Service Provider"})]})]}),o.jsx("div",{className:"bounds-fields-grid",children:v.map(([C,P])=>{var z;return o.jsxs("div",{style:{display:"contents"},children:[o.jsx(zc,{fieldKey:C,fieldDef:P,value:p[C],onChange:I,prefix:"bounds",readOnly:r,twoColumn:!0}),b!=="no-config"&&((z=l==null?void 0:l.caps)==null?void 0:z[C])!==void 0&&o.jsx("div",{style:{gridColumn:"2 / 3",display:"flex",alignItems:"center",paddingBottom:"0.5rem"},children:_(C)})]},`bounds-${C}`)})}),Q()]}),o.jsx("button",{className:"btn btn-primary",onClick:M,disabled:R,style:{marginTop:"0.5rem"},children:r?"Next: Gates":"Next: Problem Statement"})]})}function Rv(e){var n;const t=e.match(/```(?:markdown|md)?\s*\n([\s\S]*?)```/);return((n=t==null?void 0:t[1])==null?void 0:n.trim())??null}function _v(e){return e.replace(/```(?:markdown|md)?\s*\n[\s\S]*?```/,"").trim()}const zv="Tell me what your agent should do — I'll help shape it. Or ask me to draft a full intent and we'll iterate.";function so({target:e,currentText:t,onApply:n,greeting:r,placeholder:a,title:s}){const[i,l]=d.useState([{role:"assistant",content:r??zv}]),[c,u]=d.useState(""),[h,f]=d.useState(!1),[v,y]=d.useState(null),x=d.useRef(null);d.useEffect(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[i,h]);const w=async()=>{const m=c.trim();if(!m||h)return;const p=[...i,{role:"user",content:m}];l(p),u(""),y(null),f(!0);try{const g=await F.aiChat({target:e,currentText:t,messages:p.filter((S,E)=>!(E===0&&S.role==="assistant"))});g.success&&g.reply?l(S=>[...S,{role:"assistant",content:g.reply}]):y(g.error??"AI returned no reply")}catch(g){y(g instanceof Error?g.message:"Chat failed")}finally{f(!1)}},j=m=>{m.key==="Enter"&&!m.shiftKey&&!m.nativeEvent.isComposing&&(m.preventDefault(),w())};return o.jsxs("div",{className:"intent-chat",children:[o.jsx("h3",{className:"card-title",children:s??"AI Assistant"}),o.jsxs("div",{ref:x,className:"chat-messages",children:[i.map((m,p)=>{const g=m.role==="assistant"?Rv(m.content):null,S=g?_v(m.content):m.content;return o.jsx("div",{className:`chat-msg ${m.role}`,children:o.jsxs("div",{className:"chat-msg-body",children:[S&&o.jsx("div",{className:"chat-msg-prose",children:S}),g!==null&&o.jsxs(o.Fragment,{children:[o.jsx("pre",{className:"chat-fenced-block",children:g}),o.jsx("button",{type:"button",className:"btn btn-primary btn-sm chat-apply-btn",onClick:()=>n(g),children:"Apply this draft"})]})]})},p)}),h&&o.jsx("div",{className:"chat-msg assistant",children:o.jsx("div",{className:"chat-msg-body chat-msg-thinking",children:"Thinking…"})})]}),v&&o.jsx("div",{className:"error-message",children:v}),o.jsxs("div",{className:"chat-composer",children:[o.jsxs("div",{className:"chat-composer-pill",children:[o.jsx("textarea",{className:"chat-input",value:c,onChange:m=>u(m.target.value),onKeyDown:j,placeholder:a??"Ask for help articulating the intent…",rows:1,disabled:h}),o.jsx("button",{type:"button",className:"chat-send-btn",onClick:w,disabled:h||!c.trim(),"aria-label":"Send",children:"↑"})]}),o.jsx("div",{className:"chat-composer-hint",children:"Enter to send · Shift+Enter for newline"})]})]})}function Cf({open:e,onClose:t,children:n,ariaLabel:r}){const a=d.useRef(null),s=d.useRef(null);return d.useEffect(()=>{var l;if(!e)return;s.current=document.activeElement,document.body.style.overflow="hidden";const i=c=>{c.key==="Escape"&&t()};return document.addEventListener("keydown",i),(l=a.current)==null||l.focus(),()=>{document.removeEventListener("keydown",i),document.body.style.overflow="",s.current instanceof HTMLElement&&s.current.focus()}},[e,t]),Qd.createPortal(o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`bottom-sheet-backdrop${e?" is-open":""}`,onClick:t,"aria-hidden":"true"}),o.jsxs("aside",{ref:a,className:`bottom-sheet${e?" is-open":""}`,role:"dialog","aria-modal":"true","aria-label":r,tabIndex:-1,children:[o.jsx("div",{className:"bottom-sheet-handle","aria-hidden":"true"}),o.jsx("button",{type:"button",className:"bottom-sheet-close",onClick:t,"aria-label":"Close",children:"×"}),n]})]}),document.body)}const Ac=`Why — What's the situation? Why does this need to happen?
56
56
 
57
57
  Goal — What should the agent try to achieve?
58
58
 
59
- Watch out — What should the agent avoid or be careful about?`;function _y(){var $;const e=Bt(),[t]=mf(),n=Number(t.get("step"))||2,[r,a]=d.useState(null),[s,i]=d.useState(null),[l,c]=d.useState(n),[u,h]=d.useState(null),[f,g]=d.useState(null),[v,x]=d.useState(zc),[w,j]=d.useState(!1),[m,p]=d.useState(!0),[y,S]=d.useState(null),[b,T]=d.useState([]),[k,E]=d.useState(void 0);d.useEffect(()=>{var C;const R=sessionStorage.getItem("agentAuth");if(!R){e("/agent/new");return}const Y=JSON.parse(R);a(Y);const _=sessionStorage.getItem("agentGate");if(_){const P=JSON.parse(_);P.bounds&&h(P.bounds),P.context&&g(P.context),(C=P.gateContent)!=null&&C.intent&&x(P.gateContent.intent)}F.getProfile(Y.profileId).then(P=>i(P)).catch(()=>e("/agent/new")).finally(()=>p(!1)),Y.groupId&&Promise.all([F.getTeamProfileConfig(Y.groupId,Y.profileId).catch(()=>null),F.getGroupById(Y.groupId).catch(()=>null),F.listUsers().catch(()=>[])]).then(([P,z,L])=>{if(S(P),P){const U=new Map;for(const O of L){const B=O.name&&O.email?`${O.name} (${O.email})`:O.name||O.email||O.id;U.set(O.id,B)}const ne=(z==null?void 0:z.members)??[];for(const O of ne){const B=O.userId??O.id;B&&(O.name&&O.email?U.set(B,`${O.name} (${O.email})`):O.name&&U.set(B,O.name))}const J=(P.approvers??[]).map(O=>U.get(O)??O);T(J);const ye=ne.find(O=>O.role==="admin");if(ye){const O=ye.userId??ye.id;O&&E(U.get(O)??ye.name)}}})},[e]);const N=u?Object.entries(u).filter(([R])=>R!=="profile"&&R!=="path").map(([R,Y])=>`${R} = ${Y}`).join(", "):"",I=(R,Y)=>{h(R),g(Y),c(3)},D=v.trim()!==zc.trim()&&v.trim()!=="",V=R=>{D&&!confirm("Replace your current intent with the AI draft?")||x(R)},M=()=>{const R=s==null?void 0:s.ttl,Y={intent:v};sessionStorage.setItem("agentGate",JSON.stringify({bounds:u,context:f,gateContent:Y,ttlConfig:R})),e("/agent/review")};return m||!r||!s?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):o.jsxs(o.Fragment,{children:[o.jsx(jf,{currentStep:l,onStepClick:R=>{R>=2&&c(R)}}),o.jsx(fy,{profileId:r.profileId,bounds:N||void 0,groupName:r.groupName,domain:r.domain}),l===2&&o.jsx("div",{className:"card",children:o.jsx(by,{profile:s,onConfirm:I,onCancel:()=>e("/agent/new"),initialBounds:u||void 0,initialContext:f||void 0,profileConfig:y,approverNames:b,adminName:k})}),l===3&&o.jsxs("div",{className:"intent-layout",children:[o.jsx("div",{className:"card intent-pane chat",children:o.jsx(so,{target:{kind:"intent",profileId:r.profileId,bounds:N||void 0},currentText:v,onApply:V})}),o.jsxs("div",{className:"card intent-pane document",children:[o.jsx("h3",{className:"card-title",children:"What should your agent know?"}),o.jsx("textarea",{className:"intent-textarea",value:v,onChange:R=>x(R.target.value)}),o.jsxs("div",{className:"char-counter",children:[v.length," / 2000"]}),o.jsxs("div",{className:"intent-footer",children:[o.jsx("button",{className:"btn btn-ghost",onClick:()=>c(2),children:"Back"}),o.jsx("button",{className:"btn btn-primary intent-continue-btn",onClick:M,disabled:!D,children:"Continue to Review"})]}),((($=y==null?void 0:y.approvers)==null?void 0:$.length)??0)>0&&o.jsxs("div",{className:"hint-box",role:"note",children:[o.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"i"}),o.jsxs("div",{className:"hint-body",children:[o.jsxs("div",{className:"hint-head",children:["Visible to ",b.length>0?b.join(", "):"the configured approvers"]}),"Your intent will be encrypted and shared with"," ",b.length>0?b.join(", "):"this profile's required approvers",". Only they can decrypt it — your Service Provider cannot. Each approver stores a copy as their accountability record."]})]})]}),o.jsx("button",{type:"button",className:"floating-help",onClick:()=>j(!0),"aria-label":"Open intent assistant",children:"Get help with intent"}),o.jsx(kf,{open:w,onClose:()=>j(!1),ariaLabel:"Intent assistant",children:o.jsx(so,{target:{kind:"intent",profileId:r.profileId,bounds:N||void 0},currentText:v,onApply:R=>{V(R),j(!1)}})})]})]})}async function io(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}async function Cf(e,t){const n=t.boundsSchema??t.frameSchema;if(!n)throw new Error("Profile has no boundsSchema or frameSchema");const a=n.keyOrder.map(i=>`${i}=${String(e[i])}`).join(`
60
- `);return`sha256:${await io(a)}`}async function Nf(e,t){if(!t.contextSchema||t.contextSchema.keyOrder.length===0)return`sha256:${await io("")}`;const r=t.contextSchema.keyOrder.map(s=>`${s}=${String(e[s])}`).join(`
61
- `);return`sha256:${await io(r)}`}async function lo(e){return`sha256:${await io(e)}`}function Ef(e,t){return{frameHash:e.frame_hash??e.bounds_hash??t.boundsHash,boundsHash:e.bounds_hash??t.boundsHash,contextHash:t.contextHash,context:t.context,gateContent:t.gateContent,...t.path?{path:t.path}:{}}}function Ry(){var Q,G;const e=Bt(),{user:t,mode:n,domain:r}=Ce(),[a,s]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(null),[h,f]=d.useState("immediate"),[g,v]=d.useState(1800),[x,w]=d.useState(86400),[j,m]=d.useState(""),[p,y]=d.useState("hours"),[S,b]=d.useState(""),[T,k]=d.useState(!1),[E,N]=d.useState(""),[I,D]=d.useState(null),[V,M]=d.useState([]),[$,R]=d.useState(!1);d.useEffect(()=>{const K=sessionStorage.getItem("agentAuth"),ae=sessionStorage.getItem("agentGate");if(!K||!ae){e("/agent/new");return}const ve=JSON.parse(K),vt=JSON.parse(ae),un={bounds:vt.bounds??{},context:vt.context??{},gateContent:vt.gateContent};s(ve),l(un),vt.ttlConfig&&(v(vt.ttlConfig.default??1800),w(vt.ttlConfig.max??86400)),F.getProfile(ve.profileId).then(Ve=>{var ct;if(u(Ve),!S){const Ae=Ve.name??((ct=ve.profileId.split("/").pop())==null?void 0:ct.replace(/@.*$/,""))??"",Oe=[];if(un.context&&Ve.contextSchema)for(const et of Ve.contextSchema.keyOrder){const te=un.context[et];if(te!==void 0&&te!==""){const bt=String(te).split(",").map(W=>W.trim()).filter(Boolean);Oe.push(bt.join(", "))}}const Dt=Oe.length>0?`${Ae}: ${Oe.join(" · ")}`:Ae;b(Dt)}}).catch(()=>{}),ve.groupId?Promise.all([F.getTeamProfileConfig(ve.groupId,ve.profileId).catch(()=>null),F.getGroupById(ve.groupId).catch(()=>null),F.listUsers().catch(()=>[])]).then(([Ve,ct,Ae])=>{if(D(Ve),Ve){const Oe=new Map;for(const te of Ae){const bt=te.name&&te.email?`${te.name} (${te.email})`:te.name||te.email||te.id;Oe.set(te.id,bt)}const Dt=(ct==null?void 0:ct.members)??[];for(const te of Dt){const bt=te.userId??te.id;bt&&(te.name&&te.email?Oe.set(bt,`${te.name} (${te.email})`):te.name&&Oe.set(bt,te.name))}const et=(Ve.approvers??[]).map(te=>Oe.get(te)??te);M(et)}}).finally(()=>{R(!0)}):R(!0)},[e]);const Y=async()=>{if(!(!a||!i||!c||!t)){if(!a.groupId){N("No active group; cannot create authorization.");return}k(!0),N("");try{const K=r||a.domain||"owner",ae=await Cf(i.bounds,c),ve=await Nf(i.context,c),[vt,un]=await Promise.all([lo(i.gateContent.intent),lo(JSON.stringify({profile:a.profileId,domain:K,group:a.groupId}))]);let Ve,ct,Ae;if(a.isTeam){const et=await F.getApproversPubkeys(a.groupId,a.profileId);if(et.length>0){const te=await F.encryptIntent(i.gateContent.intent,et);Ve=te.intentCiphertext,ct=te.encryptedKeys,Ae=te.approversFrozen}}const Oe=await F.attest({profile_id:a.profileId,bounds:i.bounds,bounds_hash:ae,context_hash:ve,domain:K,did:t.did,gate_content_hashes:{intent:vt},execution_context_hash:un,group_id:a.groupId,ttl:g,commitment_mode:h==="per-action"?"review":"automatic",title:S.trim(),intent_ciphertext:Ve,encrypted_keys:ct,approvers_frozen:Ae}),Dt=Oe.frame_hash??Oe.bounds_hash??ae;try{await F.pushGateContent(Ef(Oe,{boundsHash:ae,contextHash:ve,context:i.context,gateContent:i.gateContent}))}catch(et){try{await F.revokeAttestation(Dt,"Auto-revoked: gate content push failed")}catch{}throw new Error(`Authorization signed but gate content delivery failed. The attestation was revoked. Please try again. (${et instanceof Error?et.message:"Unknown error"})`)}sessionStorage.removeItem("agentAuth"),sessionStorage.removeItem("agentGate"),e(`/authorizations?highlight=${encodeURIComponent(Dt)}`)}catch(K){N(K instanceof Error?K.message:"Attestation failed")}finally{k(!1)}}};if(!a||!i)return o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."});const _=Object.entries(i.bounds).filter(([K])=>K!=="profile"&&K!=="path"),C=Object.entries(i.context),z=((I==null?void 0:I.caps)!=null?Object.keys(I.caps):[]).length!==0,L=V.length>0?V.join(", "):((I==null?void 0:I.approvers)??[]).join(", "),U=z?`Within-cap actions run per the mode you choose above. Over-cap actions will require approval from you and ${L}, regardless of your mode.`:"No caps set — they won't gate any action, but your intent is encrypted and shared with them as an accountability record.",ne=z?`Over-cap actions will be reviewed by you and ${L}. Within-cap actions run per the mode you chose above.`:`Approvers ${L} can read your intent but won't gate any action — no caps configured on this profile.`,J=!!((Q=I==null?void 0:I.approvers)!=null&&Q.length),ye=g>x,O={flex:1,padding:"0.75rem",border:h==="immediate"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:h==="immediate"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},B={flex:1,padding:"0.75rem",border:h==="per-action"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:h==="per-action"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"};return o.jsxs(o.Fragment,{children:[o.jsx(jf,{currentStep:4,onStepClick:K=>{K<=3&&e(`/agent/gate?step=${K}`)}}),o.jsxs("div",{className:"card",children:[o.jsx("h3",{className:"card-title",style:{marginBottom:"0.25rem"},children:"Review & Commit"}),o.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"1.5rem"},children:"Review your authorization details before signing."}),E&&o.jsx("div",{className:"error-message",children:E}),o.jsxs("dl",{className:"review-grid",children:[o.jsx("dt",{children:"Profile"}),o.jsxs("dd",{children:[Re(a.profileId),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:a.profileId})]}),a.groupName&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Team"}),o.jsx("dd",{children:a.groupName})]}),a.groupId&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Approvers"}),o.jsx("dd",{children:$?(((G=I==null?void 0:I.approvers)==null?void 0:G.length)??0)===0?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"None — solo authorization"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:"No approvers configured for this profile in this team. Your intent stays on your gateway."})]}):o.jsxs(o.Fragment,{children:[L,o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:U})]}):o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Loading…"})})]}),o.jsx("dt",{children:"TTL"}),o.jsx("dd",{children:"30 minutes"})]}),!!_.length&&o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Bounds"}),o.jsx("dl",{className:"review-grid",children:_.map(([K,ae])=>o.jsxs("span",{style:{display:"contents"},children:[o.jsx("dt",{children:K}),o.jsx("dd",{children:String(ae)})]},K))})]}),!!C.length&&o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Context"}),o.jsx("dl",{className:"review-grid",children:C.map(([K,ae])=>o.jsxs("span",{style:{display:"contents"},children:[o.jsx("dt",{children:K}),o.jsx("dd",{children:String(ae)})]},K))})]}),o.jsx("div",{className:"gate-content-block",children:o.jsxs("div",{className:"gate-content-item",children:[o.jsx("div",{className:"gate-content-label",children:"Intent"}),o.jsx("div",{className:"gate-content-text",children:i.gateContent.intent})]})}),o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.5rem"},children:"Commitment"}),o.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"1.25rem"},children:[o.jsxs("button",{onClick:()=>f("immediate"),style:O,children:[o.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Automatic"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Agent acts freely within your limits."})]}),o.jsxs("button",{onClick:()=>f("per-action"),style:B,children:[o.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Review Each Action"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"You review and approve each action before it executes."})]})]}),o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"Duration"}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginBottom:"1.25rem",alignItems:"center"},children:[[{label:"1 hour",seconds:3600},{label:"24 hours",seconds:86400},{label:"7 days",seconds:604800},{label:"30 days",seconds:2592e3},{label:"1 year",seconds:31536e3}].filter(K=>K.seconds<=x).map(K=>o.jsx("button",{onClick:()=>{v(K.seconds),m("")},style:{padding:"0.5rem 0.85rem",border:g===K.seconds?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"0.375rem",background:g===K.seconds?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"inherit",color:"var(--text-primary)"},children:K.label},K.seconds)),o.jsxs("div",{style:{display:"flex",gap:"0.375rem",alignItems:"center"},children:[o.jsx("input",{type:"number",className:"form-input",style:{width:"5rem",padding:"0.45rem 0.6rem",fontSize:"0.85rem"},placeholder:"Custom",value:j,onChange:K=>{m(K.target.value);const ae=parseInt(K.target.value,10);if(ae>0){const ve=p==="days"?ae*86400:ae*3600;v(Math.min(ve,x))}}}),o.jsxs("select",{className:"form-input",style:{padding:"0.45rem 0.5rem",fontSize:"0.85rem"},value:p,onChange:K=>{y(K.target.value);const ae=parseInt(j,10);if(ae>0){const ve=K.target.value==="days"?ae*86400:ae*3600;v(Math.min(ve,x))}},children:[o.jsx("option",{value:"hours",children:"hours"}),o.jsx("option",{value:"days",children:"days"})]})]}),ye&&o.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--danger)"},children:["Maximum: ",x>=86400?`${Math.floor(x/86400)} days`:`${Math.floor(x/3600)} hours`]})]}),o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"Title"}),o.jsxs("div",{style:{marginBottom:"1.25rem"},children:[o.jsx("input",{type:"text",className:"form-input",placeholder:`e.g. ${Re(a.profileId)}: daily operations`,value:S,onChange:K=>b(K.target.value),maxLength:80,style:{fontSize:"0.9rem"}}),o.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"A short name to identify this authorization on your dashboard."})]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("button",{className:"btn btn-ghost",onClick:()=>e("/agent/gate"),children:"Back"}),o.jsx("button",{className:"btn btn-primary btn-lg",style:{flex:1},onClick:Y,disabled:T||!S.trim(),children:T?"Signing...":h==="immediate"?"Authorize":"Authorize (Review Mode)"})]}),o.jsx("div",{style:{marginTop:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)",textAlign:"center",display:J?"block":"none"},children:ne})]})]})}const zy={card:"💳",mail:"✉️"};function Ay({manifest:e,integration:t,state:n,onStatusChange:r,onSuccess:a}){var ye;const[s,i]=d.useState({}),[l,c]=d.useState(!1),[u,h]=d.useState(!1),[f,g]=d.useState({}),[v,x]=d.useState(!1),[w,j]=d.useState(null),[m,p]=d.useState(!1),[y,S]=d.useState(!1),[b,T]=d.useState(!1),[k,E]=d.useState(!1),[N,I]=d.useState({});d.useEffect(()=>{let O=!1;return F.getCredential(e.id).then(B=>{var Q;if(!(O||!B.configured)){if(c(!0),h(!0),B.fields){const G={};for(const K of e.credentials.fields)B.fields[K.key]!=null&&(G[K.key]=B.fields[K.key]);g(G)}if(e.oauth){const G=((Q=B.fieldNames)==null?void 0:Q.includes(e.oauth.tokenStorage))??!1;x(G),G&&F.getOAuthHealth(e.id).then(K=>{O||j(K)})}}}).catch(()=>{}),()=>{O=!0}},[e.id,e.oauth]);const D=!!e.oauth||e.credentials.fields.some(O=>!O.optional),V=e.oauth?v:l,M=!D||V,$=n==="starting"?"starting":M?t!=null&&t.running?"running":!l&&e.credentials.fields.length>0?"unconfigured":"ready":e.oauth&&l&&!v?"needs-oauth":"unconfigured",R=async()=>{if(e.credentials.fields.some(B=>{var Q;return(Q=s[B.key])==null?void 0:Q.trim()})){p(!0);try{await F.setCredential(e.id,s),c(!0),i({}),e.oauth?a(`${e.name} credentials saved!`):(a(`${e.name} credentials saved — starting integration...`),await C())}catch{a(`Failed to save ${e.name} credentials`)}finally{p(!1)}}},Y=async()=>{if(e.credentials.fields.some(B=>{var Q;return(Q=s[B.key])==null?void 0:Q.trim()})){p(!0);try{await F.setCredential(e.id,s),i({}),c(!0),e.oauth?a(`${e.name} credentials saved — now click Connect.`):(E(!1),a(`${e.name} credentials updated — restarting...`),await C())}catch{a(`Failed to update ${e.name} credentials`)}finally{p(!1)}}},_=()=>{window.open(`/auth/oauth/${e.id}/start`,"_blank","width=600,height=700");const O=setInterval(async()=>{var B;try{const Q=await F.getCredential(e.id);Q.configured&&e.oauth&&((B=Q.fieldNames)!=null&&B.includes(e.oauth.tokenStorage))&&(x(!0),E(!1),j(null),clearInterval(O),a(`${e.name} connected — starting integration...`),F.getOAuthHealth(e.id).then(j).catch(()=>{}),await C())}catch{}},2e3);setTimeout(()=>clearInterval(O),12e4)},C=async()=>{T(!0);try{const O=await F.activateIntegration(e.id);O.warning?a(O.warning):a(`${e.name} integration started with ${O.tools.length} tools`),r()}catch(O){a(`Failed to start ${e.name}: ${O instanceof Error?O.message:"Unknown error"}`)}finally{T(!1)}},P=async()=>{try{await F.removeMcpIntegration(e.id),a(`${e.name} integration removed`),r()}catch{a(`Failed to remove ${e.name}`)}},z=zy[e.icon]??"🔧",L=$==="running"?{c:"int-chip-ok",t:"Running"}:$==="starting"?{c:"int-chip-idle",t:"Starting"}:t&&!t.running&&t.error?{c:"int-chip-bad",t:"Crashed"}:{c:"int-chip-idle",t:"Stopped"},U=e.oauth&&v&&(w==null?void 0:w.status)==="failed",ne=D?U?{c:"int-chip-bad",t:"Auth failed"}:V?{c:"int-chip-ok",t:"Auth OK"}:{c:"int-chip-idle",t:"Not set up"}:{c:"int-chip-idle",t:"No auth"},J=O=>O.replace(/https?:\/\/[^\s)]+\/auth\/oauth\/[a-z-]+\/callback/gi,`${window.location.origin}/auth/oauth/${e.id}/callback`);return o.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem"},children:[o.jsx("span",{style:{fontSize:"1.4rem",lineHeight:1.2},children:z}),o.jsx("h3",{className:"card-title",style:{margin:0,flex:1,alignSelf:"center"},children:e.name}),o.jsxs("div",{style:{display:"flex",gap:"0.4rem",flexWrap:"wrap",justifyContent:"flex-end"},children:[$!=="unconfigured"&&$!=="needs-oauth"&&o.jsxs("span",{className:`int-chip ${L.c}`,children:[o.jsx("span",{className:"int-dot"}),L.t]}),o.jsxs("span",{className:`int-chip ${ne.c}`,children:[o.jsx("span",{className:"int-dot"}),ne.t]})]})]}),e.oauth&&v&&o.jsx("div",{className:"int-account",style:{marginTop:"0.7rem"},children:w!=null&&w.account?o.jsxs(o.Fragment,{children:["Connected as ",o.jsx("b",{children:w.account})]}):o.jsx("span",{className:"int-none",children:"Account not recorded — reconnect to capture which account is used"})}),U&&!k&&o.jsxs("div",{style:{marginTop:"0.7rem"},children:[o.jsxs("div",{className:"status-banner status-banner-error",style:{marginBottom:"0.6rem"},children:[o.jsx("span",{className:"status-banner-icon",children:"!"}),o.jsxs("span",{className:"status-banner-text",children:["Authentication failed",w!=null&&w.error?` — ${w.error}`:"",". Reconnect to restore access."]})]}),o.jsxs("button",{className:"btn btn-primary btn-sm",onClick:_,children:["Reconnect ",e.name]})]}),o.jsxs("details",{className:"int-details",style:{marginTop:"0.85rem",marginBottom:"1.25rem"},children:[o.jsx("summary",{children:"Details"}),o.jsxs("div",{className:"int-meta",children:[o.jsx("span",{className:"int-k",children:"What"}),o.jsx("span",{children:e.description}),e.profile&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"int-k",children:"Profile"}),o.jsx("span",{children:e.profile})]}),e.oauth&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"int-k",children:"Scopes"}),o.jsx("span",{children:((ye=e.oauth.scopes)==null?void 0:ye.join(", "))||"—"})]}),t&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"int-k",children:"Tools"}),o.jsxs("span",{children:[t.toolCount," gated"]})]})]})]}),e.setupGuide&&e.setupGuide.length>0&&($!=="running"||U)&&o.jsxs("div",{style:{marginBottom:"0.75rem"},children:[o.jsxs("button",{onClick:()=>S(!y),style:{background:"none",border:"none",padding:0,fontSize:"0.8rem",color:"var(--accent)",cursor:"pointer",display:"flex",alignItems:"center",gap:"0.375rem"},children:[o.jsx("span",{style:{transition:"transform 0.2s",transform:y?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"}),"How to set up ",e.name]}),y&&o.jsx("div",{style:{marginTop:"0.75rem",paddingLeft:"0.25rem"},children:e.setupGuide.map((O,B)=>o.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"0.75rem"},children:[o.jsx("div",{style:{width:"1.5rem",height:"1.5rem",borderRadius:"50%",background:"var(--border)",color:"var(--text-secondary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.7rem",fontWeight:700,flexShrink:0,marginTop:"0.1rem"},children:B+1}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.125rem"},children:O.title}),o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",lineHeight:1.5},children:[J(O.description),O.link&&o.jsxs(o.Fragment,{children:[" ",o.jsxs("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"0.8rem"},children:["Open ","↗"]})]})]})]})]},B))})]}),$==="starting"&&o.jsxs("div",{className:"service-status",style:{color:"var(--warning)"},children:[o.jsx("span",{className:"service-status-dot",style:{background:"var(--warning)"}}),"Starting…"]}),k&&o.jsxs("div",{style:{marginTop:"0.7rem",paddingTop:"0.85rem",borderTop:"1px solid var(--border)"},children:[o.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,marginBottom:"0.5rem"},children:"Change credentials"}),u&&o.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-muted)",marginBottom:"0.6rem"},children:["Your current values are filled in below (secret hidden — click ","“","show","”","). Edit them, then",e.oauth?" Save and Connect to re-link the account.":" Save to apply."]}),e.credentials.fields.map(O=>o.jsxs("div",{className:"form-group",style:{marginBottom:"0.6rem"},children:[o.jsx("label",{className:"form-label",children:O.label}),O.type==="password"?o.jsxs("div",{className:"cred-field",children:[o.jsx("input",{className:"form-input",type:N[O.key]?"text":"password",placeholder:O.placeholder,value:s[O.key]||"",onChange:B=>i(Q=>({...Q,[O.key]:B.target.value}))}),o.jsx("button",{className:"cred-toggle",onClick:()=>I(B=>({...B,[O.key]:!B[O.key]})),children:N[O.key]?"hide":"show"})]}):o.jsx("input",{className:"form-input",type:"text",placeholder:O.placeholder,value:s[O.key]||"",onChange:B=>i(Q=>({...Q,[O.key]:B.target.value}))})]},O.key)),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginTop:"0.25rem"},children:[o.jsx("button",{className:"btn btn-primary btn-sm",onClick:Y,disabled:m,children:m?"Saving…":"Save"}),e.oauth&&o.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:_,children:["Connect ",e.name]}),o.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>{E(!1),i({})},children:"Cancel"})]})]}),!k&&$==="running"&&t&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[o.jsx(Ge,{to:"/agent/new",className:"btn btn-primary btn-sm",style:{textDecoration:"none"},children:"Authorize agent"}),(e.credentials.fields.length>0||e.oauth)&&o.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>{i({...f}),E(!0)},title:"Re-enter client ID / secret (e.g. a new OAuth client).",children:"Change credentials"}),o.jsx("span",{style:{flex:1}}),o.jsx("button",{className:"btn btn-sm btn-ghost",style:{color:"var(--danger)"},onClick:P,title:"Stops the subprocess and removes the integration from the registry. It will NOT auto-start on next gateway restart. Re-enable with Install.",children:"Disable"})]}),o.jsx("div",{style:{display:"none"},children:o.jsx(Ge,{to:"/agent/new",className:"btn btn-ghost btn-sm",style:{textDecoration:"none",display:"block",textAlign:"center"},children:"Authorize your agent"})})]}),$==="unconfigured"&&(()=>{const O=e.credentials.fields.every(G=>G.optional),B=e.credentials.fields.some(G=>!G.optional),Q=e.credentials.fields.some(G=>{var K;return(K=s[G.key])==null?void 0:K.trim()});return o.jsxs(o.Fragment,{children:[u&&o.jsxs("div",{className:"alert",style:{fontSize:"0.8rem",background:"var(--bg-main)",border:"1px solid var(--border)",borderRadius:"0.375rem",padding:"0.5rem 0.75rem",marginBottom:"0.75rem",color:"var(--text-secondary)"},children:[o.jsx("strong",{style:{color:"var(--text-primary)"},children:"Credentials on file."})," ","Existing values are encrypted in the vault and not shown. Enter new values below to replace them, or"," ",o.jsx("button",{onClick:()=>{c(!0),e.oauth&&x(!0)},style:{background:"none",border:"none",padding:0,color:"var(--accent)",cursor:"pointer",textDecoration:"underline"},children:"keep existing"}),"."]}),e.oauth&&!u&&o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"Step 1 of 2 — enter credentials, then connect your account."}),e.setupHint&&!u&&o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:e.setupHint}),e.credentials.fields.map(G=>o.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[o.jsx("label",{className:"form-label",children:G.label}),G.type==="password"?o.jsxs("div",{className:"cred-field",children:[o.jsx("input",{className:"form-input",type:N[G.key]?"text":"password",placeholder:G.placeholder,value:s[G.key]||"",onChange:K=>i(ae=>({...ae,[G.key]:K.target.value}))}),o.jsx("button",{className:"cred-toggle",onClick:()=>I(K=>({...K,[G.key]:!K[G.key]})),children:N[G.key]?"hide":"show"})]}):o.jsx("input",{className:"form-input",type:"text",placeholder:G.placeholder,value:s[G.key]||"",onChange:K=>i(ae=>({...ae,[G.key]:K.target.value}))})]},G.key)),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[Q&&o.jsx("button",{className:"btn btn-primary",onClick:R,disabled:m||B&&!e.credentials.fields.filter(G=>!G.optional).every(G=>{var K;return(K=s[G.key])==null?void 0:K.trim()}),children:m?"Saving...":"Save & Encrypt"}),O&&!Q&&o.jsx("button",{className:"btn btn-primary",onClick:C,disabled:b,children:b?"Starting...":`Activate ${e.name}`})]})]})})(),$==="needs-oauth"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.25rem"},children:["✓"," Step 1 done — credentials saved"]}),o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["Step 2: connect your ",e.name," account to authorize access."]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[o.jsxs("button",{className:"btn btn-primary",onClick:_,children:["Connect ",e.name," Account"]}),o.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Change Credentials"})]})]}),$==="ready"&&!t&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.75rem"},children:["✓"," ",e.oauth?`${e.name} account connected`:"Credentials configured"]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[o.jsx("button",{className:"btn btn-primary",onClick:C,disabled:b,children:b?"Starting...":`Start ${e.name} Integration`}),!e.oauth&&o.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Update Credentials"}),e.oauth&&o.jsx("button",{className:"btn btn-ghost",onClick:()=>{c(!1),x(!1)},children:"Change Credentials"})]})]}),$==="ready"&&t&&!t.running&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"service-status service-status-error",style:{marginBottom:"0.75rem"},children:[o.jsx("span",{className:"service-status-dot"}),"Not running"]}),t.error&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--danger)",marginBottom:"0.75rem"},children:t.error}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("button",{className:"btn btn-primary",onClick:C,disabled:b,children:b?"Starting...":"Start"}),o.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:P,children:"Disable"})]})]})]})}function $y(){const{loading:e,mcpServerUp:t,manifestsError:n,entries:r,refresh:a}=ul(),[s,i]=d.useState(""),l=d.useCallback(c=>{i(c),setTimeout(()=>i(""),5e3)},[]);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{className:"page-title",children:"Integrations"}),o.jsx("p",{className:"page-subtitle",children:"Connect external services and manage MCP integrations."})]}),s&&o.jsx("div",{className:"alert alert-success",children:s}),e?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading integrations..."}):t===!1?o.jsxs("div",{className:"status-banner status-banner-error",children:[o.jsx("span",{className:"status-banner-icon",children:"!"}),o.jsx("span",{className:"status-banner-text",children:"MCP server is not reachable. Make sure it is running."})]}):o.jsxs(o.Fragment,{children:[r.map(c=>o.jsx(Ay,{manifest:c.manifest,integration:c.integration,state:c.state,onStatusChange:a,onSuccess:l},c.id)),r.length===0&&(n?o.jsxs("div",{className:"status-banner status-banner-error",children:[o.jsx("span",{className:"status-banner-icon",children:"!"}),o.jsxs("span",{className:"status-banner-text",children:["Couldn't load integrations — the gateway can't reach its MCP server (or you're signed out). Check the control-plane's"," ",o.jsx("code",{children:"SUVEREN_MCP_INTERNAL_URL"})," (dev MCP is :3431), then refresh."]})]}):o.jsx("p",{style:{color:"var(--text-tertiary)",textAlign:"center",marginTop:"2rem"},children:"No integrations available yet."}))]})]})}function Ly(){var D,V,M;const{activeTeam:e,activeMembership:t,refreshGroups:n,user:r}=Ce(),[a,s]=d.useState(null),[i,l]=d.useState(!1),[c,u]=d.useState(""),[h,f]=d.useState(""),[g,v]=d.useState(!1),[x,w]=d.useState(""),[j,m]=d.useState("");d.useEffect(()=>{fetch("/health").then($=>$.json()).then($=>{typeof $.spUrl=="string"&&m($.spUrl)}).catch(()=>{})},[]),d.useEffect(()=>{if(!e){s(null);return}F.getGroupById(e.id).then($=>{const R=$.group??$,Y=$.members??[],_=$.isAdmin??!1,C=Y.map(P=>{const z=P.userId||P.id||"",L=P.role||(_&&z===R.createdBy?"admin":"member");return{id:z,name:P.name||z.slice(0,8)||"Member",email:P.email||"",domains:P.domains||[],role:L,isAdmin:L==="admin"||_&&z===R.createdBy}});s({id:R.id,name:R.name,members:C})}).catch(()=>s(null))},[e==null?void 0:e.id]);const p=(a==null?void 0:a.members.filter($=>$.isAdmin))??[],y=(e==null?void 0:e.isAdmin)===!0&&p.length<=1&&p.some($=>$.id===(r==null?void 0:r.id)),S=(e==null?void 0:e.name)??"",b=x.trim()===S&&!i,T=()=>{w(""),v(!0)},k=()=>{v(!1),w("")},E=async()=>{if(!(!e||!b)){l(!0),u("");try{await F.leaveTeam(e.id),await n(),f("You have left the team."),s(null),k()}catch($){u($ instanceof Error?$.message:"Failed to leave team")}finally{l(!1)}}},N=e&&j?`${j}/dashboard/groups/${e.id}`:void 0,I=j?`${j}/dashboard/groups`:void 0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"page-header",children:o.jsxs("div",{children:[o.jsx("h1",{className:"page-title",children:"Team"}),o.jsx("p",{className:"page-subtitle",children:"Your current team context. Team management lives in your Service Provider dashboard."})]})}),c&&o.jsx("div",{className:"error-message",children:c}),h&&o.jsx("div",{className:"alert alert-success",children:h}),e?o.jsxs("div",{className:"card",style:{marginBottom:"1.5rem"},children:[o.jsxs("div",{className:"card-header",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"card-title",children:e.name}),o.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:[((D=a==null?void 0:a.members)==null?void 0:D.length)??0," ",(((V=a==null?void 0:a.members)==null?void 0:V.length)??0)===1?"member":"members",e.isAdmin&&" · You are admin"]})]}),o.jsx("span",{className:"status-badge status-active",children:"Active"})]}),(M=a==null?void 0:a.members)==null?void 0:M.map($=>o.jsxs("div",{className:"member-row",children:[o.jsx("div",{className:"member-avatar",children:$.name.split(" ").map(R=>R[0]).join("").slice(0,2).toUpperCase()}),o.jsxs("div",{className:"member-info",children:[o.jsx("div",{className:"member-name",children:$.name}),o.jsx("div",{className:"member-email",children:$.email})]}),o.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:$.role})]},$.id)),o.jsxs("div",{style:{marginTop:"1.25rem",paddingTop:"1rem",borderTop:"1px solid var(--border)",display:"flex",alignItems:"center",gap:"0.75rem",flexWrap:"wrap"},children:[N&&o.jsx("a",{className:"btn btn-secondary btn-sm",href:N,target:"_blank",rel:"noopener noreferrer",children:"Manage this team in your Service Provider →"}),o.jsx("span",{title:y?"You are the only admin. Transfer admin to another member in your Service Provider dashboard before leaving.":void 0,style:{marginLeft:"auto"},children:o.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--text-tertiary)"},onClick:T,disabled:i||y,children:"Leave team"})})]})]}):o.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem 1.5rem"},children:[o.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem"},children:"You are working solo."}),o.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",maxWidth:480,marginLeft:"auto",marginRight:"auto"},children:"Every authorization you create here is in your personal context. You can join an existing team or create a new one in your Service Provider dashboard."}),I&&o.jsx("a",{className:"btn btn-primary btn-sm",href:I,target:"_blank",rel:"noopener noreferrer",children:"Open Service Provider dashboard →"})]}),g&&e&&o.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"leave-team-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:"1rem"},onClick:k,children:o.jsxs("div",{className:"card",onClick:$=>$.stopPropagation(),style:{maxWidth:480,width:"100%",margin:0},children:[o.jsxs("h3",{id:"leave-team-title",className:"card-title",style:{marginBottom:"0.5rem"},children:["Leave ",S,"?"]}),o.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:"Leaving will:"}),o.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[o.jsx("li",{children:"Revoke all authorizations you created in this team's context"}),o.jsx("li",{children:"Reject any pending action proposals you authored"}),o.jsx("li",{children:"Disable your membership — rejoining requires admin reactivation"})]}),o.jsxs("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:["Your ",o.jsx("strong",{children:"personal"})," authorizations are not affected."]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{htmlFor:"leave-confirm-input",style:{fontSize:"0.825rem",display:"block",marginBottom:"0.375rem"},children:["Type ",o.jsx("code",{children:S})," to confirm:"]}),o.jsx("input",{id:"leave-confirm-input",className:"form-input",type:"text",value:x,onChange:$=>w($.target.value),placeholder:S,disabled:i,autoFocus:!0})]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end",marginTop:"1rem"},children:[o.jsx("button",{className:"btn btn-ghost",onClick:k,disabled:i,children:"Cancel"}),o.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:E,disabled:!b,children:i?"Leaving...":"Leave team"})]})]})})]})}function My({onDismiss:e}){const t=Bt(),{group:n,groupId:r,domain:a}=Ce(),[s,i]=d.useState([]),[l,c]=d.useState([]),[u,h]=d.useState([]),[f,g]=d.useState(!0),[v,x]=d.useState({}),[w,j]=d.useState(null);d.useEffect(()=>{Promise.all([F.listProfiles().catch(()=>[]),F.getIntegrationManifests().then(k=>k.manifests??[]).catch(()=>[]),F.getMcpHealth().then(k=>k.integrations??[]).catch(()=>[])]).then(async([k,E,N])=>{if(i(k),c(E),h(N),r){const I=await Promise.all(k.map(V=>F.getTeamProfileConfig(r,V.id).catch(()=>null))),D={};k.forEach((V,M)=>{const $=I[M];$&&(D[V.id]=$)}),x(D)}}).finally(()=>g(!1))},[r]);const m=new Map,p=new Map;for(const k of l)k.profile&&m.set(k.profile,k);for(const k of u){const E=l.find(N=>N.id===k.id);E!=null&&E.profile&&p.set(E.profile,k)}const y=s.filter(k=>{const E=k.id.replace(/@.*$/,"").split("/").pop()??k.id;return m.has(E)}),S=k=>k in v,b=(k,E)=>{if(!r){console.error("No active group when creating authorization");return}const N=S(k);sessionStorage.setItem("agentAuth",JSON.stringify({profileId:k,groupId:r,groupName:(n==null?void 0:n.name)??null,domain:a,isTeam:N})),E?sessionStorage.setItem("agentGate",JSON.stringify({bounds:E.bounds,context:E.context,gateContent:{intent:E.intent},ttlConfig:{max:E.ttl},templateMode:E.mode,templateTtl:E.ttl})):sessionStorage.removeItem("agentGate"),j(null),e==null||e(),t("/agent/gate")},T=k=>{if(!r)return;const E=k.replace(/@.*$/,"").split("/").pop()??k,N=m.get(E);N!=null&&N.templates&&N.templates.length>0?j({profileId:k,manifest:N}):b(k)};if(w){const k=w.manifest.templates??[];return o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginBottom:"1rem"},onClick:()=>j(null),children:"← Back to profiles"}),o.jsxs("h3",{style:{margin:"0 0 0.25rem 0",fontSize:"1rem"},children:["Set up ",w.manifest.name," authorization"]}),o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.5rem",marginBottom:"0.75rem",fontWeight:600},children:"Quick start"}),o.jsx("div",{style:{display:"grid",gap:"0.75rem",gridTemplateColumns:`repeat(${Math.min(k.length,3)}, 1fr)`},children:k.map(E=>o.jsxs("button",{className:"template-card",onClick:()=>b(w.profileId,E),children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.375rem"},children:[o.jsx("span",{className:`template-mode template-mode-${E.mode==="automatic"?"auto":"review"}`,children:E.mode==="automatic"?"Auto":"Review"}),o.jsx("span",{className:"template-risk","data-risk":E.risk,children:E.risk})]}),o.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.25rem"},children:E.name}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",lineHeight:1.45,marginBottom:"0.5rem"},children:E.description}),o.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.3rem"},children:E.tags.map(N=>o.jsx("span",{className:"template-tag",children:N},N))})]},E.name))}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1rem",margin:"1.5rem 0"},children:[o.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}}),o.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"or"}),o.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}})]}),o.jsx("button",{className:"btn btn-primary",style:{width:"100%",textAlign:"center",padding:"0.75rem"},onClick:()=>b(w.profileId),children:"Custom — define your own limits and scope"})]})}return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:`
59
+ Watch out — What should the agent avoid or be careful about?`;function Av(){var $;const e=Bt(),[t]=hf(),n=Number(t.get("step"))||2,[r,a]=d.useState(null),[s,i]=d.useState(null),[l,c]=d.useState(n),[u,h]=d.useState(null),[f,v]=d.useState(null),[y,x]=d.useState(Ac),[w,j]=d.useState(!1),[m,p]=d.useState(!0),[g,S]=d.useState(null),[E,T]=d.useState([]),[k,b]=d.useState(void 0);d.useEffect(()=>{var C;const _=sessionStorage.getItem("agentAuth");if(!_){e("/agent/new");return}const Q=JSON.parse(_);a(Q);const R=sessionStorage.getItem("agentGate");if(R){const P=JSON.parse(R);P.bounds&&h(P.bounds),P.context&&v(P.context),(C=P.gateContent)!=null&&C.intent&&x(P.gateContent.intent)}F.getProfile(Q.profileId).then(P=>i(P)).catch(()=>e("/agent/new")).finally(()=>p(!1)),Q.groupId&&Promise.all([F.getTeamProfileConfig(Q.groupId,Q.profileId).catch(()=>null),F.getGroupById(Q.groupId).catch(()=>null),F.listUsers().catch(()=>[])]).then(([P,z,L])=>{if(S(P),P){const U=new Map;for(const O of L){const B=O.name&&O.email?`${O.name} (${O.email})`:O.name||O.email||O.id;U.set(O.id,B)}const ne=(z==null?void 0:z.members)??[];for(const O of ne){const B=O.userId??O.id;B&&(O.name&&O.email?U.set(B,`${O.name} (${O.email})`):O.name&&U.set(B,O.name))}const J=(P.approvers??[]).map(O=>U.get(O)??O);T(J);const ve=ne.find(O=>O.role==="admin");if(ve){const O=ve.userId??ve.id;O&&b(U.get(O)??ve.name)}}})},[e]);const N=u?Object.entries(u).filter(([_])=>_!=="profile"&&_!=="path").map(([_,Q])=>`${_} = ${Q}`).join(", "):"",I=(_,Q)=>{h(_),v(Q),c(3)},D=y.trim()!==Ac.trim()&&y.trim()!=="",V=_=>{D&&!confirm("Replace your current intent with the AI draft?")||x(_)},M=()=>{const _=s==null?void 0:s.ttl,Q={intent:y};sessionStorage.setItem("agentGate",JSON.stringify({bounds:u,context:f,gateContent:Q,ttlConfig:_})),e("/agent/review")};return m||!r||!s?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):o.jsxs(o.Fragment,{children:[o.jsx(kf,{currentStep:l,onStepClick:_=>{_>=2&&c(_)}}),o.jsx(hv,{profileId:r.profileId,bounds:N||void 0,groupName:r.groupName,domain:r.domain}),l===2&&o.jsx("div",{className:"card",children:o.jsx(Iv,{profile:s,onConfirm:I,onCancel:()=>e("/agent/new"),initialBounds:u||void 0,initialContext:f||void 0,profileConfig:g,approverNames:E,adminName:k})}),l===3&&o.jsxs("div",{className:"intent-layout",children:[o.jsx("div",{className:"card intent-pane chat",children:o.jsx(so,{target:{kind:"intent",profileId:r.profileId,bounds:N||void 0},currentText:y,onApply:V})}),o.jsxs("div",{className:"card intent-pane document",children:[o.jsx("h3",{className:"card-title",children:"What should your agent know?"}),o.jsx("textarea",{className:"intent-textarea",value:y,onChange:_=>x(_.target.value)}),o.jsxs("div",{className:"char-counter",children:[y.length," / 2000"]}),o.jsxs("div",{className:"intent-footer",children:[o.jsx("button",{className:"btn btn-ghost",onClick:()=>c(2),children:"Back"}),o.jsx("button",{className:"btn btn-primary intent-continue-btn",onClick:M,disabled:!D,children:"Continue to Review"})]}),((($=g==null?void 0:g.approvers)==null?void 0:$.length)??0)>0&&o.jsxs("div",{className:"hint-box",role:"note",children:[o.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"i"}),o.jsxs("div",{className:"hint-body",children:[o.jsxs("div",{className:"hint-head",children:["Visible to ",E.length>0?E.join(", "):"the configured approvers"]}),"Your intent will be encrypted and shared with"," ",E.length>0?E.join(", "):"this profile's required approvers",". Only they can decrypt it — your Service Provider cannot. Each approver stores a copy as their accountability record."]})]})]}),o.jsx("button",{type:"button",className:"floating-help",onClick:()=>j(!0),"aria-label":"Open intent assistant",children:"Get help with intent"}),o.jsx(Cf,{open:w,onClose:()=>j(!1),ariaLabel:"Intent assistant",children:o.jsx(so,{target:{kind:"intent",profileId:r.profileId,bounds:N||void 0},currentText:y,onApply:_=>{V(_),j(!1)}})})]})]})}async function io(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map(s=>s.toString(16).padStart(2,"0")).join("")}async function Nf(e,t){const n=t.boundsSchema??t.frameSchema;if(!n)throw new Error("Profile has no boundsSchema or frameSchema");const a=n.keyOrder.map(i=>`${i}=${String(e[i])}`).join(`
60
+ `);return`sha256:${await io(a)}`}async function bf(e,t){if(!t.contextSchema||t.contextSchema.keyOrder.length===0)return`sha256:${await io("")}`;const r=t.contextSchema.keyOrder.map(s=>`${s}=${String(e[s])}`).join(`
61
+ `);return`sha256:${await io(r)}`}async function lo(e){return`sha256:${await io(e)}`}function Ef(e,t){return{frameHash:e.frame_hash??e.bounds_hash??t.boundsHash,boundsHash:e.bounds_hash??t.boundsHash,contextHash:t.contextHash,context:t.context,gateContent:t.gateContent,...t.path?{path:t.path}:{}}}function $v(){var Y,G;const e=Bt(),{user:t,mode:n,domain:r}=Ce(),[a,s]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(null),[h,f]=d.useState("immediate"),[v,y]=d.useState(1800),[x,w]=d.useState(86400),[j,m]=d.useState(""),[p,g]=d.useState("hours"),[S,E]=d.useState(""),[T,k]=d.useState(!1),[b,N]=d.useState(""),[I,D]=d.useState(null),[V,M]=d.useState([]),[$,_]=d.useState(!1);d.useEffect(()=>{const K=sessionStorage.getItem("agentAuth"),ae=sessionStorage.getItem("agentGate");if(!K||!ae){e("/agent/new");return}const ye=JSON.parse(K),yt=JSON.parse(ae),un={bounds:yt.bounds??{},context:yt.context??{},gateContent:yt.gateContent};s(ye),l(un),yt.ttlConfig&&(y(yt.ttlConfig.default??1800),w(yt.ttlConfig.max??86400)),F.getProfile(ye.profileId).then(Ve=>{var ct;if(u(Ve),!S){const Ae=Ve.name??((ct=ye.profileId.split("/").pop())==null?void 0:ct.replace(/@.*$/,""))??"",Oe=[];if(un.context&&Ve.contextSchema)for(const et of Ve.contextSchema.keyOrder){const te=un.context[et];if(te!==void 0&&te!==""){const Et=String(te).split(",").map(W=>W.trim()).filter(Boolean);Oe.push(Et.join(", "))}}const Dt=Oe.length>0?`${Ae}: ${Oe.join(" · ")}`:Ae;E(Dt)}}).catch(()=>{}),ye.groupId?Promise.all([F.getTeamProfileConfig(ye.groupId,ye.profileId).catch(()=>null),F.getGroupById(ye.groupId).catch(()=>null),F.listUsers().catch(()=>[])]).then(([Ve,ct,Ae])=>{if(D(Ve),Ve){const Oe=new Map;for(const te of Ae){const Et=te.name&&te.email?`${te.name} (${te.email})`:te.name||te.email||te.id;Oe.set(te.id,Et)}const Dt=(ct==null?void 0:ct.members)??[];for(const te of Dt){const Et=te.userId??te.id;Et&&(te.name&&te.email?Oe.set(Et,`${te.name} (${te.email})`):te.name&&Oe.set(Et,te.name))}const et=(Ve.approvers??[]).map(te=>Oe.get(te)??te);M(et)}}).finally(()=>{_(!0)}):_(!0)},[e]);const Q=async()=>{if(!(!a||!i||!c||!t)){if(!a.groupId){N("No active group; cannot create authorization.");return}k(!0),N("");try{const K=r||a.domain||"owner",ae=await Nf(i.bounds,c),ye=await bf(i.context,c),[yt,un]=await Promise.all([lo(i.gateContent.intent),lo(JSON.stringify({profile:a.profileId,domain:K,group:a.groupId}))]);let Ve,ct,Ae;if(a.isTeam){const et=await F.getApproversPubkeys(a.groupId,a.profileId);if(et.length>0){const te=await F.encryptIntent(i.gateContent.intent,et);Ve=te.intentCiphertext,ct=te.encryptedKeys,Ae=te.approversFrozen}}const Oe=await F.attest({profile_id:a.profileId,bounds:i.bounds,bounds_hash:ae,context_hash:ye,domain:K,did:t.did,gate_content_hashes:{intent:yt},execution_context_hash:un,group_id:a.groupId,ttl:v,commitment_mode:h==="per-action"?"review":"automatic",title:S.trim(),intent_ciphertext:Ve,encrypted_keys:ct,approvers_frozen:Ae}),Dt=Oe.frame_hash??Oe.bounds_hash??ae;try{await F.pushGateContent(Ef(Oe,{boundsHash:ae,contextHash:ye,context:i.context,gateContent:i.gateContent}))}catch(et){try{await F.revokeAttestation(Dt,"Auto-revoked: gate content push failed")}catch{}throw new Error(`Authorization signed but gate content delivery failed. The attestation was revoked. Please try again. (${et instanceof Error?et.message:"Unknown error"})`)}sessionStorage.removeItem("agentAuth"),sessionStorage.removeItem("agentGate"),e(`/authorizations?highlight=${encodeURIComponent(Dt)}`)}catch(K){N(K instanceof Error?K.message:"Attestation failed")}finally{k(!1)}}};if(!a||!i)return o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."});const R=Object.entries(i.bounds).filter(([K])=>K!=="profile"&&K!=="path"),C=Object.entries(i.context),z=((I==null?void 0:I.caps)!=null?Object.keys(I.caps):[]).length!==0,L=V.length>0?V.join(", "):((I==null?void 0:I.approvers)??[]).join(", "),U=z?`Within-cap actions run per the mode you choose above. Over-cap actions will require approval from you and ${L}, regardless of your mode.`:"No caps set — they won't gate any action, but your intent is encrypted and shared with them as an accountability record.",ne=z?`Over-cap actions will be reviewed by you and ${L}. Within-cap actions run per the mode you chose above.`:`Approvers ${L} can read your intent but won't gate any action — no caps configured on this profile.`,J=!!((Y=I==null?void 0:I.approvers)!=null&&Y.length),ve=v>x,O={flex:1,padding:"0.75rem",border:h==="immediate"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:h==="immediate"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},B={flex:1,padding:"0.75rem",border:h==="per-action"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:h==="per-action"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"};return o.jsxs(o.Fragment,{children:[o.jsx(kf,{currentStep:4,onStepClick:K=>{K<=3&&e(`/agent/gate?step=${K}`)}}),o.jsxs("div",{className:"card",children:[o.jsx("h3",{className:"card-title",style:{marginBottom:"0.25rem"},children:"Review & Commit"}),o.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"1.5rem"},children:"Review your authorization details before signing."}),b&&o.jsx("div",{className:"error-message",children:b}),o.jsxs("dl",{className:"review-grid",children:[o.jsx("dt",{children:"Profile"}),o.jsxs("dd",{children:[_e(a.profileId),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:a.profileId})]}),a.groupName&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Team"}),o.jsx("dd",{children:a.groupName})]}),a.groupId&&o.jsxs(o.Fragment,{children:[o.jsx("dt",{children:"Approvers"}),o.jsx("dd",{children:$?(((G=I==null?void 0:I.approvers)==null?void 0:G.length)??0)===0?o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"None — solo authorization"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:"No approvers configured for this profile in this team. Your intent stays on your gateway."})]}):o.jsxs(o.Fragment,{children:[L,o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:U})]}):o.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Loading…"})})]}),o.jsx("dt",{children:"TTL"}),o.jsx("dd",{children:"30 minutes"})]}),!!R.length&&o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Bounds"}),o.jsx("dl",{className:"review-grid",children:R.map(([K,ae])=>o.jsxs("span",{style:{display:"contents"},children:[o.jsx("dt",{children:K}),o.jsx("dd",{children:String(ae)})]},K))})]}),!!C.length&&o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Context"}),o.jsx("dl",{className:"review-grid",children:C.map(([K,ae])=>o.jsxs("span",{style:{display:"contents"},children:[o.jsx("dt",{children:K}),o.jsx("dd",{children:String(ae)})]},K))})]}),o.jsx("div",{className:"gate-content-block",children:o.jsxs("div",{className:"gate-content-item",children:[o.jsx("div",{className:"gate-content-label",children:"Intent"}),o.jsx("div",{className:"gate-content-text",children:i.gateContent.intent})]})}),o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.5rem"},children:"Commitment"}),o.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"1.25rem"},children:[o.jsxs("button",{onClick:()=>f("immediate"),style:O,children:[o.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Automatic"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Agent acts freely within your limits."})]}),o.jsxs("button",{onClick:()=>f("per-action"),style:B,children:[o.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Review Each Action"}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"You review and approve each action before it executes."})]})]}),o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"Duration"}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginBottom:"1.25rem",alignItems:"center"},children:[[{label:"1 hour",seconds:3600},{label:"24 hours",seconds:86400},{label:"7 days",seconds:604800},{label:"30 days",seconds:2592e3},{label:"1 year",seconds:31536e3}].filter(K=>K.seconds<=x).map(K=>o.jsx("button",{onClick:()=>{y(K.seconds),m("")},style:{padding:"0.5rem 0.85rem",border:v===K.seconds?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"0.375rem",background:v===K.seconds?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"inherit",color:"var(--text-primary)"},children:K.label},K.seconds)),o.jsxs("div",{style:{display:"flex",gap:"0.375rem",alignItems:"center"},children:[o.jsx("input",{type:"number",className:"form-input",style:{width:"5rem",padding:"0.45rem 0.6rem",fontSize:"0.85rem"},placeholder:"Custom",value:j,onChange:K=>{m(K.target.value);const ae=parseInt(K.target.value,10);if(ae>0){const ye=p==="days"?ae*86400:ae*3600;y(Math.min(ye,x))}}}),o.jsxs("select",{className:"form-input",style:{padding:"0.45rem 0.5rem",fontSize:"0.85rem"},value:p,onChange:K=>{g(K.target.value);const ae=parseInt(j,10);if(ae>0){const ye=K.target.value==="days"?ae*86400:ae*3600;y(Math.min(ye,x))}},children:[o.jsx("option",{value:"hours",children:"hours"}),o.jsx("option",{value:"days",children:"days"})]})]}),ve&&o.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--danger)"},children:["Maximum: ",x>=86400?`${Math.floor(x/86400)} days`:`${Math.floor(x/3600)} hours`]})]}),o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"Title"}),o.jsxs("div",{style:{marginBottom:"1.25rem"},children:[o.jsx("input",{type:"text",className:"form-input",placeholder:`e.g. ${_e(a.profileId)}: daily operations`,value:S,onChange:K=>E(K.target.value),maxLength:80,style:{fontSize:"0.9rem"}}),o.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"A short name to identify this authorization on your dashboard."})]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("button",{className:"btn btn-ghost",onClick:()=>e("/agent/gate"),children:"Back"}),o.jsx("button",{className:"btn btn-primary btn-lg",style:{flex:1},onClick:Q,disabled:T||!S.trim(),children:T?"Signing...":h==="immediate"?"Authorize":"Authorize (Review Mode)"})]}),o.jsx("div",{style:{marginTop:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)",textAlign:"center",display:J?"block":"none"},children:ne})]})]})}const Lv={card:"💳",mail:"✉️"};function Mv({manifest:e,integration:t,state:n,onStatusChange:r,onSuccess:a}){var ve;const[s,i]=d.useState({}),[l,c]=d.useState(!1),[u,h]=d.useState(!1),[f,v]=d.useState({}),[y,x]=d.useState(!1),[w,j]=d.useState(null),[m,p]=d.useState(!1),[g,S]=d.useState(!1),[E,T]=d.useState(!1),[k,b]=d.useState(!1),[N,I]=d.useState({});d.useEffect(()=>{let O=!1;return F.getCredential(e.id).then(B=>{var Y;if(!(O||!B.configured)){if(c(!0),h(!0),B.fields){const G={};for(const K of e.credentials.fields)B.fields[K.key]!=null&&(G[K.key]=B.fields[K.key]);v(G)}if(e.oauth){const G=((Y=B.fieldNames)==null?void 0:Y.includes(e.oauth.tokenStorage))??!1;x(G),G&&F.getOAuthHealth(e.id).then(K=>{O||j(K)})}}}).catch(()=>{}),()=>{O=!0}},[e.id,e.oauth]);const D=!!e.oauth||e.credentials.fields.some(O=>!O.optional),V=e.oauth?y:l,M=!D||V,$=n==="starting"?"starting":M?t!=null&&t.running?"running":!l&&e.credentials.fields.length>0?"unconfigured":"ready":e.oauth&&l&&!y?"needs-oauth":"unconfigured",_=async()=>{if(e.credentials.fields.some(B=>{var Y;return(Y=s[B.key])==null?void 0:Y.trim()})){p(!0);try{await F.setCredential(e.id,s),c(!0),i({}),e.oauth?a(`${e.name} credentials saved!`):(a(`${e.name} credentials saved — starting integration...`),await C())}catch{a(`Failed to save ${e.name} credentials`)}finally{p(!1)}}},Q=async()=>{if(e.credentials.fields.some(B=>{var Y;return(Y=s[B.key])==null?void 0:Y.trim()})){p(!0);try{await F.setCredential(e.id,s),i({}),c(!0),e.oauth?a(`${e.name} credentials saved — now click Connect.`):(b(!1),a(`${e.name} credentials updated — restarting...`),await C())}catch{a(`Failed to update ${e.name} credentials`)}finally{p(!1)}}},R=()=>{window.open(`/auth/oauth/${e.id}/start`,"_blank","width=600,height=700");const O=setInterval(async()=>{var B;try{const Y=await F.getCredential(e.id);Y.configured&&e.oauth&&((B=Y.fieldNames)!=null&&B.includes(e.oauth.tokenStorage))&&(x(!0),b(!1),j(null),clearInterval(O),a(`${e.name} connected — starting integration...`),F.getOAuthHealth(e.id).then(j).catch(()=>{}),await C())}catch{}},2e3);setTimeout(()=>clearInterval(O),12e4)},C=async()=>{T(!0);try{const O=await F.activateIntegration(e.id);O.warning?a(O.warning):a(`${e.name} integration started with ${O.tools.length} tools`),r()}catch(O){a(`Failed to start ${e.name}: ${O instanceof Error?O.message:"Unknown error"}`)}finally{T(!1)}},P=async()=>{try{await F.removeMcpIntegration(e.id),a(`${e.name} integration removed`),r()}catch{a(`Failed to remove ${e.name}`)}},z=Lv[e.icon]??"🔧",L=$==="running"?{c:"int-chip-ok",t:"Running"}:$==="starting"?{c:"int-chip-idle",t:"Starting"}:t&&!t.running&&t.error?{c:"int-chip-bad",t:"Crashed"}:{c:"int-chip-idle",t:"Stopped"},U=e.oauth&&y&&(w==null?void 0:w.status)==="failed",ne=D?U?{c:"int-chip-bad",t:"Auth failed"}:V?{c:"int-chip-ok",t:"Auth OK"}:{c:"int-chip-idle",t:"Not set up"}:{c:"int-chip-idle",t:"No auth"},J=O=>O.replace(/https?:\/\/[^\s)]+\/auth\/oauth\/[a-z-]+\/callback/gi,`${window.location.origin}/auth/oauth/${e.id}/callback`);return o.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[o.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem"},children:[o.jsx("span",{style:{fontSize:"1.4rem",lineHeight:1.2},children:z}),o.jsx("h3",{className:"card-title",style:{margin:0,flex:1,alignSelf:"center"},children:e.name}),o.jsxs("div",{style:{display:"flex",gap:"0.4rem",flexWrap:"wrap",justifyContent:"flex-end"},children:[$!=="unconfigured"&&$!=="needs-oauth"&&o.jsxs("span",{className:`int-chip ${L.c}`,children:[o.jsx("span",{className:"int-dot"}),L.t]}),o.jsxs("span",{className:`int-chip ${ne.c}`,children:[o.jsx("span",{className:"int-dot"}),ne.t]})]})]}),e.oauth&&y&&o.jsx("div",{className:"int-account",style:{marginTop:"0.7rem"},children:w!=null&&w.account?o.jsxs(o.Fragment,{children:["Connected as ",o.jsx("b",{children:w.account})]}):o.jsx("span",{className:"int-none",children:"Account not recorded — reconnect to capture which account is used"})}),U&&!k&&o.jsxs("div",{style:{marginTop:"0.7rem"},children:[o.jsxs("div",{className:"status-banner status-banner-error",style:{marginBottom:"0.6rem"},children:[o.jsx("span",{className:"status-banner-icon",children:"!"}),o.jsxs("span",{className:"status-banner-text",children:["Authentication failed",w!=null&&w.error?` — ${w.error}`:"",". Reconnect to restore access."]})]}),o.jsxs("button",{className:"btn btn-primary btn-sm",onClick:R,children:["Reconnect ",e.name]})]}),o.jsxs("details",{className:"int-details",style:{marginTop:"0.85rem",marginBottom:"1.25rem"},children:[o.jsx("summary",{children:"Details"}),o.jsxs("div",{className:"int-meta",children:[o.jsx("span",{className:"int-k",children:"What"}),o.jsx("span",{children:e.description}),e.profile&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"int-k",children:"Profile"}),o.jsx("span",{children:e.profile})]}),e.oauth&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"int-k",children:"Scopes"}),o.jsx("span",{children:((ve=e.oauth.scopes)==null?void 0:ve.join(", "))||"—"})]}),t&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"int-k",children:"Tools"}),o.jsxs("span",{children:[t.toolCount," gated"]})]})]})]}),e.setupGuide&&e.setupGuide.length>0&&($!=="running"||U)&&o.jsxs("div",{style:{marginBottom:"0.75rem"},children:[o.jsxs("button",{onClick:()=>S(!g),style:{background:"none",border:"none",padding:0,fontSize:"0.8rem",color:"var(--accent)",cursor:"pointer",display:"flex",alignItems:"center",gap:"0.375rem"},children:[o.jsx("span",{style:{transition:"transform 0.2s",transform:g?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"}),"How to set up ",e.name]}),g&&o.jsx("div",{style:{marginTop:"0.75rem",paddingLeft:"0.25rem"},children:e.setupGuide.map((O,B)=>o.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"0.75rem"},children:[o.jsx("div",{style:{width:"1.5rem",height:"1.5rem",borderRadius:"50%",background:"var(--border)",color:"var(--text-secondary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.7rem",fontWeight:700,flexShrink:0,marginTop:"0.1rem"},children:B+1}),o.jsxs("div",{children:[o.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.125rem"},children:O.title}),o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",lineHeight:1.5},children:[J(O.description),O.link&&o.jsxs(o.Fragment,{children:[" ",o.jsxs("a",{href:O.link,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"0.8rem"},children:["Open ","↗"]})]})]})]})]},B))})]}),$==="starting"&&o.jsxs("div",{className:"service-status",style:{color:"var(--warning)"},children:[o.jsx("span",{className:"service-status-dot",style:{background:"var(--warning)"}}),"Starting…"]}),k&&o.jsxs("div",{style:{marginTop:"0.7rem",paddingTop:"0.85rem",borderTop:"1px solid var(--border)"},children:[o.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,marginBottom:"0.5rem"},children:"Change credentials"}),u&&o.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-muted)",marginBottom:"0.6rem"},children:["Your current values are filled in below (secret hidden — click ","“","show","”","). Edit them, then",e.oauth?" Save and Connect to re-link the account.":" Save to apply."]}),e.credentials.fields.map(O=>o.jsxs("div",{className:"form-group",style:{marginBottom:"0.6rem"},children:[o.jsx("label",{className:"form-label",children:O.label}),O.type==="password"?o.jsxs("div",{className:"cred-field",children:[o.jsx("input",{className:"form-input",type:N[O.key]?"text":"password",placeholder:O.placeholder,value:s[O.key]||"",onChange:B=>i(Y=>({...Y,[O.key]:B.target.value}))}),o.jsx("button",{className:"cred-toggle",onClick:()=>I(B=>({...B,[O.key]:!B[O.key]})),children:N[O.key]?"hide":"show"})]}):o.jsx("input",{className:"form-input",type:"text",placeholder:O.placeholder,value:s[O.key]||"",onChange:B=>i(Y=>({...Y,[O.key]:B.target.value}))})]},O.key)),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginTop:"0.25rem"},children:[o.jsx("button",{className:"btn btn-primary btn-sm",onClick:Q,disabled:m,children:m?"Saving…":"Save"}),e.oauth&&o.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:R,children:["Connect ",e.name]}),o.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>{b(!1),i({})},children:"Cancel"})]})]}),!k&&$==="running"&&t&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[o.jsx(Ge,{to:"/agent/new",className:"btn btn-primary btn-sm",style:{textDecoration:"none"},children:"Authorize agent"}),(e.credentials.fields.length>0||e.oauth)&&o.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>{i({...f}),b(!0)},title:"Re-enter client ID / secret (e.g. a new OAuth client).",children:"Change credentials"}),o.jsx("span",{style:{flex:1}}),o.jsx("button",{className:"btn btn-sm btn-ghost",style:{color:"var(--danger)"},onClick:P,title:"Stops the subprocess and removes the integration from the registry. It will NOT auto-start on next gateway restart. Re-enable with Install.",children:"Disable"})]}),o.jsx("div",{style:{display:"none"},children:o.jsx(Ge,{to:"/agent/new",className:"btn btn-ghost btn-sm",style:{textDecoration:"none",display:"block",textAlign:"center"},children:"Authorize your agent"})})]}),$==="unconfigured"&&(()=>{const O=e.credentials.fields.every(G=>G.optional),B=e.credentials.fields.some(G=>!G.optional),Y=e.credentials.fields.some(G=>{var K;return(K=s[G.key])==null?void 0:K.trim()});return o.jsxs(o.Fragment,{children:[u&&o.jsxs("div",{className:"alert",style:{fontSize:"0.8rem",background:"var(--bg-main)",border:"1px solid var(--border)",borderRadius:"0.375rem",padding:"0.5rem 0.75rem",marginBottom:"0.75rem",color:"var(--text-secondary)"},children:[o.jsx("strong",{style:{color:"var(--text-primary)"},children:"Credentials on file."})," ","Existing values are encrypted in the vault and not shown. Enter new values below to replace them, or"," ",o.jsx("button",{onClick:()=>{c(!0),e.oauth&&x(!0)},style:{background:"none",border:"none",padding:0,color:"var(--accent)",cursor:"pointer",textDecoration:"underline"},children:"keep existing"}),"."]}),e.oauth&&!u&&o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"Step 1 of 2 — enter credentials, then connect your account."}),e.setupHint&&!u&&o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:e.setupHint}),e.credentials.fields.map(G=>o.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[o.jsx("label",{className:"form-label",children:G.label}),G.type==="password"?o.jsxs("div",{className:"cred-field",children:[o.jsx("input",{className:"form-input",type:N[G.key]?"text":"password",placeholder:G.placeholder,value:s[G.key]||"",onChange:K=>i(ae=>({...ae,[G.key]:K.target.value}))}),o.jsx("button",{className:"cred-toggle",onClick:()=>I(K=>({...K,[G.key]:!K[G.key]})),children:N[G.key]?"hide":"show"})]}):o.jsx("input",{className:"form-input",type:"text",placeholder:G.placeholder,value:s[G.key]||"",onChange:K=>i(ae=>({...ae,[G.key]:K.target.value}))})]},G.key)),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[Y&&o.jsx("button",{className:"btn btn-primary",onClick:_,disabled:m||B&&!e.credentials.fields.filter(G=>!G.optional).every(G=>{var K;return(K=s[G.key])==null?void 0:K.trim()}),children:m?"Saving...":"Save & Encrypt"}),O&&!Y&&o.jsx("button",{className:"btn btn-primary",onClick:C,disabled:E,children:E?"Starting...":`Activate ${e.name}`})]})]})})(),$==="needs-oauth"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.25rem"},children:["✓"," Step 1 done — credentials saved"]}),o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["Step 2: connect your ",e.name," account to authorize access."]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[o.jsxs("button",{className:"btn btn-primary",onClick:R,children:["Connect ",e.name," Account"]}),o.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Change Credentials"})]})]}),$==="ready"&&!t&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.75rem"},children:["✓"," ",e.oauth?`${e.name} account connected`:"Credentials configured"]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[o.jsx("button",{className:"btn btn-primary",onClick:C,disabled:E,children:E?"Starting...":`Start ${e.name} Integration`}),!e.oauth&&o.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Update Credentials"}),e.oauth&&o.jsx("button",{className:"btn btn-ghost",onClick:()=>{c(!1),x(!1)},children:"Change Credentials"})]})]}),$==="ready"&&t&&!t.running&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"service-status service-status-error",style:{marginBottom:"0.75rem"},children:[o.jsx("span",{className:"service-status-dot"}),"Not running"]}),t.error&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--danger)",marginBottom:"0.75rem"},children:t.error}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("button",{className:"btn btn-primary",onClick:C,disabled:E,children:E?"Starting...":"Start"}),o.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:P,children:"Disable"})]})]})]})}function Fv(){const{loading:e,mcpServerUp:t,manifestsError:n,entries:r,refresh:a}=dl(),[s,i]=d.useState(""),l=d.useCallback(c=>{i(c),setTimeout(()=>i(""),5e3)},[]);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{className:"page-title",children:"Integrations"}),o.jsx("p",{className:"page-subtitle",children:"Connect external services and manage MCP integrations."})]}),s&&o.jsx("div",{className:"alert alert-success",children:s}),e?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading integrations..."}):t===!1?o.jsxs("div",{className:"status-banner status-banner-error",children:[o.jsx("span",{className:"status-banner-icon",children:"!"}),o.jsx("span",{className:"status-banner-text",children:"MCP server is not reachable. Make sure it is running."})]}):o.jsxs(o.Fragment,{children:[r.map(c=>o.jsx(Mv,{manifest:c.manifest,integration:c.integration,state:c.state,onStatusChange:a,onSuccess:l},c.id)),r.length===0&&(n?o.jsxs("div",{className:"status-banner status-banner-error",children:[o.jsx("span",{className:"status-banner-icon",children:"!"}),o.jsxs("span",{className:"status-banner-text",children:["Couldn't load integrations — the gateway can't reach its MCP server (or you're signed out). Check the control-plane's"," ",o.jsx("code",{children:"SUVEREN_MCP_INTERNAL_URL"})," (dev MCP is :3431), then refresh."]})]}):o.jsx("p",{style:{color:"var(--text-tertiary)",textAlign:"center",marginTop:"2rem"},children:"No integrations available yet."}))]})]})}function Ov(){var D,V,M;const{activeTeam:e,activeMembership:t,refreshGroups:n,user:r}=Ce(),[a,s]=d.useState(null),[i,l]=d.useState(!1),[c,u]=d.useState(""),[h,f]=d.useState(""),[v,y]=d.useState(!1),[x,w]=d.useState(""),[j,m]=d.useState("");d.useEffect(()=>{fetch("/health").then($=>$.json()).then($=>{typeof $.spUrl=="string"&&m($.spUrl)}).catch(()=>{})},[]),d.useEffect(()=>{if(!e){s(null);return}F.getGroupById(e.id).then($=>{const _=$.group??$,Q=$.members??[],R=$.isAdmin??!1,C=Q.map(P=>{const z=P.userId||P.id||"",L=P.role||(R&&z===_.createdBy?"admin":"member");return{id:z,name:P.name||z.slice(0,8)||"Member",email:P.email||"",domains:P.domains||[],role:L,isAdmin:L==="admin"||R&&z===_.createdBy}});s({id:_.id,name:_.name,members:C})}).catch(()=>s(null))},[e==null?void 0:e.id]);const p=(a==null?void 0:a.members.filter($=>$.isAdmin))??[],g=(e==null?void 0:e.isAdmin)===!0&&p.length<=1&&p.some($=>$.id===(r==null?void 0:r.id)),S=(e==null?void 0:e.name)??"",E=x.trim()===S&&!i,T=()=>{w(""),y(!0)},k=()=>{y(!1),w("")},b=async()=>{if(!(!e||!E)){l(!0),u("");try{await F.leaveTeam(e.id),await n(),f("You have left the team."),s(null),k()}catch($){u($ instanceof Error?$.message:"Failed to leave team")}finally{l(!1)}}},N=e&&j?`${j}/dashboard/groups/${e.id}`:void 0,I=j?`${j}/dashboard/groups`:void 0;return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"page-header",children:o.jsxs("div",{children:[o.jsx("h1",{className:"page-title",children:"Team"}),o.jsx("p",{className:"page-subtitle",children:"Your current team context. Team management lives in your Service Provider dashboard."})]})}),c&&o.jsx("div",{className:"error-message",children:c}),h&&o.jsx("div",{className:"alert alert-success",children:h}),e?o.jsxs("div",{className:"card",style:{marginBottom:"1.5rem"},children:[o.jsxs("div",{className:"card-header",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"card-title",children:e.name}),o.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:[((D=a==null?void 0:a.members)==null?void 0:D.length)??0," ",(((V=a==null?void 0:a.members)==null?void 0:V.length)??0)===1?"member":"members",e.isAdmin&&" · You are admin"]})]}),o.jsx("span",{className:"status-badge status-active",children:"Active"})]}),(M=a==null?void 0:a.members)==null?void 0:M.map($=>o.jsxs("div",{className:"member-row",children:[o.jsx("div",{className:"member-avatar",children:$.name.split(" ").map(_=>_[0]).join("").slice(0,2).toUpperCase()}),o.jsxs("div",{className:"member-info",children:[o.jsx("div",{className:"member-name",children:$.name}),o.jsx("div",{className:"member-email",children:$.email})]}),o.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:$.role})]},$.id)),o.jsxs("div",{style:{marginTop:"1.25rem",paddingTop:"1rem",borderTop:"1px solid var(--border)",display:"flex",alignItems:"center",gap:"0.75rem",flexWrap:"wrap"},children:[N&&o.jsx("a",{className:"btn btn-secondary btn-sm",href:N,target:"_blank",rel:"noopener noreferrer",children:"Manage this team in your Service Provider →"}),o.jsx("span",{title:g?"You are the only admin. Transfer admin to another member in your Service Provider dashboard before leaving.":void 0,style:{marginLeft:"auto"},children:o.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--text-tertiary)"},onClick:T,disabled:i||g,children:"Leave team"})})]})]}):o.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem 1.5rem"},children:[o.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem"},children:"You are working solo."}),o.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",maxWidth:480,marginLeft:"auto",marginRight:"auto"},children:"Every authorization you create here is in your personal context. You can join an existing team or create a new one in your Service Provider dashboard."}),I&&o.jsx("a",{className:"btn btn-primary btn-sm",href:I,target:"_blank",rel:"noopener noreferrer",children:"Open Service Provider dashboard →"})]}),v&&e&&o.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"leave-team-title",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:"1rem"},onClick:k,children:o.jsxs("div",{className:"card",onClick:$=>$.stopPropagation(),style:{maxWidth:480,width:"100%",margin:0},children:[o.jsxs("h3",{id:"leave-team-title",className:"card-title",style:{marginBottom:"0.5rem"},children:["Leave ",S,"?"]}),o.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:"Leaving will:"}),o.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[o.jsx("li",{children:"Revoke all authorizations you created in this team's context"}),o.jsx("li",{children:"Reject any pending action proposals you authored"}),o.jsx("li",{children:"Disable your membership — rejoining requires admin reactivation"})]}),o.jsxs("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:["Your ",o.jsx("strong",{children:"personal"})," authorizations are not affected."]}),o.jsxs("div",{className:"form-group",children:[o.jsxs("label",{htmlFor:"leave-confirm-input",style:{fontSize:"0.825rem",display:"block",marginBottom:"0.375rem"},children:["Type ",o.jsx("code",{children:S})," to confirm:"]}),o.jsx("input",{id:"leave-confirm-input",className:"form-input",type:"text",value:x,onChange:$=>w($.target.value),placeholder:S,disabled:i,autoFocus:!0})]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end",marginTop:"1rem"},children:[o.jsx("button",{className:"btn btn-ghost",onClick:k,disabled:i,children:"Cancel"}),o.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:b,disabled:!E,children:i?"Leaving...":"Leave team"})]})]})})]})}function Bv({onDismiss:e}){const t=Bt(),{group:n,groupId:r,domain:a}=Ce(),[s,i]=d.useState([]),[l,c]=d.useState([]),[u,h]=d.useState([]),[f,v]=d.useState(!0),[y,x]=d.useState({}),[w,j]=d.useState(null);d.useEffect(()=>{Promise.all([F.listProfiles().catch(()=>[]),F.getIntegrationManifests().then(k=>k.manifests??[]).catch(()=>[]),F.getMcpHealth().then(k=>k.integrations??[]).catch(()=>[])]).then(async([k,b,N])=>{if(i(k),c(b),h(N),r){const I=await Promise.all(k.map(V=>F.getTeamProfileConfig(r,V.id).catch(()=>null))),D={};k.forEach((V,M)=>{const $=I[M];$&&(D[V.id]=$)}),x(D)}}).finally(()=>v(!1))},[r]);const m=new Map,p=new Map;for(const k of l)k.profile&&m.set(k.profile,k);for(const k of u){const b=l.find(N=>N.id===k.id);b!=null&&b.profile&&p.set(b.profile,k)}const g=s.filter(k=>{const b=k.id.replace(/@.*$/,"").split("/").pop()??k.id;return m.has(b)}),S=k=>k in y,E=(k,b)=>{if(!r){console.error("No active group when creating authorization");return}const N=S(k);sessionStorage.setItem("agentAuth",JSON.stringify({profileId:k,groupId:r,groupName:(n==null?void 0:n.name)??null,domain:a,isTeam:N})),b?sessionStorage.setItem("agentGate",JSON.stringify({bounds:b.bounds,context:b.context,gateContent:{intent:b.intent},ttlConfig:{max:b.ttl},templateMode:b.mode,templateTtl:b.ttl})):sessionStorage.removeItem("agentGate"),j(null),e==null||e(),t("/agent/gate")},T=k=>{if(!r)return;const b=k.replace(/@.*$/,"").split("/").pop()??k,N=m.get(b);N!=null&&N.templates&&N.templates.length>0?j({profileId:k,manifest:N}):E(k)};if(w){const k=w.manifest.templates??[];return o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginBottom:"1rem"},onClick:()=>j(null),children:"← Back to profiles"}),o.jsxs("h3",{style:{margin:"0 0 0.25rem 0",fontSize:"1rem"},children:["Set up ",w.manifest.name," authorization"]}),o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.5rem",marginBottom:"0.75rem",fontWeight:600},children:"Quick start"}),o.jsx("div",{style:{display:"grid",gap:"0.75rem",gridTemplateColumns:`repeat(${Math.min(k.length,3)}, 1fr)`},children:k.map(b=>o.jsxs("button",{className:"template-card",onClick:()=>E(w.profileId,b),children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.375rem"},children:[o.jsx("span",{className:`template-mode template-mode-${b.mode==="automatic"?"auto":"review"}`,children:b.mode==="automatic"?"Auto":"Review"}),o.jsx("span",{className:"template-risk","data-risk":b.risk,children:b.risk})]}),o.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.25rem"},children:b.name}),o.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",lineHeight:1.45,marginBottom:"0.5rem"},children:b.description}),o.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.3rem"},children:b.tags.map(N=>o.jsx("span",{className:"template-tag",children:N},N))})]},b.name))}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1rem",margin:"1.5rem 0"},children:[o.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}}),o.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"or"}),o.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}})]}),o.jsx("button",{className:"btn btn-primary",style:{width:"100%",textAlign:"center",padding:"0.75rem"},onClick:()=>E(w.profileId),children:"Custom — define your own limits and scope"})]})}return o.jsxs(o.Fragment,{children:[o.jsx("style",{children:`
62
62
  .profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; align-items: stretch; }
63
63
  .profile-grid .card { display: flex; flex-direction: column; height: 100%; margin-top: 0 !important; }
64
64
  @media (max-width: 900px) { .profile-grid { grid-template-columns: repeat(2, 1fr); } }
65
65
  @media (max-width: 560px) { .profile-grid { grid-template-columns: 1fr; } }
66
- `}),f?o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem"},children:"Loading..."}):y.length===0?o.jsxs("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:[o.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"0.9rem",marginBottom:"1rem"},children:"No integrations set up yet. Connect a service first."}),o.jsx(Ge,{to:"/integrations",className:"btn btn-primary btn-sm",onClick:()=>e==null?void 0:e(),children:"Go to Integrations"})]}):o.jsx("div",{className:"profile-grid",children:y.map(k=>{const E=S(k.id),N=k.id.replace(/@.*$/,"").split("/").pop()??k.id,I=m.get(N),D=p.get(N),V=(D==null?void 0:D.running)===!0;return o.jsxs("div",{className:"card",style:V?void 0:{opacity:.7},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.125rem"},children:[o.jsx("h3",{className:"card-title",style:{margin:0},children:Re(k.id,k.name)}),E?o.jsx("span",{style:{fontSize:"0.6rem",padding:"0.1rem 0.35rem",borderRadius:"0.2rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Team"}):o.jsx("span",{style:{fontSize:"0.6rem",padding:"0.1rem 0.35rem",borderRadius:"0.2rem",background:"var(--bg-main)",color:"var(--text-tertiary)",fontWeight:600,border:"1px solid var(--border)"},children:"Personal"})]}),o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"1rem",flex:1},children:k.description}),V?o.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>T(k.id),children:"Authorize"}):o.jsxs(Ge,{to:`/integrations?setup=${(I==null?void 0:I.id)??""}`,className:"btn btn-secondary btn-sm",style:{textDecoration:"none",textAlign:"center"},onClick:()=>e==null?void 0:e(),children:["Set up ",(I==null?void 0:I.name)??"integration"]})]},k.id)})})]})}const Fy={active:"Active",pending:"Pending",expired:"Expired",revoked:"Revoked"};function Oy({status:e,label:t}){return o.jsx("span",{className:`status-badge status-${e}`,children:t||Fy[e]})}function By({domain:e,attested:t}){const n=t===!0?"domain-attested":t===!1?"domain-missing":"";return o.jsx("span",{className:`domain-badge ${n}`,style:{fontSize:"0.75rem"},children:e})}const pn=86400,vr=3600,wa=60,Dy=30*pn;function Uy(e){if(e<=0)return"Expired";if(e>90*pn){const t=Math.floor(e/Dy);return`${t} ${t===1?"month":"months"} remaining`}if(e>7*pn){const t=Math.floor(e/pn);return`${t} ${t===1?"day":"days"} remaining`}if(e>=2*pn){const t=Math.floor(e/pn),n=Math.floor(e%pn/vr);return`${t} ${t===1?"day":"days"} ${n}h remaining`}if(e>=2*vr){const t=Math.floor(e/vr),n=Math.floor(e%vr/wa);return`${t}h ${String(n).padStart(2,"0")}m remaining`}if(e>=wa){const t=Math.floor(e/wa),n=Math.floor(e%wa);return`${t}m ${String(n).padStart(2,"0")}s remaining`}return`${Math.floor(e)}s remaining`}function Wy({expiresAt:e}){const[t,n]=d.useState(()=>e-Date.now()/1e3),r=t<2*vr;d.useEffect(()=>{const s=setInterval(()=>n(e-Date.now()/1e3),r?1e3:6e4);return()=>clearInterval(s)},[e,r]);const a=t<300;return o.jsx("span",{className:`ttl-badge ${a?"ttl-warn":"ttl-ok"}`,children:Uy(t)})}function bf({icon:e,title:t,text:n,children:r}){return o.jsxs("div",{className:"empty-state",children:[e&&o.jsx("div",{className:"empty-state-icon",children:e}),o.jsx("div",{className:"empty-state-title",children:t}),n&&o.jsx("div",{className:"empty-state-text",children:n}),r]})}function Hy(e){const t=Math.floor(e/86400);if(t>=1)return`${t} day${t===1?"":"s"}`;const n=Math.floor(e/3600);if(n>=1)return`${n} hour${n===1?"":"s"}`;const r=Math.ceil(e/60);return`${r} minute${r===1?"":"s"}`}const Vy=[{label:"30m",seconds:1800},{label:"1h",seconds:3600},{label:"2h",seconds:7200},{label:"4h",seconds:14400},{label:"8h",seconds:28800},{label:"24h",seconds:86400},{label:"7d",seconds:604800},{label:"30d",seconds:2592e3},{label:"1y",seconds:31536e3}];function Ky({item:e,onClose:t,onSuccess:n}){var m;const{user:r,activeDomain:a,groupId:s}=Ce(),i=e.remaining_seconds??0,l=Vy.filter(p=>p.seconds>i),c=((m=l[0])==null?void 0:m.seconds)??2592e3,[u,h]=d.useState(c),[f,g]=d.useState(!1),[v,x]=d.useState(""),w=Object.entries(e.frame).filter(([p])=>p!=="profile"&&p!=="path"),j=async()=>{var p;if(r){g(!0),x("");try{const y=e.frame_hash||e.profile_id||e.path,S=await F.getGateContent(y);if(!S)throw new Error("Gate content not found locally. The MCP server may have restarted. Please re-authorize through the full wizard instead.");const b=await F.getProfile(e.profile_id),T=e.frame,k=S.context??{},E=e.attested_domains[0]||a||"owner",N=await Cf(T,b),I=await Nf(k,b),[D,V]=await Promise.all([lo(S.gateContent.intent),lo(JSON.stringify({profile:e.profile_id,path:e.path,domain:E}))]);if(!s)throw new Error("No active group; cannot extend authorization.");const M=(((p=e.deferred_commitment_domains)==null?void 0:p.length)??0)>0?"review":"automatic",$=await F.attest({profile_id:e.profile_id,path:e.path,bounds:T,bounds_hash:N,context_hash:I,domain:E,did:r.did,gate_content_hashes:{intent:D},execution_context_hash:V,group_id:s,commitment_mode:M,ttl:u});await F.pushGateContent(Ef($,{boundsHash:N,contextHash:I,context:k,path:e.path,gateContent:S.gateContent})),n()}catch(y){x(y instanceof Error?y.message:"Extension failed")}finally{g(!1)}}};return o.jsx("div",{className:"modal-backdrop",onClick:p=>p.target===p.currentTarget&&t(),children:o.jsxs("div",{className:"modal",children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h3",{className:"modal-title",children:"Extend Authorization"}),o.jsx("button",{className:"modal-close",onClick:t,children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsxs("div",{style:{marginBottom:"1rem"},children:[o.jsxs("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:[Re(e.profile_id)," / ",e.path]}),w.length>0&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:w.map(([p,y])=>`${p}=${y}`).join(" · ")})]}),o.jsxs("div",{style:{marginBottom:"1rem"},children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"New duration"}),i>0&&o.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["Currently valid for ",Hy(i),". Only longer durations are shown."]}),o.jsx("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:l.length===0?o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"This authorization is already on the longest available duration. Nothing to extend."}):l.map(p=>o.jsx("button",{className:`btn ${u===p.seconds?"btn-primary":"btn-secondary"}`,onClick:()=>h(p.seconds),style:{minWidth:"3.5rem"},children:p.label},p.seconds))})]}),o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"Same bounds, context, and gate content will be re-attested with a new TTL (measured from now)."}),v&&o.jsx("div",{className:"error-message",children:v})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:t,disabled:f,children:"Cancel"}),o.jsx("button",{className:"btn btn-primary",onClick:j,disabled:f,children:f?"Extending...":"Extend"})]})]})})}function Gy(e,t,n){return[...e].sort((r,a)=>{if(n){if(r.frame_hash===n&&a.frame_hash!==n)return-1;if(a.frame_hash===n&&r.frame_hash!==n)return 1}const s=jt(r,{revokedSet:t}),i=jt(a,{revokedSet:t}),l={active:0,pending:1,expired:2,revoked:3};return l[s]!==l[i]?l[s]-l[i]:new Date(a.created_at).getTime()-new Date(r.created_at).getTime()})}function Qy({item:e,revokedSet:t,expandedHash:n,gateCache:r,gateLoading:a,copiedHash:s,revokingHash:i,copyingHash:l,profileConfigCache:c,mode:u,ownerLabel:h,isAdmin:f,onExpand:g,onCopyHash:v,onCopy:x,onRevoke:w,onExtend:j,highlightHash:m}){var z;const p=jt(e,{revokedSet:t}),y=n===e.frame_hash,S=r[e.frame_hash||e.profile_id||e.path],b=p==="active"||p==="pending"||p==="expired",T=Object.entries(e.frame).filter(([L])=>L!=="profile"&&L!=="path"),k=c.get(e.profile_id)??null,E=(((z=k==null?void 0:k.approvers)==null?void 0:z.length)??0)>0,N=new Map;if(k!=null&&k.caps&&u==="team")for(const[L,U]of T){const ne=k.caps[L];ne!==void 0&&Number(U)>ne&&N.set(L,{authorized:Number(U),cap:ne})}const I=N.size>0,D=e.approvers_frozen??[],V=(k==null?void 0:k.approvers)??[],M=u==="team"&&D.length>0&&V.length>0&&(D.length!==V.length||D.some(L=>!V.includes(L))||V.some(L=>!D.includes(L))),$=Array.from(N.entries()).map(([L,U])=>`${L}: ${U.authorized} (cap ${U.cap})`).join(", "),R=Array.from(N.entries()).map(([L,U])=>`${L}: ${U.authorized} → ${U.cap}`).join(", "),Y=I?E?N.size===1?`Above team cap: ${$} — actions require approval`:`Above team cap (${N.size}): ${$} — actions require approval`:N.size===1?`Reduced by hard cap: ${R}`:`Reduced by hard cap (${N.size}): ${R}`:"",_=I?E?"Above-cap actions under this authority require per-action approval from the profile's approvers. Bounds remain authorized at their original values.":"No approvers are configured for this profile, so the team cap is a hard ceiling. Bounds above the cap are effectively reduced to the cap. Ask the admin to raise the cap or add approvers, or copy this authorization to reissue within the cap.":void 0,C=Re(e.profile_id),P=m!=null&&e.frame_hash===m;return o.jsxs("div",{className:`card${P?" card-highlight":""}`,style:{marginBottom:0},children:[h&&o.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner: ",o.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:h})]}),o.jsxs("div",{className:"auth-card-header",children:[o.jsx("span",{style:{fontWeight:700,fontSize:"1rem",color:"var(--text-primary)",letterSpacing:"0.01em"},children:C}),e.title&&o.jsx("span",{style:{fontWeight:500,fontSize:"0.85rem",color:"var(--text-secondary)"},children:e.title}),o.jsx(Oy,{status:p}),p==="active"&&e.earliest_expiry&&o.jsx(Wy,{expiresAt:new Date(e.earliest_expiry).getTime()/1e3}),p==="expired"&&o.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:new Date(e.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.5rem",alignItems:"center"},children:[e.required_domains.map(L=>o.jsx(By,{domain:L,attested:e.attested_domains.includes(L)},L)),e.deferred_commitment_domains.length>0&&o.jsx("span",{style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Review Mode"}),I&&o.jsx("span",{title:_,style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:E?"var(--accent-subtle)":"var(--danger-subtle)",color:E?"var(--accent)":"var(--danger)",fontWeight:600,cursor:"help"},children:Y}),M&&o.jsx("button",{className:"btn btn-ghost btn-sm",style:{fontSize:"0.65rem",padding:"0.15rem 0.5rem",borderRadius:"0.25rem",background:"var(--warning-subtle, rgba(234,179,8,0.12))",color:"var(--warning, #ca8a04)",fontWeight:600,border:"1px solid var(--warning-border, rgba(234,179,8,0.3))",cursor:"pointer",lineHeight:1.4},onClick:()=>x(e),disabled:l===e.frame_hash,title:"The approver list for this profile has changed since this authority was created. Copy to reissue with the current approvers.",children:l===e.frame_hash?"Copying...":"Approver list updated · Copy with new approvers"})]}),T.length>0&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:T.map(([L,U],ne)=>{const J=N.get(L);return o.jsxs("span",{children:[ne>0&&" · ",J?E?o.jsxs("span",{title:`Team cap on ${L} is ${J.cap}. Actions exceeding the cap require per-action approval. Bound remains authorized at ${J.authorized}.`,children:[o.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[L,"=",String(U)]}),o.jsxs("span",{style:{color:"var(--accent)",marginLeft:"0.25rem",fontWeight:600},children:["↑ approval at ",J.cap]})]}):o.jsxs("span",{title:`Team cap on ${L} is ${J.cap} with no approvers configured (hard cap). Authorized for ${J.authorized}; effective ${J.cap}.`,children:[o.jsxs("span",{style:{textDecoration:"line-through",color:"var(--text-tertiary)"},children:[L,"=",String(U)]}),o.jsxs("span",{style:{color:"var(--danger)",marginLeft:"0.25rem",fontWeight:600},children:["→"," ",J.cap]})]}):o.jsxs("span",{children:[L,"=",String(U)]})]},L)})}),o.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:o.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>g(e),children:y?"▲ Hide Details":"▼ Details"})}),y&&o.jsxs("div",{style:{borderTop:"1px solid var(--border)",marginTop:"0.75rem",paddingTop:"0.75rem"},children:[T.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Bounds"}),o.jsx("dl",{className:"review-grid",children:T.map(([L,U])=>o.jsxs("span",{style:{display:"contents"},children:[o.jsx("dt",{children:L}),o.jsx("dd",{children:String(U)})]},L))})]}),(S==null?void 0:S.context)&&Object.keys(S.context).length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Context"}),o.jsx("dl",{className:"review-grid",children:Object.entries(S.context).map(([L,U])=>o.jsxs("span",{style:{display:"contents"},children:[o.jsx("dt",{children:L}),o.jsx("dd",{children:String(U)})]},L))})]}),o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Intent"}),a===e.frame_hash?o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Loading gate content..."}):S?o.jsx("div",{className:"gate-content-block",children:o.jsx("div",{className:"gate-content-item",children:o.jsx("div",{className:"gate-content-text",children:S.gateContent.intent})})}):o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Gate content not available."}),o.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"1rem"},children:["Created: ",new Date(e.created_at).toLocaleString(),e.earliest_expiry&&` · Expires: ${new Date(e.earliest_expiry).toLocaleString()}`]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginTop:"0.25rem"},children:[o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontFamily:"'SF Mono', Monaco, monospace",wordBreak:"break-all"},children:e.frame_hash}),o.jsx("button",{className:"btn btn-ghost btn-sm",style:{fontSize:"0.7rem",padding:"0.125rem 0.375rem"},onClick:()=>v(e.frame_hash),children:s===e.frame_hash?"copied":"copy"})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.75rem"},children:[!h&&o.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>x(e),disabled:l===e.frame_hash,title:"Start a new authorization pre-filled with these bounds, context, and intent",children:l===e.frame_hash?"Copying…":"⧉ Copy"}),!h&&b&&o.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>j(e),children:"↻ Extend"}),h&&f&&p!=="revoked"?o.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.frame_hash,h,C),disabled:i===e.frame_hash,children:i===e.frame_hash?"Revoking…":"Revoke"}):!h&&(p==="active"||p==="pending")?o.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.frame_hash),disabled:i===e.frame_hash,children:i===e.frame_hash?"Revoking…":"Revoke"}):null]})]})]},e.frame_hash)}function Yy(){const[e,t]=d.useState([]),[n,r]=d.useState(!0),[a,s]=d.useState([]),[i,l]=d.useState(!1),[c,u]=d.useState("mine"),[h,f]=d.useState("active"),[g,v]=d.useState(null),[x,w]=d.useState(null),[j,m]=mf(),[p,y]=d.useState(()=>j.get("new")==="1"),[S,b]=d.useState(()=>j.get("highlight")),[T,k]=d.useState(null),[E,N]=d.useState({}),[I,D]=d.useState(null),[V,M]=d.useState(null),[$,R]=d.useState(null),[Y,_]=d.useState(new Set),[C,P]=d.useState(null),[z,L]=d.useState(null),U=Bt(),{group:ne,groupId:J,domain:ye,mode:O,activeTeam:B}=Ce(),Q=(B==null?void 0:B.isAdmin)===!0,[G,K]=d.useState(()=>new Map),ae=d.useCallback(()=>{r(!0),F.getMyAttestations().then(t).catch(()=>{}).finally(()=>r(!1))},[]),ve=d.useCallback(()=>{J&&(l(!0),F.listTeamAuthorizations(J).then(s).catch(()=>{}).finally(()=>l(!1)))},[J]);ue("attestation-changed",()=>{ae(),Q&&J&&ve()}),d.useEffect(()=>{if(!S)return;j.get("highlight")&&(j.delete("highlight"),m(j,{replace:!0}));const W=window.setTimeout(()=>b(null),3e3);return()=>window.clearTimeout(W)},[]),Rt(ae,3e5),d.useEffect(()=>{c==="team"&&Q&&J&&a.length===0&&!i&&ve()},[c,Q,J,a.length,i,ve]),d.useEffect(()=>{if(O!=="team"||!J)return;const W=c==="mine"?e:a;if(W.length===0)return;const X=[...new Set(W.map(Z=>Z.profile_id))].filter(Z=>!G.has(Z));if(X.length!==0){K(Z=>{const Ne=new Map(Z);for(const xt of X)Ne.set(xt,null);return Ne});for(const Z of X)F.getTeamProfileConfig(J,Z).then(Ne=>{K(xt=>new Map(xt).set(Z,Ne))}).catch(()=>{})}},[e,a,c,J,O,G]);const vt=async W=>{if(T===W.frame_hash){k(null);return}k(W.frame_hash);const X=W.frame_hash||W.profile_id||W.path;if(!(X in E)){D(W.frame_hash);try{const Z=await F.getGateContent(X);N(Ne=>({...Ne,[X]:Z}))}catch{N(Z=>({...Z,[X]:null}))}finally{D(null)}}},un=W=>{navigator.clipboard.writeText(W).then(()=>{R(W),setTimeout(()=>R(null),2e3)})},Ve=async W=>{var X;if(!J){alert("No active group; cannot copy authorization.");return}L(W.frame_hash);try{const Z=W.frame_hash||W.profile_id||W.path;let Ne=E[Z]??null;Z in E||(Ne=await F.getGateContent(Z),N(ea=>({...ea,[Z]:Ne})));const xt=Object.fromEntries(Object.entries(W.frame).filter(([ea])=>ea!=="profile"&&ea!=="path")),Tf=(Ne==null?void 0:Ne.context)??{},If=((X=Ne==null?void 0:Ne.gateContent)==null?void 0:X.intent)??"",_f=W.deferred_commitment_domains.length>0?"review":"automatic",Rf=W.attested_domains[0]||ye||"owner";sessionStorage.setItem("agentAuth",JSON.stringify({profileId:W.profile_id,groupId:J,groupName:(ne==null?void 0:ne.name)??null,domain:Rf})),sessionStorage.setItem("agentGate",JSON.stringify({bounds:xt,context:Tf,gateContent:{intent:If},templateMode:_f})),U("/agent/gate")}catch(Z){alert(Z instanceof Error?Z.message:"Failed to copy authorization")}finally{L(null)}},ct=async(W,X,Z)=>{const Ne=X&&Z?`Revoke ${X}'s ${Z} authorization? This cannot be undone.`:"Revoke this authorization? The agent will no longer be able to execute actions under this attestation.";if(confirm(Ne)){P(W);try{await F.revokeAttestation(W),_(xt=>new Set(xt).add(W)),X&&J&&ve()}catch(xt){alert(xt instanceof Error?xt.message:"Failed to revoke authorization")}finally{P(null)}}},Ae=c==="mine"?e:a,Oe=c==="mine"?n:i,Dt={active:Ae.filter(W=>jt(W,{revokedSet:Y})==="active").length,pending:Ae.filter(W=>jt(W,{revokedSet:Y})==="pending").length,expired:Ae.filter(W=>jt(W,{revokedSet:Y})==="expired").length,revoked:Ae.filter(W=>jt(W,{revokedSet:Y})==="revoked").length},et=(()=>{const W=new Map;for(const X of Ae){if(jt(X,{revokedSet:Y})!==h)continue;const Z=W.get(X.profile_id)??{count:0,review:!1};Z.count+=1,X.deferred_commitment_domains.length>0&&(Z.review=!0),W.set(X.profile_id,Z)}return Array.from(W.entries()).map(([X,Z])=>({profileId:X,...Z})).sort((X,Z)=>Re(X.profileId).localeCompare(Re(Z.profileId)))})(),te=Gy(Ae.filter(W=>{if(jt(W,{revokedSet:Y})!==h||g!==null&&W.profile_id!==g)return!1;if(x!==null){const X=W.deferred_commitment_domains.length>0;if(x==="review"&&!X||x==="auto"&&X)return!1}return!0}),Y,S),bt={revokedSet:Y,expandedHash:T,gateCache:E,gateLoading:I,copiedHash:$,revokingHash:C,copyingHash:z,profileConfigCache:G,mode:O,activeDomain:ye,group:ne,groupId:J,onExpand:vt,onCopyHash:un,onCopy:Ve,onRevoke:ct,onExtend:M,highlightHash:S};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"1rem",flexWrap:"wrap"},children:[o.jsxs("div",{children:[o.jsx("h1",{className:"page-title",children:"Authorizations"}),o.jsx("p",{className:"page-subtitle",children:"Active, pending, and expired agent authorizations."})]}),o.jsx("button",{className:"btn btn-primary",onClick:()=>y(!0),children:"+ New authorization"})]}),p&&o.jsx("div",{className:"modal-backdrop",onClick:()=>{y(!1),j.get("new")&&(j.delete("new"),m(j,{replace:!0}))},children:o.jsxs("div",{className:"modal",onClick:W=>W.stopPropagation(),style:{maxWidth:"960px",width:"90vw"},children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h2",{className:"modal-title",children:"New authorization"}),o.jsx("button",{className:"modal-close",onClick:()=>{y(!1),j.get("new")&&(j.delete("new"),m(j,{replace:!0}))},children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem",marginTop:0,marginBottom:"1rem"},children:"What should your agent be able to do? Pick a profile, set limits, then authorize."}),o.jsx(My,{onDismiss:()=>y(!1)})]})]})}),Q&&o.jsxs("div",{className:"nav-tabs",style:{marginBottom:"0.5rem"},children:[o.jsx("button",{className:`nav-tab${c==="mine"?" active":""}`,onClick:()=>{u("mine"),f("active"),v(null),w(null),k(null)},children:"Mine"}),o.jsx("button",{className:`nav-tab${c==="team"?" active":""}`,onClick:()=>{u("team"),f("active"),v(null),w(null),k(null)},children:"Team"})]}),o.jsx("div",{className:"nav-tabs",children:["active","pending","expired","revoked"].map(W=>o.jsxs("button",{className:`nav-tab${h===W?" active":""}`,onClick:()=>{f(W),v(null),w(null)},children:[W.charAt(0).toUpperCase()+W.slice(1)," (",Dt[W],")"]},W))}),et.length>0&&o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"center",marginTop:"-0.25rem",marginBottom:"1rem"},children:[et.map(W=>{const X=g===W.profileId;return o.jsx("button",{className:`btn btn-sm ${X?"btn-primary":"btn-secondary"}`,onClick:()=>v(X?null:W.profileId),children:Re(W.profileId)},W.profileId)}),o.jsx("span",{"aria-hidden":"true",style:{color:"var(--border)",fontSize:"1.1rem",padding:"0 0.25rem",userSelect:"none"},children:"|"}),["auto","review"].map(W=>{const X=x===W;return o.jsx("button",{className:`btn btn-sm ${X?"btn-primary":"btn-secondary"}`,onClick:()=>w(X?null:W),children:W==="auto"?"Auto":"Review"},W)})]}),Oe&&Ae.length===0?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):te.length===0?o.jsx(bf,{icon:"☰",title:"No authorizations",text:`No ${h} authorizations found.`}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:te.map(W=>{const X=c==="team"?W:null,Z=X!=null&&X.owner?X.owner.name??X.owner.email??X.owner.userId:void 0;return o.jsx(Qy,{item:W,ownerLabel:Z,isAdmin:Q,...bt},W.frame_hash)})}),V&&o.jsx(Ky,{item:V,onClose:()=>M(null),onSuccess:()=>{M(null),ae()}})]})}function Pf({profileId:e}){return o.jsx("span",{className:"profile-badge",children:Re(e)})}function Jy(e){return new Date(e*1e3).toLocaleString()}function Xy(e,t){if(t==="all")return!0;const n=t==="1d"?1:t==="7d"?7:30,r=Math.floor(Date.now()/1e3)-n*86400;return e.timestamp>=r}function qy(e,t){if(!t)return!0;const n=t.toLowerCase();return e.profileId.toLowerCase().includes(n)||Re(e.profileId).toLowerCase().includes(n)||e.path.toLowerCase().includes(n)||e.action.toLowerCase().includes(n)||e.attestationHash.toLowerCase().includes(n)||e.id.toLowerCase().includes(n)||JSON.stringify(e.executionContext).toLowerCase().includes(n)}function Zy(){const{activeTeam:e,groupId:t}=Ce(),n=(e==null?void 0:e.isAdmin)===!0,[r,a]=d.useState("mine"),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,h]=d.useState({}),[f,g]=d.useState(new Set),[v,x]=d.useState(""),[w,j]=d.useState(new Set),[m,p]=d.useState(new Set),[y,S]=d.useState("all"),[b,T]=d.useState(!1),k=d.useCallback(()=>{c(!0),r==="team"&&n&&t?F.listTeamReceipts(t).then(i).catch(()=>i([])).finally(()=>c(!1)):F.getMyReceipts({limit:200}).then(i).catch(()=>{}).finally(()=>c(!1))},[r,n,t]);Rt(k,12e4),d.useEffect(()=>{r!=="team"||Object.keys(u).length>0||F.listUsers().then(_=>{const C={};for(const P of _)C[P.id]={name:P.name,email:P.email};h(C)}).catch(()=>{})},[r,u]);const E=d.useMemo(()=>{const _=new Set;for(const C of s)_.add(Re(C.profileId));return[..._].sort()},[s]),N=d.useMemo(()=>{const _=new Set;for(const C of s)_.add(C.action);return[..._].sort()},[s]),I=d.useMemo(()=>{if(r!=="team")return[];const _=new Set;for(const C of s)C.userId&&_.add(C.userId);return[..._].map(C=>{var P;return{id:C,label:(P=u[C])!=null&&P.name?`${u[C].name} (${u[C].email})`:C}}).sort((C,P)=>C.label.localeCompare(P.label))},[r,s,u]),D=d.useMemo(()=>s.filter(_=>!(!qy(_,v)||w.size>0&&!w.has(Re(_.profileId))||m.size>0&&!m.has(_.action)||f.size>0&&_.userId&&!f.has(_.userId)||!Xy(_,y))),[s,v,w,m,f,y]),V=w.size>0||m.size>0||f.size>0||y!=="all";function M(_){j(C=>{const P=new Set(C);return P.has(_)?P.delete(_):P.add(_),P})}function $(_){p(C=>{const P=new Set(C);return P.has(_)?P.delete(_):P.add(_),P})}function R(_){g(C=>{const P=new Set(C);return P.has(_)?P.delete(_):P.add(_),P})}function Y(){j(new Set),p(new Set),g(new Set),S("all"),x("")}return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{className:"page-title",children:"Receipts"}),o.jsx("p",{className:"page-subtitle",children:"Execution history for agent actions."})]}),n&&o.jsx("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem",borderBottom:"1px solid var(--border)"},children:["mine","team"].map(_=>o.jsx("button",{onClick:()=>a(_),className:"btn btn-ghost",style:{borderRadius:0,padding:"0.5rem 0.875rem",borderBottom:r===_?"2px solid var(--accent)":"2px solid transparent",color:r===_?"var(--text-primary)":"var(--text-tertiary)",fontWeight:r===_?600:500},children:_==="mine"?"Mine":"Team"},_))}),o.jsxs("div",{className:"search-filter-bar",children:[o.jsxs("div",{className:"search-input-wrap",children:[o.jsx("span",{className:"search-icon",children:"⌕"}),o.jsx("input",{type:"text",className:"form-input search-input",placeholder:"Search by profile, action, path, or hash\\u2026",value:v,onChange:_=>x(_.target.value)}),v&&o.jsx("button",{className:"search-clear",onClick:()=>x(""),children:"×"})]}),o.jsxs("button",{className:`btn btn-sm btn-secondary${b?" active":""}`,onClick:()=>T(!b),children:["Filters",V?` (${w.size+m.size+(y!=="all"?1:0)})`:""]})]}),b&&o.jsxs("div",{className:"filter-panel",children:[E.length>1&&o.jsxs("div",{className:"filter-section",children:[o.jsx("div",{className:"filter-label",children:"Profile"}),o.jsx("div",{className:"filter-chips",children:E.map(_=>o.jsx("button",{className:`filter-chip${w.has(_)?" selected":""}`,onClick:()=>M(_),children:_},_))})]}),N.length>1&&o.jsxs("div",{className:"filter-section",children:[o.jsx("div",{className:"filter-label",children:"Action"}),o.jsx("div",{className:"filter-chips",children:N.map(_=>o.jsx("button",{className:`filter-chip${m.has(_)?" selected":""}`,onClick:()=>$(_),children:_},_))})]}),r==="team"&&I.length>1&&o.jsxs("div",{className:"filter-section",children:[o.jsx("div",{className:"filter-label",children:"Owner"}),o.jsx("div",{className:"filter-chips",children:I.map(_=>o.jsx("button",{className:`filter-chip${f.has(_.id)?" selected":""}`,onClick:()=>R(_.id),children:_.label},_.id))})]}),o.jsxs("div",{className:"filter-section",children:[o.jsx("div",{className:"filter-label",children:"Time range"}),o.jsx("div",{className:"filter-chips",children:[["1d","Today"],["7d","7 days"],["30d","30 days"],["all","All time"]].map(([_,C])=>o.jsx("button",{className:`filter-chip${y===_?" selected":""}`,onClick:()=>S(_),children:C},_))})]})]}),V&&o.jsxs("div",{className:"active-filters",children:[[...w].map(_=>o.jsxs("span",{className:"active-chip",onClick:()=>M(_),children:[_," ",o.jsx("span",{className:"chip-remove",children:"×"})]},_)),[...m].map(_=>o.jsxs("span",{className:"active-chip",onClick:()=>$(_),children:[_," ",o.jsx("span",{className:"chip-remove",children:"×"})]},_)),[...f].map(_=>{const C=u[_],P=C?C.name:_;return o.jsxs("span",{className:"active-chip",onClick:()=>R(_),children:[P," ",o.jsx("span",{className:"chip-remove",children:"×"})]},_)}),y!=="all"&&o.jsxs("span",{className:"active-chip",onClick:()=>S("all"),children:[y==="1d"?"Today":y==="7d"?"7 days":"30 days"," ",o.jsx("span",{className:"chip-remove",children:"×"})]}),o.jsx("button",{className:"clear-filters",onClick:Y,children:"Clear all"})]}),l&&s.length===0?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):D.length===0?o.jsx(bf,{icon:"⌕",title:s.length===0?"No receipts yet":"No matching receipts",text:s.length===0?"Execution receipts will appear here after an agent uses an authorized tool.":"Try adjusting your search or filters."}):o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:D.length===s.length?`${s.length} receipt${s.length!==1?"s":""}`:`${D.length} of ${s.length} receipts`}),o.jsx("div",{className:"timeline",children:D.map(_=>{var C;return o.jsx("div",{className:"timeline-event",children:o.jsxs("div",{className:"card",style:{marginBottom:0},children:[o.jsxs("div",{className:"auth-card-header",children:[o.jsx(Pf,{profileId:_.profileId}),o.jsx("span",{className:"auth-card-path",children:_.path}),o.jsx("span",{className:"receipt-action",children:_.action}),o.jsx("span",{className:"auth-card-time",children:Jy(_.timestamp)})]}),r==="team"&&_.userId&&o.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner:"," ",o.jsx("span",{style:{color:"var(--text-secondary)"},children:(C=u[_.userId])!=null&&C.name?`${u[_.userId].name} (${u[_.userId].email})`:_.userId})]}),Object.keys(_.executionContext).length>0&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:Object.entries(_.executionContext).map(([P,z])=>`${P}=${z}`).join(" · ")}),o.jsxs("div",{style:{display:"flex",gap:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:[o.jsxs("span",{children:["Daily: ",_.cumulativeState.daily.count," calls, $",_.cumulativeState.daily.amount]}),o.jsxs("span",{children:["Monthly: ",_.cumulativeState.monthly.count," calls, $",_.cumulativeState.monthly.amount]})]}),o.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontFamily:"'SF Mono', Monaco, monospace",wordBreak:"break-all",marginTop:"0.375rem"},children:_.attestationHash})]})},_.id)})})]})]})}const Ac={ollama:{provider:"ollama",endpoint:"http://localhost:11434",models:["gemma4:e4b","gemma4:e2b","gemma4:26b","gemma4:31b","llama3.2","llama3.1","mistral","qwen2.5"]},openrouter:{provider:"openai-compatible",endpoint:"https://openrouter.ai/api/v1",models:["google/gemma-4-31b-it","qwen/qwen3.6-plus:free","stepfun/step-3.5-flash:free","google/gemini-2.5-flash","openai/gpt-4o-mini","anthropic/claude-haiku-4"]},openai:{provider:"openai-compatible",endpoint:"https://api.openai.com/v1",models:["gpt-4o-mini","gpt-4o","o3-mini"]},groq:{provider:"openai-compatible",endpoint:"https://api.groq.com/openai/v1",models:["llama-3.1-8b-instant","llama-3.3-70b-versatile","gemma2-9b-it"]},together:{provider:"openai-compatible",endpoint:"https://api.together.xyz/v1",models:["meta-llama/Llama-3-8b-chat-hf","meta-llama/Llama-3-70b-chat-hf"]}};function ev(){const[e,t]=d.useState(""),[n,r]=d.useState("openrouter"),[a,s]=d.useState("openai-compatible"),[i,l]=d.useState("https://openrouter.ai/api/v1"),[c,u]=d.useState("google/gemma-4-31b-it"),[h,f]=d.useState(""),[g,v]=d.useState(!1),[x,w]=d.useState(!1),[j,m]=d.useState(!1),[p,y]=d.useState(null),S=d.useCallback(N=>{t(N),setTimeout(()=>t(""),3e3)},[]),b=d.useCallback(async()=>{try{const N=await F.getCredential("ai-config");if(v(N.configured),N.configured&&N.fields){N.fields.provider&&s(N.fields.provider),N.fields.endpoint&&l(N.fields.endpoint),N.fields.model&&u(N.fields.model);const I=N.fields.endpoint??"";I.includes("openai.com")?r("openai"):I.includes("groq.com")?r("groq"):I.includes("together.xyz")?r("together"):I.includes("openrouter.ai")?r("openrouter"):r("ollama")}}catch{}},[]);d.useEffect(()=>{b()},[b]);const T=N=>{r(N);const I=Ac[N];I&&(s(I.provider),l(I.endpoint),u(I.models[0]))},k=async()=>{w(!0);try{await F.setCredential("ai-config",{provider:a,endpoint:i,model:c,...h?{apiKey:h}:{}}),v(!0),S("AI configuration saved!")}catch{S("Failed to save AI config")}finally{w(!1)}},E=async()=>{m(!0),y(null);try{const N=await F.aiTest(h?{provider:a,endpoint:i,model:c,apiKey:h}:{});y(N.ok?`OK: ${N.message}`:`Failed: ${N.message}`)}catch(N){y(`Error: ${N instanceof Error?N.message:"Unknown"}`)}finally{m(!1)}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{className:"page-title",children:"AI Assistant"}),o.jsx("p",{className:"page-subtitle",children:"Advisory AI to help you think through intent when authorizing agents."})]}),e&&o.jsx("div",{className:"alert alert-success",children:e}),o.jsxs("div",{className:"card",children:[o.jsx("h3",{className:"card-title",children:"Configuration"}),o.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Connect a trusted AI model that has access to your intent — problem, objective, and tradeoffs — to help you think through authorizations. Keys are encrypted in your vault."}),g&&o.jsxs("div",{className:"status-banner status-banner-success",style:{marginBottom:"1rem",fontSize:"0.8rem"},children:[o.jsx("span",{className:"status-banner-icon",children:"✓"}),o.jsx("span",{className:"status-banner-text",children:"AI configured"})]}),o.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[o.jsx("label",{className:"form-label",children:"Provider Preset"}),o.jsxs("select",{className:"form-input",value:n,onChange:N=>T(N.target.value),children:[o.jsx("option",{value:"openrouter",children:"OpenRouter (recommended)"}),o.jsx("option",{value:"ollama",children:"Ollama (local)"}),o.jsx("option",{value:"openai",children:"OpenAI"}),o.jsx("option",{value:"groq",children:"Groq"}),o.jsx("option",{value:"together",children:"Together"})]})]}),o.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[o.jsx("label",{className:"form-label",children:"Model"}),(()=>{var D;const N=((D=Ac[n])==null?void 0:D.models)??[],I=N.includes(c);return o.jsxs(o.Fragment,{children:[o.jsxs("select",{className:"form-input",value:I?c:"__custom__",onChange:V=>{V.target.value==="__custom__"?u(""):u(V.target.value)},style:{marginBottom:I?void 0:"0.375rem"},children:[N.map(V=>o.jsx("option",{value:V,children:V},V)),o.jsx("option",{value:"__custom__",children:"Custom model..."})]}),!I&&o.jsx("input",{className:"form-input",value:c,onChange:V=>u(V.target.value),placeholder:"Enter model name"})]})})()]}),o.jsxs("div",{className:"form-group",style:{marginBottom:"1rem"},children:[o.jsx("label",{className:"form-label",children:"API Key (if required)"}),o.jsx("input",{className:"form-input",type:"password",value:h,onChange:N=>f(N.target.value),placeholder:g?"••••••••••••••••":"sk-... (not needed for Ollama)"})]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[o.jsx("button",{className:"btn btn-primary",onClick:k,disabled:x,children:x?"Saving...":"Save & Encrypt"}),g&&o.jsx("button",{className:"btn btn-ghost",onClick:E,disabled:j,children:j?"Testing...":"Test Connection"})]}),p&&o.jsx("div",{className:`alert ${p.startsWith("OK")?"alert-success":"alert-error"}`,style:{marginTop:"0.75rem"},children:p})]}),o.jsx(tv,{}),o.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[o.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,marginBottom:"1rem"},children:"Security"}),o.jsxs("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.7},children:[o.jsxs("div",{style:{marginBottom:"1rem"},children:[o.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"What the gateway protects"}),o.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[o.jsx("li",{children:"Every tool call verified against your authorization bounds"}),o.jsx("li",{children:"Credentials never exposed to agents through MCP"}),o.jsx("li",{children:"Every action produces a signed receipt"})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"Your responsibility"}),o.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[o.jsx("li",{children:"If your AI agent has full access to your computer, it could bypass the gateway"}),o.jsx("li",{children:"For best security, run agents in sandboxed environments"}),o.jsx("li",{children:"The gateway secures what agents do through tools — not what they do on your machine"})]})]})]})]})]})}function tv(){const[e,t]=d.useState(null),[n,r]=d.useState({intent:"",context:""}),[a,s]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(null),[h,f]=d.useState(!1),g=d.useCallback(async()=>{if(!h)try{const w=await F.getAIPrompts();t(w),r({intent:w.intent.current,context:w.context.current}),f(!0)}catch(w){l(w instanceof Error?w.message:"Failed to load prompts")}},[h]),v=async w=>{if(e){s(w),l(null);try{const j=n[w],m=j.trim()===e[w].default.trim()?"":j;await F.setAIPrompt(w,m);const p=await F.getAIPrompts();t(p),r({intent:p.intent.current,context:p.context.current}),u(w),setTimeout(()=>u(null),2e3)}catch(j){l(j instanceof Error?j.message:"Save failed")}finally{s(null)}}},x=async w=>{if(confirm(`Revert ${w} prompt to the built-in default?`)){s(w),l(null);try{await F.setAIPrompt(w,"");const j=await F.getAIPrompts();t(j),r({intent:j.intent.current,context:j.context.current})}catch(j){l(j instanceof Error?j.message:"Revert failed")}finally{s(null)}}};return o.jsxs("details",{className:"card",style:{padding:"1.5rem",marginTop:"1rem"},onToggle:w=>{w.currentTarget.open&&g()},children:[o.jsx("summary",{style:{fontSize:"1rem",fontWeight:700,cursor:"pointer",listStyle:"revert",userSelect:"none"},children:"Advanced — AI assistant prompts"}),o.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",margin:"0.75rem 0 1rem 0",lineHeight:1.55},children:"These are the system prompts the AI assistant sees when helping you write Intent (per-authorization) or Context (your standing-orders brief). Edit with care — changes apply on the next chat turn."}),i&&o.jsx("div",{className:"alert alert-error",style:{marginBottom:"0.75rem"},children:i}),!h&&!i&&o.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem"},children:"Loading prompts…"}),e&&o.jsxs(o.Fragment,{children:[o.jsx($c,{kind:"intent",label:"Intent — per-authorization",description:"Used on the Intent gate when creating a new authorization.",state:e.intent,draft:n.intent,onChange:w=>r(j=>({...j,intent:w})),onSave:()=>v("intent"),onRevert:()=>x("intent"),saving:a==="intent",justSaved:c==="intent"}),o.jsx($c,{kind:"context",label:"Context — standing-orders brief",description:"Used on the Brief page when refining your context.md.",state:e.context,draft:n.context,onChange:w=>r(j=>({...j,context:w})),onSave:()=>v("context"),onRevert:()=>x("context"),saving:a==="context",justSaved:c==="context"})]})]})}function $c({kind:e,label:t,description:n,state:r,draft:a,onChange:s,onSave:i,onRevert:l,saving:c,justSaved:u}){const h=a!==r.current;return o.jsxs("section",{style:{marginBottom:"1.5rem"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:"0.25rem",gap:"1rem",flexWrap:"wrap"},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontWeight:600,fontSize:"0.9rem"},children:t}),o.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text-secondary)"},children:n})]}),r.overridden&&o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Custom"})]}),o.jsx("textarea",{className:"form-textarea",value:a,onChange:f=>s(f.target.value),rows:12,spellCheck:!1,style:{width:"100%",fontFamily:"'SF Mono', Monaco, 'Cascadia Code', monospace",fontSize:"0.82rem",lineHeight:1.55,resize:"vertical",minHeight:"14rem",marginTop:"0.5rem"},"aria-label":`${t} system prompt`}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center",marginTop:"0.5rem",flexWrap:"wrap"},children:[o.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:i,disabled:c||!h,children:c?"Saving…":"Save"}),r.overridden&&o.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:l,disabled:c,title:"Discard the override and use the built-in default",children:"Revert to default"}),u&&o.jsx("span",{style:{fontSize:"0.78rem",color:"var(--success)"},children:"Saved"}),h&&!c&&!u&&o.jsx("span",{style:{fontSize:"0.78rem",color:"var(--text-muted)"},children:"Unsaved changes"})]}),o.jsxs("details",{style:{marginTop:"0.5rem"},children:[o.jsx("summary",{style:{fontSize:"0.78rem",color:"var(--text-muted)",cursor:"pointer"},children:"Show built-in default"}),o.jsx("pre",{style:{marginTop:"0.5rem",padding:"0.75rem 1rem",background:"var(--bg-main)",border:"1px solid var(--border)",borderRadius:"0.5rem",fontSize:"0.78rem",lineHeight:1.55,whiteSpace:"pre-wrap",maxHeight:"20rem",overflowY:"auto"},children:r.default})]}),o.jsx("span",{style:{display:"none"},children:e})]})}function nv(e){return e.proposalId?"review":"automatic"}function rv(e,t,n={}){const r=n.status??"pending",a=n.includeAutonomous??!1,s=[];for(const i of e)r==="pending"&&i.status!=="pending"||n.profile&&i.profileId!==n.profile||s.push({kind:"proposal",id:i.id,sortTimestamp:i.createdAt,commitmentMode:"review",profileId:i.profileId,proposal:i});if(r==="all")for(const i of t){const l=nv(i);!a&&l==="automatic"||n.profile&&i.profileId!==n.profile||s.push({kind:"receipt",id:i.id,sortTimestamp:i.timestamp,commitmentMode:l,profileId:i.profileId,receipt:i})}return s.sort((i,l)=>l.sortTimestamp-i.sortTimestamp),typeof n.limit=="number"&&n.limit>0?s.slice(0,n.limit):s}const av={pending:"Pending",committed:"Approved",executed:"Executed",rejected:"Rejected",expired:"Expired"},ov={pending:"status-pending",committed:"status-active",executed:"status-active",rejected:"status-revoked",expired:"status-expired"};function sv(e){const t=Date.now()-e*1e3,n=t/36e5;return n<48?n<1?`${Math.max(1,Math.round(t/6e4))}m ago`:`${Math.round(n)}h ago`:new Date(e*1e3).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function iv(e){return e.split("__").pop()??e}function lv(e){const t=e.toLowerCase();return t.includes("delete")||t.includes("refund")||t.includes("cancel")||t.includes("revoke")}const cv=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]),uv=/^(image|img|photo|picture|thumbnail)(_?url)?$/i;function dv(e,t){return typeof t!="string"?!1:/^data:image\//i.test(t)?!0:uv.test(e)?/^https?:\/\//.test(t):/^https?:\/\/.+\.(jpe?g|png|gif|webp|svg|avif)(\?|$)/i.test(t)}function si(e){if(e==null)return"—";if(typeof e=="string")return e.length>160?e.slice(0,157)+"…":e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>si(t)).join(", ");try{const t=JSON.stringify(e);return t.length>160?t.slice(0,157)+"…":t}catch{return String(e)}}function fv({item:e,onApprove:t,onReject:n,resolving:r}){const a=e.kind==="proposal",s=a?e.proposal.status:"executed",i=a?e.proposal.tool:e.receipt.action,l=iv(i),c=lv(i),u=a?e.proposal.toolArgs:null,h=a?e.proposal.executionContext:e.receipt.executionContext,f=a?null:e.receipt.cumulativeState,g=u?Object.entries(u).filter(([x])=>!cv.has(x)):[],v=Object.entries(h??{});return o.jsxs("div",{className:"card",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.75rem",flexWrap:"wrap"},children:[o.jsx(Pf,{profileId:e.profileId}),o.jsx("code",{style:{fontSize:"0.85rem"},children:l}),e.commitmentMode==="automatic"&&o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"autonomous"}),o.jsxs("span",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"0.5rem"},children:[o.jsx("span",{className:`status-badge ${ov[s]}`,children:av[s]}),o.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:sv(e.sortTimestamp)})]})]}),c&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",fontSize:"0.8rem",color:"var(--warning)",background:"var(--bg-main)",border:"1px solid var(--border)",borderRadius:"0.375rem",padding:"0.4rem 0.6rem",marginBottom:"0.75rem"},children:[o.jsx("span",{children:"⚠"}),o.jsx("span",{children:"Irreversible action"})]}),a&&typeof(u==null?void 0:u._imagePreview)=="string"&&o.jsxs("div",{style:{marginBottom:"0.75rem"},children:[o.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Preview"}),o.jsx("img",{src:u._imagePreview,alt:typeof(u==null?void 0:u.altText)=="string"?u.altText:"local image preview",style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"}})]}),a&&g.length>0&&o.jsxs("div",{style:{marginBottom:"0.75rem"},children:[o.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Arguments"}),o.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:g.map(([x,w])=>o.jsxs(d.Fragment,{children:[o.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:x}),o.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word"},children:dv(x,w)?o.jsx("img",{src:w,alt:typeof(u==null?void 0:u.altText)=="string"?u.altText:x,style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"},onError:j=>{const m=j.currentTarget,p=m.parentElement;if(!p)return;m.style.display="none";const y=document.createElement("span");y.textContent=w,y.style.color="var(--text-tertiary)",p.appendChild(y)}}):si(w)})]},x))})]}),v.length>0&&o.jsx("div",{style:{marginBottom:"0.75rem",fontSize:"0.8rem",color:"var(--text-secondary)"},children:v.map(([x,w])=>`${x}=${si(w)}`).join(" · ")}),f&&o.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["After this action · today: ",f.daily.count," action",f.daily.count===1?"":"s",f.daily.amount>0?`, ${f.daily.amount}`:""," · ","this month: ",f.monthly.count,f.monthly.amount>0?`, ${f.monthly.amount}`:""]}),a&&s==="pending"&&o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("button",{className:"btn btn-primary",onClick:()=>t==null?void 0:t(e.id),disabled:r,children:r?"Approving…":"Approve"}),o.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:()=>n==null?void 0:n(e.id),disabled:r,children:"Reject"})]}),o.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:[a?"Proposal":"Receipt",": ",e.id]})]})}const pv=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]);function ii(e){if(e==null)return"—";if(typeof e=="string")return e.length>200?e.slice(0,197)+"...":e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>ii(t)).join(", ");try{const t=JSON.stringify(e);return t.length>200?t.slice(0,197)+"...":t}catch{return String(e)}}function mv(e){const t=Date.now()-e*1e3,n=Math.floor(t/6e4);if(n<60)return`${Math.max(1,n)}m ago`;const r=Math.floor(t/36e5);return r<48?`${r}h ago`:`${Math.floor(r/24)}d ago`}function hv({proposal:e,currentUserId:t,onAction:n,onMessage:r}){const[a,s]=d.useState(!1),[i,l]=d.useState(!1),[c,u]=d.useState(null),[h,f]=d.useState(!1),[g,v]=d.useState(null),[x,w]=d.useState(!1),j=e.tool.split("__").pop()??e.tool,m=Object.entries(e.toolArgs).filter(([M])=>!pv.has(M)),p=Object.entries(e.executionContext),y=e.pendingApprovers??[],S=e.approvedBy??{},b=Object.keys(S).length,T=y.filter(M=>!(M in S)).length,k=t in S,E=async()=>{if(c===null){f(!0),v(null);try{const M=await F.getAttestationIntent(e.frameHash);if(!M){v("Intent not available or you are not an authorized approver.");return}const $=await F.decryptIntent({intentCiphertext:M.intentCiphertext,encryptedKey:M.encryptedKey,approverId:t});u($)}catch(M){v(M instanceof Error?M.message:"Failed to decrypt intent")}finally{f(!1)}}},N=async()=>{x?w(!1):(w(!0),await E())},I=async()=>{s(!0),r("");try{await F.approveProposal(e.id);try{if(c===null){const M=await F.getAttestationIntent(e.frameHash);if(M){const $=await F.decryptIntent({intentCiphertext:M.intentCiphertext,encryptedKey:M.encryptedKey,approverId:t});u($),await F.storeApprovedIntent(e.frameHash,$)}}else await F.storeApprovedIntent(e.frameHash,c)}catch{}r(`Approved. ${T-1>0?`${T-1} more approver(s) still needed.`:"All approvers signed off — action is ready to execute."}`),n()}catch(M){r(M instanceof Error?M.message:"Approval failed")}finally{s(!1)}},D=async()=>{const M=prompt("Rejection reason (optional):");if(M!==null){l(!0),r("");try{await F.rejectProposal(e.id,M||void 0),r("Action rejected."),n()}catch($){r($ instanceof Error?$.message:"Rejection failed")}finally{l(!1)}}},V=a||i;return o.jsxs("div",{className:"card",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[o.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:Re(e.profileId)}),o.jsx("span",{style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Above cap"}),o.jsx("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:mv(e.createdAt)})]}),o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[b," of ",y.length," approver",y.length===1?"":"s"," signed off",y.map(M=>{const $=M in S;return o.jsxs("span",{style:{marginLeft:"0.5rem",color:$?"var(--success, green)":"var(--text-tertiary)"},children:[$?"✓":"○"," ",M===t?"You":M]},M)})]}),o.jsxs("div",{style:{marginBottom:"0.5rem"},children:[o.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Proposed action"}),o.jsx("code",{style:{fontSize:"0.85rem"},children:j})]}),m.length>0&&o.jsxs("div",{style:{marginBottom:"0.75rem"},children:[o.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Arguments"}),o.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:m.map(([M,$])=>o.jsxs(d.Fragment,{children:[o.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:M}),o.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word"},children:ii($)})]},M))})]}),p.length>0&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:p.map(([M,$])=>`${M}=${ii($)}`).join(" · ")}),o.jsxs("div",{style:{marginBottom:"0.75rem"},children:[o.jsxs("button",{className:"btn btn-ghost btn-sm",style:{padding:"0.2rem 0",fontSize:"0.75rem"},onClick:N,disabled:h,children:[x?"▲ Hide intent":"▼ Show intent",h&&" (decrypting...)"]}),x&&o.jsx("div",{style:{marginTop:"0.5rem",padding:"0.75rem",background:"var(--bg-main)",borderRadius:"0.375rem",border:"1px solid var(--border)"},children:g?o.jsx("p",{style:{color:"var(--danger)",fontSize:"0.8rem",margin:0},children:g}):c!==null?o.jsx("p",{style:{fontSize:"0.85rem",margin:0,whiteSpace:"pre-wrap",color:"var(--text-primary)"},children:c}):o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.8rem",margin:0},children:"No intent available for this authority."})})]}),!k&&o.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.25rem"},children:[o.jsx("button",{className:"btn btn-primary",onClick:I,disabled:V,children:a?"Approving...":"Approve"}),o.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:D,disabled:V,children:i?"Rejecting...":"Reject"})]}),k&&o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"You approved this action. Waiting on other approvers."}),o.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["Proposal: ",e.id]})]})}function gv(){const{domain:e,user:t}=Ce(),n=(t==null?void 0:t.id)??"",[r,a]=d.useState("awaiting-me"),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,h]=d.useState(""),f=d.useCallback(async()=>{try{const B=await F.getProposalsForApprover();i(B)}catch{}finally{c(!1)}},[]);ue("proposal-added",f),ue("proposal-approved",f),ue("proposal-rejected",f),ue("proposal-resolved",f),Rt(f,3e4);const[g,v]=d.useState([]),x=d.useCallback(async()=>{try{const B=await F.getProposals(e||"owner");v(B)}catch{}},[e]);ue("proposal-added",x),ue("proposal-approved",x),ue("proposal-rejected",x),ue("proposal-resolved",x),Rt(x,3e4,e);const w=d.useMemo(()=>{const B=[];for(const Q of g)Q.status==="pending"&&B.push(Q);for(const Q of s);return B},[g,s]),[j,m]=d.useState([]),p=d.useCallback(async()=>{if(n)try{const Q=(await F.getProposals(e||"owner")).filter(G=>G.status==="pending"&&G.pendingApprovers&&G.pendingApprovers.includes(n)&&G.approvedBy&&n in G.approvedBy);m(Q)}catch{}},[n,e]);ue("proposal-approved",p),ue("proposal-rejected",p),Rt(p,3e4,`${n}:${e}`),d.useEffect(()=>{f(),x(),p()},[]);const[y,S]=d.useState([]),[b,T]=d.useState([]),[k,E]=d.useState(!0),[N,I]=d.useState(null),[D,V]=d.useState(""),[M,$]=d.useState("pending"),[R,Y]=d.useState(null),[_,C]=d.useState(!1),P=d.useCallback(async()=>{try{const{proposals:B,receipts:Q}=await F.getThread({domain:e,status:M,sinceDays:7});S(B),T(Q)}catch{}finally{E(!1)}},[e,M]);Rt(P,3e4,`${e}:${M}`);const z=async(B,Q)=>{I(B),V("");try{const G=e||"owner",K=await F.resolveProposal(B,Q,G);V(Q==="commit"?`Action approved. Status: ${K.status}`:"Action rejected."),await P()}catch(G){V(G instanceof Error?G.message:"Failed")}finally{I(null)}},L=d.useMemo(()=>{const B=new Set;for(const Q of y)B.add(Q.profileId);for(const Q of b)B.add(Q.profileId);return Array.from(B).sort()},[y,b]),U=d.useMemo(()=>rv(y,b,{status:M,profile:R??void 0,includeAutonomous:_}),[y,b,M,R,_]),ne=d.useCallback(()=>{f(),p()},[f,p]),J=d.useMemo(()=>{const B=new Set,Q=[];for(const G of[...j,...w])B.has(G.id)||(B.add(G.id),Q.push(G));return Q.sort((G,K)=>K.createdAt-G.createdAt)},[j,w]),ye=s.length,O=J.length;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{className:"page-title",children:"Pending Approvals"}),o.jsx("p",{className:"page-subtitle",children:"Actions awaiting approval, plus recent activity from the last 7 days."})]}),o.jsxs("div",{className:"nav-tabs",style:{marginBottom:"1rem"},children:[o.jsxs("button",{className:`nav-tab${r==="awaiting-me"?" active":""}`,onClick:()=>a("awaiting-me"),children:["Awaiting me ",ye>0&&o.jsx("span",{style:{marginLeft:"0.4rem",background:"var(--warning)",color:"var(--bg-elevated)",borderRadius:"0.625rem",padding:"0 0.375rem",fontSize:"0.7rem",fontWeight:600},children:ye})]}),o.jsxs("button",{className:`nav-tab${r==="awaiting-others"?" active":""}`,onClick:()=>a("awaiting-others"),children:["Awaiting others ",O>0&&o.jsx("span",{style:{marginLeft:"0.4rem",background:"var(--border)",color:"var(--text-secondary)",borderRadius:"0.625rem",padding:"0 0.375rem",fontSize:"0.7rem",fontWeight:600},children:O})]}),o.jsx("button",{className:`nav-tab${r==="all"?" active":""}`,onClick:()=>{a("all"),P()},children:"All"})]}),r==="awaiting-me"&&o.jsx(o.Fragment,{children:l&&s.length===0?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):s.length===0?o.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[o.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions awaiting your approval."}),o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Above-cap actions under authorities you are an approver for will appear here."})]}):o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[u&&o.jsx("div",{className:"alert alert-success",children:u}),s.map(B=>o.jsx(hv,{proposal:B,currentUserId:n,onAction:ne,onMessage:h},B.id))]})}),r==="awaiting-others"&&o.jsx(o.Fragment,{children:J.length===0?o.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[o.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions waiting on others."}),o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Actions you proposed or approved that are pending other approvers will appear here."})]}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:J.map(B=>o.jsx(vv,{proposal:B,currentUserId:n,onCancel:async()=>{try{await F.rejectProposal(B.id,"cancelled by creator"),p(),x()}catch(Q){alert(Q instanceof Error?Q.message:"Cancel failed")}}},B.id))})}),r==="all"&&o.jsxs(o.Fragment,{children:[D&&o.jsx("div",{className:"alert alert-success",style:{marginBottom:"1rem"},children:D}),o.jsxs("div",{className:"filter-chips",style:{marginBottom:"1rem"},children:[o.jsx("button",{className:`filter-chip ${M==="pending"?"selected":""}`,onClick:()=>$("pending"),children:"Pending"}),o.jsx("button",{className:`filter-chip ${M==="all"?"selected":""}`,onClick:()=>$("all"),children:"All"}),L.length>0&&o.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),L.map(B=>o.jsx("button",{className:`filter-chip ${R===B?"selected":""}`,onClick:()=>Y(R===B?null:B),children:Re(B)},B)),M==="all"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),o.jsxs("button",{className:`filter-chip ${_?"selected":""}`,onClick:()=>C(!_),title:"Include actions executed without human review (automatic commitment mode)",children:[_?"✓ ":"","Autonomous actions"]})]})]}),k&&U.length===0?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):U.length===0?o.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[o.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:M==="pending"?"No actions awaiting your approval.":"Nothing here yet."}),o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:M==="pending"?"Your agents are operating within their authorizations. Switch to All to see recent activity.":"When an agent calls a gated tool, activity will appear here."})]}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:U.map(B=>o.jsx(fv,{item:B,onApprove:Q=>z(Q,"commit"),onReject:Q=>z(Q,"reject"),resolving:N===B.id},B.id))})]})]})}function yv(e){const t=Date.now()-e*1e3,n=Math.floor(t/6e4);if(n<60)return`${Math.max(1,n)}m ago`;const r=Math.floor(t/36e5);return r<48?`${r}h ago`:`${Math.floor(r/24)}d ago`}function vv({proposal:e,currentUserId:t,onCancel:n}){var u;const[r,a]=d.useState(!1),s=Object.keys(e.approvedBy??{}),i=(e.pendingApprovers??[]).filter(h=>!(h in(e.approvedBy??{}))),l=(((u=e.pendingApprovers)==null?void 0:u.length)??0)>0,c=async()=>{if(confirm("Cancel this action? All approvers will be notified.")){a(!0);try{await n()}finally{a(!1)}}};return o.jsxs("div",{className:"card",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[o.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:Re(e.profileId)}),l&&o.jsx("span",{style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Above cap"}),o.jsx("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:yv(e.createdAt)})]}),o.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:o.jsx("code",{children:e.tool.split("__").pop()??e.tool})}),l&&o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[s.map(h=>o.jsx("span",{style:{marginRight:"0.75rem",color:"var(--success, green)"},children:h===t?"You approved":`${h} approved`},h)),i.map(h=>o.jsxs("span",{style:{marginRight:"0.75rem",color:"var(--text-tertiary)"},children:["Waiting on ",h===t?"you":h]},h))]}),o.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:o.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--danger)"},onClick:c,disabled:r,children:r?"Cancelling...":"Cancel"})})]})}const xv=`# Agent Brief
66
+ `}),f?o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem"},children:"Loading..."}):g.length===0?o.jsxs("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:[o.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"0.9rem",marginBottom:"1rem"},children:"No integrations set up yet. Connect a service first."}),o.jsx(Ge,{to:"/integrations",className:"btn btn-primary btn-sm",onClick:()=>e==null?void 0:e(),children:"Go to Integrations"})]}):o.jsx("div",{className:"profile-grid",children:g.map(k=>{const b=S(k.id),N=k.id.replace(/@.*$/,"").split("/").pop()??k.id,I=m.get(N),D=p.get(N),V=(D==null?void 0:D.running)===!0;return o.jsxs("div",{className:"card",style:V?void 0:{opacity:.7},children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.125rem"},children:[o.jsx("h3",{className:"card-title",style:{margin:0},children:_e(k.id,k.name)}),b?o.jsx("span",{style:{fontSize:"0.6rem",padding:"0.1rem 0.35rem",borderRadius:"0.2rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Team"}):o.jsx("span",{style:{fontSize:"0.6rem",padding:"0.1rem 0.35rem",borderRadius:"0.2rem",background:"var(--bg-main)",color:"var(--text-tertiary)",fontWeight:600,border:"1px solid var(--border)"},children:"Personal"})]}),o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"1rem",flex:1},children:k.description}),V?o.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>T(k.id),children:"Authorize"}):o.jsxs(Ge,{to:`/integrations?setup=${(I==null?void 0:I.id)??""}`,className:"btn btn-secondary btn-sm",style:{textDecoration:"none",textAlign:"center"},onClick:()=>e==null?void 0:e(),children:["Set up ",(I==null?void 0:I.name)??"integration"]})]},k.id)})})]})}const Dv={active:"Active",pending:"Pending",expired:"Expired",revoked:"Revoked"};function Uv({status:e,label:t}){return o.jsx("span",{className:`status-badge status-${e}`,children:t||Dv[e]})}function Wv({domain:e,attested:t}){const n=t===!0?"domain-attested":t===!1?"domain-missing":"";return o.jsx("span",{className:`domain-badge ${n}`,style:{fontSize:"0.75rem"},children:e})}const pn=86400,yr=3600,wa=60,Hv=30*pn;function Vv(e){if(e<=0)return"Expired";if(e>90*pn){const t=Math.floor(e/Hv);return`${t} ${t===1?"month":"months"} remaining`}if(e>7*pn){const t=Math.floor(e/pn);return`${t} ${t===1?"day":"days"} remaining`}if(e>=2*pn){const t=Math.floor(e/pn),n=Math.floor(e%pn/yr);return`${t} ${t===1?"day":"days"} ${n}h remaining`}if(e>=2*yr){const t=Math.floor(e/yr),n=Math.floor(e%yr/wa);return`${t}h ${String(n).padStart(2,"0")}m remaining`}if(e>=wa){const t=Math.floor(e/wa),n=Math.floor(e%wa);return`${t}m ${String(n).padStart(2,"0")}s remaining`}return`${Math.floor(e)}s remaining`}function Kv({expiresAt:e}){const[t,n]=d.useState(()=>e-Date.now()/1e3),r=t<2*yr;d.useEffect(()=>{const s=setInterval(()=>n(e-Date.now()/1e3),r?1e3:6e4);return()=>clearInterval(s)},[e,r]);const a=t<300;return o.jsx("span",{className:`ttl-badge ${a?"ttl-warn":"ttl-ok"}`,children:Vv(t)})}function Pf({icon:e,title:t,text:n,children:r}){return o.jsxs("div",{className:"empty-state",children:[e&&o.jsx("div",{className:"empty-state-icon",children:e}),o.jsx("div",{className:"empty-state-title",children:t}),n&&o.jsx("div",{className:"empty-state-text",children:n}),r]})}function Gv(e){const t=Math.floor(e/86400);if(t>=1)return`${t} day${t===1?"":"s"}`;const n=Math.floor(e/3600);if(n>=1)return`${n} hour${n===1?"":"s"}`;const r=Math.ceil(e/60);return`${r} minute${r===1?"":"s"}`}const Yv=[{label:"30m",seconds:1800},{label:"1h",seconds:3600},{label:"2h",seconds:7200},{label:"4h",seconds:14400},{label:"8h",seconds:28800},{label:"24h",seconds:86400},{label:"7d",seconds:604800},{label:"30d",seconds:2592e3},{label:"1y",seconds:31536e3}];function Qv({item:e,onClose:t,onSuccess:n}){var m;const{user:r,activeDomain:a,groupId:s}=Ce(),i=e.remaining_seconds??0,l=Yv.filter(p=>p.seconds>i),c=((m=l[0])==null?void 0:m.seconds)??2592e3,[u,h]=d.useState(c),[f,v]=d.useState(!1),[y,x]=d.useState(""),w=Object.entries(e.frame).filter(([p])=>p!=="profile"&&p!=="path"),j=async()=>{var p;if(r){v(!0),x("");try{const g=e.frame_hash||e.profile_id||e.path,S=await F.getGateContent(g);if(!S)throw new Error("Gate content not found locally. The MCP server may have restarted. Please re-authorize through the full wizard instead.");const E=await F.getProfile(e.profile_id),T=e.frame,k=S.context??{},b=e.attested_domains[0]||a||"owner",N=await Nf(T,E),I=await bf(k,E),[D,V]=await Promise.all([lo(S.gateContent.intent),lo(JSON.stringify({profile:e.profile_id,path:e.path,domain:b}))]);if(!s)throw new Error("No active group; cannot extend authorization.");const M=(((p=e.deferred_commitment_domains)==null?void 0:p.length)??0)>0?"review":"automatic",$=await F.attest({profile_id:e.profile_id,path:e.path,bounds:T,bounds_hash:N,context_hash:I,domain:b,did:r.did,gate_content_hashes:{intent:D},execution_context_hash:V,group_id:s,commitment_mode:M,ttl:u});await F.pushGateContent(Ef($,{boundsHash:N,contextHash:I,context:k,path:e.path,gateContent:S.gateContent})),n()}catch(g){x(g instanceof Error?g.message:"Extension failed")}finally{v(!1)}}};return o.jsx("div",{className:"modal-backdrop",onClick:p=>p.target===p.currentTarget&&t(),children:o.jsxs("div",{className:"modal",children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h3",{className:"modal-title",children:"Extend Authorization"}),o.jsx("button",{className:"modal-close",onClick:t,children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsxs("div",{style:{marginBottom:"1rem"},children:[o.jsxs("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:[_e(e.profile_id)," / ",e.path]}),w.length>0&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:w.map(([p,g])=>`${p}=${g}`).join(" · ")})]}),o.jsxs("div",{style:{marginBottom:"1rem"},children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"New duration"}),i>0&&o.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["Currently valid for ",Gv(i),". Only longer durations are shown."]}),o.jsx("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:l.length===0?o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"This authorization is already on the longest available duration. Nothing to extend."}):l.map(p=>o.jsx("button",{className:`btn ${u===p.seconds?"btn-primary":"btn-secondary"}`,onClick:()=>h(p.seconds),style:{minWidth:"3.5rem"},children:p.label},p.seconds))})]}),o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"Same bounds, context, and gate content will be re-attested with a new TTL (measured from now)."}),y&&o.jsx("div",{className:"error-message",children:y})]}),o.jsxs("div",{className:"modal-footer",children:[o.jsx("button",{className:"btn btn-secondary",onClick:t,disabled:f,children:"Cancel"}),o.jsx("button",{className:"btn btn-primary",onClick:j,disabled:f,children:f?"Extending...":"Extend"})]})]})})}function Jv(e,t,n){return[...e].sort((r,a)=>{if(n){if(r.frame_hash===n&&a.frame_hash!==n)return-1;if(a.frame_hash===n&&r.frame_hash!==n)return 1}const s=jt(r,{revokedSet:t}),i=jt(a,{revokedSet:t}),l={active:0,pending:1,expired:2,revoked:3};return l[s]!==l[i]?l[s]-l[i]:new Date(a.created_at).getTime()-new Date(r.created_at).getTime()})}function Xv({item:e,revokedSet:t,expandedHash:n,gateCache:r,gateLoading:a,copiedHash:s,revokingHash:i,copyingHash:l,profileConfigCache:c,mode:u,ownerLabel:h,isAdmin:f,onExpand:v,onCopyHash:y,onCopy:x,onRevoke:w,onExtend:j,highlightHash:m}){var z;const p=jt(e,{revokedSet:t}),g=n===e.frame_hash,S=r[e.frame_hash||e.profile_id||e.path],E=p==="active"||p==="pending"||p==="expired",T=Object.entries(e.frame).filter(([L])=>L!=="profile"&&L!=="path"),k=c.get(e.profile_id)??null,b=(((z=k==null?void 0:k.approvers)==null?void 0:z.length)??0)>0,N=new Map;if(k!=null&&k.caps&&u==="team")for(const[L,U]of T){const ne=k.caps[L];ne!==void 0&&Number(U)>ne&&N.set(L,{authorized:Number(U),cap:ne})}const I=N.size>0,D=e.approvers_frozen??[],V=(k==null?void 0:k.approvers)??[],M=u==="team"&&D.length>0&&V.length>0&&(D.length!==V.length||D.some(L=>!V.includes(L))||V.some(L=>!D.includes(L))),$=Array.from(N.entries()).map(([L,U])=>`${L}: ${U.authorized} (cap ${U.cap})`).join(", "),_=Array.from(N.entries()).map(([L,U])=>`${L}: ${U.authorized} → ${U.cap}`).join(", "),Q=I?b?N.size===1?`Above team cap: ${$} — actions require approval`:`Above team cap (${N.size}): ${$} — actions require approval`:N.size===1?`Reduced by hard cap: ${_}`:`Reduced by hard cap (${N.size}): ${_}`:"",R=I?b?"Above-cap actions under this authority require per-action approval from the profile's approvers. Bounds remain authorized at their original values.":"No approvers are configured for this profile, so the team cap is a hard ceiling. Bounds above the cap are effectively reduced to the cap. Ask the admin to raise the cap or add approvers, or copy this authorization to reissue within the cap.":void 0,C=_e(e.profile_id),P=m!=null&&e.frame_hash===m;return o.jsxs("div",{className:`card${P?" card-highlight":""}`,style:{marginBottom:0},children:[h&&o.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner: ",o.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:h})]}),o.jsxs("div",{className:"auth-card-header",children:[o.jsx("span",{style:{fontWeight:700,fontSize:"1rem",color:"var(--text-primary)",letterSpacing:"0.01em"},children:C}),e.title&&o.jsx("span",{style:{fontWeight:500,fontSize:"0.85rem",color:"var(--text-secondary)"},children:e.title}),o.jsx(Uv,{status:p}),p==="active"&&e.earliest_expiry&&o.jsx(Kv,{expiresAt:new Date(e.earliest_expiry).getTime()/1e3}),p==="expired"&&o.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:new Date(e.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.5rem",alignItems:"center"},children:[e.required_domains.map(L=>o.jsx(Wv,{domain:L,attested:e.attested_domains.includes(L)},L)),e.deferred_commitment_domains.length>0&&o.jsx("span",{style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Review Mode"}),I&&o.jsx("span",{title:R,style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:b?"var(--accent-subtle)":"var(--danger-subtle)",color:b?"var(--accent)":"var(--danger)",fontWeight:600,cursor:"help"},children:Q}),M&&o.jsx("button",{className:"btn btn-ghost btn-sm",style:{fontSize:"0.65rem",padding:"0.15rem 0.5rem",borderRadius:"0.25rem",background:"var(--warning-subtle, rgba(234,179,8,0.12))",color:"var(--warning, #ca8a04)",fontWeight:600,border:"1px solid var(--warning-border, rgba(234,179,8,0.3))",cursor:"pointer",lineHeight:1.4},onClick:()=>x(e),disabled:l===e.frame_hash,title:"The approver list for this profile has changed since this authority was created. Copy to reissue with the current approvers.",children:l===e.frame_hash?"Copying...":"Approver list updated · Copy with new approvers"})]}),T.length>0&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:T.map(([L,U],ne)=>{const J=N.get(L);return o.jsxs("span",{children:[ne>0&&" · ",J?b?o.jsxs("span",{title:`Team cap on ${L} is ${J.cap}. Actions exceeding the cap require per-action approval. Bound remains authorized at ${J.authorized}.`,children:[o.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[L,"=",String(U)]}),o.jsxs("span",{style:{color:"var(--accent)",marginLeft:"0.25rem",fontWeight:600},children:["↑ approval at ",J.cap]})]}):o.jsxs("span",{title:`Team cap on ${L} is ${J.cap} with no approvers configured (hard cap). Authorized for ${J.authorized}; effective ${J.cap}.`,children:[o.jsxs("span",{style:{textDecoration:"line-through",color:"var(--text-tertiary)"},children:[L,"=",String(U)]}),o.jsxs("span",{style:{color:"var(--danger)",marginLeft:"0.25rem",fontWeight:600},children:["→"," ",J.cap]})]}):o.jsxs("span",{children:[L,"=",String(U)]})]},L)})}),o.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:o.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>v(e),children:g?"▲ Hide Details":"▼ Details"})}),g&&o.jsxs("div",{style:{borderTop:"1px solid var(--border)",marginTop:"0.75rem",paddingTop:"0.75rem"},children:[T.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Bounds"}),o.jsx("dl",{className:"review-grid",children:T.map(([L,U])=>o.jsxs("span",{style:{display:"contents"},children:[o.jsx("dt",{children:L}),o.jsx("dd",{children:String(U)})]},L))})]}),(S==null?void 0:S.context)&&Object.keys(S.context).length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Context"}),o.jsx("dl",{className:"review-grid",children:Object.entries(S.context).map(([L,U])=>o.jsxs("span",{style:{display:"contents"},children:[o.jsx("dt",{children:L}),o.jsx("dd",{children:String(U)})]},L))})]}),o.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Intent"}),a===e.frame_hash?o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Loading gate content..."}):S?o.jsx("div",{className:"gate-content-block",children:o.jsx("div",{className:"gate-content-item",children:o.jsx("div",{className:"gate-content-text",children:S.gateContent.intent})})}):o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Gate content not available."}),o.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"1rem"},children:["Created: ",new Date(e.created_at).toLocaleString(),e.earliest_expiry&&` · Expires: ${new Date(e.earliest_expiry).toLocaleString()}`]}),o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginTop:"0.25rem"},children:[o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontFamily:"'SF Mono', Monaco, monospace",wordBreak:"break-all"},children:e.frame_hash}),o.jsx("button",{className:"btn btn-ghost btn-sm",style:{fontSize:"0.7rem",padding:"0.125rem 0.375rem"},onClick:()=>y(e.frame_hash),children:s===e.frame_hash?"copied":"copy"})]}),o.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.75rem"},children:[!h&&o.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>x(e),disabled:l===e.frame_hash,title:"Start a new authorization pre-filled with these bounds, context, and intent",children:l===e.frame_hash?"Copying…":"⧉ Copy"}),!h&&E&&o.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>j(e),children:"↻ Extend"}),h&&f&&p!=="revoked"?o.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.frame_hash,h,C),disabled:i===e.frame_hash,children:i===e.frame_hash?"Revoking…":"Revoke"}):!h&&(p==="active"||p==="pending")?o.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.frame_hash),disabled:i===e.frame_hash,children:i===e.frame_hash?"Revoking…":"Revoke"}):null]})]})]},e.frame_hash)}function qv(){const[e,t]=d.useState([]),[n,r]=d.useState(!0),[a,s]=d.useState([]),[i,l]=d.useState(!1),[c,u]=d.useState("mine"),[h,f]=d.useState("active"),[v,y]=d.useState(null),[x,w]=d.useState(null),[j,m]=hf(),[p,g]=d.useState(()=>j.get("new")==="1"),[S,E]=d.useState(()=>j.get("highlight")),[T,k]=d.useState(null),[b,N]=d.useState({}),[I,D]=d.useState(null),[V,M]=d.useState(null),[$,_]=d.useState(null),[Q,R]=d.useState(new Set),[C,P]=d.useState(null),[z,L]=d.useState(null),U=Bt(),{group:ne,groupId:J,domain:ve,mode:O,activeTeam:B}=Ce(),Y=(B==null?void 0:B.isAdmin)===!0,[G,K]=d.useState(()=>new Map),ae=d.useCallback(()=>{r(!0),F.getMyAttestations().then(t).catch(()=>{}).finally(()=>r(!1))},[]),ye=d.useCallback(()=>{J&&(l(!0),F.listTeamAuthorizations(J).then(s).catch(()=>{}).finally(()=>l(!1)))},[J]);ue("attestation-changed",()=>{ae(),Y&&J&&ye()}),d.useEffect(()=>{if(!S)return;j.get("highlight")&&(j.delete("highlight"),m(j,{replace:!0}));const W=window.setTimeout(()=>E(null),3e3);return()=>window.clearTimeout(W)},[]),_t(ae,3e5),d.useEffect(()=>{c==="team"&&Y&&J&&a.length===0&&!i&&ye()},[c,Y,J,a.length,i,ye]),d.useEffect(()=>{if(O!=="team"||!J)return;const W=c==="mine"?e:a;if(W.length===0)return;const X=[...new Set(W.map(Z=>Z.profile_id))].filter(Z=>!G.has(Z));if(X.length!==0){K(Z=>{const Ne=new Map(Z);for(const xt of X)Ne.set(xt,null);return Ne});for(const Z of X)F.getTeamProfileConfig(J,Z).then(Ne=>{K(xt=>new Map(xt).set(Z,Ne))}).catch(()=>{})}},[e,a,c,J,O,G]);const yt=async W=>{if(T===W.frame_hash){k(null);return}k(W.frame_hash);const X=W.frame_hash||W.profile_id||W.path;if(!(X in b)){D(W.frame_hash);try{const Z=await F.getGateContent(X);N(Ne=>({...Ne,[X]:Z}))}catch{N(Z=>({...Z,[X]:null}))}finally{D(null)}}},un=W=>{navigator.clipboard.writeText(W).then(()=>{_(W),setTimeout(()=>_(null),2e3)})},Ve=async W=>{var X;if(!J){alert("No active group; cannot copy authorization.");return}L(W.frame_hash);try{const Z=W.frame_hash||W.profile_id||W.path;let Ne=b[Z]??null;Z in b||(Ne=await F.getGateContent(Z),N(ea=>({...ea,[Z]:Ne})));const xt=Object.fromEntries(Object.entries(W.frame).filter(([ea])=>ea!=="profile"&&ea!=="path")),If=(Ne==null?void 0:Ne.context)??{},Rf=((X=Ne==null?void 0:Ne.gateContent)==null?void 0:X.intent)??"",_f=W.deferred_commitment_domains.length>0?"review":"automatic",zf=W.attested_domains[0]||ve||"owner";sessionStorage.setItem("agentAuth",JSON.stringify({profileId:W.profile_id,groupId:J,groupName:(ne==null?void 0:ne.name)??null,domain:zf})),sessionStorage.setItem("agentGate",JSON.stringify({bounds:xt,context:If,gateContent:{intent:Rf},templateMode:_f})),U("/agent/gate")}catch(Z){alert(Z instanceof Error?Z.message:"Failed to copy authorization")}finally{L(null)}},ct=async(W,X,Z)=>{const Ne=X&&Z?`Revoke ${X}'s ${Z} authorization? This cannot be undone.`:"Revoke this authorization? The agent will no longer be able to execute actions under this attestation.";if(confirm(Ne)){P(W);try{await F.revokeAttestation(W),R(xt=>new Set(xt).add(W)),X&&J&&ye()}catch(xt){alert(xt instanceof Error?xt.message:"Failed to revoke authorization")}finally{P(null)}}},Ae=c==="mine"?e:a,Oe=c==="mine"?n:i,Dt={active:Ae.filter(W=>jt(W,{revokedSet:Q})==="active").length,pending:Ae.filter(W=>jt(W,{revokedSet:Q})==="pending").length,expired:Ae.filter(W=>jt(W,{revokedSet:Q})==="expired").length,revoked:Ae.filter(W=>jt(W,{revokedSet:Q})==="revoked").length},et=(()=>{const W=new Map;for(const X of Ae){if(jt(X,{revokedSet:Q})!==h)continue;const Z=W.get(X.profile_id)??{count:0,review:!1};Z.count+=1,X.deferred_commitment_domains.length>0&&(Z.review=!0),W.set(X.profile_id,Z)}return Array.from(W.entries()).map(([X,Z])=>({profileId:X,...Z})).sort((X,Z)=>_e(X.profileId).localeCompare(_e(Z.profileId)))})(),te=Jv(Ae.filter(W=>{if(jt(W,{revokedSet:Q})!==h||v!==null&&W.profile_id!==v)return!1;if(x!==null){const X=W.deferred_commitment_domains.length>0;if(x==="review"&&!X||x==="auto"&&X)return!1}return!0}),Q,S),Et={revokedSet:Q,expandedHash:T,gateCache:b,gateLoading:I,copiedHash:$,revokingHash:C,copyingHash:z,profileConfigCache:G,mode:O,activeDomain:ve,group:ne,groupId:J,onExpand:yt,onCopyHash:un,onCopy:Ve,onRevoke:ct,onExtend:M,highlightHash:S};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"1rem",flexWrap:"wrap"},children:[o.jsxs("div",{children:[o.jsx("h1",{className:"page-title",children:"Authorizations"}),o.jsx("p",{className:"page-subtitle",children:"Active, pending, and expired agent authorizations."})]}),o.jsx("button",{className:"btn btn-primary",onClick:()=>g(!0),children:"+ New authorization"})]}),p&&o.jsx("div",{className:"modal-backdrop",onClick:()=>{g(!1),j.get("new")&&(j.delete("new"),m(j,{replace:!0}))},children:o.jsxs("div",{className:"modal",onClick:W=>W.stopPropagation(),style:{maxWidth:"960px",width:"90vw"},children:[o.jsxs("div",{className:"modal-header",children:[o.jsx("h2",{className:"modal-title",children:"New authorization"}),o.jsx("button",{className:"modal-close",onClick:()=>{g(!1),j.get("new")&&(j.delete("new"),m(j,{replace:!0}))},children:"×"})]}),o.jsxs("div",{className:"modal-body",children:[o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem",marginTop:0,marginBottom:"1rem"},children:"What should your agent be able to do? Pick a profile, set limits, then authorize."}),o.jsx(Bv,{onDismiss:()=>g(!1)})]})]})}),Y&&o.jsxs("div",{className:"nav-tabs",style:{marginBottom:"0.5rem"},children:[o.jsx("button",{className:`nav-tab${c==="mine"?" active":""}`,onClick:()=>{u("mine"),f("active"),y(null),w(null),k(null)},children:"Mine"}),o.jsx("button",{className:`nav-tab${c==="team"?" active":""}`,onClick:()=>{u("team"),f("active"),y(null),w(null),k(null)},children:"Team"})]}),o.jsx("div",{className:"nav-tabs",children:["active","pending","expired","revoked"].map(W=>o.jsxs("button",{className:`nav-tab${h===W?" active":""}`,onClick:()=>{f(W),y(null),w(null)},children:[W.charAt(0).toUpperCase()+W.slice(1)," (",Dt[W],")"]},W))}),et.length>0&&o.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"center",marginTop:"-0.25rem",marginBottom:"1rem"},children:[et.map(W=>{const X=v===W.profileId;return o.jsx("button",{className:`btn btn-sm ${X?"btn-primary":"btn-secondary"}`,onClick:()=>y(X?null:W.profileId),children:_e(W.profileId)},W.profileId)}),o.jsx("span",{"aria-hidden":"true",style:{color:"var(--border)",fontSize:"1.1rem",padding:"0 0.25rem",userSelect:"none"},children:"|"}),["auto","review"].map(W=>{const X=x===W;return o.jsx("button",{className:`btn btn-sm ${X?"btn-primary":"btn-secondary"}`,onClick:()=>w(X?null:W),children:W==="auto"?"Auto":"Review"},W)})]}),Oe&&Ae.length===0?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):te.length===0?o.jsx(Pf,{icon:"☰",title:"No authorizations",text:`No ${h} authorizations found.`}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:te.map(W=>{const X=c==="team"?W:null,Z=X!=null&&X.owner?X.owner.name??X.owner.email??X.owner.userId:void 0;return o.jsx(Xv,{item:W,ownerLabel:Z,isAdmin:Y,...Et},W.frame_hash)})}),V&&o.jsx(Qv,{item:V,onClose:()=>M(null),onSuccess:()=>{M(null),ae()}})]})}function Tf({profileId:e}){return o.jsx("span",{className:"profile-badge",children:_e(e)})}function Zv(e){return new Date(e*1e3).toLocaleString()}function ey(e,t){if(t==="all")return!0;const n=t==="1d"?1:t==="7d"?7:30,r=Math.floor(Date.now()/1e3)-n*86400;return e.timestamp>=r}function ty(e,t){if(!t)return!0;const n=t.toLowerCase();return e.profileId.toLowerCase().includes(n)||_e(e.profileId).toLowerCase().includes(n)||e.path.toLowerCase().includes(n)||e.action.toLowerCase().includes(n)||e.attestationHash.toLowerCase().includes(n)||e.id.toLowerCase().includes(n)||JSON.stringify(e.executionContext).toLowerCase().includes(n)}function ny(){const{activeTeam:e,groupId:t}=Ce(),n=(e==null?void 0:e.isAdmin)===!0,[r,a]=d.useState("mine"),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,h]=d.useState({}),[f,v]=d.useState(new Set),[y,x]=d.useState(""),[w,j]=d.useState(new Set),[m,p]=d.useState(new Set),[g,S]=d.useState("all"),[E,T]=d.useState(!1),k=d.useCallback(()=>{c(!0),r==="team"&&n&&t?F.listTeamReceipts(t).then(i).catch(()=>i([])).finally(()=>c(!1)):F.getMyReceipts({limit:200}).then(i).catch(()=>{}).finally(()=>c(!1))},[r,n,t]);_t(k,12e4),d.useEffect(()=>{r!=="team"||Object.keys(u).length>0||F.listUsers().then(R=>{const C={};for(const P of R)C[P.id]={name:P.name,email:P.email};h(C)}).catch(()=>{})},[r,u]);const b=d.useMemo(()=>{const R=new Set;for(const C of s)R.add(_e(C.profileId));return[...R].sort()},[s]),N=d.useMemo(()=>{const R=new Set;for(const C of s)R.add(C.action);return[...R].sort()},[s]),I=d.useMemo(()=>{if(r!=="team")return[];const R=new Set;for(const C of s)C.userId&&R.add(C.userId);return[...R].map(C=>{var P;return{id:C,label:(P=u[C])!=null&&P.name?`${u[C].name} (${u[C].email})`:C}}).sort((C,P)=>C.label.localeCompare(P.label))},[r,s,u]),D=d.useMemo(()=>s.filter(R=>!(!ty(R,y)||w.size>0&&!w.has(_e(R.profileId))||m.size>0&&!m.has(R.action)||f.size>0&&R.userId&&!f.has(R.userId)||!ey(R,g))),[s,y,w,m,f,g]),V=w.size>0||m.size>0||f.size>0||g!=="all";function M(R){j(C=>{const P=new Set(C);return P.has(R)?P.delete(R):P.add(R),P})}function $(R){p(C=>{const P=new Set(C);return P.has(R)?P.delete(R):P.add(R),P})}function _(R){v(C=>{const P=new Set(C);return P.has(R)?P.delete(R):P.add(R),P})}function Q(){j(new Set),p(new Set),v(new Set),S("all"),x("")}return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{className:"page-title",children:"Receipts"}),o.jsx("p",{className:"page-subtitle",children:"Execution history for agent actions."})]}),n&&o.jsx("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem",borderBottom:"1px solid var(--border)"},children:["mine","team"].map(R=>o.jsx("button",{onClick:()=>a(R),className:"btn btn-ghost",style:{borderRadius:0,padding:"0.5rem 0.875rem",borderBottom:r===R?"2px solid var(--accent)":"2px solid transparent",color:r===R?"var(--text-primary)":"var(--text-tertiary)",fontWeight:r===R?600:500},children:R==="mine"?"Mine":"Team"},R))}),o.jsxs("div",{className:"search-filter-bar",children:[o.jsxs("div",{className:"search-input-wrap",children:[o.jsx("span",{className:"search-icon",children:"⌕"}),o.jsx("input",{type:"text",className:"form-input search-input",placeholder:"Search by profile, action, path, or hash\\u2026",value:y,onChange:R=>x(R.target.value)}),y&&o.jsx("button",{className:"search-clear",onClick:()=>x(""),children:"×"})]}),o.jsxs("button",{className:`btn btn-sm btn-secondary${E?" active":""}`,onClick:()=>T(!E),children:["Filters",V?` (${w.size+m.size+(g!=="all"?1:0)})`:""]})]}),E&&o.jsxs("div",{className:"filter-panel",children:[b.length>1&&o.jsxs("div",{className:"filter-section",children:[o.jsx("div",{className:"filter-label",children:"Profile"}),o.jsx("div",{className:"filter-chips",children:b.map(R=>o.jsx("button",{className:`filter-chip${w.has(R)?" selected":""}`,onClick:()=>M(R),children:R},R))})]}),N.length>1&&o.jsxs("div",{className:"filter-section",children:[o.jsx("div",{className:"filter-label",children:"Action"}),o.jsx("div",{className:"filter-chips",children:N.map(R=>o.jsx("button",{className:`filter-chip${m.has(R)?" selected":""}`,onClick:()=>$(R),children:R},R))})]}),r==="team"&&I.length>1&&o.jsxs("div",{className:"filter-section",children:[o.jsx("div",{className:"filter-label",children:"Owner"}),o.jsx("div",{className:"filter-chips",children:I.map(R=>o.jsx("button",{className:`filter-chip${f.has(R.id)?" selected":""}`,onClick:()=>_(R.id),children:R.label},R.id))})]}),o.jsxs("div",{className:"filter-section",children:[o.jsx("div",{className:"filter-label",children:"Time range"}),o.jsx("div",{className:"filter-chips",children:[["1d","Today"],["7d","7 days"],["30d","30 days"],["all","All time"]].map(([R,C])=>o.jsx("button",{className:`filter-chip${g===R?" selected":""}`,onClick:()=>S(R),children:C},R))})]})]}),V&&o.jsxs("div",{className:"active-filters",children:[[...w].map(R=>o.jsxs("span",{className:"active-chip",onClick:()=>M(R),children:[R," ",o.jsx("span",{className:"chip-remove",children:"×"})]},R)),[...m].map(R=>o.jsxs("span",{className:"active-chip",onClick:()=>$(R),children:[R," ",o.jsx("span",{className:"chip-remove",children:"×"})]},R)),[...f].map(R=>{const C=u[R],P=C?C.name:R;return o.jsxs("span",{className:"active-chip",onClick:()=>_(R),children:[P," ",o.jsx("span",{className:"chip-remove",children:"×"})]},R)}),g!=="all"&&o.jsxs("span",{className:"active-chip",onClick:()=>S("all"),children:[g==="1d"?"Today":g==="7d"?"7 days":"30 days"," ",o.jsx("span",{className:"chip-remove",children:"×"})]}),o.jsx("button",{className:"clear-filters",onClick:Q,children:"Clear all"})]}),l&&s.length===0?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):D.length===0?o.jsx(Pf,{icon:"⌕",title:s.length===0?"No receipts yet":"No matching receipts",text:s.length===0?"Execution receipts will appear here after an agent uses an authorized tool.":"Try adjusting your search or filters."}):o.jsxs(o.Fragment,{children:[o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:D.length===s.length?`${s.length} receipt${s.length!==1?"s":""}`:`${D.length} of ${s.length} receipts`}),o.jsx("div",{className:"timeline",children:D.map(R=>{var C;return o.jsx("div",{className:"timeline-event",children:o.jsxs("div",{className:"card",style:{marginBottom:0},children:[o.jsxs("div",{className:"auth-card-header",children:[o.jsx(Tf,{profileId:R.profileId}),o.jsx("span",{className:"auth-card-path",children:R.path}),o.jsx("span",{className:"receipt-action",children:R.action}),o.jsx("span",{className:"auth-card-time",children:Zv(R.timestamp)})]}),r==="team"&&R.userId&&o.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner:"," ",o.jsx("span",{style:{color:"var(--text-secondary)"},children:(C=u[R.userId])!=null&&C.name?`${u[R.userId].name} (${u[R.userId].email})`:R.userId})]}),Object.keys(R.executionContext).length>0&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:Object.entries(R.executionContext).map(([P,z])=>`${P}=${z}`).join(" · ")}),o.jsxs("div",{style:{display:"flex",gap:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:[o.jsxs("span",{children:["Daily: ",R.cumulativeState.daily.count," calls, $",R.cumulativeState.daily.amount]}),o.jsxs("span",{children:["Monthly: ",R.cumulativeState.monthly.count," calls, $",R.cumulativeState.monthly.amount]})]}),o.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontFamily:"'SF Mono', Monaco, monospace",wordBreak:"break-all",marginTop:"0.375rem"},children:R.attestationHash})]})},R.id)})})]})]})}const $c={ollama:{provider:"ollama",endpoint:"http://localhost:11434",models:["gemma4:e4b","gemma4:e2b","gemma4:26b","gemma4:31b","llama3.2","llama3.1","mistral","qwen2.5"]},openrouter:{provider:"openai-compatible",endpoint:"https://openrouter.ai/api/v1",models:["google/gemma-4-31b-it","qwen/qwen3.6-plus:free","stepfun/step-3.5-flash:free","google/gemini-2.5-flash","openai/gpt-4o-mini","anthropic/claude-haiku-4"]},openai:{provider:"openai-compatible",endpoint:"https://api.openai.com/v1",models:["gpt-4o-mini","gpt-4o","o3-mini"]},groq:{provider:"openai-compatible",endpoint:"https://api.groq.com/openai/v1",models:["llama-3.1-8b-instant","llama-3.3-70b-versatile","gemma2-9b-it"]},together:{provider:"openai-compatible",endpoint:"https://api.together.xyz/v1",models:["meta-llama/Llama-3-8b-chat-hf","meta-llama/Llama-3-70b-chat-hf"]}};function ry(){const[e,t]=d.useState(""),[n,r]=d.useState("openrouter"),[a,s]=d.useState("openai-compatible"),[i,l]=d.useState("https://openrouter.ai/api/v1"),[c,u]=d.useState("google/gemma-4-31b-it"),[h,f]=d.useState(""),[v,y]=d.useState(!1),[x,w]=d.useState(!1),[j,m]=d.useState(!1),[p,g]=d.useState(null),S=d.useCallback(N=>{t(N),setTimeout(()=>t(""),3e3)},[]),E=d.useCallback(async()=>{try{const N=await F.getCredential("ai-config");if(y(N.configured),N.configured&&N.fields){N.fields.provider&&s(N.fields.provider),N.fields.endpoint&&l(N.fields.endpoint),N.fields.model&&u(N.fields.model);const I=N.fields.endpoint??"";I.includes("openai.com")?r("openai"):I.includes("groq.com")?r("groq"):I.includes("together.xyz")?r("together"):I.includes("openrouter.ai")?r("openrouter"):r("ollama")}}catch{}},[]);d.useEffect(()=>{E()},[E]);const T=N=>{r(N);const I=$c[N];I&&(s(I.provider),l(I.endpoint),u(I.models[0]))},k=async()=>{w(!0);try{await F.setCredential("ai-config",{provider:a,endpoint:i,model:c,...h?{apiKey:h}:{}}),y(!0),S("AI configuration saved!")}catch{S("Failed to save AI config")}finally{w(!1)}},b=async()=>{m(!0),g(null);try{const N=await F.aiTest(h?{provider:a,endpoint:i,model:c,apiKey:h}:{});g(N.ok?`OK: ${N.message}`:`Failed: ${N.message}`)}catch(N){g(`Error: ${N instanceof Error?N.message:"Unknown"}`)}finally{m(!1)}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{className:"page-title",children:"AI Assistant"}),o.jsx("p",{className:"page-subtitle",children:"Advisory AI to help you think through intent when authorizing agents."})]}),e&&o.jsx("div",{className:"alert alert-success",children:e}),o.jsxs("div",{className:"card",children:[o.jsx("h3",{className:"card-title",children:"Configuration"}),o.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Connect a trusted AI model that has access to your intent — problem, objective, and tradeoffs — to help you think through authorizations. Keys are encrypted in your vault."}),v&&o.jsxs("div",{className:"status-banner status-banner-success",style:{marginBottom:"1rem",fontSize:"0.8rem"},children:[o.jsx("span",{className:"status-banner-icon",children:"✓"}),o.jsx("span",{className:"status-banner-text",children:"AI configured"})]}),o.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[o.jsx("label",{className:"form-label",children:"Provider Preset"}),o.jsxs("select",{className:"form-input",value:n,onChange:N=>T(N.target.value),children:[o.jsx("option",{value:"openrouter",children:"OpenRouter (recommended)"}),o.jsx("option",{value:"ollama",children:"Ollama (local)"}),o.jsx("option",{value:"openai",children:"OpenAI"}),o.jsx("option",{value:"groq",children:"Groq"}),o.jsx("option",{value:"together",children:"Together"})]})]}),o.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[o.jsx("label",{className:"form-label",children:"Model"}),(()=>{var D;const N=((D=$c[n])==null?void 0:D.models)??[],I=N.includes(c);return o.jsxs(o.Fragment,{children:[o.jsxs("select",{className:"form-input",value:I?c:"__custom__",onChange:V=>{V.target.value==="__custom__"?u(""):u(V.target.value)},style:{marginBottom:I?void 0:"0.375rem"},children:[N.map(V=>o.jsx("option",{value:V,children:V},V)),o.jsx("option",{value:"__custom__",children:"Custom model..."})]}),!I&&o.jsx("input",{className:"form-input",value:c,onChange:V=>u(V.target.value),placeholder:"Enter model name"})]})})()]}),o.jsxs("div",{className:"form-group",style:{marginBottom:"1rem"},children:[o.jsx("label",{className:"form-label",children:"API Key (if required)"}),o.jsx("input",{className:"form-input",type:"password",value:h,onChange:N=>f(N.target.value),placeholder:v?"••••••••••••••••":"sk-... (not needed for Ollama)"})]}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[o.jsx("button",{className:"btn btn-primary",onClick:k,disabled:x,children:x?"Saving...":"Save & Encrypt"}),v&&o.jsx("button",{className:"btn btn-ghost",onClick:b,disabled:j,children:j?"Testing...":"Test Connection"})]}),p&&o.jsx("div",{className:`alert ${p.startsWith("OK")?"alert-success":"alert-error"}`,style:{marginTop:"0.75rem"},children:p})]}),o.jsx(ay,{}),o.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[o.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,marginBottom:"1rem"},children:"Security"}),o.jsxs("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.7},children:[o.jsxs("div",{style:{marginBottom:"1rem"},children:[o.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"What the gateway protects"}),o.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[o.jsx("li",{children:"Every tool call verified against your authorization bounds"}),o.jsx("li",{children:"Credentials never exposed to agents through MCP"}),o.jsx("li",{children:"Every action produces a signed receipt"})]})]}),o.jsxs("div",{children:[o.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"Your responsibility"}),o.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[o.jsx("li",{children:"If your AI agent has full access to your computer, it could bypass the gateway"}),o.jsx("li",{children:"For best security, run agents in sandboxed environments"}),o.jsx("li",{children:"The gateway secures what agents do through tools — not what they do on your machine"})]})]})]})]})]})}function ay(){const[e,t]=d.useState(null),[n,r]=d.useState({intent:"",context:""}),[a,s]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(null),[h,f]=d.useState(!1),v=d.useCallback(async()=>{if(!h)try{const w=await F.getAIPrompts();t(w),r({intent:w.intent.current,context:w.context.current}),f(!0)}catch(w){l(w instanceof Error?w.message:"Failed to load prompts")}},[h]),y=async w=>{if(e){s(w),l(null);try{const j=n[w],m=j.trim()===e[w].default.trim()?"":j;await F.setAIPrompt(w,m);const p=await F.getAIPrompts();t(p),r({intent:p.intent.current,context:p.context.current}),u(w),setTimeout(()=>u(null),2e3)}catch(j){l(j instanceof Error?j.message:"Save failed")}finally{s(null)}}},x=async w=>{if(confirm(`Revert ${w} prompt to the built-in default?`)){s(w),l(null);try{await F.setAIPrompt(w,"");const j=await F.getAIPrompts();t(j),r({intent:j.intent.current,context:j.context.current})}catch(j){l(j instanceof Error?j.message:"Revert failed")}finally{s(null)}}};return o.jsxs("details",{className:"card",style:{padding:"1.5rem",marginTop:"1rem"},onToggle:w=>{w.currentTarget.open&&v()},children:[o.jsx("summary",{style:{fontSize:"1rem",fontWeight:700,cursor:"pointer",listStyle:"revert",userSelect:"none"},children:"Advanced — AI assistant prompts"}),o.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",margin:"0.75rem 0 1rem 0",lineHeight:1.55},children:"These are the system prompts the AI assistant sees when helping you write Intent (per-authorization) or Context (your standing-orders brief). Edit with care — changes apply on the next chat turn."}),i&&o.jsx("div",{className:"alert alert-error",style:{marginBottom:"0.75rem"},children:i}),!h&&!i&&o.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem"},children:"Loading prompts…"}),e&&o.jsxs(o.Fragment,{children:[o.jsx(Lc,{kind:"intent",label:"Intent — per-authorization",description:"Used on the Intent gate when creating a new authorization.",state:e.intent,draft:n.intent,onChange:w=>r(j=>({...j,intent:w})),onSave:()=>y("intent"),onRevert:()=>x("intent"),saving:a==="intent",justSaved:c==="intent"}),o.jsx(Lc,{kind:"context",label:"Context — standing-orders brief",description:"Used on the Brief page when refining your context.md.",state:e.context,draft:n.context,onChange:w=>r(j=>({...j,context:w})),onSave:()=>y("context"),onRevert:()=>x("context"),saving:a==="context",justSaved:c==="context"})]})]})}function Lc({kind:e,label:t,description:n,state:r,draft:a,onChange:s,onSave:i,onRevert:l,saving:c,justSaved:u}){const h=a!==r.current;return o.jsxs("section",{style:{marginBottom:"1.5rem"},children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:"0.25rem",gap:"1rem",flexWrap:"wrap"},children:[o.jsxs("div",{children:[o.jsx("div",{style:{fontWeight:600,fontSize:"0.9rem"},children:t}),o.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text-secondary)"},children:n})]}),r.overridden&&o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Custom"})]}),o.jsx("textarea",{className:"form-textarea",value:a,onChange:f=>s(f.target.value),rows:12,spellCheck:!1,style:{width:"100%",fontFamily:"'SF Mono', Monaco, 'Cascadia Code', monospace",fontSize:"0.82rem",lineHeight:1.55,resize:"vertical",minHeight:"14rem",marginTop:"0.5rem"},"aria-label":`${t} system prompt`}),o.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center",marginTop:"0.5rem",flexWrap:"wrap"},children:[o.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:i,disabled:c||!h,children:c?"Saving…":"Save"}),r.overridden&&o.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:l,disabled:c,title:"Discard the override and use the built-in default",children:"Revert to default"}),u&&o.jsx("span",{style:{fontSize:"0.78rem",color:"var(--success)"},children:"Saved"}),h&&!c&&!u&&o.jsx("span",{style:{fontSize:"0.78rem",color:"var(--text-muted)"},children:"Unsaved changes"})]}),o.jsxs("details",{style:{marginTop:"0.5rem"},children:[o.jsx("summary",{style:{fontSize:"0.78rem",color:"var(--text-muted)",cursor:"pointer"},children:"Show built-in default"}),o.jsx("pre",{style:{marginTop:"0.5rem",padding:"0.75rem 1rem",background:"var(--bg-main)",border:"1px solid var(--border)",borderRadius:"0.5rem",fontSize:"0.78rem",lineHeight:1.55,whiteSpace:"pre-wrap",maxHeight:"20rem",overflowY:"auto"},children:r.default})]}),o.jsx("span",{style:{display:"none"},children:e})]})}function oy(e){return e.proposalId?"review":"automatic"}function sy(e,t,n={}){const r=n.status??"pending",a=n.includeAutonomous??!1,s=[];for(const i of e)r==="pending"&&i.status!=="pending"||n.profile&&i.profileId!==n.profile||s.push({kind:"proposal",id:i.id,sortTimestamp:i.createdAt,commitmentMode:"review",profileId:i.profileId,proposal:i});if(r==="all")for(const i of t){const l=oy(i);!a&&l==="automatic"||n.profile&&i.profileId!==n.profile||s.push({kind:"receipt",id:i.id,sortTimestamp:i.timestamp,commitmentMode:l,profileId:i.profileId,receipt:i})}return s.sort((i,l)=>l.sortTimestamp-i.sortTimestamp),typeof n.limit=="number"&&n.limit>0?s.slice(0,n.limit):s}const iy={pending:"Pending",committed:"Approved",executed:"Executed",rejected:"Rejected",expired:"Expired"},ly={pending:"status-pending",committed:"status-active",executed:"status-active",rejected:"status-revoked",expired:"status-expired"};function cy(e){const t=Date.now()-e*1e3,n=t/36e5;return n<48?n<1?`${Math.max(1,Math.round(t/6e4))}m ago`:`${Math.round(n)}h ago`:new Date(e*1e3).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function uy(e){return e.split("__").pop()??e}function dy(e){const t=e.toLowerCase();return t.includes("delete")||t.includes("refund")||t.includes("cancel")||t.includes("revoke")}const fy=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]),py=/^(image|img|photo|picture|thumbnail)(_?url)?$/i;function my(e,t){return typeof t!="string"?!1:/^data:image\//i.test(t)?!0:py.test(e)?/^https?:\/\//.test(t):/^https?:\/\/.+\.(jpe?g|png|gif|webp|svg|avif)(\?|$)/i.test(t)}function ii(e){if(e==null)return"—";if(typeof e=="string")return e.length>160?e.slice(0,157)+"…":e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>ii(t)).join(", ");try{const t=JSON.stringify(e);return t.length>160?t.slice(0,157)+"…":t}catch{return String(e)}}function hy({item:e,onApprove:t,onReject:n,resolving:r}){const a=e.kind==="proposal",s=a?e.proposal.status:"executed",i=a?e.proposal.tool:e.receipt.action,l=uy(i),c=dy(i),u=a?e.proposal.toolArgs:null,h=a?e.proposal.executionContext:e.receipt.executionContext,f=a?null:e.receipt.cumulativeState,v=u?Object.entries(u).filter(([x])=>!fy.has(x)):[],y=Object.entries(h??{});return o.jsxs("div",{className:"card",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.75rem",flexWrap:"wrap"},children:[o.jsx(Tf,{profileId:e.profileId}),o.jsx("code",{style:{fontSize:"0.85rem"},children:l}),e.commitmentMode==="automatic"&&o.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"autonomous"}),o.jsxs("span",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"0.5rem"},children:[o.jsx("span",{className:`status-badge ${ly[s]}`,children:iy[s]}),o.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:cy(e.sortTimestamp)})]})]}),c&&o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",fontSize:"0.8rem",color:"var(--warning)",background:"var(--bg-main)",border:"1px solid var(--border)",borderRadius:"0.375rem",padding:"0.4rem 0.6rem",marginBottom:"0.75rem"},children:[o.jsx("span",{children:"⚠"}),o.jsx("span",{children:"Irreversible action"})]}),a&&typeof(u==null?void 0:u._imagePreview)=="string"&&o.jsxs("div",{style:{marginBottom:"0.75rem"},children:[o.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Preview"}),o.jsx("img",{src:u._imagePreview,alt:typeof(u==null?void 0:u.altText)=="string"?u.altText:"local image preview",style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"}})]}),a&&v.length>0&&o.jsxs("div",{style:{marginBottom:"0.75rem"},children:[o.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Arguments"}),o.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:v.map(([x,w])=>o.jsxs(d.Fragment,{children:[o.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:x}),o.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word"},children:my(x,w)?o.jsx("img",{src:w,alt:typeof(u==null?void 0:u.altText)=="string"?u.altText:x,style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"},onError:j=>{const m=j.currentTarget,p=m.parentElement;if(!p)return;m.style.display="none";const g=document.createElement("span");g.textContent=w,g.style.color="var(--text-tertiary)",p.appendChild(g)}}):ii(w)})]},x))})]}),y.length>0&&o.jsx("div",{style:{marginBottom:"0.75rem",fontSize:"0.8rem",color:"var(--text-secondary)"},children:y.map(([x,w])=>`${x}=${ii(w)}`).join(" · ")}),f&&o.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["After this action · today: ",f.daily.count," action",f.daily.count===1?"":"s",f.daily.amount>0?`, ${f.daily.amount}`:""," · ","this month: ",f.monthly.count,f.monthly.amount>0?`, ${f.monthly.amount}`:""]}),a&&s==="pending"&&o.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[o.jsx("button",{className:"btn btn-primary",onClick:()=>t==null?void 0:t(e.id),disabled:r,children:r?"Approving…":"Approve"}),o.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:()=>n==null?void 0:n(e.id),disabled:r,children:"Reject"})]}),o.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:[a?"Proposal":"Receipt",": ",e.id]})]})}const gy=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]);function li(e){if(e==null)return"—";if(typeof e=="string")return e.length>200?e.slice(0,197)+"...":e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>li(t)).join(", ");try{const t=JSON.stringify(e);return t.length>200?t.slice(0,197)+"...":t}catch{return String(e)}}function vy(e){const t=Date.now()-e*1e3,n=Math.floor(t/6e4);if(n<60)return`${Math.max(1,n)}m ago`;const r=Math.floor(t/36e5);return r<48?`${r}h ago`:`${Math.floor(r/24)}d ago`}function yy({proposal:e,currentUserId:t,onAction:n,onMessage:r}){const[a,s]=d.useState(!1),[i,l]=d.useState(!1),[c,u]=d.useState(null),[h,f]=d.useState(!1),[v,y]=d.useState(null),[x,w]=d.useState(!1),j=e.tool.split("__").pop()??e.tool,m=Object.entries(e.toolArgs).filter(([M])=>!gy.has(M)),p=Object.entries(e.executionContext),g=e.pendingApprovers??[],S=e.approvedBy??{},E=Object.keys(S).length,T=g.filter(M=>!(M in S)).length,k=t in S,b=async()=>{if(c===null){f(!0),y(null);try{const M=await F.getAttestationIntent(e.frameHash);if(!M){y("Intent not available or you are not an authorized approver.");return}const $=await F.decryptIntent({intentCiphertext:M.intentCiphertext,encryptedKey:M.encryptedKey,approverId:t});u($)}catch(M){y(M instanceof Error?M.message:"Failed to decrypt intent")}finally{f(!1)}}},N=async()=>{x?w(!1):(w(!0),await b())},I=async()=>{s(!0),r("");try{await F.approveProposal(e.id);try{if(c===null){const M=await F.getAttestationIntent(e.frameHash);if(M){const $=await F.decryptIntent({intentCiphertext:M.intentCiphertext,encryptedKey:M.encryptedKey,approverId:t});u($),await F.storeApprovedIntent(e.frameHash,$)}}else await F.storeApprovedIntent(e.frameHash,c)}catch{}r(`Approved. ${T-1>0?`${T-1} more approver(s) still needed.`:"All approvers signed off — action is ready to execute."}`),n()}catch(M){r(M instanceof Error?M.message:"Approval failed")}finally{s(!1)}},D=async()=>{const M=prompt("Rejection reason (optional):");if(M!==null){l(!0),r("");try{await F.rejectProposal(e.id,M||void 0),r("Action rejected."),n()}catch($){r($ instanceof Error?$.message:"Rejection failed")}finally{l(!1)}}},V=a||i;return o.jsxs("div",{className:"card",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[o.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:_e(e.profileId)}),o.jsx("span",{style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Above cap"}),o.jsx("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:vy(e.createdAt)})]}),o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[E," of ",g.length," approver",g.length===1?"":"s"," signed off",g.map(M=>{const $=M in S;return o.jsxs("span",{style:{marginLeft:"0.5rem",color:$?"var(--success, green)":"var(--text-tertiary)"},children:[$?"✓":"○"," ",M===t?"You":M]},M)})]}),o.jsxs("div",{style:{marginBottom:"0.5rem"},children:[o.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Proposed action"}),o.jsx("code",{style:{fontSize:"0.85rem"},children:j})]}),m.length>0&&o.jsxs("div",{style:{marginBottom:"0.75rem"},children:[o.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Arguments"}),o.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:m.map(([M,$])=>o.jsxs(d.Fragment,{children:[o.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:M}),o.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word"},children:li($)})]},M))})]}),p.length>0&&o.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:p.map(([M,$])=>`${M}=${li($)}`).join(" · ")}),o.jsxs("div",{style:{marginBottom:"0.75rem"},children:[o.jsxs("button",{className:"btn btn-ghost btn-sm",style:{padding:"0.2rem 0",fontSize:"0.75rem"},onClick:N,disabled:h,children:[x?"▲ Hide intent":"▼ Show intent",h&&" (decrypting...)"]}),x&&o.jsx("div",{style:{marginTop:"0.5rem",padding:"0.75rem",background:"var(--bg-main)",borderRadius:"0.375rem",border:"1px solid var(--border)"},children:v?o.jsx("p",{style:{color:"var(--danger)",fontSize:"0.8rem",margin:0},children:v}):c!==null?o.jsx("p",{style:{fontSize:"0.85rem",margin:0,whiteSpace:"pre-wrap",color:"var(--text-primary)"},children:c}):o.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.8rem",margin:0},children:"No intent available for this authority."})})]}),!k&&o.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.25rem"},children:[o.jsx("button",{className:"btn btn-primary",onClick:I,disabled:V,children:a?"Approving...":"Approve"}),o.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:D,disabled:V,children:i?"Rejecting...":"Reject"})]}),k&&o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"You approved this action. Waiting on other approvers."}),o.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["Proposal: ",e.id]})]})}function xy(){const{domain:e,user:t}=Ce(),n=(t==null?void 0:t.id)??"",[r,a]=d.useState("awaiting-me"),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,h]=d.useState(""),f=d.useCallback(async()=>{try{const B=await F.getProposalsForApprover();i(B)}catch{}finally{c(!1)}},[]);ue("proposal-added",f),ue("proposal-approved",f),ue("proposal-rejected",f),ue("proposal-resolved",f),_t(f,3e4);const[v,y]=d.useState([]),x=d.useCallback(async()=>{try{const B=await F.getProposals(e||"owner");y(B)}catch{}},[e]);ue("proposal-added",x),ue("proposal-approved",x),ue("proposal-rejected",x),ue("proposal-resolved",x),_t(x,3e4,e);const w=d.useMemo(()=>{const B=[];for(const Y of v)Y.status==="pending"&&B.push(Y);for(const Y of s);return B},[v,s]),[j,m]=d.useState([]),p=d.useCallback(async()=>{if(n)try{const Y=(await F.getProposals(e||"owner")).filter(G=>G.status==="pending"&&G.pendingApprovers&&G.pendingApprovers.includes(n)&&G.approvedBy&&n in G.approvedBy);m(Y)}catch{}},[n,e]);ue("proposal-approved",p),ue("proposal-rejected",p),_t(p,3e4,`${n}:${e}`),d.useEffect(()=>{f(),x(),p()},[]);const[g,S]=d.useState([]),[E,T]=d.useState([]),[k,b]=d.useState(!0),[N,I]=d.useState(null),[D,V]=d.useState(""),[M,$]=d.useState("pending"),[_,Q]=d.useState(null),[R,C]=d.useState(!1),P=d.useCallback(async()=>{try{const{proposals:B,receipts:Y}=await F.getThread({domain:e,status:M,sinceDays:7});S(B),T(Y)}catch{}finally{b(!1)}},[e,M]);_t(P,3e4,`${e}:${M}`);const z=async(B,Y)=>{I(B),V("");try{const G=e||"owner",K=await F.resolveProposal(B,Y,G);V(Y==="commit"?`Action approved. Status: ${K.status}`:"Action rejected."),await P()}catch(G){V(G instanceof Error?G.message:"Failed")}finally{I(null)}},L=d.useMemo(()=>{const B=new Set;for(const Y of g)B.add(Y.profileId);for(const Y of E)B.add(Y.profileId);return Array.from(B).sort()},[g,E]),U=d.useMemo(()=>sy(g,E,{status:M,profile:_??void 0,includeAutonomous:R}),[g,E,M,_,R]),ne=d.useCallback(()=>{f(),p()},[f,p]),J=d.useMemo(()=>{const B=new Set,Y=[];for(const G of[...j,...w])B.has(G.id)||(B.add(G.id),Y.push(G));return Y.sort((G,K)=>K.createdAt-G.createdAt)},[j,w]),ve=s.length,O=J.length;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{className:"page-title",children:"Pending Approvals"}),o.jsx("p",{className:"page-subtitle",children:"Actions awaiting approval, plus recent activity from the last 7 days."})]}),o.jsxs("div",{className:"nav-tabs",style:{marginBottom:"1rem"},children:[o.jsxs("button",{className:`nav-tab${r==="awaiting-me"?" active":""}`,onClick:()=>a("awaiting-me"),children:["Awaiting me ",ve>0&&o.jsx("span",{style:{marginLeft:"0.4rem",background:"var(--warning)",color:"var(--bg-elevated)",borderRadius:"0.625rem",padding:"0 0.375rem",fontSize:"0.7rem",fontWeight:600},children:ve})]}),o.jsxs("button",{className:`nav-tab${r==="awaiting-others"?" active":""}`,onClick:()=>a("awaiting-others"),children:["Awaiting others ",O>0&&o.jsx("span",{style:{marginLeft:"0.4rem",background:"var(--border)",color:"var(--text-secondary)",borderRadius:"0.625rem",padding:"0 0.375rem",fontSize:"0.7rem",fontWeight:600},children:O})]}),o.jsx("button",{className:`nav-tab${r==="all"?" active":""}`,onClick:()=>{a("all"),P()},children:"All"})]}),r==="awaiting-me"&&o.jsx(o.Fragment,{children:l&&s.length===0?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):s.length===0?o.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[o.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions awaiting your approval."}),o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Above-cap actions under authorities you are an approver for will appear here."})]}):o.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[u&&o.jsx("div",{className:"alert alert-success",children:u}),s.map(B=>o.jsx(yy,{proposal:B,currentUserId:n,onAction:ne,onMessage:h},B.id))]})}),r==="awaiting-others"&&o.jsx(o.Fragment,{children:J.length===0?o.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[o.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions waiting on others."}),o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Actions you proposed or approved that are pending other approvers will appear here."})]}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:J.map(B=>o.jsx(Sy,{proposal:B,currentUserId:n,onCancel:async()=>{try{await F.rejectProposal(B.id,"cancelled by creator"),p(),x()}catch(Y){alert(Y instanceof Error?Y.message:"Cancel failed")}}},B.id))})}),r==="all"&&o.jsxs(o.Fragment,{children:[D&&o.jsx("div",{className:"alert alert-success",style:{marginBottom:"1rem"},children:D}),o.jsxs("div",{className:"filter-chips",style:{marginBottom:"1rem"},children:[o.jsx("button",{className:`filter-chip ${M==="pending"?"selected":""}`,onClick:()=>$("pending"),children:"Pending"}),o.jsx("button",{className:`filter-chip ${M==="all"?"selected":""}`,onClick:()=>$("all"),children:"All"}),L.length>0&&o.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),L.map(B=>o.jsx("button",{className:`filter-chip ${_===B?"selected":""}`,onClick:()=>Q(_===B?null:B),children:_e(B)},B)),M==="all"&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),o.jsxs("button",{className:`filter-chip ${R?"selected":""}`,onClick:()=>C(!R),title:"Include actions executed without human review (automatic commitment mode)",children:[R?"✓ ":"","Autonomous actions"]})]})]}),k&&U.length===0?o.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):U.length===0?o.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[o.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:M==="pending"?"No actions awaiting your approval.":"Nothing here yet."}),o.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:M==="pending"?"Your agents are operating within their authorizations. Switch to All to see recent activity.":"When an agent calls a gated tool, activity will appear here."})]}):o.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:U.map(B=>o.jsx(hy,{item:B,onApprove:Y=>z(Y,"commit"),onReject:Y=>z(Y,"reject"),resolving:N===B.id},B.id))})]})]})}function wy(e){const t=Date.now()-e*1e3,n=Math.floor(t/6e4);if(n<60)return`${Math.max(1,n)}m ago`;const r=Math.floor(t/36e5);return r<48?`${r}h ago`:`${Math.floor(r/24)}d ago`}function Sy({proposal:e,currentUserId:t,onCancel:n}){var u;const[r,a]=d.useState(!1),s=Object.keys(e.approvedBy??{}),i=(e.pendingApprovers??[]).filter(h=>!(h in(e.approvedBy??{}))),l=(((u=e.pendingApprovers)==null?void 0:u.length)??0)>0,c=async()=>{if(confirm("Cancel this action? All approvers will be notified.")){a(!0);try{await n()}finally{a(!1)}}};return o.jsxs("div",{className:"card",children:[o.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[o.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:_e(e.profileId)}),l&&o.jsx("span",{style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:"var(--accent-subtle)",color:"var(--accent)",fontWeight:600},children:"Above cap"}),o.jsx("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:wy(e.createdAt)})]}),o.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:o.jsx("code",{children:e.tool.split("__").pop()??e.tool})}),l&&o.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[s.map(h=>o.jsx("span",{style:{marginRight:"0.75rem",color:"var(--success, green)"},children:h===t?"You approved":`${h} approved`},h)),i.map(h=>o.jsxs("span",{style:{marginRight:"0.75rem",color:"var(--text-tertiary)"},children:["Waiting on ",h===t?"you":h]},h))]}),o.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:o.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--danger)"},onClick:c,disabled:r,children:r?"Cancelling...":"Cancel"})})]})}const jy=`# Agent Brief
67
67
 
68
68
  You act on my behalf through Suveren — the gateway that gates every
69
69
  privileged tool call you make. Suveren implements the bounded-authority
@@ -99,4 +99,4 @@ executes. When you propose an action:
99
99
  next.
100
100
  - Never email anyone outside the company without asking first.
101
101
  - When drafting posts, prefer plain language over marketing copy.
102
- `;function wv(){const[e,t]=d.useState(""),[n,r]=d.useState(""),[a,s]=d.useState(!0),[i,l]=d.useState(!1),[c,u]=d.useState(null),[h,f]=d.useState(!1),g=e!==n,v=new Blob([e]).size,x=16*1024;d.useEffect(()=>{if(!g)return;const p=S=>{S.preventDefault(),S.returnValue=""},y=S=>{var k,E;if(S.defaultPrevented||S.button!==0||S.metaKey||S.ctrlKey||S.shiftKey||S.altKey)return;const b=(E=(k=S.target)==null?void 0:k.closest)==null?void 0:E.call(k,"a");if(!b||!b.href)return;let T;try{T=new URL(b.href)}catch{return}T.origin===window.location.origin&&T.pathname!==window.location.pathname&&(confirm("You have unsaved changes to your agent brief. Leave anyway?")||(S.preventDefault(),S.stopPropagation()))};return window.addEventListener("beforeunload",p),document.addEventListener("click",y,!0),()=>{window.removeEventListener("beforeunload",p),document.removeEventListener("click",y,!0)}},[g]),d.useEffect(()=>{let p=!1;return F.getAgentContext().then(y=>{p||(t(y),r(y))}).catch(y=>{p||u({kind:"error",text:y instanceof Error?y.message:"Failed to load context"})}).finally(()=>{p||s(!1)}),()=>{p=!0}},[]);const w=async()=>{l(!0),u(null);try{await F.saveAgentContext(e),r(e),u({kind:"ok",text:"Saved. New MCP sessions will pick this up on next connect."})}catch(p){u({kind:"error",text:p instanceof Error?p.message:"Save failed"})}finally{l(!1)}},j=()=>{t(n),u(null)},m=()=>{e.trim()&&!confirm("Replace current context with the starter template?")||t(xv)};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{className:"page-title",children:"Agent Brief"}),o.jsx("p",{className:"page-subtitle",children:"Standing orders for agents that connect via MCP. This text prepends every new session — keep it tight."}),!e.trim()&&!a&&o.jsx("button",{className:"btn btn-primary btn-sm",onClick:m,disabled:i,title:"Insert a starter brief covering Suveren basics and example standing orders",style:{marginTop:"0.5rem"},children:"Insert starter template"})]}),c&&o.jsx("div",{className:c.kind==="ok"?"alert alert-success":"error-message",style:{marginBottom:"1rem"},children:c.text}),o.jsxs("div",{className:"intent-layout",style:{marginBottom:"1rem"},children:[o.jsx("div",{className:"card intent-pane chat",children:o.jsx(so,{target:{kind:"context"},currentText:e,onApply:p=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||t(p)},greeting:"Tell me what your agent should know — I'll help shape your standing orders. Or ask me to draft a full brief and we'll iterate.",placeholder:"Ask for help with your brief…"})}),o.jsxs("div",{className:"card intent-pane document",children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.5rem"},children:[o.jsx("h3",{className:"card-title",style:{marginBottom:0},children:"context.md"}),o.jsxs("span",{style:{fontSize:"0.75rem",color:v>x?"var(--danger)":"var(--text-muted)"},children:[v.toLocaleString()," / ",x.toLocaleString()," bytes"]})]}),o.jsx("textarea",{className:"form-textarea",value:e,onChange:p=>t(p.target.value),placeholder:a?"Loading…":'Type your standing orders here, or click "Insert starter template" below.',disabled:a,rows:18,style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem",lineHeight:1.5,minHeight:"22rem"}}),o.jsxs("div",{className:"intent-footer",style:{marginTop:"0.75rem"},children:[o.jsx("button",{className:"btn btn-ghost",onClick:j,disabled:i||!g,children:"Revert"}),o.jsx("button",{className:"btn btn-primary",style:{flex:1},onClick:w,disabled:i||!g||v>x||a,children:i?"Saving…":"Save"})]})]}),o.jsx("button",{type:"button",className:"floating-help",onClick:()=>f(!0),"aria-label":"Open brief assistant",children:"Get help with brief"}),o.jsx(kf,{open:h,onClose:()=>f(!1),ariaLabel:"Brief assistant",children:o.jsx(so,{target:{kind:"context"},currentText:e,onApply:p=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||(t(p),f(!1))},greeting:"Tell me what your agent should know — I'll help shape your standing orders.",placeholder:"Ask for help with your brief…"})})]})]})}function Sv({children:e}){const{user:t,mode:n,domain:r}=Ce();return t?n==="team"&&!r?o.jsx(Vt,{to:"/onboarding",replace:!0}):o.jsx(o.Fragment,{children:e}):o.jsx(Vt,{to:"/login",replace:!0})}function jv(){const{user:e}=Ce();return o.jsxs(og,{children:[o.jsx(Se,{path:"/login",element:e?o.jsx(Vt,{to:"/",replace:!0}):o.jsx(ay,{})}),o.jsx(Se,{path:"/onboarding",element:e?o.jsx(oy,{}):o.jsx(Vt,{to:"/login",replace:!0})}),o.jsxs(Se,{element:o.jsx(Sv,{children:o.jsx(ry,{})}),children:[o.jsx(Se,{path:"/",element:o.jsx(uy,{})}),o.jsx(Se,{path:"/agent/new",element:o.jsx(Vt,{to:"/authorizations?new=1",replace:!0})}),o.jsx(Se,{path:"/agent/gate",element:o.jsx(_y,{})}),o.jsx(Se,{path:"/agent/review",element:o.jsx(Ry,{})}),o.jsx(Se,{path:"/integrations",element:o.jsx($y,{})}),o.jsx(Se,{path:"/groups",element:o.jsx(Ly,{})}),o.jsx(Se,{path:"/authorizations",element:o.jsx(Yy,{})}),o.jsx(Se,{path:"/audit",element:o.jsx(Zy,{})}),o.jsx(Se,{path:"/proposals",element:o.jsx(gv,{})}),o.jsx(Se,{path:"/agent-brief",element:o.jsx(wv,{})}),o.jsx(Se,{path:"/settings",element:o.jsx(ev,{})}),o.jsx(Se,{path:"/settings/services",element:o.jsx(Vt,{to:"/settings",replace:!0})}),o.jsx(Se,{path:"/deploy",element:o.jsx(Vt,{to:"/integrations",replace:!0})})]}),o.jsx(Se,{path:"*",element:o.jsx(Vt,{to:"/",replace:!0})})]})}function kv(){return o.jsx(Ig,{children:o.jsx(Bg,{children:o.jsx(Dg,{children:o.jsx(jv,{})})})})}Yd(document.getElementById("root")).render(o.jsx(d.StrictMode,{children:o.jsx(kv,{})}));
102
+ `;function ky(){const[e,t]=d.useState(""),[n,r]=d.useState(""),[a,s]=d.useState(!0),[i,l]=d.useState(!1),[c,u]=d.useState(null),[h,f]=d.useState(!1),v=e!==n,y=new Blob([e]).size,x=16*1024;d.useEffect(()=>{if(!v)return;const p=S=>{S.preventDefault(),S.returnValue=""},g=S=>{var k,b;if(S.defaultPrevented||S.button!==0||S.metaKey||S.ctrlKey||S.shiftKey||S.altKey)return;const E=(b=(k=S.target)==null?void 0:k.closest)==null?void 0:b.call(k,"a");if(!E||!E.href)return;let T;try{T=new URL(E.href)}catch{return}T.origin===window.location.origin&&T.pathname!==window.location.pathname&&(confirm("You have unsaved changes to your agent brief. Leave anyway?")||(S.preventDefault(),S.stopPropagation()))};return window.addEventListener("beforeunload",p),document.addEventListener("click",g,!0),()=>{window.removeEventListener("beforeunload",p),document.removeEventListener("click",g,!0)}},[v]),d.useEffect(()=>{let p=!1;return F.getAgentContext().then(g=>{p||(t(g),r(g))}).catch(g=>{p||u({kind:"error",text:g instanceof Error?g.message:"Failed to load context"})}).finally(()=>{p||s(!1)}),()=>{p=!0}},[]);const w=async()=>{l(!0),u(null);try{await F.saveAgentContext(e),r(e),u({kind:"ok",text:"Saved. New MCP sessions will pick this up on next connect."})}catch(p){u({kind:"error",text:p instanceof Error?p.message:"Save failed"})}finally{l(!1)}},j=()=>{t(n),u(null)},m=()=>{e.trim()&&!confirm("Replace current context with the starter template?")||t(jy)};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"page-header",children:[o.jsx("h1",{className:"page-title",children:"Agent Brief"}),o.jsx("p",{className:"page-subtitle",children:"Standing orders for agents that connect via MCP. This text prepends every new session — keep it tight."}),!e.trim()&&!a&&o.jsx("button",{className:"btn btn-primary btn-sm",onClick:m,disabled:i,title:"Insert a starter brief covering Suveren basics and example standing orders",style:{marginTop:"0.5rem"},children:"Insert starter template"})]}),c&&o.jsx("div",{className:c.kind==="ok"?"alert alert-success":"error-message",style:{marginBottom:"1rem"},children:c.text}),o.jsxs("div",{className:"intent-layout",style:{marginBottom:"1rem"},children:[o.jsx("div",{className:"card intent-pane chat",children:o.jsx(so,{target:{kind:"context"},currentText:e,onApply:p=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||t(p)},greeting:"Tell me what your agent should know — I'll help shape your standing orders. Or ask me to draft a full brief and we'll iterate.",placeholder:"Ask for help with your brief…"})}),o.jsxs("div",{className:"card intent-pane document",children:[o.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.5rem"},children:[o.jsx("h3",{className:"card-title",style:{marginBottom:0},children:"context.md"}),o.jsxs("span",{style:{fontSize:"0.75rem",color:y>x?"var(--danger)":"var(--text-muted)"},children:[y.toLocaleString()," / ",x.toLocaleString()," bytes"]})]}),o.jsx("textarea",{className:"form-textarea",value:e,onChange:p=>t(p.target.value),placeholder:a?"Loading…":'Type your standing orders here, or click "Insert starter template" below.',disabled:a,rows:18,style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem",lineHeight:1.5,minHeight:"22rem"}}),o.jsxs("div",{className:"intent-footer",style:{marginTop:"0.75rem"},children:[o.jsx("button",{className:"btn btn-ghost",onClick:j,disabled:i||!v,children:"Revert"}),o.jsx("button",{className:"btn btn-primary",style:{flex:1},onClick:w,disabled:i||!v||y>x||a,children:i?"Saving…":"Save"})]})]}),o.jsx("button",{type:"button",className:"floating-help",onClick:()=>f(!0),"aria-label":"Open brief assistant",children:"Get help with brief"}),o.jsx(Cf,{open:h,onClose:()=>f(!1),ariaLabel:"Brief assistant",children:o.jsx(so,{target:{kind:"context"},currentText:e,onApply:p=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||(t(p),f(!1))},greeting:"Tell me what your agent should know — I'll help shape your standing orders.",placeholder:"Ask for help with your brief…"})})]})]})}function Cy({children:e}){const{user:t,mode:n,domain:r}=Ce();return t?n==="team"&&!r?o.jsx(Vt,{to:"/onboarding",replace:!0}):o.jsx(o.Fragment,{children:e}):o.jsx(Vt,{to:"/login",replace:!0})}function Ny(){const{user:e}=Ce();return o.jsxs(sg,{children:[o.jsx(Se,{path:"/login",element:e?o.jsx(Vt,{to:"/",replace:!0}):o.jsx(iv,{})}),o.jsx(Se,{path:"/onboarding",element:e?o.jsx(lv,{}):o.jsx(Vt,{to:"/login",replace:!0})}),o.jsxs(Se,{element:o.jsx(Cy,{children:o.jsx(sv,{})}),children:[o.jsx(Se,{path:"/",element:o.jsx(pv,{})}),o.jsx(Se,{path:"/agent/new",element:o.jsx(Vt,{to:"/authorizations?new=1",replace:!0})}),o.jsx(Se,{path:"/agent/gate",element:o.jsx(Av,{})}),o.jsx(Se,{path:"/agent/review",element:o.jsx($v,{})}),o.jsx(Se,{path:"/integrations",element:o.jsx(Fv,{})}),o.jsx(Se,{path:"/groups",element:o.jsx(Ov,{})}),o.jsx(Se,{path:"/authorizations",element:o.jsx(qv,{})}),o.jsx(Se,{path:"/audit",element:o.jsx(ny,{})}),o.jsx(Se,{path:"/proposals",element:o.jsx(xy,{})}),o.jsx(Se,{path:"/agent-brief",element:o.jsx(ky,{})}),o.jsx(Se,{path:"/settings",element:o.jsx(ry,{})}),o.jsx(Se,{path:"/settings/services",element:o.jsx(Vt,{to:"/settings",replace:!0})}),o.jsx(Se,{path:"/deploy",element:o.jsx(Vt,{to:"/integrations",replace:!0})})]}),o.jsx(Se,{path:"*",element:o.jsx(Vt,{to:"/",replace:!0})})]})}function by(){return o.jsx(Rg,{children:o.jsx(Dg,{children:o.jsx(Ug,{children:o.jsx(Ny,{})})})})}Jd(document.getElementById("root")).render(o.jsx(d.StrictMode,{children:o.jsx(by,{})}));