@suveren/gateway 0.3.4 → 0.3.6
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
|
|
1
|
+
var Hf=Object.defineProperty;var Vf=(e,t,n)=>t in e?Hf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ma=(e,t,n)=>Vf(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)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(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();var Jc={exports:{}},ya={},Xc={exports:{}},Z={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ var Wf=Object.defineProperty;var Hf=(e,t,n)=>t in e?Wf(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 to=Symbol.for("react.element"),
|
|
9
|
+
*/var to=Symbol.for("react.element"),Kf=Symbol.for("react.portal"),Gf=Symbol.for("react.fragment"),Yf=Symbol.for("react.strict_mode"),Qf=Symbol.for("react.profiler"),Jf=Symbol.for("react.provider"),Xf=Symbol.for("react.context"),qf=Symbol.for("react.forward_ref"),Zf=Symbol.for("react.suspense"),ep=Symbol.for("react.memo"),tp=Symbol.for("react.lazy"),Sl=Symbol.iterator;function np(e){return e===null||typeof e!="object"?null:(e=Sl&&e[Sl]||e["@@iterator"],typeof e=="function"?e:null)}var qc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Zc=Object.assign,eu={};function ar(e,t,n){this.props=e,this.context=t,this.refs=eu,this.updater=n||qc}ar.prototype.isReactComponent={};ar.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")};ar.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function tu(){}tu.prototype=ar.prototype;function yi(e,t,n){this.props=e,this.context=t,this.refs=eu,this.updater=n||qc}var xi=yi.prototype=new tu;xi.constructor=yi;Zc(xi,ar.prototype);xi.isPureReactComponent=!0;var jl=Array.isArray,nu=Object.prototype.hasOwnProperty,wi={current:null},ru={key:!0,ref:!0,__self:!0,__source:!0};function ou(e,t,n){var r,o={},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)nu.call(t,r)&&!ru.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];o.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)o[r]===void 0&&(o[r]=l[r]);return{$$typeof:to,type:e,key:s,ref:i,props:o,_owner:wi.current}}function rp(e,t){return{$$typeof:to,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Si(e){return typeof e=="object"&&e!==null&&e.$$typeof===to}function op(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var kl=/\/+/g;function Fa(e,t){return typeof e=="object"&&e!==null&&e.key!=null?op(""+e.key):t.toString(36)}function To(e,t,n,r,o){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 to:case Kf:i=!0}}if(i)return i=e,o=o(i),e=r===""?"."+Fa(i,0):r,jl(o)?(n="",e!=null&&(n=e.replace(kl,"$&/")+"/"),To(o,t,n,"",function(u){return u})):o!=null&&(Si(o)&&(o=rp(o,n+(!o.key||i&&i.key===o.key?"":(""+o.key).replace(kl,"$&/")+"/")+e)),t.push(o)),1;if(i=0,r=r===""?".":r+":",jl(e))for(var l=0;l<e.length;l++){s=e[l];var c=r+Fa(s,l);i+=To(s,t,n,c,o)}else if(c=np(e),typeof c=="function")for(e=c.call(e),l=0;!(s=e.next()).done;)s=s.value,c=r+Fa(s,l++),i+=To(s,t,n,c,o);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 co(e,t,n){if(e==null)return e;var r=[],o=0;return To(e,r,"","",function(s){return t.call(n,s,o++)}),r}function ap(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 Be={current:null},Io={transition:null},sp={ReactCurrentDispatcher:Be,ReactCurrentBatchConfig:Io,ReactCurrentOwner:wi};function au(){throw Error("act(...) is not supported in production builds of React.")}Z.Children={map:co,forEach:function(e,t,n){co(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return co(e,function(){t++}),t},toArray:function(e){return co(e,function(t){return t})||[]},only:function(e){if(!Si(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Z.Component=ar;Z.Fragment=Gf;Z.Profiler=Qf;Z.PureComponent=yi;Z.StrictMode=Yf;Z.Suspense=Zf;Z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=sp;Z.act=au;Z.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=Zc({},e.props),o=e.key,s=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,i=wi.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)nu.call(t,c)&&!ru.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:to,type:e.type,key:o,ref:s,props:r,_owner:i}};Z.createContext=function(e){return e={$$typeof:Xf,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Jf,_context:e},e.Consumer=e};Z.createElement=ou;Z.createFactory=function(e){var t=ou.bind(null,e);return t.type=e,t};Z.createRef=function(){return{current:null}};Z.forwardRef=function(e){return{$$typeof:qf,render:e}};Z.isValidElement=Si;Z.lazy=function(e){return{$$typeof:tp,_payload:{_status:-1,_result:e},_init:ap}};Z.memo=function(e,t){return{$$typeof:ep,type:e,compare:t===void 0?null:t}};Z.startTransition=function(e){var t=Io.transition;Io.transition={};try{e()}finally{Io.transition=t}};Z.unstable_act=au;Z.useCallback=function(e,t){return Be.current.useCallback(e,t)};Z.useContext=function(e){return Be.current.useContext(e)};Z.useDebugValue=function(){};Z.useDeferredValue=function(e){return Be.current.useDeferredValue(e)};Z.useEffect=function(e,t){return Be.current.useEffect(e,t)};Z.useId=function(){return Be.current.useId()};Z.useImperativeHandle=function(e,t,n){return Be.current.useImperativeHandle(e,t,n)};Z.useInsertionEffect=function(e,t){return Be.current.useInsertionEffect(e,t)};Z.useLayoutEffect=function(e,t){return Be.current.useLayoutEffect(e,t)};Z.useMemo=function(e,t){return Be.current.useMemo(e,t)};Z.useReducer=function(e,t,n){return Be.current.useReducer(e,t,n)};Z.useRef=function(e){return Be.current.useRef(e)};Z.useState=function(e){return Be.current.useState(e)};Z.useSyncExternalStore=function(e,t,n){return Be.current.useSyncExternalStore(e,t,n)};Z.useTransition=function(){return Be.current.useTransition()};Z.version="18.3.1";Xc.exports=Z;var d=Xc.exports;/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.production.min.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ var Wf=Object.defineProperty;var Hf=(e,t,n)=>t in e?Wf(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
|
|
17
|
+
*/var ip=d,lp=Symbol.for("react.element"),cp=Symbol.for("react.fragment"),up=Object.prototype.hasOwnProperty,dp=ip.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,fp={key:!0,ref:!0,__self:!0,__source:!0};function su(e,t,n){var r,o={},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)up.call(t,r)&&!fp.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:lp,type:e,key:s,ref:i,props:o,_owner:dp.current}}ya.Fragment=cp;ya.jsx=su;ya.jsxs=su;Jc.exports=ya;var a=Jc.exports,iu={exports:{}},et={},lu={exports:{}},cu={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.min.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var Wf=Object.defineProperty;var Hf=(e,t,n)=>t in e?Wf(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(z,R){var $=z.length;z.push(R);e:for(;0<$;){var L=$-1>>>1,V=z[L];if(0<o(V,R))z[L]=R,z[$]=V,$=L;else break e}}function n(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var R=z[0],$=z.pop();if($!==R){z[0]=$;e:for(var L=0,V=z.length,ee=V>>>1;L<ee;){var J=2*(L+1)-1,je=z[J],b=J+1,U=z[b];if(0>o(je,$))b<V&&0>o(U,je)?(z[L]=U,z[b]=$,L=b):(z[L]=je,z[J]=$,L=J);else if(b<V&&0>o(U,$))z[L]=U,z[b]=$,L=b;else break e}}return R}function o(z,R){var $=z.sortIndex-R.sortIndex;return $!==0?$:z.id-R.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=[],
|
|
25
|
+
*/(function(e){function t(z,R){var $=z.length;z.push(R);e:for(;0<$;){var L=$-1>>>1,V=z[L];if(0<o(V,R))z[L]=R,z[$]=V,$=L;else break e}}function n(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var R=z[0],$=z.pop();if($!==R){z[0]=$;e:for(var L=0,V=z.length,ee=V>>>1;L<ee;){var J=2*(L+1)-1,je=z[J],b=J+1,U=z[b];if(0>o(je,$))b<V&&0>o(U,je)?(z[L]=U,z[b]=$,L=b):(z[L]=je,z[J]=$,L=J);else if(b<V&&0>o(U,$))z[L]=U,z[b]=$,L=b;else break e}}return R}function o(z,R){var $=z.sortIndex-R.sortIndex;return $!==0?$:z.id-R.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=[],m=1,f=null,v=3,y=!1,x=!1,w=!1,j=typeof setTimeout=="function"?setTimeout:null,h=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(z){for(var R=n(u);R!==null;){if(R.callback===null)r(u);else if(R.startTime<=z)r(u),R.sortIndex=R.expirationTime,t(c,R);else break;R=n(u)}}function S(z){if(w=!1,g(z),!x)if(n(c)!==null)x=!0,X(E);else{var R=n(u);R!==null&&se(S,R.startTime-z)}}function E(z,R){x=!1,w&&(w=!1,h(N),N=-1),y=!0;var $=v;try{for(g(R),f=n(c);f!==null&&(!(f.expirationTime>R)||z&&!H());){var L=f.callback;if(typeof L=="function"){f.callback=null,v=f.priorityLevel;var V=L(f.expirationTime<=R);R=e.unstable_now(),typeof V=="function"?f.callback=V:f===n(c)&&r(c),g(R)}else r(c);f=n(c)}if(f!==null)var ee=!0;else{var J=n(u);J!==null&&se(S,J.startTime-R),ee=!1}return ee}finally{f=null,v=$,y=!1}}var P=!1,k=null,N=-1,C=5,T=-1;function H(){return!(e.unstable_now()-T<C)}function W(){if(k!==null){var z=e.unstable_now();T=z;var R=!0;try{R=k(!0,z)}finally{R?B():(P=!1,k=null)}}else P=!1}var B;if(typeof p=="function")B=function(){p(W)};else if(typeof MessageChannel<"u"){var _=new MessageChannel,D=_.port2;_.port1.onmessage=W,B=function(){D.postMessage(null)}}else B=function(){j(W,0)};function X(z){k=z,P||(P=!0,B())}function se(z,R){N=j(function(){z(e.unstable_now())},R)}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(z){z.callback=null},e.unstable_continueExecution=function(){x||y||(x=!0,X(E))},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(z){switch(v){case 1:case 2:case 3:var R=3;break;default:R=v}var $=v;v=R;try{return z()}finally{v=$}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(z,R){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var $=v;v=z;try{return R()}finally{v=$}},e.unstable_scheduleCallback=function(z,R,$){var L=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?L+$:L):$=L,z){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=$+V,z={id:m++,callback:R,priorityLevel:z,startTime:$,expirationTime:V,sortIndex:-1},$>L?(z.sortIndex=$,t(u,z),n(c)===null&&z===n(u)&&(w?(h(N),N=-1):w=!0,se(S,$-L))):(z.sortIndex=V,t(c,z),x||y||(x=!0,X(E))),z},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(z){var R=v;return function(){var $=v;v=R;try{return z.apply(this,arguments)}finally{v=$}}}})(cu);lu.exports=cu;var pp=lu.exports;/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -30,14 +30,14 @@ var Wf=Object.defineProperty;var Hf=(e,t,n)=>t in e?Wf(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
|
|
33
|
+
*/var mp=d,Ze=pp;function M(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 uu=new Set,Mr={};function Tn(e,t){qn(e,t),qn(e+"Capture",t)}function qn(e,t){for(Mr[e]=t,e=0;e<t.length;e++)uu.add(t[e])}var Mt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vs=Object.prototype.hasOwnProperty,hp=/^[: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]*$/,Cl={},bl={};function gp(e){return vs.call(bl,e)?!0:vs.call(Cl,e)?!1:hp.test(e)?bl[e]=!0:(Cl[e]=!0,!1)}function vp(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 yp(e,t,n,r){if(t===null||typeof t>"u"||vp(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 De(e,t,n,r,o,s,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=i}var Re={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Re[e]=new De(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Re[t]=new De(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Re[e]=new De(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Re[e]=new De(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){Re[e]=new De(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Re[e]=new De(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Re[e]=new De(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Re[e]=new De(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Re[e]=new De(e,5,!1,e.toLowerCase(),null,!1,!1)});var ji=/[\-:]([a-z])/g;function ki(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(ji,ki);Re[t]=new De(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(ji,ki);Re[t]=new De(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(ji,ki);Re[t]=new De(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Re[e]=new De(e,1,!1,e.toLowerCase(),null,!1,!1)});Re.xlinkHref=new De("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Re[e]=new De(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ci(e,t,n,r){var o=Re.hasOwnProperty(t)?Re[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(yp(t,n,o,r)&&(n=null),r||o===null?gp(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Ut=mp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,uo=Symbol.for("react.element"),An=Symbol.for("react.portal"),$n=Symbol.for("react.fragment"),bi=Symbol.for("react.strict_mode"),ys=Symbol.for("react.profiler"),du=Symbol.for("react.provider"),fu=Symbol.for("react.context"),Ni=Symbol.for("react.forward_ref"),xs=Symbol.for("react.suspense"),ws=Symbol.for("react.suspense_list"),Ei=Symbol.for("react.memo"),Kt=Symbol.for("react.lazy"),pu=Symbol.for("react.offscreen"),Nl=Symbol.iterator;function pr(e){return e===null||typeof e!="object"?null:(e=Nl&&e[Nl]||e["@@iterator"],typeof e=="function"?e:null)}var he=Object.assign,Oa;function jr(e){if(Oa===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Oa=t&&t[1]||""}return`
|
|
34
34
|
`+Oa+e}var Ba=!1;function Da(e,t){if(!e||Ba)return"";Ba=!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 o=u.stack.split(`
|
|
35
35
|
`),s=r.stack.split(`
|
|
36
36
|
`),i=o.length-1,l=s.length-1;1<=i&&0<=l&&o[i]!==s[l];)l--;for(;1<=i&&0<=l;i--,l--)if(o[i]!==s[l]){if(i!==1||l!==1)do if(i--,l--,0>l||o[i]!==s[l]){var c=`
|
|
37
|
-
`+o[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{Ba=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?jr(e):""}function ym(e){switch(e.tag){case 5:return jr(e.type);case 16:return jr("Lazy");case 13:return jr("Suspense");case 19:return jr("SuspenseList");case 0:case 2:case 15:return e=Da(e.type,!1),e;case 11:return e=Da(e.type.render,!1),e;case 1:return e=Da(e.type,!0),e;default:return""}}function Ss(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 $n:return"Fragment";case An:return"Portal";case ys:return"Profiler";case bi:return"StrictMode";case xs:return"Suspense";case ws:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case fu:return(e.displayName||"Context")+".Consumer";case du:return(e._context.displayName||"Context")+".Provider";case Ni:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ei:return t=e.displayName||null,t!==null?t:Ss(e.type)||"Memo";case Kt:t=e._payload,e=e._init;try{return Ss(e(t))}catch{}}return null}function xm(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 Ss(t);case 8:return t===bi?"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 ln(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function pu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function wm(e){var t=pu(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 o=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.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 fo(e){e._valueTracker||(e._valueTracker=wm(e))}function hu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=pu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Vo(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 js(e,t){var n=t.checked;return he({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function El(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ln(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 gu(e,t){t=t.checked,t!=null&&Ci(e,"checked",t,!1)}function ks(e,t){gu(e,t);var n=ln(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")?Cs(e,t.type,n):t.hasOwnProperty("defaultValue")&&Cs(e,t.type,ln(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function zl(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 Cs(e,t,n){(t!=="number"||Vo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var kr=Array.isArray;function Kn(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ln(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function bs(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(M(91));return he({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Pl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(M(92));if(kr(n)){if(1<n.length)throw Error(M(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ln(n)}}function vu(e,t){var n=ln(t.value),r=ln(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 Tl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function yu(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 Ns(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?yu(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var mo,xu=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(mo=mo||document.createElement("div"),mo.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=mo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Fr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Er={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},Sm=["Webkit","ms","Moz","O"];Object.keys(Er).forEach(function(e){Sm.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Er[t]=Er[e]})});function wu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Er.hasOwnProperty(e)&&Er[e]?(""+t).trim():t+"px"}function Su(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=wu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var jm=he({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 Es(e,t){if(t){if(jm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(M(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(M(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(M(61))}if(t.style!=null&&typeof t.style!="object")throw Error(M(62))}}function zs(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 Ps=null;function zi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ts=null,Gn=null,Yn=null;function Il(e){if(e=oo(e)){if(typeof Ts!="function")throw Error(M(280));var t=e.stateNode;t&&(t=ka(t),Ts(e.stateNode,e.type,t))}}function ju(e){Gn?Yn?Yn.push(e):Yn=[e]:Gn=e}function ku(){if(Gn){var e=Gn,t=Yn;if(Yn=Gn=null,Il(e),t)for(e=0;e<t.length;e++)Il(t[e])}}function Cu(e,t){return e(t)}function bu(){}var Ua=!1;function Nu(e,t,n){if(Ua)return e(t,n);Ua=!0;try{return Cu(e,t,n)}finally{Ua=!1,(Gn!==null||Yn!==null)&&(bu(),ku())}}function Or(e,t){var n=e.stateNode;if(n===null)return null;var r=ka(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(M(231,t,typeof n));return n}var Is=!1;if(Mt)try{var pr={};Object.defineProperty(pr,"passive",{get:function(){Is=!0}}),window.addEventListener("test",pr,pr),window.removeEventListener("test",pr,pr)}catch{Is=!1}function km(e,t,n,r,o,s,i,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(p){this.onError(p)}}var zr=!1,Ko=null,Go=!1,Rs=null,Cm={onError:function(e){zr=!0,Ko=e}};function bm(e,t,n,r,o,s,i,l,c){zr=!1,Ko=null,km.apply(Cm,arguments)}function Nm(e,t,n,r,o,s,i,l,c){if(bm.apply(this,arguments),zr){if(zr){var u=Ko;zr=!1,Ko=null}else throw Error(M(198));Go||(Go=!0,Rs=u)}}function In(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 Eu(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 Rl(e){if(In(e)!==e)throw Error(M(188))}function Em(e){var t=e.alternate;if(!t){if(t=In(e),t===null)throw Error(M(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var s=o.alternate;if(s===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===s.child){for(s=o.child;s;){if(s===n)return Rl(o),e;if(s===r)return Rl(o),t;s=s.sibling}throw Error(M(188))}if(n.return!==r.return)n=o,r=s;else{for(var i=!1,l=o.child;l;){if(l===n){i=!0,n=o,r=s;break}if(l===r){i=!0,r=o,n=s;break}l=l.sibling}if(!i){for(l=s.child;l;){if(l===n){i=!0,n=s,r=o;break}if(l===r){i=!0,r=s,n=o;break}l=l.sibling}if(!i)throw Error(M(189))}}if(n.alternate!==r)throw Error(M(190))}if(n.tag!==3)throw Error(M(188));return n.stateNode.current===n?e:t}function zu(e){return e=Em(e),e!==null?Pu(e):null}function Pu(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Pu(e);if(t!==null)return t;e=e.sibling}return null}var Tu=Ze.unstable_scheduleCallback,_l=Ze.unstable_cancelCallback,zm=Ze.unstable_shouldYield,Pm=Ze.unstable_requestPaint,ve=Ze.unstable_now,Tm=Ze.unstable_getCurrentPriorityLevel,Pi=Ze.unstable_ImmediatePriority,Iu=Ze.unstable_UserBlockingPriority,Yo=Ze.unstable_NormalPriority,Im=Ze.unstable_LowPriority,Ru=Ze.unstable_IdlePriority,xa=null,Nt=null;function Rm(e){if(Nt&&typeof Nt.onCommitFiberRoot=="function")try{Nt.onCommitFiberRoot(xa,e,void 0,(e.current.flags&128)===128)}catch{}}var yt=Math.clz32?Math.clz32:$m,_m=Math.log,Am=Math.LN2;function $m(e){return e>>>=0,e===0?32:31-(_m(e)/Am|0)|0}var po=64,ho=4194304;function Cr(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 Qo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~o;l!==0?r=Cr(l):(s&=i,s!==0&&(r=Cr(s)))}else i=n&~o,i!==0?r=Cr(i):s!==0&&(r=Cr(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,s=t&-t,o>=s||o===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-yt(t),o=1<<n,r|=e[n],t&=~o;return r}function Lm(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 Mm(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,s=e.pendingLanes;0<s;){var i=31-yt(s),l=1<<i,c=o[i];c===-1?(!(l&n)||l&r)&&(o[i]=Lm(l,t)):c<=t&&(e.expiredLanes|=l),s&=~l}}function _s(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function _u(){var e=po;return po<<=1,!(po&4194240)&&(po=64),e}function Wa(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function no(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-yt(t),e[t]=n}function Fm(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 o=31-yt(n),s=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~s}}function Ti(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-yt(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var ae=0;function Au(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var $u,Ii,Lu,Mu,Fu,As=!1,go=[],Zt=null,en=null,tn=null,Br=new Map,Dr=new Map,Qt=[],Om="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 Al(e,t){switch(e){case"focusin":case"focusout":Zt=null;break;case"dragenter":case"dragleave":en=null;break;case"mouseover":case"mouseout":tn=null;break;case"pointerover":case"pointerout":Br.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dr.delete(t.pointerId)}}function hr(e,t,n,r,o,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[o]},t!==null&&(t=oo(t),t!==null&&Ii(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Bm(e,t,n,r,o){switch(t){case"focusin":return Zt=hr(Zt,e,t,n,r,o),!0;case"dragenter":return en=hr(en,e,t,n,r,o),!0;case"mouseover":return tn=hr(tn,e,t,n,r,o),!0;case"pointerover":var s=o.pointerId;return Br.set(s,hr(Br.get(s)||null,e,t,n,r,o)),!0;case"gotpointercapture":return s=o.pointerId,Dr.set(s,hr(Dr.get(s)||null,e,t,n,r,o)),!0}return!1}function Ou(e){var t=xn(e.target);if(t!==null){var n=In(t);if(n!==null){if(t=n.tag,t===13){if(t=Eu(n),t!==null){e.blockedOn=t,Fu(e.priority,function(){Lu(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 Ro(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=$s(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ps=r,n.target.dispatchEvent(r),Ps=null}else return t=oo(n),t!==null&&Ii(t),e.blockedOn=n,!1;t.shift()}return!0}function $l(e,t,n){Ro(e)&&n.delete(t)}function Dm(){As=!1,Zt!==null&&Ro(Zt)&&(Zt=null),en!==null&&Ro(en)&&(en=null),tn!==null&&Ro(tn)&&(tn=null),Br.forEach($l),Dr.forEach($l)}function gr(e,t){e.blockedOn===t&&(e.blockedOn=null,As||(As=!0,Ze.unstable_scheduleCallback(Ze.unstable_NormalPriority,Dm)))}function Ur(e){function t(o){return gr(o,e)}if(0<go.length){gr(go[0],e);for(var n=1;n<go.length;n++){var r=go[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Zt!==null&&gr(Zt,e),en!==null&&gr(en,e),tn!==null&&gr(tn,e),Br.forEach(t),Dr.forEach(t),n=0;n<Qt.length;n++)r=Qt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Qt.length&&(n=Qt[0],n.blockedOn===null);)Ou(n),n.blockedOn===null&&Qt.shift()}var Qn=Ut.ReactCurrentBatchConfig,Jo=!0;function Um(e,t,n,r){var o=ae,s=Qn.transition;Qn.transition=null;try{ae=1,Ri(e,t,n,r)}finally{ae=o,Qn.transition=s}}function Wm(e,t,n,r){var o=ae,s=Qn.transition;Qn.transition=null;try{ae=4,Ri(e,t,n,r)}finally{ae=o,Qn.transition=s}}function Ri(e,t,n,r){if(Jo){var o=$s(e,t,n,r);if(o===null)Za(e,t,r,Xo,n),Al(e,r);else if(Bm(o,e,t,n,r))r.stopPropagation();else if(Al(e,r),t&4&&-1<Om.indexOf(e)){for(;o!==null;){var s=oo(o);if(s!==null&&$u(s),s=$s(e,t,n,r),s===null&&Za(e,t,r,Xo,n),s===o)break;o=s}o!==null&&r.stopPropagation()}else Za(e,t,r,null,n)}}var Xo=null;function $s(e,t,n,r){if(Xo=null,e=zi(r),e=xn(e),e!==null)if(t=In(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Eu(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 Xo=e,null}function Bu(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(Tm()){case Pi:return 1;case Iu:return 4;case Yo:case Im:return 16;case Ru:return 536870912;default:return 16}default:return 16}}var Xt=null,_i=null,_o=null;function Du(){if(_o)return _o;var e,t=_i,n=t.length,r,o="value"in Xt?Xt.value:Xt.textContent,s=o.length;for(e=0;e<n&&t[e]===o[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===o[s-r];r++);return _o=o.slice(e,1<r?1-r:void 0)}function Ao(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 vo(){return!0}function Ll(){return!1}function tt(e){function t(n,r,o,s,i){this._reactName=n,this._targetInst=o,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)?vo:Ll,this.isPropagationStopped=Ll,this}return he(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=vo)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=vo)},persist:function(){},isPersistent:vo}),t}var sr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ai=tt(sr),ro=he({},sr,{view:0,detail:0}),Hm=tt(ro),Ha,Va,vr,wa=he({},ro,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$i,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!==vr&&(vr&&e.type==="mousemove"?(Ha=e.screenX-vr.screenX,Va=e.screenY-vr.screenY):Va=Ha=0,vr=e),Ha)},movementY:function(e){return"movementY"in e?e.movementY:Va}}),Ml=tt(wa),Vm=he({},wa,{dataTransfer:0}),Km=tt(Vm),Gm=he({},ro,{relatedTarget:0}),Ka=tt(Gm),Ym=he({},sr,{animationName:0,elapsedTime:0,pseudoElement:0}),Qm=tt(Ym),Jm=he({},sr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Xm=tt(Jm),qm=he({},sr,{data:0}),Fl=tt(qm),Zm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ep={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"},tp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function np(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=tp[e])?!!t[e]:!1}function $i(){return np}var rp=he({},ro,{key:function(e){if(e.key){var t=Zm[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ao(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?ep[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$i,charCode:function(e){return e.type==="keypress"?Ao(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ao(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),op=tt(rp),ap=he({},wa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ol=tt(ap),sp=he({},ro,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$i}),ip=tt(sp),lp=he({},sr,{propertyName:0,elapsedTime:0,pseudoElement:0}),cp=tt(lp),up=he({},wa,{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}),dp=tt(up),fp=[9,13,27,32],Li=Mt&&"CompositionEvent"in window,Pr=null;Mt&&"documentMode"in document&&(Pr=document.documentMode);var mp=Mt&&"TextEvent"in window&&!Pr,Uu=Mt&&(!Li||Pr&&8<Pr&&11>=Pr),Bl=" ",Dl=!1;function Wu(e,t){switch(e){case"keyup":return fp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ln=!1;function pp(e,t){switch(e){case"compositionend":return Hu(t);case"keypress":return t.which!==32?null:(Dl=!0,Bl);case"textInput":return e=t.data,e===Bl&&Dl?null:e;default:return null}}function hp(e,t){if(Ln)return e==="compositionend"||!Li&&Wu(e,t)?(e=Du(),_o=_i=Xt=null,Ln=!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 Uu&&t.locale!=="ko"?null:t.data;default:return null}}var gp={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 Ul(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!gp[e.type]:t==="textarea"}function Vu(e,t,n,r){ju(r),t=qo(t,"onChange"),0<t.length&&(n=new Ai("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Tr=null,Wr=null;function vp(e){nd(e,0)}function Sa(e){var t=On(e);if(hu(t))return e}function yp(e,t){if(e==="change")return t}var Ku=!1;if(Mt){var Ga;if(Mt){var Ya="oninput"in document;if(!Ya){var Wl=document.createElement("div");Wl.setAttribute("oninput","return;"),Ya=typeof Wl.oninput=="function"}Ga=Ya}else Ga=!1;Ku=Ga&&(!document.documentMode||9<document.documentMode)}function Hl(){Tr&&(Tr.detachEvent("onpropertychange",Gu),Wr=Tr=null)}function Gu(e){if(e.propertyName==="value"&&Sa(Wr)){var t=[];Vu(t,Wr,e,zi(e)),Nu(vp,t)}}function xp(e,t,n){e==="focusin"?(Hl(),Tr=t,Wr=n,Tr.attachEvent("onpropertychange",Gu)):e==="focusout"&&Hl()}function wp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Sa(Wr)}function Sp(e,t){if(e==="click")return Sa(t)}function jp(e,t){if(e==="input"||e==="change")return Sa(t)}function kp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wt=typeof Object.is=="function"?Object.is:kp;function Hr(e,t){if(wt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!vs.call(t,o)||!wt(e[o],t[o]))return!1}return!0}function Vl(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Kl(e,t){var n=Vl(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=Vl(n)}}function Yu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Yu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qu(){for(var e=window,t=Vo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Vo(e.document)}return t}function Mi(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 Cp(e){var t=Qu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Yu(n.ownerDocument.documentElement,n)){if(r!==null&&Mi(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 o=n.textContent.length,s=Math.min(r.start,o);r=r.end===void 0?s:Math.min(r.end,o),!e.extend&&s>r&&(o=r,r=s,s=o),o=Kl(n,s);var i=Kl(n,r);o&&i&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(o.node,o.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 bp=Mt&&"documentMode"in document&&11>=document.documentMode,Mn=null,Ls=null,Ir=null,Ms=!1;function Gl(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ms||Mn==null||Mn!==Vo(r)||(r=Mn,"selectionStart"in r&&Mi(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}),Ir&&Hr(Ir,r)||(Ir=r,r=qo(Ls,"onSelect"),0<r.length&&(t=new Ai("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Mn)))}function yo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Fn={animationend:yo("Animation","AnimationEnd"),animationiteration:yo("Animation","AnimationIteration"),animationstart:yo("Animation","AnimationStart"),transitionend:yo("Transition","TransitionEnd")},Qa={},Ju={};Mt&&(Ju=document.createElement("div").style,"AnimationEvent"in window||(delete Fn.animationend.animation,delete Fn.animationiteration.animation,delete Fn.animationstart.animation),"TransitionEvent"in window||delete Fn.transitionend.transition);function ja(e){if(Qa[e])return Qa[e];if(!Fn[e])return e;var t=Fn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ju)return Qa[e]=t[n];return e}var Xu=ja("animationend"),qu=ja("animationiteration"),Zu=ja("animationstart"),ed=ja("transitionend"),td=new Map,Yl="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 un(e,t){td.set(e,t),Tn(t,[e])}for(var Ja=0;Ja<Yl.length;Ja++){var Xa=Yl[Ja],Np=Xa.toLowerCase(),Ep=Xa[0].toUpperCase()+Xa.slice(1);un(Np,"on"+Ep)}un(Xu,"onAnimationEnd");un(qu,"onAnimationIteration");un(Zu,"onAnimationStart");un("dblclick","onDoubleClick");un("focusin","onFocus");un("focusout","onBlur");un(ed,"onTransitionEnd");qn("onMouseEnter",["mouseout","mouseover"]);qn("onMouseLeave",["mouseout","mouseover"]);qn("onPointerEnter",["pointerout","pointerover"]);qn("onPointerLeave",["pointerout","pointerover"]);Tn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Tn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Tn("onBeforeInput",["compositionend","keypress","textInput","paste"]);Tn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Tn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Tn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var br="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(" "),zp=new Set("cancel close invalid load scroll toggle".split(" ").concat(br));function Ql(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Nm(r,t,void 0,e),e.currentTarget=null}function nd(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=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&&o.isPropagationStopped())break e;Ql(o,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&&o.isPropagationStopped())break e;Ql(o,l,u),s=c}}}if(Go)throw e=Rs,Go=!1,Rs=null,e}function le(e,t){var n=t[Us];n===void 0&&(n=t[Us]=new Set);var r=e+"__bubble";n.has(r)||(rd(t,e,2,!1),n.add(r))}function qa(e,t,n){var r=0;t&&(r|=4),rd(n,e,r,t)}var xo="_reactListening"+Math.random().toString(36).slice(2);function Vr(e){if(!e[xo]){e[xo]=!0,uu.forEach(function(n){n!=="selectionchange"&&(zp.has(n)||qa(n,!1,e),qa(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[xo]||(t[xo]=!0,qa("selectionchange",!1,t))}}function rd(e,t,n,r){switch(Bu(t)){case 1:var o=Um;break;case 4:o=Wm;break;default:o=Ri}n=o.bind(null,t,n,e),o=void 0,!Is||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Za(e,t,n,r,o){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===o||l.nodeType===8&&l.parentNode===o)break;if(i===4)for(i=r.return;i!==null;){var c=i.tag;if((c===3||c===4)&&(c=i.stateNode.containerInfo,c===o||c.nodeType===8&&c.parentNode===o))return;i=i.return}for(;l!==null;){if(i=xn(l),i===null)return;if(c=i.tag,c===5||c===6){r=s=i;continue e}l=l.parentNode}}r=r.return}Nu(function(){var u=s,p=zi(n),f=[];e:{var v=td.get(e);if(v!==void 0){var y=Ai,x=e;switch(e){case"keypress":if(Ao(n)===0)break e;case"keydown":case"keyup":y=op;break;case"focusin":x="focus",y=Ka;break;case"focusout":x="blur",y=Ka;break;case"beforeblur":case"afterblur":y=Ka;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=Ml;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=Km;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=ip;break;case Xu:case qu:case Zu:y=Qm;break;case ed:y=cp;break;case"scroll":y=Hm;break;case"wheel":y=dp;break;case"copy":case"cut":case"paste":y=Xm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=Ol}var w=(t&4)!==0,j=!w&&e==="scroll",h=w?v!==null?v+"Capture":null:v;w=[];for(var m=u,g;m!==null;){g=m;var S=g.stateNode;if(g.tag===5&&S!==null&&(g=S,h!==null&&(S=Or(m,h),S!=null&&w.push(Kr(m,S,g)))),j)break;m=m.return}0<w.length&&(v=new y(v,x,null,n,p),f.push({event:v,listeners:w}))}}if(!(t&7)){e:{if(v=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",v&&n!==Ps&&(x=n.relatedTarget||n.fromElement)&&(xn(x)||x[Ft]))break e;if((y||v)&&(v=p.window===p?p:(v=p.ownerDocument)?v.defaultView||v.parentWindow:window,y?(x=n.relatedTarget||n.toElement,y=u,x=x?xn(x):null,x!==null&&(j=In(x),x!==j||x.tag!==5&&x.tag!==6)&&(x=null)):(y=null,x=u),y!==x)){if(w=Ml,S="onMouseLeave",h="onMouseEnter",m="mouse",(e==="pointerout"||e==="pointerover")&&(w=Ol,S="onPointerLeave",h="onPointerEnter",m="pointer"),j=y==null?v:On(y),g=x==null?v:On(x),v=new w(S,m+"leave",y,n,p),v.target=j,v.relatedTarget=g,S=null,xn(p)===u&&(w=new w(h,m+"enter",x,n,p),w.target=g,w.relatedTarget=j,S=w),j=S,y&&x)t:{for(w=y,h=x,m=0,g=w;g;g=_n(g))m++;for(g=0,S=h;S;S=_n(S))g++;for(;0<m-g;)w=_n(w),m--;for(;0<g-m;)h=_n(h),g--;for(;m--;){if(w===h||h!==null&&w===h.alternate)break t;w=_n(w),h=_n(h)}w=null}else w=null;y!==null&&Jl(f,v,y,w,!1),x!==null&&j!==null&&Jl(f,j,x,w,!0)}}e:{if(v=u?On(u):window,y=v.nodeName&&v.nodeName.toLowerCase(),y==="select"||y==="input"&&v.type==="file")var E=yp;else if(Ul(v))if(Ku)E=jp;else{E=wp;var P=xp}else(y=v.nodeName)&&y.toLowerCase()==="input"&&(v.type==="checkbox"||v.type==="radio")&&(E=Sp);if(E&&(E=E(e,u))){Vu(f,E,n,p);break e}P&&P(e,v,u),e==="focusout"&&(P=v._wrapperState)&&P.controlled&&v.type==="number"&&Cs(v,"number",v.value)}switch(P=u?On(u):window,e){case"focusin":(Ul(P)||P.contentEditable==="true")&&(Mn=P,Ls=u,Ir=null);break;case"focusout":Ir=Ls=Mn=null;break;case"mousedown":Ms=!0;break;case"contextmenu":case"mouseup":case"dragend":Ms=!1,Gl(f,n,p);break;case"selectionchange":if(bp)break;case"keydown":case"keyup":Gl(f,n,p)}var k;if(Li)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else Ln?Wu(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(Uu&&n.locale!=="ko"&&(Ln||N!=="onCompositionStart"?N==="onCompositionEnd"&&Ln&&(k=Du()):(Xt=p,_i="value"in Xt?Xt.value:Xt.textContent,Ln=!0)),P=qo(u,N),0<P.length&&(N=new Fl(N,e,null,n,p),f.push({event:N,listeners:P}),k?N.data=k:(k=Hu(n),k!==null&&(N.data=k)))),(k=mp?pp(e,n):hp(e,n))&&(u=qo(u,"onBeforeInput"),0<u.length&&(p=new Fl("onBeforeInput","beforeinput",null,n,p),f.push({event:p,listeners:u}),p.data=k))}nd(f,t)})}function Kr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qo(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,s=o.stateNode;o.tag===5&&s!==null&&(o=s,s=Or(e,n),s!=null&&r.unshift(Kr(e,s,o)),s=Or(e,t),s!=null&&r.push(Kr(e,s,o))),e=e.return}return r}function _n(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Jl(e,t,n,r,o){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,o?(c=Or(n,s),c!=null&&i.unshift(Kr(n,c,l))):o||(c=Or(n,s),c!=null&&i.push(Kr(n,c,l)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var Pp=/\r\n?/g,Tp=/\u0000|\uFFFD/g;function Xl(e){return(typeof e=="string"?e:""+e).replace(Pp,`
|
|
38
|
-
`).replace(Tp,"")}function wo(e,t,n){if(t=Xl(t),Xl(e)!==t&&n)throw Error(M(425))}function Zo(){}var Fs=null,Os=null;function Bs(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 Ds=typeof setTimeout=="function"?setTimeout:void 0,Ip=typeof clearTimeout=="function"?clearTimeout:void 0,ql=typeof Promise=="function"?Promise:void 0,Rp=typeof queueMicrotask=="function"?queueMicrotask:typeof ql<"u"?function(e){return ql.resolve(null).then(e).catch(_p)}:Ds;function _p(e){setTimeout(function(){throw e})}function es(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),Ur(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Ur(t)}function nn(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 Zl(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 ir=Math.random().toString(36).slice(2),bt="__reactFiber$"+ir,Gr="__reactProps$"+ir,Ft="__reactContainer$"+ir,Us="__reactEvents$"+ir,Ap="__reactListeners$"+ir,$p="__reactHandles$"+ir;function xn(e){var t=e[bt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ft]||n[bt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Zl(e);e!==null;){if(n=e[bt])return n;e=Zl(e)}return t}e=n,n=e.parentNode}return null}function oo(e){return e=e[bt]||e[Ft],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function On(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(M(33))}function ka(e){return e[Gr]||null}var Ws=[],Bn=-1;function dn(e){return{current:e}}function ce(e){0>Bn||(e.current=Ws[Bn],Ws[Bn]=null,Bn--)}function ie(e,t){Bn++,Ws[Bn]=e.current,e.current=t}var cn={},Me=dn(cn),Ve=dn(!1),bn=cn;function Zn(e,t){var n=e.type.contextTypes;if(!n)return cn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},s;for(s in n)o[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ke(e){return e=e.childContextTypes,e!=null}function ea(){ce(Ve),ce(Me)}function ec(e,t,n){if(Me.current!==cn)throw Error(M(168));ie(Me,t),ie(Ve,n)}function od(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(M(108,xm(e)||"Unknown",o));return he({},n,r)}function ta(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||cn,bn=Me.current,ie(Me,e),ie(Ve,Ve.current),!0}function tc(e,t,n){var r=e.stateNode;if(!r)throw Error(M(169));n?(e=od(e,t,bn),r.__reactInternalMemoizedMergedChildContext=e,ce(Ve),ce(Me),ie(Me,e)):ce(Ve),ie(Ve,n)}var Rt=null,Ca=!1,ts=!1;function ad(e){Rt===null?Rt=[e]:Rt.push(e)}function Lp(e){Ca=!0,ad(e)}function fn(){if(!ts&&Rt!==null){ts=!0;var e=0,t=ae;try{var n=Rt;for(ae=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Rt=null,Ca=!1}catch(o){throw Rt!==null&&(Rt=Rt.slice(e+1)),Tu(Pi,fn),o}finally{ae=t,ts=!1}}return null}var Dn=[],Un=0,na=null,ra=0,ot=[],at=0,Nn=null,_t=1,At="";function gn(e,t){Dn[Un++]=ra,Dn[Un++]=na,na=e,ra=t}function sd(e,t,n){ot[at++]=_t,ot[at++]=At,ot[at++]=Nn,Nn=e;var r=_t;e=At;var o=32-yt(r)-1;r&=~(1<<o),n+=1;var s=32-yt(t)+o;if(30<s){var i=o-o%5;s=(r&(1<<i)-1).toString(32),r>>=i,o-=i,_t=1<<32-yt(t)+o|n<<o|r,At=s+e}else _t=1<<s|n<<o|r,At=e}function Fi(e){e.return!==null&&(gn(e,1),sd(e,1,0))}function Oi(e){for(;e===na;)na=Dn[--Un],Dn[Un]=null,ra=Dn[--Un],Dn[Un]=null;for(;e===Nn;)Nn=ot[--at],ot[at]=null,At=ot[--at],ot[at]=null,_t=ot[--at],ot[at]=null}var qe=null,Xe=null,ue=!1,vt=null;function id(e,t){var n=st(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 nc(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,Xe=nn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,qe=e,Xe=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Nn!==null?{id:_t,overflow:At}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=st(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,qe=e,Xe=null,!0):!1;default:return!1}}function Hs(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Vs(e){if(ue){var t=Xe;if(t){var n=t;if(!nc(e,t)){if(Hs(e))throw Error(M(418));t=nn(n.nextSibling);var r=qe;t&&nc(e,t)?id(r,n):(e.flags=e.flags&-4097|2,ue=!1,qe=e)}}else{if(Hs(e))throw Error(M(418));e.flags=e.flags&-4097|2,ue=!1,qe=e}}}function rc(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;qe=e}function So(e){if(e!==qe)return!1;if(!ue)return rc(e),ue=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Bs(e.type,e.memoizedProps)),t&&(t=Xe)){if(Hs(e))throw ld(),Error(M(418));for(;t;)id(e,t),t=nn(t.nextSibling)}if(rc(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Xe=nn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Xe=null}}else Xe=qe?nn(e.stateNode.nextSibling):null;return!0}function ld(){for(var e=Xe;e;)e=nn(e.nextSibling)}function er(){Xe=qe=null,ue=!1}function Bi(e){vt===null?vt=[e]:vt.push(e)}var Mp=Ut.ReactCurrentBatchConfig;function yr(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(M(309));var r=n.stateNode}if(!r)throw Error(M(147,e));var o=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(i){var l=o.refs;i===null?delete l[s]:l[s]=i},t._stringRef=s,t)}if(typeof e!="string")throw Error(M(284));if(!n._owner)throw Error(M(290,e))}return e}function jo(e,t){throw e=Object.prototype.toString.call(t),Error(M(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function oc(e){var t=e._init;return t(e._payload)}function cd(e){function t(h,m){if(e){var g=h.deletions;g===null?(h.deletions=[m],h.flags|=16):g.push(m)}}function n(h,m){if(!e)return null;for(;m!==null;)t(h,m),m=m.sibling;return null}function r(h,m){for(h=new Map;m!==null;)m.key!==null?h.set(m.key,m):h.set(m.index,m),m=m.sibling;return h}function o(h,m){return h=sn(h,m),h.index=0,h.sibling=null,h}function s(h,m,g){return h.index=g,e?(g=h.alternate,g!==null?(g=g.index,g<m?(h.flags|=2,m):g):(h.flags|=2,m)):(h.flags|=1048576,m)}function i(h){return e&&h.alternate===null&&(h.flags|=2),h}function l(h,m,g,S){return m===null||m.tag!==6?(m=ls(g,h.mode,S),m.return=h,m):(m=o(m,g),m.return=h,m)}function c(h,m,g,S){var E=g.type;return E===$n?p(h,m,g.props.children,S,g.key):m!==null&&(m.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Kt&&oc(E)===m.type)?(S=o(m,g.props),S.ref=yr(h,m,g),S.return=h,S):(S=Do(g.type,g.key,g.props,null,h.mode,S),S.ref=yr(h,m,g),S.return=h,S)}function u(h,m,g,S){return m===null||m.tag!==4||m.stateNode.containerInfo!==g.containerInfo||m.stateNode.implementation!==g.implementation?(m=cs(g,h.mode,S),m.return=h,m):(m=o(m,g.children||[]),m.return=h,m)}function p(h,m,g,S,E){return m===null||m.tag!==7?(m=Cn(g,h.mode,S,E),m.return=h,m):(m=o(m,g),m.return=h,m)}function f(h,m,g){if(typeof m=="string"&&m!==""||typeof m=="number")return m=ls(""+m,h.mode,g),m.return=h,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case uo:return g=Do(m.type,m.key,m.props,null,h.mode,g),g.ref=yr(h,null,m),g.return=h,g;case An:return m=cs(m,h.mode,g),m.return=h,m;case Kt:var S=m._init;return f(h,S(m._payload),g)}if(kr(m)||mr(m))return m=Cn(m,h.mode,g,null),m.return=h,m;jo(h,m)}return null}function v(h,m,g,S){var E=m!==null?m.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return E!==null?null:l(h,m,""+g,S);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case uo:return g.key===E?c(h,m,g,S):null;case An:return g.key===E?u(h,m,g,S):null;case Kt:return E=g._init,v(h,m,E(g._payload),S)}if(kr(g)||mr(g))return E!==null?null:p(h,m,g,S,null);jo(h,g)}return null}function y(h,m,g,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return h=h.get(g)||null,l(m,h,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case uo:return h=h.get(S.key===null?g:S.key)||null,c(m,h,S,E);case An:return h=h.get(S.key===null?g:S.key)||null,u(m,h,S,E);case Kt:var P=S._init;return y(h,m,g,P(S._payload),E)}if(kr(S)||mr(S))return h=h.get(g)||null,p(m,h,S,E,null);jo(m,S)}return null}function x(h,m,g,S){for(var E=null,P=null,k=m,N=m=0,C=null;k!==null&&N<g.length;N++){k.index>N?(C=k,k=null):C=k.sibling;var T=v(h,k,g[N],S);if(T===null){k===null&&(k=C);break}e&&k&&T.alternate===null&&t(h,k),m=s(T,m,N),P===null?E=T:P.sibling=T,P=T,k=C}if(N===g.length)return n(h,k),ue&&gn(h,N),E;if(k===null){for(;N<g.length;N++)k=f(h,g[N],S),k!==null&&(m=s(k,m,N),P===null?E=k:P.sibling=k,P=k);return ue&&gn(h,N),E}for(k=r(h,k);N<g.length;N++)C=y(k,h,N,g[N],S),C!==null&&(e&&C.alternate!==null&&k.delete(C.key===null?N:C.key),m=s(C,m,N),P===null?E=C:P.sibling=C,P=C);return e&&k.forEach(function(H){return t(h,H)}),ue&&gn(h,N),E}function w(h,m,g,S){var E=mr(g);if(typeof E!="function")throw Error(M(150));if(g=E.call(g),g==null)throw Error(M(151));for(var P=E=null,k=m,N=m=0,C=null,T=g.next();k!==null&&!T.done;N++,T=g.next()){k.index>N?(C=k,k=null):C=k.sibling;var H=v(h,k,T.value,S);if(H===null){k===null&&(k=C);break}e&&k&&H.alternate===null&&t(h,k),m=s(H,m,N),P===null?E=H:P.sibling=H,P=H,k=C}if(T.done)return n(h,k),ue&&gn(h,N),E;if(k===null){for(;!T.done;N++,T=g.next())T=f(h,T.value,S),T!==null&&(m=s(T,m,N),P===null?E=T:P.sibling=T,P=T);return ue&&gn(h,N),E}for(k=r(h,k);!T.done;N++,T=g.next())T=y(k,h,N,T.value,S),T!==null&&(e&&T.alternate!==null&&k.delete(T.key===null?N:T.key),m=s(T,m,N),P===null?E=T:P.sibling=T,P=T);return e&&k.forEach(function(W){return t(h,W)}),ue&&gn(h,N),E}function j(h,m,g,S){if(typeof g=="object"&&g!==null&&g.type===$n&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case uo:e:{for(var E=g.key,P=m;P!==null;){if(P.key===E){if(E=g.type,E===$n){if(P.tag===7){n(h,P.sibling),m=o(P,g.props.children),m.return=h,h=m;break e}}else if(P.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Kt&&oc(E)===P.type){n(h,P.sibling),m=o(P,g.props),m.ref=yr(h,P,g),m.return=h,h=m;break e}n(h,P);break}else t(h,P);P=P.sibling}g.type===$n?(m=Cn(g.props.children,h.mode,S,g.key),m.return=h,h=m):(S=Do(g.type,g.key,g.props,null,h.mode,S),S.ref=yr(h,m,g),S.return=h,h=S)}return i(h);case An:e:{for(P=g.key;m!==null;){if(m.key===P)if(m.tag===4&&m.stateNode.containerInfo===g.containerInfo&&m.stateNode.implementation===g.implementation){n(h,m.sibling),m=o(m,g.children||[]),m.return=h,h=m;break e}else{n(h,m);break}else t(h,m);m=m.sibling}m=cs(g,h.mode,S),m.return=h,h=m}return i(h);case Kt:return P=g._init,j(h,m,P(g._payload),S)}if(kr(g))return x(h,m,g,S);if(mr(g))return w(h,m,g,S);jo(h,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,m!==null&&m.tag===6?(n(h,m.sibling),m=o(m,g),m.return=h,h=m):(n(h,m),m=ls(g,h.mode,S),m.return=h,h=m),i(h)):n(h,m)}return j}var tr=cd(!0),ud=cd(!1),oa=dn(null),aa=null,Wn=null,Di=null;function Ui(){Di=Wn=aa=null}function Wi(e){var t=oa.current;ce(oa),e._currentValue=t}function Ks(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 Jn(e,t){aa=e,Di=Wn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(He=!0),e.firstContext=null)}function lt(e){var t=e._currentValue;if(Di!==e)if(e={context:e,memoizedValue:t,next:null},Wn===null){if(aa===null)throw Error(M(308));Wn=e,aa.dependencies={lanes:0,firstContext:e}}else Wn=Wn.next=e;return t}var wn=null;function Hi(e){wn===null?wn=[e]:wn.push(e)}function dd(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Hi(t)):(n.next=o.next,o.next=n),t.interleaved=n,Ot(e,r)}function Ot(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 Gt=!1;function Vi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fd(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 Lt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function rn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,te&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Ot(e,n)}return o=r.interleaved,o===null?(t.next=t,Hi(r)):(t.next=o.next,o.next=t),r.interleaved=t,Ot(e,n)}function $o(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,Ti(e,n)}}function ac(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=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?o=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?o=s=t:s=s.next=t}else o=s=t;n={baseState:r.baseState,firstBaseUpdate:o,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 sa(e,t,n,r){var o=e.updateQueue;Gt=!1;var s=o.firstBaseUpdate,i=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var c=l,u=c.next;c.next=null,i===null?s=u:i.next=u,i=c;var p=e.alternate;p!==null&&(p=p.updateQueue,l=p.lastBaseUpdate,l!==i&&(l===null?p.firstBaseUpdate=u:l.next=u,p.lastBaseUpdate=c))}if(s!==null){var f=o.baseState;i=0,p=u=c=null,l=s;do{var v=l.lane,y=l.eventTime;if((r&v)===v){p!==null&&(p=p.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=he({},f,v);break e;case 2:Gt=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,v=o.effects,v===null?o.effects=[l]:v.push(l))}else y={eventTime:y,lane:v,tag:l.tag,payload:l.payload,callback:l.callback,next:null},p===null?(u=p=y,c=f):p=p.next=y,i|=v;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;v=l,l=v.next,v.next=null,o.lastBaseUpdate=v,o.shared.pending=null}}while(!0);if(p===null&&(c=f),o.baseState=c,o.firstBaseUpdate=u,o.lastBaseUpdate=p,t=o.shared.interleaved,t!==null){o=t;do i|=o.lane,o=o.next;while(o!==t)}else s===null&&(o.shared.lanes=0);zn|=i,e.lanes=i,e.memoizedState=f}}function sc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(M(191,o));o.call(r)}}}var ao={},Et=dn(ao),Yr=dn(ao),Qr=dn(ao);function Sn(e){if(e===ao)throw Error(M(174));return e}function Ki(e,t){switch(ie(Qr,t),ie(Yr,e),ie(Et,ao),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ns(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ns(t,e)}ce(Et),ie(Et,t)}function nr(){ce(Et),ce(Yr),ce(Qr)}function md(e){Sn(Qr.current);var t=Sn(Et.current),n=Ns(t,e.type);t!==n&&(ie(Yr,e),ie(Et,n))}function Gi(e){Yr.current===e&&(ce(Et),ce(Yr))}var me=dn(0);function ia(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 ns=[];function Yi(){for(var e=0;e<ns.length;e++)ns[e]._workInProgressVersionPrimary=null;ns.length=0}var Lo=Ut.ReactCurrentDispatcher,rs=Ut.ReactCurrentBatchConfig,En=0,pe=null,we=null,be=null,la=!1,Rr=!1,Jr=0,Fp=0;function Ae(){throw Error(M(321))}function Qi(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wt(e[n],t[n]))return!1;return!0}function Ji(e,t,n,r,o,s){if(En=s,pe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Lo.current=e===null||e.memoizedState===null?Up:Wp,e=n(r,o),Rr){s=0;do{if(Rr=!1,Jr=0,25<=s)throw Error(M(301));s+=1,be=we=null,t.updateQueue=null,Lo.current=Hp,e=n(r,o)}while(Rr)}if(Lo.current=ca,t=we!==null&&we.next!==null,En=0,be=we=pe=null,la=!1,t)throw Error(M(300));return e}function Xi(){var e=Jr!==0;return Jr=0,e}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return be===null?pe.memoizedState=be=e:be=be.next=e,be}function ct(){if(we===null){var e=pe.alternate;e=e!==null?e.memoizedState:null}else e=we.next;var t=be===null?pe.memoizedState:be.next;if(t!==null)be=t,we=e;else{if(e===null)throw Error(M(310));we=e,e={memoizedState:we.memoizedState,baseState:we.baseState,baseQueue:we.baseQueue,queue:we.queue,next:null},be===null?pe.memoizedState=be=e:be=be.next=e}return be}function Xr(e,t){return typeof t=="function"?t(e):t}function os(e){var t=ct(),n=t.queue;if(n===null)throw Error(M(311));n.lastRenderedReducer=e;var r=we,o=r.baseQueue,s=n.pending;if(s!==null){if(o!==null){var i=o.next;o.next=s.next,s.next=i}r.baseQueue=o=s,n.pending=null}if(o!==null){s=o.next,r=r.baseState;var l=i=null,c=null,u=s;do{var p=u.lane;if((En&p)===p)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:p,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,i=r):c=c.next=f,pe.lanes|=p,zn|=p}u=u.next}while(u!==null&&u!==s);c===null?i=r:c.next=l,wt(r,t.memoizedState)||(He=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do s=o.lane,pe.lanes|=s,zn|=s,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function as(e){var t=ct(),n=t.queue;if(n===null)throw Error(M(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,s=t.memoizedState;if(o!==null){n.pending=null;var i=o=o.next;do s=e(s,i.action),i=i.next;while(i!==o);wt(s,t.memoizedState)||(He=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function pd(){}function hd(e,t){var n=pe,r=ct(),o=t(),s=!wt(r.memoizedState,o);if(s&&(r.memoizedState=o,He=!0),r=r.queue,qi(yd.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||be!==null&&be.memoizedState.tag&1){if(n.flags|=2048,qr(9,vd.bind(null,n,r,o,t),void 0,null),Ne===null)throw Error(M(349));En&30||gd(n,t,o)}return o}function gd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=pe.updateQueue,t===null?(t={lastEffect:null,stores:null},pe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function vd(e,t,n,r){t.value=n,t.getSnapshot=r,xd(t)&&wd(e)}function yd(e,t,n){return n(function(){xd(t)&&wd(e)})}function xd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wt(e,n)}catch{return!0}}function wd(e){var t=Ot(e,1);t!==null&&xt(t,e,1,-1)}function ic(e){var t=kt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xr,lastRenderedState:e},t.queue=e,e=e.dispatch=Dp.bind(null,pe,e),[t.memoizedState,e]}function qr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=pe.updateQueue,t===null?(t={lastEffect:null,stores:null},pe.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 Sd(){return ct().memoizedState}function Mo(e,t,n,r){var o=kt();pe.flags|=e,o.memoizedState=qr(1|t,n,void 0,r===void 0?null:r)}function ba(e,t,n,r){var o=ct();r=r===void 0?null:r;var s=void 0;if(we!==null){var i=we.memoizedState;if(s=i.destroy,r!==null&&Qi(r,i.deps)){o.memoizedState=qr(t,n,s,r);return}}pe.flags|=e,o.memoizedState=qr(1|t,n,s,r)}function lc(e,t){return Mo(8390656,8,e,t)}function qi(e,t){return ba(2048,8,e,t)}function jd(e,t){return ba(4,2,e,t)}function kd(e,t){return ba(4,4,e,t)}function Cd(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 bd(e,t,n){return n=n!=null?n.concat([e]):null,ba(4,4,Cd.bind(null,t,e),n)}function Zi(){}function Nd(e,t){var n=ct();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Qi(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ed(e,t){var n=ct();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Qi(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function zd(e,t,n){return En&21?(wt(n,t)||(n=_u(),pe.lanes|=n,zn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,He=!0),e.memoizedState=n)}function Op(e,t){var n=ae;ae=n!==0&&4>n?n:4,e(!0);var r=rs.transition;rs.transition={};try{e(!1),t()}finally{ae=n,rs.transition=r}}function Pd(){return ct().memoizedState}function Bp(e,t,n){var r=an(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Td(e))Id(t,n);else if(n=dd(e,t,n,r),n!==null){var o=Oe();xt(n,e,r,o),Rd(n,t,r)}}function Dp(e,t,n){var r=an(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Td(e))Id(t,o);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(o.hasEagerState=!0,o.eagerState=l,wt(l,i)){var c=t.interleaved;c===null?(o.next=o,Hi(t)):(o.next=c.next,c.next=o),t.interleaved=o;return}}catch{}finally{}n=dd(e,t,o,r),n!==null&&(o=Oe(),xt(n,e,r,o),Rd(n,t,r))}}function Td(e){var t=e.alternate;return e===pe||t!==null&&t===pe}function Id(e,t){Rr=la=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ti(e,n)}}var ca={readContext:lt,useCallback:Ae,useContext:Ae,useEffect:Ae,useImperativeHandle:Ae,useInsertionEffect:Ae,useLayoutEffect:Ae,useMemo:Ae,useReducer:Ae,useRef:Ae,useState:Ae,useDebugValue:Ae,useDeferredValue:Ae,useTransition:Ae,useMutableSource:Ae,useSyncExternalStore:Ae,useId:Ae,unstable_isNewReconciler:!1},Up={readContext:lt,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:lt,useEffect:lc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Mo(4194308,4,Cd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Mo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Mo(4,2,e,t)},useMemo:function(e,t){var n=kt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=kt();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=Bp.bind(null,pe,e),[r.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:ic,useDebugValue:Zi,useDeferredValue:function(e){return kt().memoizedState=e},useTransition:function(){var e=ic(!1),t=e[0];return e=Op.bind(null,e[1]),kt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=pe,o=kt();if(ue){if(n===void 0)throw Error(M(407));n=n()}else{if(n=t(),Ne===null)throw Error(M(349));En&30||gd(r,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,lc(yd.bind(null,r,s,e),[e]),r.flags|=2048,qr(9,vd.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=kt(),t=Ne.identifierPrefix;if(ue){var n=At,r=_t;n=(r&~(1<<32-yt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Jr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Fp++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Wp={readContext:lt,useCallback:Nd,useContext:lt,useEffect:qi,useImperativeHandle:bd,useInsertionEffect:jd,useLayoutEffect:kd,useMemo:Ed,useReducer:os,useRef:Sd,useState:function(){return os(Xr)},useDebugValue:Zi,useDeferredValue:function(e){var t=ct();return zd(t,we.memoizedState,e)},useTransition:function(){var e=os(Xr)[0],t=ct().memoizedState;return[e,t]},useMutableSource:pd,useSyncExternalStore:hd,useId:Pd,unstable_isNewReconciler:!1},Hp={readContext:lt,useCallback:Nd,useContext:lt,useEffect:qi,useImperativeHandle:bd,useInsertionEffect:jd,useLayoutEffect:kd,useMemo:Ed,useReducer:as,useRef:Sd,useState:function(){return as(Xr)},useDebugValue:Zi,useDeferredValue:function(e){var t=ct();return we===null?t.memoizedState=e:zd(t,we.memoizedState,e)},useTransition:function(){var e=as(Xr)[0],t=ct().memoizedState;return[e,t]},useMutableSource:pd,useSyncExternalStore:hd,useId:Pd,unstable_isNewReconciler:!1};function ht(e,t){if(e&&e.defaultProps){t=he({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Gs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:he({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Na={isMounted:function(e){return(e=e._reactInternals)?In(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Oe(),o=an(e),s=Lt(r,o);s.payload=t,n!=null&&(s.callback=n),t=rn(e,s,o),t!==null&&(xt(t,e,o,r),$o(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Oe(),o=an(e),s=Lt(r,o);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=rn(e,s,o),t!==null&&(xt(t,e,o,r),$o(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Oe(),r=an(e),o=Lt(n,r);o.tag=2,t!=null&&(o.callback=t),t=rn(e,o,r),t!==null&&(xt(t,e,r,n),$o(t,e,r))}};function cc(e,t,n,r,o,s,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,i):t.prototype&&t.prototype.isPureReactComponent?!Hr(n,r)||!Hr(o,s):!0}function _d(e,t,n){var r=!1,o=cn,s=t.contextType;return typeof s=="object"&&s!==null?s=lt(s):(o=Ke(t)?bn:Me.current,r=t.contextTypes,s=(r=r!=null)?Zn(e,o):cn),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Na,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=s),t}function uc(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&&Na.enqueueReplaceState(t,t.state,null)}function Ys(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},Vi(e);var s=t.contextType;typeof s=="object"&&s!==null?o.context=lt(s):(s=Ke(t)?bn:Me.current,o.context=Zn(e,s)),o.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Gs(e,t,s,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Na.enqueueReplaceState(o,o.state,null),sa(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function rr(e,t){try{var n="",r=t;do n+=ym(r),r=r.return;while(r);var o=n}catch(s){o=`
|
|
37
|
+
`+o[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{Ba=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?jr(e):""}function xp(e){switch(e.tag){case 5:return jr(e.type);case 16:return jr("Lazy");case 13:return jr("Suspense");case 19:return jr("SuspenseList");case 0:case 2:case 15:return e=Da(e.type,!1),e;case 11:return e=Da(e.type.render,!1),e;case 1:return e=Da(e.type,!0),e;default:return""}}function Ss(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 $n:return"Fragment";case An:return"Portal";case ys:return"Profiler";case bi:return"StrictMode";case xs:return"Suspense";case ws:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case fu:return(e.displayName||"Context")+".Consumer";case du:return(e._context.displayName||"Context")+".Provider";case Ni:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ei:return t=e.displayName||null,t!==null?t:Ss(e.type)||"Memo";case Kt:t=e._payload,e=e._init;try{return Ss(e(t))}catch{}}return null}function wp(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 Ss(t);case 8:return t===bi?"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 ln(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function mu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Sp(e){var t=mu(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 o=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.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 fo(e){e._valueTracker||(e._valueTracker=Sp(e))}function hu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=mu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Vo(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 js(e,t){var n=t.checked;return he({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function El(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ln(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 gu(e,t){t=t.checked,t!=null&&Ci(e,"checked",t,!1)}function ks(e,t){gu(e,t);var n=ln(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")?Cs(e,t.type,n):t.hasOwnProperty("defaultValue")&&Cs(e,t.type,ln(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function zl(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 Cs(e,t,n){(t!=="number"||Vo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var kr=Array.isArray;function Kn(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+ln(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function bs(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(M(91));return he({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Pl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(M(92));if(kr(n)){if(1<n.length)throw Error(M(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ln(n)}}function vu(e,t){var n=ln(t.value),r=ln(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 Tl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function yu(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 Ns(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?yu(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var po,xu=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(po=po||document.createElement("div"),po.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=po.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Fr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Er={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},jp=["Webkit","ms","Moz","O"];Object.keys(Er).forEach(function(e){jp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Er[t]=Er[e]})});function wu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Er.hasOwnProperty(e)&&Er[e]?(""+t).trim():t+"px"}function Su(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=wu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var kp=he({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 Es(e,t){if(t){if(kp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(M(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(M(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(M(61))}if(t.style!=null&&typeof t.style!="object")throw Error(M(62))}}function zs(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 Ps=null;function zi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ts=null,Gn=null,Yn=null;function Il(e){if(e=oo(e)){if(typeof Ts!="function")throw Error(M(280));var t=e.stateNode;t&&(t=ka(t),Ts(e.stateNode,e.type,t))}}function ju(e){Gn?Yn?Yn.push(e):Yn=[e]:Gn=e}function ku(){if(Gn){var e=Gn,t=Yn;if(Yn=Gn=null,Il(e),t)for(e=0;e<t.length;e++)Il(t[e])}}function Cu(e,t){return e(t)}function bu(){}var Ua=!1;function Nu(e,t,n){if(Ua)return e(t,n);Ua=!0;try{return Cu(e,t,n)}finally{Ua=!1,(Gn!==null||Yn!==null)&&(bu(),ku())}}function Or(e,t){var n=e.stateNode;if(n===null)return null;var r=ka(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(M(231,t,typeof n));return n}var Is=!1;if(Mt)try{var mr={};Object.defineProperty(mr,"passive",{get:function(){Is=!0}}),window.addEventListener("test",mr,mr),window.removeEventListener("test",mr,mr)}catch{Is=!1}function Cp(e,t,n,r,o,s,i,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(m){this.onError(m)}}var zr=!1,Ko=null,Go=!1,Rs=null,bp={onError:function(e){zr=!0,Ko=e}};function Np(e,t,n,r,o,s,i,l,c){zr=!1,Ko=null,Cp.apply(bp,arguments)}function Ep(e,t,n,r,o,s,i,l,c){if(Np.apply(this,arguments),zr){if(zr){var u=Ko;zr=!1,Ko=null}else throw Error(M(198));Go||(Go=!0,Rs=u)}}function In(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 Eu(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 Rl(e){if(In(e)!==e)throw Error(M(188))}function zp(e){var t=e.alternate;if(!t){if(t=In(e),t===null)throw Error(M(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var s=o.alternate;if(s===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===s.child){for(s=o.child;s;){if(s===n)return Rl(o),e;if(s===r)return Rl(o),t;s=s.sibling}throw Error(M(188))}if(n.return!==r.return)n=o,r=s;else{for(var i=!1,l=o.child;l;){if(l===n){i=!0,n=o,r=s;break}if(l===r){i=!0,r=o,n=s;break}l=l.sibling}if(!i){for(l=s.child;l;){if(l===n){i=!0,n=s,r=o;break}if(l===r){i=!0,r=s,n=o;break}l=l.sibling}if(!i)throw Error(M(189))}}if(n.alternate!==r)throw Error(M(190))}if(n.tag!==3)throw Error(M(188));return n.stateNode.current===n?e:t}function zu(e){return e=zp(e),e!==null?Pu(e):null}function Pu(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Pu(e);if(t!==null)return t;e=e.sibling}return null}var Tu=Ze.unstable_scheduleCallback,_l=Ze.unstable_cancelCallback,Pp=Ze.unstable_shouldYield,Tp=Ze.unstable_requestPaint,ve=Ze.unstable_now,Ip=Ze.unstable_getCurrentPriorityLevel,Pi=Ze.unstable_ImmediatePriority,Iu=Ze.unstable_UserBlockingPriority,Yo=Ze.unstable_NormalPriority,Rp=Ze.unstable_LowPriority,Ru=Ze.unstable_IdlePriority,xa=null,Nt=null;function _p(e){if(Nt&&typeof Nt.onCommitFiberRoot=="function")try{Nt.onCommitFiberRoot(xa,e,void 0,(e.current.flags&128)===128)}catch{}}var yt=Math.clz32?Math.clz32:Lp,Ap=Math.log,$p=Math.LN2;function Lp(e){return e>>>=0,e===0?32:31-(Ap(e)/$p|0)|0}var mo=64,ho=4194304;function Cr(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 Qo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,s=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~o;l!==0?r=Cr(l):(s&=i,s!==0&&(r=Cr(s)))}else i=n&~o,i!==0?r=Cr(i):s!==0&&(r=Cr(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,s=t&-t,o>=s||o===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-yt(t),o=1<<n,r|=e[n],t&=~o;return r}function Mp(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 Fp(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,s=e.pendingLanes;0<s;){var i=31-yt(s),l=1<<i,c=o[i];c===-1?(!(l&n)||l&r)&&(o[i]=Mp(l,t)):c<=t&&(e.expiredLanes|=l),s&=~l}}function _s(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function _u(){var e=mo;return mo<<=1,!(mo&4194240)&&(mo=64),e}function Wa(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function no(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-yt(t),e[t]=n}function Op(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 o=31-yt(n),s=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~s}}function Ti(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-yt(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var ae=0;function Au(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var $u,Ii,Lu,Mu,Fu,As=!1,go=[],Zt=null,en=null,tn=null,Br=new Map,Dr=new Map,Qt=[],Bp="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 Al(e,t){switch(e){case"focusin":case"focusout":Zt=null;break;case"dragenter":case"dragleave":en=null;break;case"mouseover":case"mouseout":tn=null;break;case"pointerover":case"pointerout":Br.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Dr.delete(t.pointerId)}}function hr(e,t,n,r,o,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[o]},t!==null&&(t=oo(t),t!==null&&Ii(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Dp(e,t,n,r,o){switch(t){case"focusin":return Zt=hr(Zt,e,t,n,r,o),!0;case"dragenter":return en=hr(en,e,t,n,r,o),!0;case"mouseover":return tn=hr(tn,e,t,n,r,o),!0;case"pointerover":var s=o.pointerId;return Br.set(s,hr(Br.get(s)||null,e,t,n,r,o)),!0;case"gotpointercapture":return s=o.pointerId,Dr.set(s,hr(Dr.get(s)||null,e,t,n,r,o)),!0}return!1}function Ou(e){var t=xn(e.target);if(t!==null){var n=In(t);if(n!==null){if(t=n.tag,t===13){if(t=Eu(n),t!==null){e.blockedOn=t,Fu(e.priority,function(){Lu(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 Ro(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=$s(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ps=r,n.target.dispatchEvent(r),Ps=null}else return t=oo(n),t!==null&&Ii(t),e.blockedOn=n,!1;t.shift()}return!0}function $l(e,t,n){Ro(e)&&n.delete(t)}function Up(){As=!1,Zt!==null&&Ro(Zt)&&(Zt=null),en!==null&&Ro(en)&&(en=null),tn!==null&&Ro(tn)&&(tn=null),Br.forEach($l),Dr.forEach($l)}function gr(e,t){e.blockedOn===t&&(e.blockedOn=null,As||(As=!0,Ze.unstable_scheduleCallback(Ze.unstable_NormalPriority,Up)))}function Ur(e){function t(o){return gr(o,e)}if(0<go.length){gr(go[0],e);for(var n=1;n<go.length;n++){var r=go[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Zt!==null&&gr(Zt,e),en!==null&&gr(en,e),tn!==null&&gr(tn,e),Br.forEach(t),Dr.forEach(t),n=0;n<Qt.length;n++)r=Qt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Qt.length&&(n=Qt[0],n.blockedOn===null);)Ou(n),n.blockedOn===null&&Qt.shift()}var Qn=Ut.ReactCurrentBatchConfig,Jo=!0;function Wp(e,t,n,r){var o=ae,s=Qn.transition;Qn.transition=null;try{ae=1,Ri(e,t,n,r)}finally{ae=o,Qn.transition=s}}function Hp(e,t,n,r){var o=ae,s=Qn.transition;Qn.transition=null;try{ae=4,Ri(e,t,n,r)}finally{ae=o,Qn.transition=s}}function Ri(e,t,n,r){if(Jo){var o=$s(e,t,n,r);if(o===null)Za(e,t,r,Xo,n),Al(e,r);else if(Dp(o,e,t,n,r))r.stopPropagation();else if(Al(e,r),t&4&&-1<Bp.indexOf(e)){for(;o!==null;){var s=oo(o);if(s!==null&&$u(s),s=$s(e,t,n,r),s===null&&Za(e,t,r,Xo,n),s===o)break;o=s}o!==null&&r.stopPropagation()}else Za(e,t,r,null,n)}}var Xo=null;function $s(e,t,n,r){if(Xo=null,e=zi(r),e=xn(e),e!==null)if(t=In(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Eu(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 Xo=e,null}function Bu(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(Ip()){case Pi:return 1;case Iu:return 4;case Yo:case Rp:return 16;case Ru:return 536870912;default:return 16}default:return 16}}var Xt=null,_i=null,_o=null;function Du(){if(_o)return _o;var e,t=_i,n=t.length,r,o="value"in Xt?Xt.value:Xt.textContent,s=o.length;for(e=0;e<n&&t[e]===o[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===o[s-r];r++);return _o=o.slice(e,1<r?1-r:void 0)}function Ao(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 vo(){return!0}function Ll(){return!1}function tt(e){function t(n,r,o,s,i){this._reactName=n,this._targetInst=o,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)?vo:Ll,this.isPropagationStopped=Ll,this}return he(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=vo)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=vo)},persist:function(){},isPersistent:vo}),t}var sr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ai=tt(sr),ro=he({},sr,{view:0,detail:0}),Vp=tt(ro),Ha,Va,vr,wa=he({},ro,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$i,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!==vr&&(vr&&e.type==="mousemove"?(Ha=e.screenX-vr.screenX,Va=e.screenY-vr.screenY):Va=Ha=0,vr=e),Ha)},movementY:function(e){return"movementY"in e?e.movementY:Va}}),Ml=tt(wa),Kp=he({},wa,{dataTransfer:0}),Gp=tt(Kp),Yp=he({},ro,{relatedTarget:0}),Ka=tt(Yp),Qp=he({},sr,{animationName:0,elapsedTime:0,pseudoElement:0}),Jp=tt(Qp),Xp=he({},sr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),qp=tt(Xp),Zp=he({},sr,{data:0}),Fl=tt(Zp),em={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},tm={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"},nm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function rm(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=nm[e])?!!t[e]:!1}function $i(){return rm}var om=he({},ro,{key:function(e){if(e.key){var t=em[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ao(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?tm[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$i,charCode:function(e){return e.type==="keypress"?Ao(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ao(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),am=tt(om),sm=he({},wa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ol=tt(sm),im=he({},ro,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$i}),lm=tt(im),cm=he({},sr,{propertyName:0,elapsedTime:0,pseudoElement:0}),um=tt(cm),dm=he({},wa,{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}),fm=tt(dm),pm=[9,13,27,32],Li=Mt&&"CompositionEvent"in window,Pr=null;Mt&&"documentMode"in document&&(Pr=document.documentMode);var mm=Mt&&"TextEvent"in window&&!Pr,Uu=Mt&&(!Li||Pr&&8<Pr&&11>=Pr),Bl=" ",Dl=!1;function Wu(e,t){switch(e){case"keyup":return pm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hu(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ln=!1;function hm(e,t){switch(e){case"compositionend":return Hu(t);case"keypress":return t.which!==32?null:(Dl=!0,Bl);case"textInput":return e=t.data,e===Bl&&Dl?null:e;default:return null}}function gm(e,t){if(Ln)return e==="compositionend"||!Li&&Wu(e,t)?(e=Du(),_o=_i=Xt=null,Ln=!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 Uu&&t.locale!=="ko"?null:t.data;default:return null}}var vm={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 Ul(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!vm[e.type]:t==="textarea"}function Vu(e,t,n,r){ju(r),t=qo(t,"onChange"),0<t.length&&(n=new Ai("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Tr=null,Wr=null;function ym(e){nd(e,0)}function Sa(e){var t=On(e);if(hu(t))return e}function xm(e,t){if(e==="change")return t}var Ku=!1;if(Mt){var Ga;if(Mt){var Ya="oninput"in document;if(!Ya){var Wl=document.createElement("div");Wl.setAttribute("oninput","return;"),Ya=typeof Wl.oninput=="function"}Ga=Ya}else Ga=!1;Ku=Ga&&(!document.documentMode||9<document.documentMode)}function Hl(){Tr&&(Tr.detachEvent("onpropertychange",Gu),Wr=Tr=null)}function Gu(e){if(e.propertyName==="value"&&Sa(Wr)){var t=[];Vu(t,Wr,e,zi(e)),Nu(ym,t)}}function wm(e,t,n){e==="focusin"?(Hl(),Tr=t,Wr=n,Tr.attachEvent("onpropertychange",Gu)):e==="focusout"&&Hl()}function Sm(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Sa(Wr)}function jm(e,t){if(e==="click")return Sa(t)}function km(e,t){if(e==="input"||e==="change")return Sa(t)}function Cm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var wt=typeof Object.is=="function"?Object.is:Cm;function Hr(e,t){if(wt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!vs.call(t,o)||!wt(e[o],t[o]))return!1}return!0}function Vl(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Kl(e,t){var n=Vl(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=Vl(n)}}function Yu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Yu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Qu(){for(var e=window,t=Vo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Vo(e.document)}return t}function Mi(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 bm(e){var t=Qu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Yu(n.ownerDocument.documentElement,n)){if(r!==null&&Mi(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 o=n.textContent.length,s=Math.min(r.start,o);r=r.end===void 0?s:Math.min(r.end,o),!e.extend&&s>r&&(o=r,r=s,s=o),o=Kl(n,s);var i=Kl(n,r);o&&i&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(o.node,o.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 Nm=Mt&&"documentMode"in document&&11>=document.documentMode,Mn=null,Ls=null,Ir=null,Ms=!1;function Gl(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ms||Mn==null||Mn!==Vo(r)||(r=Mn,"selectionStart"in r&&Mi(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}),Ir&&Hr(Ir,r)||(Ir=r,r=qo(Ls,"onSelect"),0<r.length&&(t=new Ai("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Mn)))}function yo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Fn={animationend:yo("Animation","AnimationEnd"),animationiteration:yo("Animation","AnimationIteration"),animationstart:yo("Animation","AnimationStart"),transitionend:yo("Transition","TransitionEnd")},Qa={},Ju={};Mt&&(Ju=document.createElement("div").style,"AnimationEvent"in window||(delete Fn.animationend.animation,delete Fn.animationiteration.animation,delete Fn.animationstart.animation),"TransitionEvent"in window||delete Fn.transitionend.transition);function ja(e){if(Qa[e])return Qa[e];if(!Fn[e])return e;var t=Fn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ju)return Qa[e]=t[n];return e}var Xu=ja("animationend"),qu=ja("animationiteration"),Zu=ja("animationstart"),ed=ja("transitionend"),td=new Map,Yl="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 un(e,t){td.set(e,t),Tn(t,[e])}for(var Ja=0;Ja<Yl.length;Ja++){var Xa=Yl[Ja],Em=Xa.toLowerCase(),zm=Xa[0].toUpperCase()+Xa.slice(1);un(Em,"on"+zm)}un(Xu,"onAnimationEnd");un(qu,"onAnimationIteration");un(Zu,"onAnimationStart");un("dblclick","onDoubleClick");un("focusin","onFocus");un("focusout","onBlur");un(ed,"onTransitionEnd");qn("onMouseEnter",["mouseout","mouseover"]);qn("onMouseLeave",["mouseout","mouseover"]);qn("onPointerEnter",["pointerout","pointerover"]);qn("onPointerLeave",["pointerout","pointerover"]);Tn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Tn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Tn("onBeforeInput",["compositionend","keypress","textInput","paste"]);Tn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Tn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Tn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var br="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(" "),Pm=new Set("cancel close invalid load scroll toggle".split(" ").concat(br));function Ql(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Ep(r,t,void 0,e),e.currentTarget=null}function nd(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=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&&o.isPropagationStopped())break e;Ql(o,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&&o.isPropagationStopped())break e;Ql(o,l,u),s=c}}}if(Go)throw e=Rs,Go=!1,Rs=null,e}function le(e,t){var n=t[Us];n===void 0&&(n=t[Us]=new Set);var r=e+"__bubble";n.has(r)||(rd(t,e,2,!1),n.add(r))}function qa(e,t,n){var r=0;t&&(r|=4),rd(n,e,r,t)}var xo="_reactListening"+Math.random().toString(36).slice(2);function Vr(e){if(!e[xo]){e[xo]=!0,uu.forEach(function(n){n!=="selectionchange"&&(Pm.has(n)||qa(n,!1,e),qa(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[xo]||(t[xo]=!0,qa("selectionchange",!1,t))}}function rd(e,t,n,r){switch(Bu(t)){case 1:var o=Wp;break;case 4:o=Hp;break;default:o=Ri}n=o.bind(null,t,n,e),o=void 0,!Is||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Za(e,t,n,r,o){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===o||l.nodeType===8&&l.parentNode===o)break;if(i===4)for(i=r.return;i!==null;){var c=i.tag;if((c===3||c===4)&&(c=i.stateNode.containerInfo,c===o||c.nodeType===8&&c.parentNode===o))return;i=i.return}for(;l!==null;){if(i=xn(l),i===null)return;if(c=i.tag,c===5||c===6){r=s=i;continue e}l=l.parentNode}}r=r.return}Nu(function(){var u=s,m=zi(n),f=[];e:{var v=td.get(e);if(v!==void 0){var y=Ai,x=e;switch(e){case"keypress":if(Ao(n)===0)break e;case"keydown":case"keyup":y=am;break;case"focusin":x="focus",y=Ka;break;case"focusout":x="blur",y=Ka;break;case"beforeblur":case"afterblur":y=Ka;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=Ml;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=Gp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=lm;break;case Xu:case qu:case Zu:y=Jp;break;case ed:y=um;break;case"scroll":y=Vp;break;case"wheel":y=fm;break;case"copy":case"cut":case"paste":y=qp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=Ol}var w=(t&4)!==0,j=!w&&e==="scroll",h=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,h!==null&&(S=Or(p,h),S!=null&&w.push(Kr(p,S,g)))),j)break;p=p.return}0<w.length&&(v=new y(v,x,null,n,m),f.push({event:v,listeners:w}))}}if(!(t&7)){e:{if(v=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",v&&n!==Ps&&(x=n.relatedTarget||n.fromElement)&&(xn(x)||x[Ft]))break e;if((y||v)&&(v=m.window===m?m:(v=m.ownerDocument)?v.defaultView||v.parentWindow:window,y?(x=n.relatedTarget||n.toElement,y=u,x=x?xn(x):null,x!==null&&(j=In(x),x!==j||x.tag!==5&&x.tag!==6)&&(x=null)):(y=null,x=u),y!==x)){if(w=Ml,S="onMouseLeave",h="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(w=Ol,S="onPointerLeave",h="onPointerEnter",p="pointer"),j=y==null?v:On(y),g=x==null?v:On(x),v=new w(S,p+"leave",y,n,m),v.target=j,v.relatedTarget=g,S=null,xn(m)===u&&(w=new w(h,p+"enter",x,n,m),w.target=g,w.relatedTarget=j,S=w),j=S,y&&x)t:{for(w=y,h=x,p=0,g=w;g;g=_n(g))p++;for(g=0,S=h;S;S=_n(S))g++;for(;0<p-g;)w=_n(w),p--;for(;0<g-p;)h=_n(h),g--;for(;p--;){if(w===h||h!==null&&w===h.alternate)break t;w=_n(w),h=_n(h)}w=null}else w=null;y!==null&&Jl(f,v,y,w,!1),x!==null&&j!==null&&Jl(f,j,x,w,!0)}}e:{if(v=u?On(u):window,y=v.nodeName&&v.nodeName.toLowerCase(),y==="select"||y==="input"&&v.type==="file")var E=xm;else if(Ul(v))if(Ku)E=km;else{E=Sm;var P=wm}else(y=v.nodeName)&&y.toLowerCase()==="input"&&(v.type==="checkbox"||v.type==="radio")&&(E=jm);if(E&&(E=E(e,u))){Vu(f,E,n,m);break e}P&&P(e,v,u),e==="focusout"&&(P=v._wrapperState)&&P.controlled&&v.type==="number"&&Cs(v,"number",v.value)}switch(P=u?On(u):window,e){case"focusin":(Ul(P)||P.contentEditable==="true")&&(Mn=P,Ls=u,Ir=null);break;case"focusout":Ir=Ls=Mn=null;break;case"mousedown":Ms=!0;break;case"contextmenu":case"mouseup":case"dragend":Ms=!1,Gl(f,n,m);break;case"selectionchange":if(Nm)break;case"keydown":case"keyup":Gl(f,n,m)}var k;if(Li)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else Ln?Wu(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(Uu&&n.locale!=="ko"&&(Ln||N!=="onCompositionStart"?N==="onCompositionEnd"&&Ln&&(k=Du()):(Xt=m,_i="value"in Xt?Xt.value:Xt.textContent,Ln=!0)),P=qo(u,N),0<P.length&&(N=new Fl(N,e,null,n,m),f.push({event:N,listeners:P}),k?N.data=k:(k=Hu(n),k!==null&&(N.data=k)))),(k=mm?hm(e,n):gm(e,n))&&(u=qo(u,"onBeforeInput"),0<u.length&&(m=new Fl("onBeforeInput","beforeinput",null,n,m),f.push({event:m,listeners:u}),m.data=k))}nd(f,t)})}function Kr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qo(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,s=o.stateNode;o.tag===5&&s!==null&&(o=s,s=Or(e,n),s!=null&&r.unshift(Kr(e,s,o)),s=Or(e,t),s!=null&&r.push(Kr(e,s,o))),e=e.return}return r}function _n(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Jl(e,t,n,r,o){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,o?(c=Or(n,s),c!=null&&i.unshift(Kr(n,c,l))):o||(c=Or(n,s),c!=null&&i.push(Kr(n,c,l)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var Tm=/\r\n?/g,Im=/\u0000|\uFFFD/g;function Xl(e){return(typeof e=="string"?e:""+e).replace(Tm,`
|
|
38
|
+
`).replace(Im,"")}function wo(e,t,n){if(t=Xl(t),Xl(e)!==t&&n)throw Error(M(425))}function Zo(){}var Fs=null,Os=null;function Bs(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 Ds=typeof setTimeout=="function"?setTimeout:void 0,Rm=typeof clearTimeout=="function"?clearTimeout:void 0,ql=typeof Promise=="function"?Promise:void 0,_m=typeof queueMicrotask=="function"?queueMicrotask:typeof ql<"u"?function(e){return ql.resolve(null).then(e).catch(Am)}:Ds;function Am(e){setTimeout(function(){throw e})}function es(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),Ur(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Ur(t)}function nn(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 Zl(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 ir=Math.random().toString(36).slice(2),bt="__reactFiber$"+ir,Gr="__reactProps$"+ir,Ft="__reactContainer$"+ir,Us="__reactEvents$"+ir,$m="__reactListeners$"+ir,Lm="__reactHandles$"+ir;function xn(e){var t=e[bt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ft]||n[bt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Zl(e);e!==null;){if(n=e[bt])return n;e=Zl(e)}return t}e=n,n=e.parentNode}return null}function oo(e){return e=e[bt]||e[Ft],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function On(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(M(33))}function ka(e){return e[Gr]||null}var Ws=[],Bn=-1;function dn(e){return{current:e}}function ce(e){0>Bn||(e.current=Ws[Bn],Ws[Bn]=null,Bn--)}function ie(e,t){Bn++,Ws[Bn]=e.current,e.current=t}var cn={},Me=dn(cn),Ve=dn(!1),bn=cn;function Zn(e,t){var n=e.type.contextTypes;if(!n)return cn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},s;for(s in n)o[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ke(e){return e=e.childContextTypes,e!=null}function ea(){ce(Ve),ce(Me)}function ec(e,t,n){if(Me.current!==cn)throw Error(M(168));ie(Me,t),ie(Ve,n)}function od(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(M(108,wp(e)||"Unknown",o));return he({},n,r)}function ta(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||cn,bn=Me.current,ie(Me,e),ie(Ve,Ve.current),!0}function tc(e,t,n){var r=e.stateNode;if(!r)throw Error(M(169));n?(e=od(e,t,bn),r.__reactInternalMemoizedMergedChildContext=e,ce(Ve),ce(Me),ie(Me,e)):ce(Ve),ie(Ve,n)}var Rt=null,Ca=!1,ts=!1;function ad(e){Rt===null?Rt=[e]:Rt.push(e)}function Mm(e){Ca=!0,ad(e)}function fn(){if(!ts&&Rt!==null){ts=!0;var e=0,t=ae;try{var n=Rt;for(ae=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Rt=null,Ca=!1}catch(o){throw Rt!==null&&(Rt=Rt.slice(e+1)),Tu(Pi,fn),o}finally{ae=t,ts=!1}}return null}var Dn=[],Un=0,na=null,ra=0,ot=[],at=0,Nn=null,_t=1,At="";function gn(e,t){Dn[Un++]=ra,Dn[Un++]=na,na=e,ra=t}function sd(e,t,n){ot[at++]=_t,ot[at++]=At,ot[at++]=Nn,Nn=e;var r=_t;e=At;var o=32-yt(r)-1;r&=~(1<<o),n+=1;var s=32-yt(t)+o;if(30<s){var i=o-o%5;s=(r&(1<<i)-1).toString(32),r>>=i,o-=i,_t=1<<32-yt(t)+o|n<<o|r,At=s+e}else _t=1<<s|n<<o|r,At=e}function Fi(e){e.return!==null&&(gn(e,1),sd(e,1,0))}function Oi(e){for(;e===na;)na=Dn[--Un],Dn[Un]=null,ra=Dn[--Un],Dn[Un]=null;for(;e===Nn;)Nn=ot[--at],ot[at]=null,At=ot[--at],ot[at]=null,_t=ot[--at],ot[at]=null}var qe=null,Xe=null,ue=!1,vt=null;function id(e,t){var n=st(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 nc(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,Xe=nn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,qe=e,Xe=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Nn!==null?{id:_t,overflow:At}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=st(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,qe=e,Xe=null,!0):!1;default:return!1}}function Hs(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Vs(e){if(ue){var t=Xe;if(t){var n=t;if(!nc(e,t)){if(Hs(e))throw Error(M(418));t=nn(n.nextSibling);var r=qe;t&&nc(e,t)?id(r,n):(e.flags=e.flags&-4097|2,ue=!1,qe=e)}}else{if(Hs(e))throw Error(M(418));e.flags=e.flags&-4097|2,ue=!1,qe=e}}}function rc(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;qe=e}function So(e){if(e!==qe)return!1;if(!ue)return rc(e),ue=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Bs(e.type,e.memoizedProps)),t&&(t=Xe)){if(Hs(e))throw ld(),Error(M(418));for(;t;)id(e,t),t=nn(t.nextSibling)}if(rc(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Xe=nn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Xe=null}}else Xe=qe?nn(e.stateNode.nextSibling):null;return!0}function ld(){for(var e=Xe;e;)e=nn(e.nextSibling)}function er(){Xe=qe=null,ue=!1}function Bi(e){vt===null?vt=[e]:vt.push(e)}var Fm=Ut.ReactCurrentBatchConfig;function yr(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(M(309));var r=n.stateNode}if(!r)throw Error(M(147,e));var o=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(i){var l=o.refs;i===null?delete l[s]:l[s]=i},t._stringRef=s,t)}if(typeof e!="string")throw Error(M(284));if(!n._owner)throw Error(M(290,e))}return e}function jo(e,t){throw e=Object.prototype.toString.call(t),Error(M(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function oc(e){var t=e._init;return t(e._payload)}function cd(e){function t(h,p){if(e){var g=h.deletions;g===null?(h.deletions=[p],h.flags|=16):g.push(p)}}function n(h,p){if(!e)return null;for(;p!==null;)t(h,p),p=p.sibling;return null}function r(h,p){for(h=new Map;p!==null;)p.key!==null?h.set(p.key,p):h.set(p.index,p),p=p.sibling;return h}function o(h,p){return h=sn(h,p),h.index=0,h.sibling=null,h}function s(h,p,g){return h.index=g,e?(g=h.alternate,g!==null?(g=g.index,g<p?(h.flags|=2,p):g):(h.flags|=2,p)):(h.flags|=1048576,p)}function i(h){return e&&h.alternate===null&&(h.flags|=2),h}function l(h,p,g,S){return p===null||p.tag!==6?(p=ls(g,h.mode,S),p.return=h,p):(p=o(p,g),p.return=h,p)}function c(h,p,g,S){var E=g.type;return E===$n?m(h,p,g.props.children,S,g.key):p!==null&&(p.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Kt&&oc(E)===p.type)?(S=o(p,g.props),S.ref=yr(h,p,g),S.return=h,S):(S=Do(g.type,g.key,g.props,null,h.mode,S),S.ref=yr(h,p,g),S.return=h,S)}function u(h,p,g,S){return p===null||p.tag!==4||p.stateNode.containerInfo!==g.containerInfo||p.stateNode.implementation!==g.implementation?(p=cs(g,h.mode,S),p.return=h,p):(p=o(p,g.children||[]),p.return=h,p)}function m(h,p,g,S,E){return p===null||p.tag!==7?(p=Cn(g,h.mode,S,E),p.return=h,p):(p=o(p,g),p.return=h,p)}function f(h,p,g){if(typeof p=="string"&&p!==""||typeof p=="number")return p=ls(""+p,h.mode,g),p.return=h,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case uo:return g=Do(p.type,p.key,p.props,null,h.mode,g),g.ref=yr(h,null,p),g.return=h,g;case An:return p=cs(p,h.mode,g),p.return=h,p;case Kt:var S=p._init;return f(h,S(p._payload),g)}if(kr(p)||pr(p))return p=Cn(p,h.mode,g,null),p.return=h,p;jo(h,p)}return null}function v(h,p,g,S){var E=p!==null?p.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return E!==null?null:l(h,p,""+g,S);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case uo:return g.key===E?c(h,p,g,S):null;case An:return g.key===E?u(h,p,g,S):null;case Kt:return E=g._init,v(h,p,E(g._payload),S)}if(kr(g)||pr(g))return E!==null?null:m(h,p,g,S,null);jo(h,g)}return null}function y(h,p,g,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return h=h.get(g)||null,l(p,h,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case uo:return h=h.get(S.key===null?g:S.key)||null,c(p,h,S,E);case An:return h=h.get(S.key===null?g:S.key)||null,u(p,h,S,E);case Kt:var P=S._init;return y(h,p,g,P(S._payload),E)}if(kr(S)||pr(S))return h=h.get(g)||null,m(p,h,S,E,null);jo(p,S)}return null}function x(h,p,g,S){for(var E=null,P=null,k=p,N=p=0,C=null;k!==null&&N<g.length;N++){k.index>N?(C=k,k=null):C=k.sibling;var T=v(h,k,g[N],S);if(T===null){k===null&&(k=C);break}e&&k&&T.alternate===null&&t(h,k),p=s(T,p,N),P===null?E=T:P.sibling=T,P=T,k=C}if(N===g.length)return n(h,k),ue&&gn(h,N),E;if(k===null){for(;N<g.length;N++)k=f(h,g[N],S),k!==null&&(p=s(k,p,N),P===null?E=k:P.sibling=k,P=k);return ue&&gn(h,N),E}for(k=r(h,k);N<g.length;N++)C=y(k,h,N,g[N],S),C!==null&&(e&&C.alternate!==null&&k.delete(C.key===null?N:C.key),p=s(C,p,N),P===null?E=C:P.sibling=C,P=C);return e&&k.forEach(function(H){return t(h,H)}),ue&&gn(h,N),E}function w(h,p,g,S){var E=pr(g);if(typeof E!="function")throw Error(M(150));if(g=E.call(g),g==null)throw Error(M(151));for(var P=E=null,k=p,N=p=0,C=null,T=g.next();k!==null&&!T.done;N++,T=g.next()){k.index>N?(C=k,k=null):C=k.sibling;var H=v(h,k,T.value,S);if(H===null){k===null&&(k=C);break}e&&k&&H.alternate===null&&t(h,k),p=s(H,p,N),P===null?E=H:P.sibling=H,P=H,k=C}if(T.done)return n(h,k),ue&&gn(h,N),E;if(k===null){for(;!T.done;N++,T=g.next())T=f(h,T.value,S),T!==null&&(p=s(T,p,N),P===null?E=T:P.sibling=T,P=T);return ue&&gn(h,N),E}for(k=r(h,k);!T.done;N++,T=g.next())T=y(k,h,N,T.value,S),T!==null&&(e&&T.alternate!==null&&k.delete(T.key===null?N:T.key),p=s(T,p,N),P===null?E=T:P.sibling=T,P=T);return e&&k.forEach(function(W){return t(h,W)}),ue&&gn(h,N),E}function j(h,p,g,S){if(typeof g=="object"&&g!==null&&g.type===$n&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case uo:e:{for(var E=g.key,P=p;P!==null;){if(P.key===E){if(E=g.type,E===$n){if(P.tag===7){n(h,P.sibling),p=o(P,g.props.children),p.return=h,h=p;break e}}else if(P.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Kt&&oc(E)===P.type){n(h,P.sibling),p=o(P,g.props),p.ref=yr(h,P,g),p.return=h,h=p;break e}n(h,P);break}else t(h,P);P=P.sibling}g.type===$n?(p=Cn(g.props.children,h.mode,S,g.key),p.return=h,h=p):(S=Do(g.type,g.key,g.props,null,h.mode,S),S.ref=yr(h,p,g),S.return=h,h=S)}return i(h);case An:e:{for(P=g.key;p!==null;){if(p.key===P)if(p.tag===4&&p.stateNode.containerInfo===g.containerInfo&&p.stateNode.implementation===g.implementation){n(h,p.sibling),p=o(p,g.children||[]),p.return=h,h=p;break e}else{n(h,p);break}else t(h,p);p=p.sibling}p=cs(g,h.mode,S),p.return=h,h=p}return i(h);case Kt:return P=g._init,j(h,p,P(g._payload),S)}if(kr(g))return x(h,p,g,S);if(pr(g))return w(h,p,g,S);jo(h,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,p!==null&&p.tag===6?(n(h,p.sibling),p=o(p,g),p.return=h,h=p):(n(h,p),p=ls(g,h.mode,S),p.return=h,h=p),i(h)):n(h,p)}return j}var tr=cd(!0),ud=cd(!1),oa=dn(null),aa=null,Wn=null,Di=null;function Ui(){Di=Wn=aa=null}function Wi(e){var t=oa.current;ce(oa),e._currentValue=t}function Ks(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 Jn(e,t){aa=e,Di=Wn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(He=!0),e.firstContext=null)}function lt(e){var t=e._currentValue;if(Di!==e)if(e={context:e,memoizedValue:t,next:null},Wn===null){if(aa===null)throw Error(M(308));Wn=e,aa.dependencies={lanes:0,firstContext:e}}else Wn=Wn.next=e;return t}var wn=null;function Hi(e){wn===null?wn=[e]:wn.push(e)}function dd(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Hi(t)):(n.next=o.next,o.next=n),t.interleaved=n,Ot(e,r)}function Ot(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 Gt=!1;function Vi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fd(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 Lt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function rn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,te&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Ot(e,n)}return o=r.interleaved,o===null?(t.next=t,Hi(r)):(t.next=o.next,o.next=t),r.interleaved=t,Ot(e,n)}function $o(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,Ti(e,n)}}function ac(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=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?o=s=i:s=s.next=i,n=n.next}while(n!==null);s===null?o=s=t:s=s.next=t}else o=s=t;n={baseState:r.baseState,firstBaseUpdate:o,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 sa(e,t,n,r){var o=e.updateQueue;Gt=!1;var s=o.firstBaseUpdate,i=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var c=l,u=c.next;c.next=null,i===null?s=u:i.next=u,i=c;var m=e.alternate;m!==null&&(m=m.updateQueue,l=m.lastBaseUpdate,l!==i&&(l===null?m.firstBaseUpdate=u:l.next=u,m.lastBaseUpdate=c))}if(s!==null){var f=o.baseState;i=0,m=u=c=null,l=s;do{var v=l.lane,y=l.eventTime;if((r&v)===v){m!==null&&(m=m.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=he({},f,v);break e;case 2:Gt=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,v=o.effects,v===null?o.effects=[l]:v.push(l))}else y={eventTime:y,lane:v,tag:l.tag,payload:l.payload,callback:l.callback,next:null},m===null?(u=m=y,c=f):m=m.next=y,i|=v;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;v=l,l=v.next,v.next=null,o.lastBaseUpdate=v,o.shared.pending=null}}while(!0);if(m===null&&(c=f),o.baseState=c,o.firstBaseUpdate=u,o.lastBaseUpdate=m,t=o.shared.interleaved,t!==null){o=t;do i|=o.lane,o=o.next;while(o!==t)}else s===null&&(o.shared.lanes=0);zn|=i,e.lanes=i,e.memoizedState=f}}function sc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(M(191,o));o.call(r)}}}var ao={},Et=dn(ao),Yr=dn(ao),Qr=dn(ao);function Sn(e){if(e===ao)throw Error(M(174));return e}function Ki(e,t){switch(ie(Qr,t),ie(Yr,e),ie(Et,ao),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ns(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ns(t,e)}ce(Et),ie(Et,t)}function nr(){ce(Et),ce(Yr),ce(Qr)}function pd(e){Sn(Qr.current);var t=Sn(Et.current),n=Ns(t,e.type);t!==n&&(ie(Yr,e),ie(Et,n))}function Gi(e){Yr.current===e&&(ce(Et),ce(Yr))}var pe=dn(0);function ia(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 ns=[];function Yi(){for(var e=0;e<ns.length;e++)ns[e]._workInProgressVersionPrimary=null;ns.length=0}var Lo=Ut.ReactCurrentDispatcher,rs=Ut.ReactCurrentBatchConfig,En=0,me=null,we=null,be=null,la=!1,Rr=!1,Jr=0,Om=0;function Ae(){throw Error(M(321))}function Qi(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wt(e[n],t[n]))return!1;return!0}function Ji(e,t,n,r,o,s){if(En=s,me=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Lo.current=e===null||e.memoizedState===null?Wm:Hm,e=n(r,o),Rr){s=0;do{if(Rr=!1,Jr=0,25<=s)throw Error(M(301));s+=1,be=we=null,t.updateQueue=null,Lo.current=Vm,e=n(r,o)}while(Rr)}if(Lo.current=ca,t=we!==null&&we.next!==null,En=0,be=we=me=null,la=!1,t)throw Error(M(300));return e}function Xi(){var e=Jr!==0;return Jr=0,e}function kt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return be===null?me.memoizedState=be=e:be=be.next=e,be}function ct(){if(we===null){var e=me.alternate;e=e!==null?e.memoizedState:null}else e=we.next;var t=be===null?me.memoizedState:be.next;if(t!==null)be=t,we=e;else{if(e===null)throw Error(M(310));we=e,e={memoizedState:we.memoizedState,baseState:we.baseState,baseQueue:we.baseQueue,queue:we.queue,next:null},be===null?me.memoizedState=be=e:be=be.next=e}return be}function Xr(e,t){return typeof t=="function"?t(e):t}function os(e){var t=ct(),n=t.queue;if(n===null)throw Error(M(311));n.lastRenderedReducer=e;var r=we,o=r.baseQueue,s=n.pending;if(s!==null){if(o!==null){var i=o.next;o.next=s.next,s.next=i}r.baseQueue=o=s,n.pending=null}if(o!==null){s=o.next,r=r.baseState;var l=i=null,c=null,u=s;do{var m=u.lane;if((En&m)===m)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:m,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,i=r):c=c.next=f,me.lanes|=m,zn|=m}u=u.next}while(u!==null&&u!==s);c===null?i=r:c.next=l,wt(r,t.memoizedState)||(He=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do s=o.lane,me.lanes|=s,zn|=s,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function as(e){var t=ct(),n=t.queue;if(n===null)throw Error(M(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,s=t.memoizedState;if(o!==null){n.pending=null;var i=o=o.next;do s=e(s,i.action),i=i.next;while(i!==o);wt(s,t.memoizedState)||(He=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function md(){}function hd(e,t){var n=me,r=ct(),o=t(),s=!wt(r.memoizedState,o);if(s&&(r.memoizedState=o,He=!0),r=r.queue,qi(yd.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||be!==null&&be.memoizedState.tag&1){if(n.flags|=2048,qr(9,vd.bind(null,n,r,o,t),void 0,null),Ne===null)throw Error(M(349));En&30||gd(n,t,o)}return o}function gd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=me.updateQueue,t===null?(t={lastEffect:null,stores:null},me.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function vd(e,t,n,r){t.value=n,t.getSnapshot=r,xd(t)&&wd(e)}function yd(e,t,n){return n(function(){xd(t)&&wd(e)})}function xd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wt(e,n)}catch{return!0}}function wd(e){var t=Ot(e,1);t!==null&&xt(t,e,1,-1)}function ic(e){var t=kt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Xr,lastRenderedState:e},t.queue=e,e=e.dispatch=Um.bind(null,me,e),[t.memoizedState,e]}function qr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=me.updateQueue,t===null?(t={lastEffect:null,stores:null},me.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 Sd(){return ct().memoizedState}function Mo(e,t,n,r){var o=kt();me.flags|=e,o.memoizedState=qr(1|t,n,void 0,r===void 0?null:r)}function ba(e,t,n,r){var o=ct();r=r===void 0?null:r;var s=void 0;if(we!==null){var i=we.memoizedState;if(s=i.destroy,r!==null&&Qi(r,i.deps)){o.memoizedState=qr(t,n,s,r);return}}me.flags|=e,o.memoizedState=qr(1|t,n,s,r)}function lc(e,t){return Mo(8390656,8,e,t)}function qi(e,t){return ba(2048,8,e,t)}function jd(e,t){return ba(4,2,e,t)}function kd(e,t){return ba(4,4,e,t)}function Cd(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 bd(e,t,n){return n=n!=null?n.concat([e]):null,ba(4,4,Cd.bind(null,t,e),n)}function Zi(){}function Nd(e,t){var n=ct();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Qi(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ed(e,t){var n=ct();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Qi(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function zd(e,t,n){return En&21?(wt(n,t)||(n=_u(),me.lanes|=n,zn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,He=!0),e.memoizedState=n)}function Bm(e,t){var n=ae;ae=n!==0&&4>n?n:4,e(!0);var r=rs.transition;rs.transition={};try{e(!1),t()}finally{ae=n,rs.transition=r}}function Pd(){return ct().memoizedState}function Dm(e,t,n){var r=an(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Td(e))Id(t,n);else if(n=dd(e,t,n,r),n!==null){var o=Oe();xt(n,e,r,o),Rd(n,t,r)}}function Um(e,t,n){var r=an(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Td(e))Id(t,o);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(o.hasEagerState=!0,o.eagerState=l,wt(l,i)){var c=t.interleaved;c===null?(o.next=o,Hi(t)):(o.next=c.next,c.next=o),t.interleaved=o;return}}catch{}finally{}n=dd(e,t,o,r),n!==null&&(o=Oe(),xt(n,e,r,o),Rd(n,t,r))}}function Td(e){var t=e.alternate;return e===me||t!==null&&t===me}function Id(e,t){Rr=la=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ti(e,n)}}var ca={readContext:lt,useCallback:Ae,useContext:Ae,useEffect:Ae,useImperativeHandle:Ae,useInsertionEffect:Ae,useLayoutEffect:Ae,useMemo:Ae,useReducer:Ae,useRef:Ae,useState:Ae,useDebugValue:Ae,useDeferredValue:Ae,useTransition:Ae,useMutableSource:Ae,useSyncExternalStore:Ae,useId:Ae,unstable_isNewReconciler:!1},Wm={readContext:lt,useCallback:function(e,t){return kt().memoizedState=[e,t===void 0?null:t],e},useContext:lt,useEffect:lc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Mo(4194308,4,Cd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Mo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Mo(4,2,e,t)},useMemo:function(e,t){var n=kt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=kt();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=Dm.bind(null,me,e),[r.memoizedState,e]},useRef:function(e){var t=kt();return e={current:e},t.memoizedState=e},useState:ic,useDebugValue:Zi,useDeferredValue:function(e){return kt().memoizedState=e},useTransition:function(){var e=ic(!1),t=e[0];return e=Bm.bind(null,e[1]),kt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=me,o=kt();if(ue){if(n===void 0)throw Error(M(407));n=n()}else{if(n=t(),Ne===null)throw Error(M(349));En&30||gd(r,t,n)}o.memoizedState=n;var s={value:n,getSnapshot:t};return o.queue=s,lc(yd.bind(null,r,s,e),[e]),r.flags|=2048,qr(9,vd.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=kt(),t=Ne.identifierPrefix;if(ue){var n=At,r=_t;n=(r&~(1<<32-yt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Jr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Om++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Hm={readContext:lt,useCallback:Nd,useContext:lt,useEffect:qi,useImperativeHandle:bd,useInsertionEffect:jd,useLayoutEffect:kd,useMemo:Ed,useReducer:os,useRef:Sd,useState:function(){return os(Xr)},useDebugValue:Zi,useDeferredValue:function(e){var t=ct();return zd(t,we.memoizedState,e)},useTransition:function(){var e=os(Xr)[0],t=ct().memoizedState;return[e,t]},useMutableSource:md,useSyncExternalStore:hd,useId:Pd,unstable_isNewReconciler:!1},Vm={readContext:lt,useCallback:Nd,useContext:lt,useEffect:qi,useImperativeHandle:bd,useInsertionEffect:jd,useLayoutEffect:kd,useMemo:Ed,useReducer:as,useRef:Sd,useState:function(){return as(Xr)},useDebugValue:Zi,useDeferredValue:function(e){var t=ct();return we===null?t.memoizedState=e:zd(t,we.memoizedState,e)},useTransition:function(){var e=as(Xr)[0],t=ct().memoizedState;return[e,t]},useMutableSource:md,useSyncExternalStore:hd,useId:Pd,unstable_isNewReconciler:!1};function ht(e,t){if(e&&e.defaultProps){t=he({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Gs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:he({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Na={isMounted:function(e){return(e=e._reactInternals)?In(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Oe(),o=an(e),s=Lt(r,o);s.payload=t,n!=null&&(s.callback=n),t=rn(e,s,o),t!==null&&(xt(t,e,o,r),$o(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Oe(),o=an(e),s=Lt(r,o);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=rn(e,s,o),t!==null&&(xt(t,e,o,r),$o(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Oe(),r=an(e),o=Lt(n,r);o.tag=2,t!=null&&(o.callback=t),t=rn(e,o,r),t!==null&&(xt(t,e,r,n),$o(t,e,r))}};function cc(e,t,n,r,o,s,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,i):t.prototype&&t.prototype.isPureReactComponent?!Hr(n,r)||!Hr(o,s):!0}function _d(e,t,n){var r=!1,o=cn,s=t.contextType;return typeof s=="object"&&s!==null?s=lt(s):(o=Ke(t)?bn:Me.current,r=t.contextTypes,s=(r=r!=null)?Zn(e,o):cn),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Na,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=s),t}function uc(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&&Na.enqueueReplaceState(t,t.state,null)}function Ys(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},Vi(e);var s=t.contextType;typeof s=="object"&&s!==null?o.context=lt(s):(s=Ke(t)?bn:Me.current,o.context=Zn(e,s)),o.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Gs(e,t,s,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&Na.enqueueReplaceState(o,o.state,null),sa(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function rr(e,t){try{var n="",r=t;do n+=xp(r),r=r.return;while(r);var o=n}catch(s){o=`
|
|
39
39
|
Error generating stack: `+s.message+`
|
|
40
|
-
`+s.stack}return{value:e,source:t,stack:o,digest:null}}function ss(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Qs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Vp=typeof WeakMap=="function"?WeakMap:Map;function Ad(e,t,n){n=Lt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){da||(da=!0,ai=r),Qs(e,t)},n}function $d(e,t,n){n=Lt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Qs(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Qs(e,t),typeof r!="function"&&(on===null?on=new Set([this]):on.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function dc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Vp;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=ah.bind(null,e,t,n),t.then(e,e))}function fc(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 mc(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,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=Lt(-1,1),t.tag=2,rn(n,t,1))),n.lanes|=1),e)}var Kp=Ut.ReactCurrentOwner,He=!1;function Fe(e,t,n,r){t.child=e===null?ud(t,null,n,r):tr(t,e.child,n,r)}function pc(e,t,n,r,o){n=n.render;var s=t.ref;return Jn(t,o),r=Ji(e,t,n,r,s,o),n=Xi(),e!==null&&!He?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Bt(e,t,o)):(ue&&n&&Fi(t),t.flags|=1,Fe(e,t,r,o),t.child)}function hc(e,t,n,r,o){if(e===null){var s=n.type;return typeof s=="function"&&!il(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,Ld(e,t,s,r,o)):(e=Do(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&o)){var i=s.memoizedProps;if(n=n.compare,n=n!==null?n:Hr,n(i,r)&&e.ref===t.ref)return Bt(e,t,o)}return t.flags|=1,e=sn(s,r),e.ref=t.ref,e.return=t,t.child=e}function Ld(e,t,n,r,o){if(e!==null){var s=e.memoizedProps;if(Hr(s,r)&&e.ref===t.ref)if(He=!1,t.pendingProps=r=s,(e.lanes&o)!==0)e.flags&131072&&(He=!0);else return t.lanes=e.lanes,Bt(e,t,o)}return Js(e,t,n,r,o)}function Md(e,t,n){var r=t.pendingProps,o=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ie(Vn,Qe),Qe|=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,ie(Vn,Qe),Qe|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,ie(Vn,Qe),Qe|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,ie(Vn,Qe),Qe|=r;return Fe(e,t,o,n),t.child}function Fd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Js(e,t,n,r,o){var s=Ke(n)?bn:Me.current;return s=Zn(t,s),Jn(t,o),n=Ji(e,t,n,r,s,o),r=Xi(),e!==null&&!He?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Bt(e,t,o)):(ue&&r&&Fi(t),t.flags|=1,Fe(e,t,n,o),t.child)}function gc(e,t,n,r,o){if(Ke(n)){var s=!0;ta(t)}else s=!1;if(Jn(t,o),t.stateNode===null)Fo(e,t),_d(t,n,r),Ys(t,n,r,o),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=lt(u):(u=Ke(n)?bn:Me.current,u=Zn(t,u));var p=n.getDerivedStateFromProps,f=typeof p=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==r||c!==u)&&uc(t,i,r,u),Gt=!1;var v=t.memoizedState;i.state=v,sa(t,r,i,o),c=t.memoizedState,l!==r||v!==c||Ve.current||Gt?(typeof p=="function"&&(Gs(t,n,p,r),c=t.memoizedState),(l=Gt||cc(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,fd(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:ht(t.type,l),i.props=u,f=t.pendingProps,v=i.context,c=n.contextType,typeof c=="object"&&c!==null?c=lt(c):(c=Ke(n)?bn:Me.current,c=Zn(t,c));var y=n.getDerivedStateFromProps;(p=typeof y=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==f||v!==c)&&uc(t,i,r,c),Gt=!1,v=t.memoizedState,i.state=v,sa(t,r,i,o);var x=t.memoizedState;l!==f||v!==x||Ve.current||Gt?(typeof y=="function"&&(Gs(t,n,y,r),x=t.memoizedState),(u=Gt||cc(t,n,u,r,v,x,c)||!1)?(p||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 Xs(e,t,n,r,s,o)}function Xs(e,t,n,r,o,s){Fd(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return o&&tc(t,n,!1),Bt(e,t,s);r=t.stateNode,Kp.current=t;var l=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=tr(t,e.child,null,s),t.child=tr(t,null,l,s)):Fe(e,t,l,s),t.memoizedState=r.state,o&&tc(t,n,!0),t.child}function Od(e){var t=e.stateNode;t.pendingContext?ec(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ec(e,t.context,!1),Ki(e,t.containerInfo)}function vc(e,t,n,r,o){return er(),Bi(o),t.flags|=256,Fe(e,t,n,r),t.child}var qs={dehydrated:null,treeContext:null,retryLane:0};function Zs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Bd(e,t,n){var r=t.pendingProps,o=me.current,s=!1,i=(t.flags&128)!==0,l;if((l=i)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),ie(me,o&1),e===null)return Vs(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=Pa(i,r,0,null),e=Cn(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Zs(n),t.memoizedState=qs,e):el(t,i));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return Gp(e,t,i,r,l,o,n);if(s){s=r.fallback,i=t.mode,o=e.child,l=o.sibling;var c={mode:"hidden",children:r.children};return!(i&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=sn(o,c),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?s=sn(l,s):(s=Cn(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?Zs(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},s.memoizedState=i,s.childLanes=e.childLanes&~n,t.memoizedState=qs,r}return s=e.child,e=s.sibling,r=sn(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 el(e,t){return t=Pa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ko(e,t,n,r){return r!==null&&Bi(r),tr(t,e.child,null,n),e=el(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gp(e,t,n,r,o,s,i){if(n)return t.flags&256?(t.flags&=-257,r=ss(Error(M(422))),ko(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,o=t.mode,r=Pa({mode:"visible",children:r.children},o,0,null),s=Cn(s,o,i,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&tr(t,e.child,null,i),t.child.memoizedState=Zs(i),t.memoizedState=qs,s);if(!(t.mode&1))return ko(e,t,i,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(M(419)),r=ss(s,r,void 0),ko(e,t,i,r)}if(l=(i&e.childLanes)!==0,He||l){if(r=Ne,r!==null){switch(i&-i){case 4:o=2;break;case 16:o=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:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|i)?0:o,o!==0&&o!==s.retryLane&&(s.retryLane=o,Ot(e,o),xt(r,e,o,-1))}return sl(),r=ss(Error(M(421))),ko(e,t,i,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=sh.bind(null,e),o._reactRetry=t,null):(e=s.treeContext,Xe=nn(o.nextSibling),qe=t,ue=!0,vt=null,e!==null&&(ot[at++]=_t,ot[at++]=At,ot[at++]=Nn,_t=e.id,At=e.overflow,Nn=t),t=el(t,r.children),t.flags|=4096,t)}function yc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ks(e.return,t,n)}function is(e,t,n,r,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=o)}function Dd(e,t,n){var r=t.pendingProps,o=r.revealOrder,s=r.tail;if(Fe(e,t,r.children,n),r=me.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&&yc(e,n,t);else if(e.tag===19)yc(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(ie(me,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&ia(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),is(t,!1,o,n,s);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&ia(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}is(t,!0,n,null,s);break;case"together":is(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Fo(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Bt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),zn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(M(153));if(t.child!==null){for(e=t.child,n=sn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=sn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Yp(e,t,n){switch(t.tag){case 3:Od(t),er();break;case 5:md(t);break;case 1:Ke(t.type)&&ta(t);break;case 4:Ki(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;ie(oa,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ie(me,me.current&1),t.flags|=128,null):n&t.child.childLanes?Bd(e,t,n):(ie(me,me.current&1),e=Bt(e,t,n),e!==null?e.sibling:null);ie(me,me.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Dd(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),ie(me,me.current),r)break;return null;case 22:case 23:return t.lanes=0,Md(e,t,n)}return Bt(e,t,n)}var Ud,ei,Wd,Hd;Ud=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}};ei=function(){};Wd=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Sn(Et.current);var s=null;switch(n){case"input":o=js(e,o),r=js(e,r),s=[];break;case"select":o=he({},o,{value:void 0}),r=he({},r,{value:void 0}),s=[];break;case"textarea":o=bs(e,o),r=bs(e,r),s=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Zo)}Es(n,r);var i;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var l=o[u];for(i in l)l.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Mr.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(l=o!=null?o[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"&&(Mr.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&le("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)}};Hd=function(e,t,n,r){n!==r&&(t.flags|=4)};function xr(e,t){if(!ue)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 $e(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Qp(e,t,n){var r=t.pendingProps;switch(Oi(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $e(t),null;case 1:return Ke(t.type)&&ea(),$e(t),null;case 3:return r=t.stateNode,nr(),ce(Ve),ce(Me),Yi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(So(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,vt!==null&&(li(vt),vt=null))),ei(e,t),$e(t),null;case 5:Gi(t);var o=Sn(Qr.current);if(n=t.type,e!==null&&t.stateNode!=null)Wd(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(M(166));return $e(t),null}if(e=Sn(Et.current),So(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[bt]=t,r[Gr]=s,e=(t.mode&1)!==0,n){case"dialog":le("cancel",r),le("close",r);break;case"iframe":case"object":case"embed":le("load",r);break;case"video":case"audio":for(o=0;o<br.length;o++)le(br[o],r);break;case"source":le("error",r);break;case"img":case"image":case"link":le("error",r),le("load",r);break;case"details":le("toggle",r);break;case"input":El(r,s),le("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},le("invalid",r);break;case"textarea":Pl(r,s),le("invalid",r)}Es(n,s),o=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&&wo(r.textContent,l,e),o=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&wo(r.textContent,l,e),o=["children",""+l]):Mr.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&le("scroll",r)}switch(n){case"input":fo(r),zl(r,s,!0);break;case"textarea":fo(r),Tl(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Zo)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=yu(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[bt]=t,e[Gr]=r,Ud(e,t,!1,!1),t.stateNode=e;e:{switch(i=zs(n,r),n){case"dialog":le("cancel",e),le("close",e),o=r;break;case"iframe":case"object":case"embed":le("load",e),o=r;break;case"video":case"audio":for(o=0;o<br.length;o++)le(br[o],e);o=r;break;case"source":le("error",e),o=r;break;case"img":case"image":case"link":le("error",e),le("load",e),o=r;break;case"details":le("toggle",e),o=r;break;case"input":El(e,r),o=js(e,r),le("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=he({},r,{value:void 0}),le("invalid",e);break;case"textarea":Pl(e,r),o=bs(e,r),le("invalid",e);break;default:o=r}Es(n,o),l=o;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];s==="style"?Su(e,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&xu(e,c)):s==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Fr(e,c):typeof c=="number"&&Fr(e,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Mr.hasOwnProperty(s)?c!=null&&s==="onScroll"&&le("scroll",e):c!=null&&Ci(e,s,c,i))}switch(n){case"input":fo(e),zl(e,r,!1);break;case"textarea":fo(e),Tl(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ln(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Kn(e,!!r.multiple,s,!1):r.defaultValue!=null&&Kn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Zo)}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 $e(t),null;case 6:if(e&&t.stateNode!=null)Hd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(M(166));if(n=Sn(Qr.current),Sn(Et.current),So(t)){if(r=t.stateNode,n=t.memoizedProps,r[bt]=t,(s=r.nodeValue!==n)&&(e=qe,e!==null))switch(e.tag){case 3:wo(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&wo(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[bt]=t,t.stateNode=r}return $e(t),null;case 13:if(ce(me),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ue&&Xe!==null&&t.mode&1&&!(t.flags&128))ld(),er(),t.flags|=98560,s=!1;else if(s=So(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(M(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(M(317));s[bt]=t}else er(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;$e(t),s=!1}else vt!==null&&(li(vt),vt=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||me.current&1?Se===0&&(Se=3):sl())),t.updateQueue!==null&&(t.flags|=4),$e(t),null);case 4:return nr(),ei(e,t),e===null&&Vr(t.stateNode.containerInfo),$e(t),null;case 10:return Wi(t.type._context),$e(t),null;case 17:return Ke(t.type)&&ea(),$e(t),null;case 19:if(ce(me),s=t.memoizedState,s===null)return $e(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)xr(s,!1);else{if(Se!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=ia(e),i!==null){for(t.flags|=128,xr(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 ie(me,me.current&1|2),t.child}e=e.sibling}s.tail!==null&&ve()>or&&(t.flags|=128,r=!0,xr(s,!1),t.lanes=4194304)}else{if(!r)if(e=ia(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),xr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!ue)return $e(t),null}else 2*ve()-s.renderingStartTime>or&&n!==1073741824&&(t.flags|=128,r=!0,xr(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=ve(),t.sibling=null,n=me.current,ie(me,r?n&1|2:n&1),t):($e(t),null);case 22:case 23:return al(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Qe&1073741824&&($e(t),t.subtreeFlags&6&&(t.flags|=8192)):$e(t),null;case 24:return null;case 25:return null}throw Error(M(156,t.tag))}function Jp(e,t){switch(Oi(t),t.tag){case 1:return Ke(t.type)&&ea(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return nr(),ce(Ve),ce(Me),Yi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Gi(t),null;case 13:if(ce(me),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(M(340));er()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ce(me),null;case 4:return nr(),null;case 10:return Wi(t.type._context),null;case 22:case 23:return al(),null;case 24:return null;default:return null}}var Co=!1,Le=!1,Xp=typeof WeakSet=="function"?WeakSet:Set,K=null;function Hn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ge(e,t,r)}else n.current=null}function ti(e,t,n){try{n()}catch(r){ge(e,t,r)}}var xc=!1;function qp(e,t){if(Fs=Jo,e=Qu(),Mi(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 o=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,p=0,f=e,v=null;t:for(;;){for(var y;f!==n||o!==0&&f.nodeType!==3||(l=i+o),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===o&&(l=i),v===s&&++p===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(Os={focusedElem:e,selectionRange:n},Jo=!1,K=t;K!==null;)if(t=K,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;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,h=t.stateNode,m=h.getSnapshotBeforeUpdate(t.elementType===t.type?w:ht(t.type,w),j);h.__reactInternalSnapshotBeforeUpdate=m}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(M(163))}}catch(S){ge(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return x=xc,xc=!1,x}function _r(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var s=o.destroy;o.destroy=void 0,s!==void 0&&ti(t,n,s)}o=o.next}while(o!==r)}}function Ea(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 ni(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 Vd(e){var t=e.alternate;t!==null&&(e.alternate=null,Vd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[bt],delete t[Gr],delete t[Us],delete t[Ap],delete t[$p])),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 Kd(e){return e.tag===5||e.tag===3||e.tag===4}function wc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Kd(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 ri(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=Zo));else if(r!==4&&(e=e.child,e!==null))for(ri(e,t,n),e=e.sibling;e!==null;)ri(e,t,n),e=e.sibling}function oi(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(oi(e,t,n),e=e.sibling;e!==null;)oi(e,t,n),e=e.sibling}var Te=null,gt=!1;function Vt(e,t,n){for(n=n.child;n!==null;)Gd(e,t,n),n=n.sibling}function Gd(e,t,n){if(Nt&&typeof Nt.onCommitFiberUnmount=="function")try{Nt.onCommitFiberUnmount(xa,n)}catch{}switch(n.tag){case 5:Le||Hn(n,t);case 6:var r=Te,o=gt;Te=null,Vt(e,t,n),Te=r,gt=o,Te!==null&&(gt?(e=Te,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Te.removeChild(n.stateNode));break;case 18:Te!==null&&(gt?(e=Te,n=n.stateNode,e.nodeType===8?es(e.parentNode,n):e.nodeType===1&&es(e,n),Ur(e)):es(Te,n.stateNode));break;case 4:r=Te,o=gt,Te=n.stateNode.containerInfo,gt=!0,Vt(e,t,n),Te=r,gt=o;break;case 0:case 11:case 14:case 15:if(!Le&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var s=o,i=s.destroy;s=s.tag,i!==void 0&&(s&2||s&4)&&ti(n,t,i),o=o.next}while(o!==r)}Vt(e,t,n);break;case 1:if(!Le&&(Hn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ge(n,t,l)}Vt(e,t,n);break;case 21:Vt(e,t,n);break;case 22:n.mode&1?(Le=(r=Le)||n.memoizedState!==null,Vt(e,t,n),Le=r):Vt(e,t,n);break;default:Vt(e,t,n)}}function Sc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Xp),t.forEach(function(r){var o=ih.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function pt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var s=e,i=t,l=i;e:for(;l!==null;){switch(l.tag){case 5:Te=l.stateNode,gt=!1;break e;case 3:Te=l.stateNode.containerInfo,gt=!0;break e;case 4:Te=l.stateNode.containerInfo,gt=!0;break e}l=l.return}if(Te===null)throw Error(M(160));Gd(s,i,o),Te=null,gt=!1;var c=o.alternate;c!==null&&(c.return=null),o.return=null}catch(u){ge(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Yd(t,e),t=t.sibling}function Yd(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(pt(t,e),jt(e),r&4){try{_r(3,e,e.return),Ea(3,e)}catch(w){ge(e,e.return,w)}try{_r(5,e,e.return)}catch(w){ge(e,e.return,w)}}break;case 1:pt(t,e),jt(e),r&512&&n!==null&&Hn(n,n.return);break;case 5:if(pt(t,e),jt(e),r&512&&n!==null&&Hn(n,n.return),e.flags&32){var o=e.stateNode;try{Fr(o,"")}catch(w){ge(e,e.return,w)}}if(r&4&&(o=e.stateNode,o!=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&&gu(o,s),zs(l,i);var u=zs(l,s);for(i=0;i<c.length;i+=2){var p=c[i],f=c[i+1];p==="style"?Su(o,f):p==="dangerouslySetInnerHTML"?xu(o,f):p==="children"?Fr(o,f):Ci(o,p,f,u)}switch(l){case"input":ks(o,s);break;case"textarea":vu(o,s);break;case"select":var v=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!s.multiple;var y=s.value;y!=null?Kn(o,!!s.multiple,y,!1):v!==!!s.multiple&&(s.defaultValue!=null?Kn(o,!!s.multiple,s.defaultValue,!0):Kn(o,!!s.multiple,s.multiple?[]:"",!1))}o[Gr]=s}catch(w){ge(e,e.return,w)}}break;case 6:if(pt(t,e),jt(e),r&4){if(e.stateNode===null)throw Error(M(162));o=e.stateNode,s=e.memoizedProps;try{o.nodeValue=s}catch(w){ge(e,e.return,w)}}break;case 3:if(pt(t,e),jt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ur(t.containerInfo)}catch(w){ge(e,e.return,w)}break;case 4:pt(t,e),jt(e);break;case 13:pt(t,e),jt(e),o=e.child,o.flags&8192&&(s=o.memoizedState!==null,o.stateNode.isHidden=s,!s||o.alternate!==null&&o.alternate.memoizedState!==null||(rl=ve())),r&4&&Sc(e);break;case 22:if(p=n!==null&&n.memoizedState!==null,e.mode&1?(Le=(u=Le)||p,pt(t,e),Le=u):pt(t,e),jt(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!p&&e.mode&1)for(K=e,p=e.child;p!==null;){for(f=K=p;K!==null;){switch(v=K,y=v.child,v.tag){case 0:case 11:case 14:case 15:_r(4,v,v.return);break;case 1:Hn(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){ge(r,n,w)}}break;case 5:Hn(v,v.return);break;case 22:if(v.memoizedState!==null){kc(f);continue}}y!==null?(y.return=v,K=y):kc(f)}p=p.sibling}e:for(p=null,f=e;;){if(f.tag===5){if(p===null){p=f;try{o=f.stateNode,u?(s=o.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=wu("display",i))}catch(w){ge(e,e.return,w)}}}else if(f.tag===6){if(p===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(w){ge(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;p===f&&(p=null),f=f.return}p===f&&(p=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:pt(t,e),jt(e),r&4&&Sc(e);break;case 21:break;default:pt(t,e),jt(e)}}function jt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Kd(n)){var r=n;break e}n=n.return}throw Error(M(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Fr(o,""),r.flags&=-33);var s=wc(e);oi(e,s,o);break;case 3:case 4:var i=r.stateNode.containerInfo,l=wc(e);ri(e,l,i);break;default:throw Error(M(161))}}catch(c){ge(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Zp(e,t,n){K=e,Qd(e)}function Qd(e,t,n){for(var r=(e.mode&1)!==0;K!==null;){var o=K,s=o.child;if(o.tag===22&&r){var i=o.memoizedState!==null||Co;if(!i){var l=o.alternate,c=l!==null&&l.memoizedState!==null||Le;l=Co;var u=Le;if(Co=i,(Le=c)&&!u)for(K=o;K!==null;)i=K,c=i.child,i.tag===22&&i.memoizedState!==null?Cc(o):c!==null?(c.return=i,K=c):Cc(o);for(;s!==null;)K=s,Qd(s),s=s.sibling;K=o,Co=l,Le=u}jc(e)}else o.subtreeFlags&8772&&s!==null?(s.return=o,K=s):jc(e)}}function jc(e){for(;K!==null;){var t=K;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Le||Ea(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Le)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:ht(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&sc(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}sc(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 p=u.memoizedState;if(p!==null){var f=p.dehydrated;f!==null&&Ur(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(M(163))}Le||t.flags&512&&ni(t)}catch(v){ge(t,t.return,v)}}if(t===e){K=null;break}if(n=t.sibling,n!==null){n.return=t.return,K=n;break}K=t.return}}function kc(e){for(;K!==null;){var t=K;if(t===e){K=null;break}var n=t.sibling;if(n!==null){n.return=t.return,K=n;break}K=t.return}}function Cc(e){for(;K!==null;){var t=K;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Ea(4,t)}catch(c){ge(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(c){ge(t,o,c)}}var s=t.return;try{ni(t)}catch(c){ge(t,s,c)}break;case 5:var i=t.return;try{ni(t)}catch(c){ge(t,i,c)}}}catch(c){ge(t,t.return,c)}if(t===e){K=null;break}var l=t.sibling;if(l!==null){l.return=t.return,K=l;break}K=t.return}}var eh=Math.ceil,ua=Ut.ReactCurrentDispatcher,tl=Ut.ReactCurrentOwner,it=Ut.ReactCurrentBatchConfig,te=0,Ne=null,ye=null,Ie=0,Qe=0,Vn=dn(0),Se=0,Zr=null,zn=0,za=0,nl=0,Ar=null,We=null,rl=0,or=1/0,It=null,da=!1,ai=null,on=null,bo=!1,qt=null,fa=0,$r=0,si=null,Oo=-1,Bo=0;function Oe(){return te&6?ve():Oo!==-1?Oo:Oo=ve()}function an(e){return e.mode&1?te&2&&Ie!==0?Ie&-Ie:Mp.transition!==null?(Bo===0&&(Bo=_u()),Bo):(e=ae,e!==0||(e=window.event,e=e===void 0?16:Bu(e.type)),e):1}function xt(e,t,n,r){if(50<$r)throw $r=0,si=null,Error(M(185));no(e,n,r),(!(te&2)||e!==Ne)&&(e===Ne&&(!(te&2)&&(za|=n),Se===4&&Jt(e,Ie)),Ge(e,r),n===1&&te===0&&!(t.mode&1)&&(or=ve()+500,Ca&&fn()))}function Ge(e,t){var n=e.callbackNode;Mm(e,t);var r=Qo(e,e===Ne?Ie:0);if(r===0)n!==null&&_l(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&_l(n),t===1)e.tag===0?Lp(bc.bind(null,e)):ad(bc.bind(null,e)),Rp(function(){!(te&6)&&fn()}),n=null;else{switch(Au(r)){case 1:n=Pi;break;case 4:n=Iu;break;case 16:n=Yo;break;case 536870912:n=Ru;break;default:n=Yo}n=rf(n,Jd.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Jd(e,t){if(Oo=-1,Bo=0,te&6)throw Error(M(327));var n=e.callbackNode;if(Xn()&&e.callbackNode!==n)return null;var r=Qo(e,e===Ne?Ie:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ma(e,r);else{t=r;var o=te;te|=2;var s=qd();(Ne!==e||Ie!==t)&&(It=null,or=ve()+500,kn(e,t));do try{rh();break}catch(l){Xd(e,l)}while(!0);Ui(),ua.current=s,te=o,ye!==null?t=0:(Ne=null,Ie=0,t=Se)}if(t!==0){if(t===2&&(o=_s(e),o!==0&&(r=o,t=ii(e,o))),t===1)throw n=Zr,kn(e,0),Jt(e,r),Ge(e,ve()),n;if(t===6)Jt(e,r);else{if(o=e.current.alternate,!(r&30)&&!th(o)&&(t=ma(e,r),t===2&&(s=_s(e),s!==0&&(r=s,t=ii(e,s))),t===1))throw n=Zr,kn(e,0),Jt(e,r),Ge(e,ve()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(M(345));case 2:vn(e,We,It);break;case 3:if(Jt(e,r),(r&130023424)===r&&(t=rl+500-ve(),10<t)){if(Qo(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Oe(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Ds(vn.bind(null,e,We,It),t);break}vn(e,We,It);break;case 4:if(Jt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var i=31-yt(r);s=1<<i,i=t[i],i>o&&(o=i),r&=~s}if(r=o,r=ve()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*eh(r/1960))-r,10<r){e.timeoutHandle=Ds(vn.bind(null,e,We,It),r);break}vn(e,We,It);break;case 5:vn(e,We,It);break;default:throw Error(M(329))}}}return Ge(e,ve()),e.callbackNode===n?Jd.bind(null,e):null}function ii(e,t){var n=Ar;return e.current.memoizedState.isDehydrated&&(kn(e,t).flags|=256),e=ma(e,t),e!==2&&(t=We,We=n,t!==null&&li(t)),e}function li(e){We===null?We=e:We.push.apply(We,e)}function th(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 o=n[r],s=o.getSnapshot;o=o.value;try{if(!wt(s(),o))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 Jt(e,t){for(t&=~nl,t&=~za,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-yt(t),r=1<<n;e[n]=-1,t&=~r}}function bc(e){if(te&6)throw Error(M(327));Xn();var t=Qo(e,0);if(!(t&1))return Ge(e,ve()),null;var n=ma(e,t);if(e.tag!==0&&n===2){var r=_s(e);r!==0&&(t=r,n=ii(e,r))}if(n===1)throw n=Zr,kn(e,0),Jt(e,t),Ge(e,ve()),n;if(n===6)throw Error(M(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,vn(e,We,It),Ge(e,ve()),null}function ol(e,t){var n=te;te|=1;try{return e(t)}finally{te=n,te===0&&(or=ve()+500,Ca&&fn())}}function Pn(e){qt!==null&&qt.tag===0&&!(te&6)&&Xn();var t=te;te|=1;var n=it.transition,r=ae;try{if(it.transition=null,ae=1,e)return e()}finally{ae=r,it.transition=n,te=t,!(te&6)&&fn()}}function al(){Qe=Vn.current,ce(Vn)}function kn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Ip(n)),ye!==null)for(n=ye.return;n!==null;){var r=n;switch(Oi(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ea();break;case 3:nr(),ce(Ve),ce(Me),Yi();break;case 5:Gi(r);break;case 4:nr();break;case 13:ce(me);break;case 19:ce(me);break;case 10:Wi(r.type._context);break;case 22:case 23:al()}n=n.return}if(Ne=e,ye=e=sn(e.current,null),Ie=Qe=t,Se=0,Zr=null,nl=za=zn=0,We=Ar=null,wn!==null){for(t=0;t<wn.length;t++)if(n=wn[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,s=n.pending;if(s!==null){var i=s.next;s.next=o,r.next=i}n.pending=r}wn=null}return e}function Xd(e,t){do{var n=ye;try{if(Ui(),Lo.current=ca,la){for(var r=pe.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}la=!1}if(En=0,be=we=pe=null,Rr=!1,Jr=0,tl.current=null,n===null||n.return===null){Se=1,Zr=t,ye=null;break}e:{var s=e,i=n.return,l=n,c=t;if(t=Ie,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,p=l,f=p.tag;if(!(p.mode&1)&&(f===0||f===11||f===15)){var v=p.alternate;v?(p.updateQueue=v.updateQueue,p.memoizedState=v.memoizedState,p.lanes=v.lanes):(p.updateQueue=null,p.memoizedState=null)}var y=fc(i);if(y!==null){y.flags&=-257,mc(y,i,l,s,t),y.mode&1&&dc(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)){dc(s,u,t),sl();break e}c=Error(M(426))}}else if(ue&&l.mode&1){var j=fc(i);if(j!==null){!(j.flags&65536)&&(j.flags|=256),mc(j,i,l,s,t),Bi(rr(c,l));break e}}s=c=rr(c,l),Se!==4&&(Se=2),Ar===null?Ar=[s]:Ar.push(s),s=i;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var h=Ad(s,c,t);ac(s,h);break e;case 1:l=c;var m=s.type,g=s.stateNode;if(!(s.flags&128)&&(typeof m.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(on===null||!on.has(g)))){s.flags|=65536,t&=-t,s.lanes|=t;var S=$d(s,l,t);ac(s,S);break e}}s=s.return}while(s!==null)}ef(n)}catch(E){t=E,ye===n&&n!==null&&(ye=n=n.return);continue}break}while(!0)}function qd(){var e=ua.current;return ua.current=ca,e===null?ca:e}function sl(){(Se===0||Se===3||Se===2)&&(Se=4),Ne===null||!(zn&268435455)&&!(za&268435455)||Jt(Ne,Ie)}function ma(e,t){var n=te;te|=2;var r=qd();(Ne!==e||Ie!==t)&&(It=null,kn(e,t));do try{nh();break}catch(o){Xd(e,o)}while(!0);if(Ui(),te=n,ua.current=r,ye!==null)throw Error(M(261));return Ne=null,Ie=0,Se}function nh(){for(;ye!==null;)Zd(ye)}function rh(){for(;ye!==null&&!zm();)Zd(ye)}function Zd(e){var t=nf(e.alternate,e,Qe);e.memoizedProps=e.pendingProps,t===null?ef(e):ye=t,tl.current=null}function ef(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Jp(n,t),n!==null){n.flags&=32767,ye=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Se=6,ye=null;return}}else if(n=Qp(n,t,Qe),n!==null){ye=n;return}if(t=t.sibling,t!==null){ye=t;return}ye=t=e}while(t!==null);Se===0&&(Se=5)}function vn(e,t,n){var r=ae,o=it.transition;try{it.transition=null,ae=1,oh(e,t,n,r)}finally{it.transition=o,ae=r}return null}function oh(e,t,n,r){do Xn();while(qt!==null);if(te&6)throw Error(M(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(M(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(Fm(e,s),e===Ne&&(ye=Ne=null,Ie=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||bo||(bo=!0,rf(Yo,function(){return Xn(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=it.transition,it.transition=null;var i=ae;ae=1;var l=te;te|=4,tl.current=null,qp(e,n),Yd(n,e),Cp(Os),Jo=!!Fs,Os=Fs=null,e.current=n,Zp(n),Pm(),te=l,ae=i,it.transition=s}else e.current=n;if(bo&&(bo=!1,qt=e,fa=o),s=e.pendingLanes,s===0&&(on=null),Rm(n.stateNode),Ge(e,ve()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(da)throw da=!1,e=ai,ai=null,e;return fa&1&&e.tag!==0&&Xn(),s=e.pendingLanes,s&1?e===si?$r++:($r=0,si=e):$r=0,fn(),null}function Xn(){if(qt!==null){var e=Au(fa),t=it.transition,n=ae;try{if(it.transition=null,ae=16>e?16:e,qt===null)var r=!1;else{if(e=qt,qt=null,fa=0,te&6)throw Error(M(331));var o=te;for(te|=4,K=e.current;K!==null;){var s=K,i=s.child;if(K.flags&16){var l=s.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(K=u;K!==null;){var p=K;switch(p.tag){case 0:case 11:case 15:_r(8,p,s)}var f=p.child;if(f!==null)f.return=p,K=f;else for(;K!==null;){p=K;var v=p.sibling,y=p.return;if(Vd(p),p===u){K=null;break}if(v!==null){v.return=y,K=v;break}K=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)}}K=s}}if(s.subtreeFlags&2064&&i!==null)i.return=s,K=i;else e:for(;K!==null;){if(s=K,s.flags&2048)switch(s.tag){case 0:case 11:case 15:_r(9,s,s.return)}var h=s.sibling;if(h!==null){h.return=s.return,K=h;break e}K=s.return}}var m=e.current;for(K=m;K!==null;){i=K;var g=i.child;if(i.subtreeFlags&2064&&g!==null)g.return=i,K=g;else e:for(i=m;K!==null;){if(l=K,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Ea(9,l)}}catch(E){ge(l,l.return,E)}if(l===i){K=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,K=S;break e}K=l.return}}if(te=o,fn(),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(xa,e)}catch{}r=!0}return r}finally{ae=n,it.transition=t}}return!1}function Nc(e,t,n){t=rr(n,t),t=Ad(e,t,1),e=rn(e,t,1),t=Oe(),e!==null&&(no(e,1,t),Ge(e,t))}function ge(e,t,n){if(e.tag===3)Nc(e,e,n);else for(;t!==null;){if(t.tag===3){Nc(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(on===null||!on.has(r))){e=rr(n,e),e=$d(t,e,1),t=rn(t,e,1),e=Oe(),t!==null&&(no(t,1,e),Ge(t,e));break}}t=t.return}}function ah(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Oe(),e.pingedLanes|=e.suspendedLanes&n,Ne===e&&(Ie&n)===n&&(Se===4||Se===3&&(Ie&130023424)===Ie&&500>ve()-rl?kn(e,0):nl|=n),Ge(e,t)}function tf(e,t){t===0&&(e.mode&1?(t=ho,ho<<=1,!(ho&130023424)&&(ho=4194304)):t=1);var n=Oe();e=Ot(e,t),e!==null&&(no(e,t,n),Ge(e,n))}function sh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),tf(e,n)}function ih(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(M(314))}r!==null&&r.delete(t),tf(e,n)}var nf;nf=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ve.current)He=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return He=!1,Yp(e,t,n);He=!!(e.flags&131072)}else He=!1,ue&&t.flags&1048576&&sd(t,ra,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Fo(e,t),e=t.pendingProps;var o=Zn(t,Me.current);Jn(t,n),o=Ji(null,t,r,e,o,n);var s=Xi();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ke(r)?(s=!0,ta(t)):s=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Vi(t),o.updater=Na,t.stateNode=o,o._reactInternals=t,Ys(t,r,e,n),t=Xs(null,t,r,!0,s,n)):(t.tag=0,ue&&s&&Fi(t),Fe(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Fo(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=ch(r),e=ht(r,e),o){case 0:t=Js(null,t,r,e,n);break e;case 1:t=gc(null,t,r,e,n);break e;case 11:t=pc(null,t,r,e,n);break e;case 14:t=hc(null,t,r,ht(r.type,e),n);break e}throw Error(M(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ht(r,o),Js(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ht(r,o),gc(e,t,r,o,n);case 3:e:{if(Od(t),e===null)throw Error(M(387));r=t.pendingProps,s=t.memoizedState,o=s.element,fd(e,t),sa(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){o=rr(Error(M(423)),t),t=vc(e,t,r,n,o);break e}else if(r!==o){o=rr(Error(M(424)),t),t=vc(e,t,r,n,o);break e}else for(Xe=nn(t.stateNode.containerInfo.firstChild),qe=t,ue=!0,vt=null,n=ud(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(er(),r===o){t=Bt(e,t,n);break e}Fe(e,t,r,n)}t=t.child}return t;case 5:return md(t),e===null&&Vs(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,i=o.children,Bs(r,o)?i=null:s!==null&&Bs(r,s)&&(t.flags|=32),Fd(e,t),Fe(e,t,i,n),t.child;case 6:return e===null&&Vs(t),null;case 13:return Bd(e,t,n);case 4:return Ki(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=tr(t,null,r,n):Fe(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ht(r,o),pc(e,t,r,o,n);case 7:return Fe(e,t,t.pendingProps,n),t.child;case 8:return Fe(e,t,t.pendingProps.children,n),t.child;case 12:return Fe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,s=t.memoizedProps,i=o.value,ie(oa,r._currentValue),r._currentValue=i,s!==null)if(wt(s.value,i)){if(s.children===o.children&&!Ve.current){t=Bt(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=Lt(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?c.next=c:(c.next=p.next,p.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ks(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(M(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Ks(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}Fe(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Jn(t,n),o=lt(o),r=r(o),t.flags|=1,Fe(e,t,r,n),t.child;case 14:return r=t.type,o=ht(r,t.pendingProps),o=ht(r.type,o),hc(e,t,r,o,n);case 15:return Ld(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ht(r,o),Fo(e,t),t.tag=1,Ke(r)?(e=!0,ta(t)):e=!1,Jn(t,n),_d(t,r,o),Ys(t,r,o,n),Xs(null,t,r,!0,e,n);case 19:return Dd(e,t,n);case 22:return Md(e,t,n)}throw Error(M(156,t.tag))};function rf(e,t){return Tu(e,t)}function lh(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 st(e,t,n,r){return new lh(e,t,n,r)}function il(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ch(e){if(typeof e=="function")return il(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ni)return 11;if(e===Ei)return 14}return 2}function sn(e,t){var n=e.alternate;return n===null?(n=st(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 Do(e,t,n,r,o,s){var i=2;if(r=e,typeof e=="function")il(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case $n:return Cn(n.children,o,s,t);case bi:i=8,o|=8;break;case ys:return e=st(12,n,t,o|2),e.elementType=ys,e.lanes=s,e;case xs:return e=st(13,n,t,o),e.elementType=xs,e.lanes=s,e;case ws:return e=st(19,n,t,o),e.elementType=ws,e.lanes=s,e;case mu:return Pa(n,o,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case du:i=10;break e;case fu:i=9;break e;case Ni:i=11;break e;case Ei:i=14;break e;case Kt:i=16,r=null;break e}throw Error(M(130,e==null?e:typeof e,""))}return t=st(i,n,t,o),t.elementType=e,t.type=r,t.lanes=s,t}function Cn(e,t,n,r){return e=st(7,e,r,t),e.lanes=n,e}function Pa(e,t,n,r){return e=st(22,e,r,t),e.elementType=mu,e.lanes=n,e.stateNode={isHidden:!1},e}function ls(e,t,n){return e=st(6,e,null,t),e.lanes=n,e}function cs(e,t,n){return t=st(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function uh(e,t,n,r,o){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=Wa(0),this.expirationTimes=Wa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wa(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function ll(e,t,n,r,o,s,i,l,c){return e=new uh(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=st(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Vi(s),e}function dh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:An,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function of(e){if(!e)return cn;e=e._reactInternals;e:{if(In(e)!==e||e.tag!==1)throw Error(M(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ke(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(M(171))}if(e.tag===1){var n=e.type;if(Ke(n))return od(e,n,t)}return t}function af(e,t,n,r,o,s,i,l,c){return e=ll(n,r,!0,e,o,s,i,l,c),e.context=of(null),n=e.current,r=Oe(),o=an(n),s=Lt(r,o),s.callback=t??null,rn(n,s,o),e.current.lanes=o,no(e,o,r),Ge(e,r),e}function Ta(e,t,n,r){var o=t.current,s=Oe(),i=an(o);return n=of(n),t.context===null?t.context=n:t.pendingContext=n,t=Lt(s,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=rn(o,t,i),e!==null&&(xt(e,o,i,s),$o(e,o,i)),i}function pa(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 Ec(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cl(e,t){Ec(e,t),(e=e.alternate)&&Ec(e,t)}function fh(){return null}var sf=typeof reportError=="function"?reportError:function(e){console.error(e)};function ul(e){this._internalRoot=e}Ia.prototype.render=ul.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(M(409));Ta(e,t,null,null)};Ia.prototype.unmount=ul.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Pn(function(){Ta(null,e,null,null)}),t[Ft]=null}};function Ia(e){this._internalRoot=e}Ia.prototype.unstable_scheduleHydration=function(e){if(e){var t=Mu();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Qt.length&&t!==0&&t<Qt[n].priority;n++);Qt.splice(n,0,e),n===0&&Ou(e)}};function dl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ra(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function zc(){}function mh(e,t,n,r,o){if(o){if(typeof r=="function"){var s=r;r=function(){var u=pa(i);s.call(u)}}var i=af(t,r,e,0,null,!1,!1,"",zc);return e._reactRootContainer=i,e[Ft]=i.current,Vr(e.nodeType===8?e.parentNode:e),Pn(),i}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var l=r;r=function(){var u=pa(c);l.call(u)}}var c=ll(e,0,!1,null,null,!1,!1,"",zc);return e._reactRootContainer=c,e[Ft]=c.current,Vr(e.nodeType===8?e.parentNode:e),Pn(function(){Ta(t,c,n,r)}),c}function _a(e,t,n,r,o){var s=n._reactRootContainer;if(s){var i=s;if(typeof o=="function"){var l=o;o=function(){var c=pa(i);l.call(c)}}Ta(t,i,e,o)}else i=mh(n,t,e,o,r);return pa(i)}$u=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Cr(t.pendingLanes);n!==0&&(Ti(t,n|1),Ge(t,ve()),!(te&6)&&(or=ve()+500,fn()))}break;case 13:Pn(function(){var r=Ot(e,1);if(r!==null){var o=Oe();xt(r,e,1,o)}}),cl(e,1)}};Ii=function(e){if(e.tag===13){var t=Ot(e,134217728);if(t!==null){var n=Oe();xt(t,e,134217728,n)}cl(e,134217728)}};Lu=function(e){if(e.tag===13){var t=an(e),n=Ot(e,t);if(n!==null){var r=Oe();xt(n,e,t,r)}cl(e,t)}};Mu=function(){return ae};Fu=function(e,t){var n=ae;try{return ae=e,t()}finally{ae=n}};Ts=function(e,t,n){switch(t){case"input":if(ks(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 o=ka(r);if(!o)throw Error(M(90));hu(r),ks(r,o)}}}break;case"textarea":vu(e,n);break;case"select":t=n.value,t!=null&&Kn(e,!!n.multiple,t,!1)}};Cu=ol;bu=Pn;var ph={usingClientEntryPoint:!1,Events:[oo,On,ka,ju,ku,ol]},wr={findFiberByHostInstance:xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hh={bundleType:wr.bundleType,version:wr.version,rendererPackageName:wr.rendererPackageName,rendererConfig:wr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ut.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=zu(e),e===null?null:e.stateNode},findFiberByHostInstance:wr.findFiberByHostInstance||fh,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 No=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!No.isDisabled&&No.supportsFiber)try{xa=No.inject(hh),Nt=No}catch{}}et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ph;et.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!dl(t))throw Error(M(200));return dh(e,t,null,n)};et.createRoot=function(e,t){if(!dl(e))throw Error(M(299));var n=!1,r="",o=sf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ll(e,1,!1,null,null,n,!1,r,o),e[Ft]=t.current,Vr(e.nodeType===8?e.parentNode:e),new ul(t)};et.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(M(188)):(e=Object.keys(e).join(","),Error(M(268,e)));return e=zu(t),e=e===null?null:e.stateNode,e};et.flushSync=function(e){return Pn(e)};et.hydrate=function(e,t,n){if(!Ra(t))throw Error(M(200));return _a(null,e,t,!0,n)};et.hydrateRoot=function(e,t,n){if(!dl(e))throw Error(M(405));var r=n!=null&&n.hydratedSources||null,o=!1,s="",i=sf;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=af(t,null,e,1,n??null,o,!1,s,i),e[Ft]=t.current,Vr(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Ia(t)};et.render=function(e,t,n){if(!Ra(t))throw Error(M(200));return _a(null,e,t,!1,n)};et.unmountComponentAtNode=function(e){if(!Ra(e))throw Error(M(40));return e._reactRootContainer?(Pn(function(){_a(null,null,e,!1,function(){e._reactRootContainer=null,e[Ft]=null})}),!0):!1};et.unstable_batchedUpdates=ol;et.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ra(n))throw Error(M(200));if(e==null||e._reactInternals===void 0)throw Error(M(38));return _a(e,t,n,!1,r)};et.version="18.3.1-next-f1338f8080-20240426";function lf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(lf)}catch(e){console.error(e)}}lf(),iu.exports=et;var cf=iu.exports,uf,Pc=cf;uf=Pc.createRoot,Pc.hydrateRoot;/**
|
|
40
|
+
`+s.stack}return{value:e,source:t,stack:o,digest:null}}function ss(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Qs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Km=typeof WeakMap=="function"?WeakMap:Map;function Ad(e,t,n){n=Lt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){da||(da=!0,ai=r),Qs(e,t)},n}function $d(e,t,n){n=Lt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Qs(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Qs(e,t),typeof r!="function"&&(on===null?on=new Set([this]):on.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function dc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Km;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=sh.bind(null,e,t,n),t.then(e,e))}function fc(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 pc(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,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=Lt(-1,1),t.tag=2,rn(n,t,1))),n.lanes|=1),e)}var Gm=Ut.ReactCurrentOwner,He=!1;function Fe(e,t,n,r){t.child=e===null?ud(t,null,n,r):tr(t,e.child,n,r)}function mc(e,t,n,r,o){n=n.render;var s=t.ref;return Jn(t,o),r=Ji(e,t,n,r,s,o),n=Xi(),e!==null&&!He?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Bt(e,t,o)):(ue&&n&&Fi(t),t.flags|=1,Fe(e,t,r,o),t.child)}function hc(e,t,n,r,o){if(e===null){var s=n.type;return typeof s=="function"&&!il(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,Ld(e,t,s,r,o)):(e=Do(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&o)){var i=s.memoizedProps;if(n=n.compare,n=n!==null?n:Hr,n(i,r)&&e.ref===t.ref)return Bt(e,t,o)}return t.flags|=1,e=sn(s,r),e.ref=t.ref,e.return=t,t.child=e}function Ld(e,t,n,r,o){if(e!==null){var s=e.memoizedProps;if(Hr(s,r)&&e.ref===t.ref)if(He=!1,t.pendingProps=r=s,(e.lanes&o)!==0)e.flags&131072&&(He=!0);else return t.lanes=e.lanes,Bt(e,t,o)}return Js(e,t,n,r,o)}function Md(e,t,n){var r=t.pendingProps,o=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},ie(Vn,Qe),Qe|=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,ie(Vn,Qe),Qe|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,ie(Vn,Qe),Qe|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,ie(Vn,Qe),Qe|=r;return Fe(e,t,o,n),t.child}function Fd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Js(e,t,n,r,o){var s=Ke(n)?bn:Me.current;return s=Zn(t,s),Jn(t,o),n=Ji(e,t,n,r,s,o),r=Xi(),e!==null&&!He?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Bt(e,t,o)):(ue&&r&&Fi(t),t.flags|=1,Fe(e,t,n,o),t.child)}function gc(e,t,n,r,o){if(Ke(n)){var s=!0;ta(t)}else s=!1;if(Jn(t,o),t.stateNode===null)Fo(e,t),_d(t,n,r),Ys(t,n,r,o),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=lt(u):(u=Ke(n)?bn:Me.current,u=Zn(t,u));var m=n.getDerivedStateFromProps,f=typeof m=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==r||c!==u)&&uc(t,i,r,u),Gt=!1;var v=t.memoizedState;i.state=v,sa(t,r,i,o),c=t.memoizedState,l!==r||v!==c||Ve.current||Gt?(typeof m=="function"&&(Gs(t,n,m,r),c=t.memoizedState),(l=Gt||cc(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,fd(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:ht(t.type,l),i.props=u,f=t.pendingProps,v=i.context,c=n.contextType,typeof c=="object"&&c!==null?c=lt(c):(c=Ke(n)?bn:Me.current,c=Zn(t,c));var y=n.getDerivedStateFromProps;(m=typeof y=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==f||v!==c)&&uc(t,i,r,c),Gt=!1,v=t.memoizedState,i.state=v,sa(t,r,i,o);var x=t.memoizedState;l!==f||v!==x||Ve.current||Gt?(typeof y=="function"&&(Gs(t,n,y,r),x=t.memoizedState),(u=Gt||cc(t,n,u,r,v,x,c)||!1)?(m||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 Xs(e,t,n,r,s,o)}function Xs(e,t,n,r,o,s){Fd(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return o&&tc(t,n,!1),Bt(e,t,s);r=t.stateNode,Gm.current=t;var l=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=tr(t,e.child,null,s),t.child=tr(t,null,l,s)):Fe(e,t,l,s),t.memoizedState=r.state,o&&tc(t,n,!0),t.child}function Od(e){var t=e.stateNode;t.pendingContext?ec(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ec(e,t.context,!1),Ki(e,t.containerInfo)}function vc(e,t,n,r,o){return er(),Bi(o),t.flags|=256,Fe(e,t,n,r),t.child}var qs={dehydrated:null,treeContext:null,retryLane:0};function Zs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Bd(e,t,n){var r=t.pendingProps,o=pe.current,s=!1,i=(t.flags&128)!==0,l;if((l=i)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),ie(pe,o&1),e===null)return Vs(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=Pa(i,r,0,null),e=Cn(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Zs(n),t.memoizedState=qs,e):el(t,i));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return Ym(e,t,i,r,l,o,n);if(s){s=r.fallback,i=t.mode,o=e.child,l=o.sibling;var c={mode:"hidden",children:r.children};return!(i&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=sn(o,c),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?s=sn(l,s):(s=Cn(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?Zs(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},s.memoizedState=i,s.childLanes=e.childLanes&~n,t.memoizedState=qs,r}return s=e.child,e=s.sibling,r=sn(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 el(e,t){return t=Pa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ko(e,t,n,r){return r!==null&&Bi(r),tr(t,e.child,null,n),e=el(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Ym(e,t,n,r,o,s,i){if(n)return t.flags&256?(t.flags&=-257,r=ss(Error(M(422))),ko(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,o=t.mode,r=Pa({mode:"visible",children:r.children},o,0,null),s=Cn(s,o,i,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&tr(t,e.child,null,i),t.child.memoizedState=Zs(i),t.memoizedState=qs,s);if(!(t.mode&1))return ko(e,t,i,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(M(419)),r=ss(s,r,void 0),ko(e,t,i,r)}if(l=(i&e.childLanes)!==0,He||l){if(r=Ne,r!==null){switch(i&-i){case 4:o=2;break;case 16:o=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:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|i)?0:o,o!==0&&o!==s.retryLane&&(s.retryLane=o,Ot(e,o),xt(r,e,o,-1))}return sl(),r=ss(Error(M(421))),ko(e,t,i,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=ih.bind(null,e),o._reactRetry=t,null):(e=s.treeContext,Xe=nn(o.nextSibling),qe=t,ue=!0,vt=null,e!==null&&(ot[at++]=_t,ot[at++]=At,ot[at++]=Nn,_t=e.id,At=e.overflow,Nn=t),t=el(t,r.children),t.flags|=4096,t)}function yc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ks(e.return,t,n)}function is(e,t,n,r,o){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=o)}function Dd(e,t,n){var r=t.pendingProps,o=r.revealOrder,s=r.tail;if(Fe(e,t,r.children,n),r=pe.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&&yc(e,n,t);else if(e.tag===19)yc(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(ie(pe,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&ia(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),is(t,!1,o,n,s);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&ia(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}is(t,!0,n,null,s);break;case"together":is(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Fo(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Bt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),zn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(M(153));if(t.child!==null){for(e=t.child,n=sn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=sn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Qm(e,t,n){switch(t.tag){case 3:Od(t),er();break;case 5:pd(t);break;case 1:Ke(t.type)&&ta(t);break;case 4:Ki(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;ie(oa,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(ie(pe,pe.current&1),t.flags|=128,null):n&t.child.childLanes?Bd(e,t,n):(ie(pe,pe.current&1),e=Bt(e,t,n),e!==null?e.sibling:null);ie(pe,pe.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Dd(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),ie(pe,pe.current),r)break;return null;case 22:case 23:return t.lanes=0,Md(e,t,n)}return Bt(e,t,n)}var Ud,ei,Wd,Hd;Ud=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}};ei=function(){};Wd=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Sn(Et.current);var s=null;switch(n){case"input":o=js(e,o),r=js(e,r),s=[];break;case"select":o=he({},o,{value:void 0}),r=he({},r,{value:void 0}),s=[];break;case"textarea":o=bs(e,o),r=bs(e,r),s=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Zo)}Es(n,r);var i;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var l=o[u];for(i in l)l.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Mr.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var c=r[u];if(l=o!=null?o[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"&&(Mr.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&le("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)}};Hd=function(e,t,n,r){n!==r&&(t.flags|=4)};function xr(e,t){if(!ue)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 $e(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Jm(e,t,n){var r=t.pendingProps;switch(Oi(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $e(t),null;case 1:return Ke(t.type)&&ea(),$e(t),null;case 3:return r=t.stateNode,nr(),ce(Ve),ce(Me),Yi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(So(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,vt!==null&&(li(vt),vt=null))),ei(e,t),$e(t),null;case 5:Gi(t);var o=Sn(Qr.current);if(n=t.type,e!==null&&t.stateNode!=null)Wd(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(M(166));return $e(t),null}if(e=Sn(Et.current),So(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[bt]=t,r[Gr]=s,e=(t.mode&1)!==0,n){case"dialog":le("cancel",r),le("close",r);break;case"iframe":case"object":case"embed":le("load",r);break;case"video":case"audio":for(o=0;o<br.length;o++)le(br[o],r);break;case"source":le("error",r);break;case"img":case"image":case"link":le("error",r),le("load",r);break;case"details":le("toggle",r);break;case"input":El(r,s),le("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},le("invalid",r);break;case"textarea":Pl(r,s),le("invalid",r)}Es(n,s),o=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&&wo(r.textContent,l,e),o=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&wo(r.textContent,l,e),o=["children",""+l]):Mr.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&le("scroll",r)}switch(n){case"input":fo(r),zl(r,s,!0);break;case"textarea":fo(r),Tl(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=Zo)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=yu(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[bt]=t,e[Gr]=r,Ud(e,t,!1,!1),t.stateNode=e;e:{switch(i=zs(n,r),n){case"dialog":le("cancel",e),le("close",e),o=r;break;case"iframe":case"object":case"embed":le("load",e),o=r;break;case"video":case"audio":for(o=0;o<br.length;o++)le(br[o],e);o=r;break;case"source":le("error",e),o=r;break;case"img":case"image":case"link":le("error",e),le("load",e),o=r;break;case"details":le("toggle",e),o=r;break;case"input":El(e,r),o=js(e,r),le("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=he({},r,{value:void 0}),le("invalid",e);break;case"textarea":Pl(e,r),o=bs(e,r),le("invalid",e);break;default:o=r}Es(n,o),l=o;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];s==="style"?Su(e,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&xu(e,c)):s==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Fr(e,c):typeof c=="number"&&Fr(e,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Mr.hasOwnProperty(s)?c!=null&&s==="onScroll"&&le("scroll",e):c!=null&&Ci(e,s,c,i))}switch(n){case"input":fo(e),zl(e,r,!1);break;case"textarea":fo(e),Tl(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ln(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Kn(e,!!r.multiple,s,!1):r.defaultValue!=null&&Kn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Zo)}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 $e(t),null;case 6:if(e&&t.stateNode!=null)Hd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(M(166));if(n=Sn(Qr.current),Sn(Et.current),So(t)){if(r=t.stateNode,n=t.memoizedProps,r[bt]=t,(s=r.nodeValue!==n)&&(e=qe,e!==null))switch(e.tag){case 3:wo(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&wo(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[bt]=t,t.stateNode=r}return $e(t),null;case 13:if(ce(pe),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ue&&Xe!==null&&t.mode&1&&!(t.flags&128))ld(),er(),t.flags|=98560,s=!1;else if(s=So(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(M(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(M(317));s[bt]=t}else er(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;$e(t),s=!1}else vt!==null&&(li(vt),vt=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||pe.current&1?Se===0&&(Se=3):sl())),t.updateQueue!==null&&(t.flags|=4),$e(t),null);case 4:return nr(),ei(e,t),e===null&&Vr(t.stateNode.containerInfo),$e(t),null;case 10:return Wi(t.type._context),$e(t),null;case 17:return Ke(t.type)&&ea(),$e(t),null;case 19:if(ce(pe),s=t.memoizedState,s===null)return $e(t),null;if(r=(t.flags&128)!==0,i=s.rendering,i===null)if(r)xr(s,!1);else{if(Se!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=ia(e),i!==null){for(t.flags|=128,xr(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 ie(pe,pe.current&1|2),t.child}e=e.sibling}s.tail!==null&&ve()>or&&(t.flags|=128,r=!0,xr(s,!1),t.lanes=4194304)}else{if(!r)if(e=ia(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),xr(s,!0),s.tail===null&&s.tailMode==="hidden"&&!i.alternate&&!ue)return $e(t),null}else 2*ve()-s.renderingStartTime>or&&n!==1073741824&&(t.flags|=128,r=!0,xr(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=ve(),t.sibling=null,n=pe.current,ie(pe,r?n&1|2:n&1),t):($e(t),null);case 22:case 23:return al(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Qe&1073741824&&($e(t),t.subtreeFlags&6&&(t.flags|=8192)):$e(t),null;case 24:return null;case 25:return null}throw Error(M(156,t.tag))}function Xm(e,t){switch(Oi(t),t.tag){case 1:return Ke(t.type)&&ea(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return nr(),ce(Ve),ce(Me),Yi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Gi(t),null;case 13:if(ce(pe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(M(340));er()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ce(pe),null;case 4:return nr(),null;case 10:return Wi(t.type._context),null;case 22:case 23:return al(),null;case 24:return null;default:return null}}var Co=!1,Le=!1,qm=typeof WeakSet=="function"?WeakSet:Set,K=null;function Hn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ge(e,t,r)}else n.current=null}function ti(e,t,n){try{n()}catch(r){ge(e,t,r)}}var xc=!1;function Zm(e,t){if(Fs=Jo,e=Qu(),Mi(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 o=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,m=0,f=e,v=null;t:for(;;){for(var y;f!==n||o!==0&&f.nodeType!==3||(l=i+o),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===o&&(l=i),v===s&&++m===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(Os={focusedElem:e,selectionRange:n},Jo=!1,K=t;K!==null;)if(t=K,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;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,h=t.stateNode,p=h.getSnapshotBeforeUpdate(t.elementType===t.type?w:ht(t.type,w),j);h.__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(M(163))}}catch(S){ge(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return x=xc,xc=!1,x}function _r(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var s=o.destroy;o.destroy=void 0,s!==void 0&&ti(t,n,s)}o=o.next}while(o!==r)}}function Ea(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 ni(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 Vd(e){var t=e.alternate;t!==null&&(e.alternate=null,Vd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[bt],delete t[Gr],delete t[Us],delete t[$m],delete t[Lm])),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 Kd(e){return e.tag===5||e.tag===3||e.tag===4}function wc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Kd(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 ri(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=Zo));else if(r!==4&&(e=e.child,e!==null))for(ri(e,t,n),e=e.sibling;e!==null;)ri(e,t,n),e=e.sibling}function oi(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(oi(e,t,n),e=e.sibling;e!==null;)oi(e,t,n),e=e.sibling}var Te=null,gt=!1;function Vt(e,t,n){for(n=n.child;n!==null;)Gd(e,t,n),n=n.sibling}function Gd(e,t,n){if(Nt&&typeof Nt.onCommitFiberUnmount=="function")try{Nt.onCommitFiberUnmount(xa,n)}catch{}switch(n.tag){case 5:Le||Hn(n,t);case 6:var r=Te,o=gt;Te=null,Vt(e,t,n),Te=r,gt=o,Te!==null&&(gt?(e=Te,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Te.removeChild(n.stateNode));break;case 18:Te!==null&&(gt?(e=Te,n=n.stateNode,e.nodeType===8?es(e.parentNode,n):e.nodeType===1&&es(e,n),Ur(e)):es(Te,n.stateNode));break;case 4:r=Te,o=gt,Te=n.stateNode.containerInfo,gt=!0,Vt(e,t,n),Te=r,gt=o;break;case 0:case 11:case 14:case 15:if(!Le&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var s=o,i=s.destroy;s=s.tag,i!==void 0&&(s&2||s&4)&&ti(n,t,i),o=o.next}while(o!==r)}Vt(e,t,n);break;case 1:if(!Le&&(Hn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ge(n,t,l)}Vt(e,t,n);break;case 21:Vt(e,t,n);break;case 22:n.mode&1?(Le=(r=Le)||n.memoizedState!==null,Vt(e,t,n),Le=r):Vt(e,t,n);break;default:Vt(e,t,n)}}function Sc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new qm),t.forEach(function(r){var o=lh.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function mt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var s=e,i=t,l=i;e:for(;l!==null;){switch(l.tag){case 5:Te=l.stateNode,gt=!1;break e;case 3:Te=l.stateNode.containerInfo,gt=!0;break e;case 4:Te=l.stateNode.containerInfo,gt=!0;break e}l=l.return}if(Te===null)throw Error(M(160));Gd(s,i,o),Te=null,gt=!1;var c=o.alternate;c!==null&&(c.return=null),o.return=null}catch(u){ge(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Yd(t,e),t=t.sibling}function Yd(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(mt(t,e),jt(e),r&4){try{_r(3,e,e.return),Ea(3,e)}catch(w){ge(e,e.return,w)}try{_r(5,e,e.return)}catch(w){ge(e,e.return,w)}}break;case 1:mt(t,e),jt(e),r&512&&n!==null&&Hn(n,n.return);break;case 5:if(mt(t,e),jt(e),r&512&&n!==null&&Hn(n,n.return),e.flags&32){var o=e.stateNode;try{Fr(o,"")}catch(w){ge(e,e.return,w)}}if(r&4&&(o=e.stateNode,o!=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&&gu(o,s),zs(l,i);var u=zs(l,s);for(i=0;i<c.length;i+=2){var m=c[i],f=c[i+1];m==="style"?Su(o,f):m==="dangerouslySetInnerHTML"?xu(o,f):m==="children"?Fr(o,f):Ci(o,m,f,u)}switch(l){case"input":ks(o,s);break;case"textarea":vu(o,s);break;case"select":var v=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!s.multiple;var y=s.value;y!=null?Kn(o,!!s.multiple,y,!1):v!==!!s.multiple&&(s.defaultValue!=null?Kn(o,!!s.multiple,s.defaultValue,!0):Kn(o,!!s.multiple,s.multiple?[]:"",!1))}o[Gr]=s}catch(w){ge(e,e.return,w)}}break;case 6:if(mt(t,e),jt(e),r&4){if(e.stateNode===null)throw Error(M(162));o=e.stateNode,s=e.memoizedProps;try{o.nodeValue=s}catch(w){ge(e,e.return,w)}}break;case 3:if(mt(t,e),jt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ur(t.containerInfo)}catch(w){ge(e,e.return,w)}break;case 4:mt(t,e),jt(e);break;case 13:mt(t,e),jt(e),o=e.child,o.flags&8192&&(s=o.memoizedState!==null,o.stateNode.isHidden=s,!s||o.alternate!==null&&o.alternate.memoizedState!==null||(rl=ve())),r&4&&Sc(e);break;case 22:if(m=n!==null&&n.memoizedState!==null,e.mode&1?(Le=(u=Le)||m,mt(t,e),Le=u):mt(t,e),jt(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!m&&e.mode&1)for(K=e,m=e.child;m!==null;){for(f=K=m;K!==null;){switch(v=K,y=v.child,v.tag){case 0:case 11:case 14:case 15:_r(4,v,v.return);break;case 1:Hn(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){ge(r,n,w)}}break;case 5:Hn(v,v.return);break;case 22:if(v.memoizedState!==null){kc(f);continue}}y!==null?(y.return=v,K=y):kc(f)}m=m.sibling}e:for(m=null,f=e;;){if(f.tag===5){if(m===null){m=f;try{o=f.stateNode,u?(s=o.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=wu("display",i))}catch(w){ge(e,e.return,w)}}}else if(f.tag===6){if(m===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(w){ge(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;m===f&&(m=null),f=f.return}m===f&&(m=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:mt(t,e),jt(e),r&4&&Sc(e);break;case 21:break;default:mt(t,e),jt(e)}}function jt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Kd(n)){var r=n;break e}n=n.return}throw Error(M(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Fr(o,""),r.flags&=-33);var s=wc(e);oi(e,s,o);break;case 3:case 4:var i=r.stateNode.containerInfo,l=wc(e);ri(e,l,i);break;default:throw Error(M(161))}}catch(c){ge(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function eh(e,t,n){K=e,Qd(e)}function Qd(e,t,n){for(var r=(e.mode&1)!==0;K!==null;){var o=K,s=o.child;if(o.tag===22&&r){var i=o.memoizedState!==null||Co;if(!i){var l=o.alternate,c=l!==null&&l.memoizedState!==null||Le;l=Co;var u=Le;if(Co=i,(Le=c)&&!u)for(K=o;K!==null;)i=K,c=i.child,i.tag===22&&i.memoizedState!==null?Cc(o):c!==null?(c.return=i,K=c):Cc(o);for(;s!==null;)K=s,Qd(s),s=s.sibling;K=o,Co=l,Le=u}jc(e)}else o.subtreeFlags&8772&&s!==null?(s.return=o,K=s):jc(e)}}function jc(e){for(;K!==null;){var t=K;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Le||Ea(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Le)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:ht(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&sc(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}sc(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 m=u.memoizedState;if(m!==null){var f=m.dehydrated;f!==null&&Ur(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(M(163))}Le||t.flags&512&&ni(t)}catch(v){ge(t,t.return,v)}}if(t===e){K=null;break}if(n=t.sibling,n!==null){n.return=t.return,K=n;break}K=t.return}}function kc(e){for(;K!==null;){var t=K;if(t===e){K=null;break}var n=t.sibling;if(n!==null){n.return=t.return,K=n;break}K=t.return}}function Cc(e){for(;K!==null;){var t=K;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Ea(4,t)}catch(c){ge(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(c){ge(t,o,c)}}var s=t.return;try{ni(t)}catch(c){ge(t,s,c)}break;case 5:var i=t.return;try{ni(t)}catch(c){ge(t,i,c)}}}catch(c){ge(t,t.return,c)}if(t===e){K=null;break}var l=t.sibling;if(l!==null){l.return=t.return,K=l;break}K=t.return}}var th=Math.ceil,ua=Ut.ReactCurrentDispatcher,tl=Ut.ReactCurrentOwner,it=Ut.ReactCurrentBatchConfig,te=0,Ne=null,ye=null,Ie=0,Qe=0,Vn=dn(0),Se=0,Zr=null,zn=0,za=0,nl=0,Ar=null,We=null,rl=0,or=1/0,It=null,da=!1,ai=null,on=null,bo=!1,qt=null,fa=0,$r=0,si=null,Oo=-1,Bo=0;function Oe(){return te&6?ve():Oo!==-1?Oo:Oo=ve()}function an(e){return e.mode&1?te&2&&Ie!==0?Ie&-Ie:Fm.transition!==null?(Bo===0&&(Bo=_u()),Bo):(e=ae,e!==0||(e=window.event,e=e===void 0?16:Bu(e.type)),e):1}function xt(e,t,n,r){if(50<$r)throw $r=0,si=null,Error(M(185));no(e,n,r),(!(te&2)||e!==Ne)&&(e===Ne&&(!(te&2)&&(za|=n),Se===4&&Jt(e,Ie)),Ge(e,r),n===1&&te===0&&!(t.mode&1)&&(or=ve()+500,Ca&&fn()))}function Ge(e,t){var n=e.callbackNode;Fp(e,t);var r=Qo(e,e===Ne?Ie:0);if(r===0)n!==null&&_l(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&_l(n),t===1)e.tag===0?Mm(bc.bind(null,e)):ad(bc.bind(null,e)),_m(function(){!(te&6)&&fn()}),n=null;else{switch(Au(r)){case 1:n=Pi;break;case 4:n=Iu;break;case 16:n=Yo;break;case 536870912:n=Ru;break;default:n=Yo}n=rf(n,Jd.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Jd(e,t){if(Oo=-1,Bo=0,te&6)throw Error(M(327));var n=e.callbackNode;if(Xn()&&e.callbackNode!==n)return null;var r=Qo(e,e===Ne?Ie:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=pa(e,r);else{t=r;var o=te;te|=2;var s=qd();(Ne!==e||Ie!==t)&&(It=null,or=ve()+500,kn(e,t));do try{oh();break}catch(l){Xd(e,l)}while(!0);Ui(),ua.current=s,te=o,ye!==null?t=0:(Ne=null,Ie=0,t=Se)}if(t!==0){if(t===2&&(o=_s(e),o!==0&&(r=o,t=ii(e,o))),t===1)throw n=Zr,kn(e,0),Jt(e,r),Ge(e,ve()),n;if(t===6)Jt(e,r);else{if(o=e.current.alternate,!(r&30)&&!nh(o)&&(t=pa(e,r),t===2&&(s=_s(e),s!==0&&(r=s,t=ii(e,s))),t===1))throw n=Zr,kn(e,0),Jt(e,r),Ge(e,ve()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(M(345));case 2:vn(e,We,It);break;case 3:if(Jt(e,r),(r&130023424)===r&&(t=rl+500-ve(),10<t)){if(Qo(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Oe(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Ds(vn.bind(null,e,We,It),t);break}vn(e,We,It);break;case 4:if(Jt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var i=31-yt(r);s=1<<i,i=t[i],i>o&&(o=i),r&=~s}if(r=o,r=ve()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*th(r/1960))-r,10<r){e.timeoutHandle=Ds(vn.bind(null,e,We,It),r);break}vn(e,We,It);break;case 5:vn(e,We,It);break;default:throw Error(M(329))}}}return Ge(e,ve()),e.callbackNode===n?Jd.bind(null,e):null}function ii(e,t){var n=Ar;return e.current.memoizedState.isDehydrated&&(kn(e,t).flags|=256),e=pa(e,t),e!==2&&(t=We,We=n,t!==null&&li(t)),e}function li(e){We===null?We=e:We.push.apply(We,e)}function nh(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 o=n[r],s=o.getSnapshot;o=o.value;try{if(!wt(s(),o))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 Jt(e,t){for(t&=~nl,t&=~za,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-yt(t),r=1<<n;e[n]=-1,t&=~r}}function bc(e){if(te&6)throw Error(M(327));Xn();var t=Qo(e,0);if(!(t&1))return Ge(e,ve()),null;var n=pa(e,t);if(e.tag!==0&&n===2){var r=_s(e);r!==0&&(t=r,n=ii(e,r))}if(n===1)throw n=Zr,kn(e,0),Jt(e,t),Ge(e,ve()),n;if(n===6)throw Error(M(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,vn(e,We,It),Ge(e,ve()),null}function ol(e,t){var n=te;te|=1;try{return e(t)}finally{te=n,te===0&&(or=ve()+500,Ca&&fn())}}function Pn(e){qt!==null&&qt.tag===0&&!(te&6)&&Xn();var t=te;te|=1;var n=it.transition,r=ae;try{if(it.transition=null,ae=1,e)return e()}finally{ae=r,it.transition=n,te=t,!(te&6)&&fn()}}function al(){Qe=Vn.current,ce(Vn)}function kn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Rm(n)),ye!==null)for(n=ye.return;n!==null;){var r=n;switch(Oi(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ea();break;case 3:nr(),ce(Ve),ce(Me),Yi();break;case 5:Gi(r);break;case 4:nr();break;case 13:ce(pe);break;case 19:ce(pe);break;case 10:Wi(r.type._context);break;case 22:case 23:al()}n=n.return}if(Ne=e,ye=e=sn(e.current,null),Ie=Qe=t,Se=0,Zr=null,nl=za=zn=0,We=Ar=null,wn!==null){for(t=0;t<wn.length;t++)if(n=wn[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,s=n.pending;if(s!==null){var i=s.next;s.next=o,r.next=i}n.pending=r}wn=null}return e}function Xd(e,t){do{var n=ye;try{if(Ui(),Lo.current=ca,la){for(var r=me.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}la=!1}if(En=0,be=we=me=null,Rr=!1,Jr=0,tl.current=null,n===null||n.return===null){Se=1,Zr=t,ye=null;break}e:{var s=e,i=n.return,l=n,c=t;if(t=Ie,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,m=l,f=m.tag;if(!(m.mode&1)&&(f===0||f===11||f===15)){var v=m.alternate;v?(m.updateQueue=v.updateQueue,m.memoizedState=v.memoizedState,m.lanes=v.lanes):(m.updateQueue=null,m.memoizedState=null)}var y=fc(i);if(y!==null){y.flags&=-257,pc(y,i,l,s,t),y.mode&1&&dc(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)){dc(s,u,t),sl();break e}c=Error(M(426))}}else if(ue&&l.mode&1){var j=fc(i);if(j!==null){!(j.flags&65536)&&(j.flags|=256),pc(j,i,l,s,t),Bi(rr(c,l));break e}}s=c=rr(c,l),Se!==4&&(Se=2),Ar===null?Ar=[s]:Ar.push(s),s=i;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var h=Ad(s,c,t);ac(s,h);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"&&(on===null||!on.has(g)))){s.flags|=65536,t&=-t,s.lanes|=t;var S=$d(s,l,t);ac(s,S);break e}}s=s.return}while(s!==null)}ef(n)}catch(E){t=E,ye===n&&n!==null&&(ye=n=n.return);continue}break}while(!0)}function qd(){var e=ua.current;return ua.current=ca,e===null?ca:e}function sl(){(Se===0||Se===3||Se===2)&&(Se=4),Ne===null||!(zn&268435455)&&!(za&268435455)||Jt(Ne,Ie)}function pa(e,t){var n=te;te|=2;var r=qd();(Ne!==e||Ie!==t)&&(It=null,kn(e,t));do try{rh();break}catch(o){Xd(e,o)}while(!0);if(Ui(),te=n,ua.current=r,ye!==null)throw Error(M(261));return Ne=null,Ie=0,Se}function rh(){for(;ye!==null;)Zd(ye)}function oh(){for(;ye!==null&&!Pp();)Zd(ye)}function Zd(e){var t=nf(e.alternate,e,Qe);e.memoizedProps=e.pendingProps,t===null?ef(e):ye=t,tl.current=null}function ef(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Xm(n,t),n!==null){n.flags&=32767,ye=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Se=6,ye=null;return}}else if(n=Jm(n,t,Qe),n!==null){ye=n;return}if(t=t.sibling,t!==null){ye=t;return}ye=t=e}while(t!==null);Se===0&&(Se=5)}function vn(e,t,n){var r=ae,o=it.transition;try{it.transition=null,ae=1,ah(e,t,n,r)}finally{it.transition=o,ae=r}return null}function ah(e,t,n,r){do Xn();while(qt!==null);if(te&6)throw Error(M(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(M(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(Op(e,s),e===Ne&&(ye=Ne=null,Ie=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||bo||(bo=!0,rf(Yo,function(){return Xn(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=it.transition,it.transition=null;var i=ae;ae=1;var l=te;te|=4,tl.current=null,Zm(e,n),Yd(n,e),bm(Os),Jo=!!Fs,Os=Fs=null,e.current=n,eh(n),Tp(),te=l,ae=i,it.transition=s}else e.current=n;if(bo&&(bo=!1,qt=e,fa=o),s=e.pendingLanes,s===0&&(on=null),_p(n.stateNode),Ge(e,ve()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(da)throw da=!1,e=ai,ai=null,e;return fa&1&&e.tag!==0&&Xn(),s=e.pendingLanes,s&1?e===si?$r++:($r=0,si=e):$r=0,fn(),null}function Xn(){if(qt!==null){var e=Au(fa),t=it.transition,n=ae;try{if(it.transition=null,ae=16>e?16:e,qt===null)var r=!1;else{if(e=qt,qt=null,fa=0,te&6)throw Error(M(331));var o=te;for(te|=4,K=e.current;K!==null;){var s=K,i=s.child;if(K.flags&16){var l=s.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(K=u;K!==null;){var m=K;switch(m.tag){case 0:case 11:case 15:_r(8,m,s)}var f=m.child;if(f!==null)f.return=m,K=f;else for(;K!==null;){m=K;var v=m.sibling,y=m.return;if(Vd(m),m===u){K=null;break}if(v!==null){v.return=y,K=v;break}K=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)}}K=s}}if(s.subtreeFlags&2064&&i!==null)i.return=s,K=i;else e:for(;K!==null;){if(s=K,s.flags&2048)switch(s.tag){case 0:case 11:case 15:_r(9,s,s.return)}var h=s.sibling;if(h!==null){h.return=s.return,K=h;break e}K=s.return}}var p=e.current;for(K=p;K!==null;){i=K;var g=i.child;if(i.subtreeFlags&2064&&g!==null)g.return=i,K=g;else e:for(i=p;K!==null;){if(l=K,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Ea(9,l)}}catch(E){ge(l,l.return,E)}if(l===i){K=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,K=S;break e}K=l.return}}if(te=o,fn(),Nt&&typeof Nt.onPostCommitFiberRoot=="function")try{Nt.onPostCommitFiberRoot(xa,e)}catch{}r=!0}return r}finally{ae=n,it.transition=t}}return!1}function Nc(e,t,n){t=rr(n,t),t=Ad(e,t,1),e=rn(e,t,1),t=Oe(),e!==null&&(no(e,1,t),Ge(e,t))}function ge(e,t,n){if(e.tag===3)Nc(e,e,n);else for(;t!==null;){if(t.tag===3){Nc(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(on===null||!on.has(r))){e=rr(n,e),e=$d(t,e,1),t=rn(t,e,1),e=Oe(),t!==null&&(no(t,1,e),Ge(t,e));break}}t=t.return}}function sh(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Oe(),e.pingedLanes|=e.suspendedLanes&n,Ne===e&&(Ie&n)===n&&(Se===4||Se===3&&(Ie&130023424)===Ie&&500>ve()-rl?kn(e,0):nl|=n),Ge(e,t)}function tf(e,t){t===0&&(e.mode&1?(t=ho,ho<<=1,!(ho&130023424)&&(ho=4194304)):t=1);var n=Oe();e=Ot(e,t),e!==null&&(no(e,t,n),Ge(e,n))}function ih(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),tf(e,n)}function lh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(M(314))}r!==null&&r.delete(t),tf(e,n)}var nf;nf=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ve.current)He=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return He=!1,Qm(e,t,n);He=!!(e.flags&131072)}else He=!1,ue&&t.flags&1048576&&sd(t,ra,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Fo(e,t),e=t.pendingProps;var o=Zn(t,Me.current);Jn(t,n),o=Ji(null,t,r,e,o,n);var s=Xi();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ke(r)?(s=!0,ta(t)):s=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Vi(t),o.updater=Na,t.stateNode=o,o._reactInternals=t,Ys(t,r,e,n),t=Xs(null,t,r,!0,s,n)):(t.tag=0,ue&&s&&Fi(t),Fe(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Fo(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=uh(r),e=ht(r,e),o){case 0:t=Js(null,t,r,e,n);break e;case 1:t=gc(null,t,r,e,n);break e;case 11:t=mc(null,t,r,e,n);break e;case 14:t=hc(null,t,r,ht(r.type,e),n);break e}throw Error(M(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ht(r,o),Js(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ht(r,o),gc(e,t,r,o,n);case 3:e:{if(Od(t),e===null)throw Error(M(387));r=t.pendingProps,s=t.memoizedState,o=s.element,fd(e,t),sa(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){o=rr(Error(M(423)),t),t=vc(e,t,r,n,o);break e}else if(r!==o){o=rr(Error(M(424)),t),t=vc(e,t,r,n,o);break e}else for(Xe=nn(t.stateNode.containerInfo.firstChild),qe=t,ue=!0,vt=null,n=ud(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(er(),r===o){t=Bt(e,t,n);break e}Fe(e,t,r,n)}t=t.child}return t;case 5:return pd(t),e===null&&Vs(t),r=t.type,o=t.pendingProps,s=e!==null?e.memoizedProps:null,i=o.children,Bs(r,o)?i=null:s!==null&&Bs(r,s)&&(t.flags|=32),Fd(e,t),Fe(e,t,i,n),t.child;case 6:return e===null&&Vs(t),null;case 13:return Bd(e,t,n);case 4:return Ki(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=tr(t,null,r,n):Fe(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ht(r,o),mc(e,t,r,o,n);case 7:return Fe(e,t,t.pendingProps,n),t.child;case 8:return Fe(e,t,t.pendingProps.children,n),t.child;case 12:return Fe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,s=t.memoizedProps,i=o.value,ie(oa,r._currentValue),r._currentValue=i,s!==null)if(wt(s.value,i)){if(s.children===o.children&&!Ve.current){t=Bt(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=Lt(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var m=u.pending;m===null?c.next=c:(c.next=m.next,m.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ks(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(M(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Ks(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}Fe(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Jn(t,n),o=lt(o),r=r(o),t.flags|=1,Fe(e,t,r,n),t.child;case 14:return r=t.type,o=ht(r,t.pendingProps),o=ht(r.type,o),hc(e,t,r,o,n);case 15:return Ld(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ht(r,o),Fo(e,t),t.tag=1,Ke(r)?(e=!0,ta(t)):e=!1,Jn(t,n),_d(t,r,o),Ys(t,r,o,n),Xs(null,t,r,!0,e,n);case 19:return Dd(e,t,n);case 22:return Md(e,t,n)}throw Error(M(156,t.tag))};function rf(e,t){return Tu(e,t)}function ch(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 st(e,t,n,r){return new ch(e,t,n,r)}function il(e){return e=e.prototype,!(!e||!e.isReactComponent)}function uh(e){if(typeof e=="function")return il(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ni)return 11;if(e===Ei)return 14}return 2}function sn(e,t){var n=e.alternate;return n===null?(n=st(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 Do(e,t,n,r,o,s){var i=2;if(r=e,typeof e=="function")il(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case $n:return Cn(n.children,o,s,t);case bi:i=8,o|=8;break;case ys:return e=st(12,n,t,o|2),e.elementType=ys,e.lanes=s,e;case xs:return e=st(13,n,t,o),e.elementType=xs,e.lanes=s,e;case ws:return e=st(19,n,t,o),e.elementType=ws,e.lanes=s,e;case pu:return Pa(n,o,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case du:i=10;break e;case fu:i=9;break e;case Ni:i=11;break e;case Ei:i=14;break e;case Kt:i=16,r=null;break e}throw Error(M(130,e==null?e:typeof e,""))}return t=st(i,n,t,o),t.elementType=e,t.type=r,t.lanes=s,t}function Cn(e,t,n,r){return e=st(7,e,r,t),e.lanes=n,e}function Pa(e,t,n,r){return e=st(22,e,r,t),e.elementType=pu,e.lanes=n,e.stateNode={isHidden:!1},e}function ls(e,t,n){return e=st(6,e,null,t),e.lanes=n,e}function cs(e,t,n){return t=st(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function dh(e,t,n,r,o){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=Wa(0),this.expirationTimes=Wa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wa(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function ll(e,t,n,r,o,s,i,l,c){return e=new dh(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=st(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Vi(s),e}function fh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:An,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function of(e){if(!e)return cn;e=e._reactInternals;e:{if(In(e)!==e||e.tag!==1)throw Error(M(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ke(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(M(171))}if(e.tag===1){var n=e.type;if(Ke(n))return od(e,n,t)}return t}function af(e,t,n,r,o,s,i,l,c){return e=ll(n,r,!0,e,o,s,i,l,c),e.context=of(null),n=e.current,r=Oe(),o=an(n),s=Lt(r,o),s.callback=t??null,rn(n,s,o),e.current.lanes=o,no(e,o,r),Ge(e,r),e}function Ta(e,t,n,r){var o=t.current,s=Oe(),i=an(o);return n=of(n),t.context===null?t.context=n:t.pendingContext=n,t=Lt(s,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=rn(o,t,i),e!==null&&(xt(e,o,i,s),$o(e,o,i)),i}function ma(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 Ec(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cl(e,t){Ec(e,t),(e=e.alternate)&&Ec(e,t)}function ph(){return null}var sf=typeof reportError=="function"?reportError:function(e){console.error(e)};function ul(e){this._internalRoot=e}Ia.prototype.render=ul.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(M(409));Ta(e,t,null,null)};Ia.prototype.unmount=ul.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Pn(function(){Ta(null,e,null,null)}),t[Ft]=null}};function Ia(e){this._internalRoot=e}Ia.prototype.unstable_scheduleHydration=function(e){if(e){var t=Mu();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Qt.length&&t!==0&&t<Qt[n].priority;n++);Qt.splice(n,0,e),n===0&&Ou(e)}};function dl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ra(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function zc(){}function mh(e,t,n,r,o){if(o){if(typeof r=="function"){var s=r;r=function(){var u=ma(i);s.call(u)}}var i=af(t,r,e,0,null,!1,!1,"",zc);return e._reactRootContainer=i,e[Ft]=i.current,Vr(e.nodeType===8?e.parentNode:e),Pn(),i}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var l=r;r=function(){var u=ma(c);l.call(u)}}var c=ll(e,0,!1,null,null,!1,!1,"",zc);return e._reactRootContainer=c,e[Ft]=c.current,Vr(e.nodeType===8?e.parentNode:e),Pn(function(){Ta(t,c,n,r)}),c}function _a(e,t,n,r,o){var s=n._reactRootContainer;if(s){var i=s;if(typeof o=="function"){var l=o;o=function(){var c=ma(i);l.call(c)}}Ta(t,i,e,o)}else i=mh(n,t,e,o,r);return ma(i)}$u=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Cr(t.pendingLanes);n!==0&&(Ti(t,n|1),Ge(t,ve()),!(te&6)&&(or=ve()+500,fn()))}break;case 13:Pn(function(){var r=Ot(e,1);if(r!==null){var o=Oe();xt(r,e,1,o)}}),cl(e,1)}};Ii=function(e){if(e.tag===13){var t=Ot(e,134217728);if(t!==null){var n=Oe();xt(t,e,134217728,n)}cl(e,134217728)}};Lu=function(e){if(e.tag===13){var t=an(e),n=Ot(e,t);if(n!==null){var r=Oe();xt(n,e,t,r)}cl(e,t)}};Mu=function(){return ae};Fu=function(e,t){var n=ae;try{return ae=e,t()}finally{ae=n}};Ts=function(e,t,n){switch(t){case"input":if(ks(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 o=ka(r);if(!o)throw Error(M(90));hu(r),ks(r,o)}}}break;case"textarea":vu(e,n);break;case"select":t=n.value,t!=null&&Kn(e,!!n.multiple,t,!1)}};Cu=ol;bu=Pn;var hh={usingClientEntryPoint:!1,Events:[oo,On,ka,ju,ku,ol]},wr={findFiberByHostInstance:xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},gh={bundleType:wr.bundleType,version:wr.version,rendererPackageName:wr.rendererPackageName,rendererConfig:wr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ut.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=zu(e),e===null?null:e.stateNode},findFiberByHostInstance:wr.findFiberByHostInstance||ph,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 No=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!No.isDisabled&&No.supportsFiber)try{xa=No.inject(gh),Nt=No}catch{}}et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=hh;et.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!dl(t))throw Error(M(200));return fh(e,t,null,n)};et.createRoot=function(e,t){if(!dl(e))throw Error(M(299));var n=!1,r="",o=sf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ll(e,1,!1,null,null,n,!1,r,o),e[Ft]=t.current,Vr(e.nodeType===8?e.parentNode:e),new ul(t)};et.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(M(188)):(e=Object.keys(e).join(","),Error(M(268,e)));return e=zu(t),e=e===null?null:e.stateNode,e};et.flushSync=function(e){return Pn(e)};et.hydrate=function(e,t,n){if(!Ra(t))throw Error(M(200));return _a(null,e,t,!0,n)};et.hydrateRoot=function(e,t,n){if(!dl(e))throw Error(M(405));var r=n!=null&&n.hydratedSources||null,o=!1,s="",i=sf;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=af(t,null,e,1,n??null,o,!1,s,i),e[Ft]=t.current,Vr(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Ia(t)};et.render=function(e,t,n){if(!Ra(t))throw Error(M(200));return _a(null,e,t,!1,n)};et.unmountComponentAtNode=function(e){if(!Ra(e))throw Error(M(40));return e._reactRootContainer?(Pn(function(){_a(null,null,e,!1,function(){e._reactRootContainer=null,e[Ft]=null})}),!0):!1};et.unstable_batchedUpdates=ol;et.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ra(n))throw Error(M(200));if(e==null||e._reactInternals===void 0)throw Error(M(38));return _a(e,t,n,!1,r)};et.version="18.3.1-next-f1338f8080-20240426";function lf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(lf)}catch(e){console.error(e)}}lf(),iu.exports=et;var cf=iu.exports,uf,Pc=cf;uf=Pc.createRoot,Pc.hydrateRoot;/**
|
|
41
41
|
* react-router v7.13.1
|
|
42
42
|
*
|
|
43
43
|
* Copyright (c) Remix Software Inc.
|
|
@@ -46,27 +46,27 @@ 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 Tc="popstate";function Ic(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function gh(e={}){function t(r,o){var u;let s=(u=o.state)==null?void 0:u.masked,{pathname:i,search:l,hash:c}=s||r.location;return ci("",{pathname:i,search:l,hash:c},o.state&&o.state.usr||null,o.state&&o.state.key||"default",s?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,o){return typeof o=="string"?o:eo(o)}return yh(t,n,null,e)}function de(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ut(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function vh(){return Math.random().toString(36).substring(2,10)}function Rc(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 ci(e,t,n=null,r,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?lr(t):t,state:n,key:t&&t.key||r||vh(),unstable_mask:o}}function eo({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 lr(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 yh(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:s=!1}=r,i=o.history,l="POP",c=null,u=p();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function p(){return(i.state||{idx:null}).idx}function f(){l="POP";let j=p(),h=j==null?null:j-u;u=j,c&&c({action:l,location:w.location,delta:h})}function v(j,h){l="PUSH";let m=Ic(j)?j:ci(w.location,j,h);u=p()+1;let g=Rc(m,u),S=w.createHref(m.unstable_mask||m);try{i.pushState(g,"",S)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;o.location.assign(S)}s&&c&&c({action:l,location:w.location,delta:1})}function y(j,h){l="REPLACE";let m=Ic(j)?j:ci(w.location,j,h);u=p();let g=Rc(m,u),S=w.createHref(m.unstable_mask||m);i.replaceState(g,"",S),s&&c&&c({action:l,location:w.location,delta:0})}function x(j){return xh(j)}let w={get action(){return l},get location(){return e(o,i)},listen(j){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(Tc,f),c=j,()=>{o.removeEventListener(Tc,f),c=null}},createHref(j){return t(o,j)},createURL:x,encodeLocation(j){let h=x(j);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:v,replace:y,go(j){return i.go(j)}};return w}function xh(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),de(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:eo(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function df(e,t,n="/"){return wh(e,t,n,!1)}function wh(e,t,n,r){let o=typeof t=="string"?lr(t):t,s=Dt(o.pathname||"/",n);if(s==null)return null;let i=ff(e);Sh(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let u=Rh(s);l=Th(i[c],u,r)}return l}function ff(e,t=[],n=[],r="",o=!1){let s=(i,l,c=o,u)=>{let p={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&c)return;de(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let f=zt([r,p.relativePath]),v=n.concat(p);i.children&&i.children.length>0&&(de(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),ff(i.children,t,v,f,c)),!(i.path==null&&!i.index)&&t.push({path:f,score:zh(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 mf(i.path))s(i,l,!0,u)}),t}function mf(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return o?[s,""]:[s];let i=mf(r.join("/")),l=[];return l.push(...i.map(c=>c===""?s:[s,c].join("/"))),o&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Sh(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Ph(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var jh=/^:[\w-]+$/,kh=3,Ch=2,bh=1,Nh=10,Eh=-2,_c=e=>e==="*";function zh(e,t){let n=e.split("/"),r=n.length;return n.some(_c)&&(r+=Eh),t&&(r+=Ch),n.filter(o=>!_c(o)).reduce((o,s)=>o+(jh.test(s)?kh:s===""?bh:Nh),r)}function Ph(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function Th(e,t,n=!1){let{routesMeta:r}=e,o={},s="/",i=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,p=s==="/"?t:t.slice(s.length)||"/",f=ha({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},p),v=c.route;if(!f&&u&&n&&!r[r.length-1].route.index&&(f=ha({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},p)),!f)return null;Object.assign(o,f.params),i.push({params:o,pathname:zt([s,f.pathname]),pathnameBase:Lh(zt([s,f.pathnameBase])),route:v}),f.pathnameBase!=="/"&&(s=zt([s,f.pathnameBase]))}return i}function ha(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Ih(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let s=o[0],i=s.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce((u,{paramName:p,isOptional:f},v)=>{if(p==="*"){let x=l[v]||"";i=s.slice(0,s.length-x.length).replace(/(.)\/+$/,"$1")}const y=l[v];return f&&!y?u[p]=void 0:u[p]=(y||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:i,pattern:e}}function Ih(e,t=!1,n=!0){ut(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=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c,u,p)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let f=p.charAt(u+i.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function Rh(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ut(!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 Dt(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 _h=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Ah(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?lr(e):e,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=Ac(n.substring(1),"/"):s=Ac(n,t)):s=t,{pathname:s,search:Mh(r),hash:Fh(o)}}function Ac(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function us(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 $h(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function fl(e){let t=$h(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Aa(e,t,n,r=!1){let o;typeof e=="string"?o=lr(e):(o={...e},de(!o.pathname||!o.pathname.includes("?"),us("?","pathname","search",o)),de(!o.pathname||!o.pathname.includes("#"),us("#","pathname","hash",o)),de(!o.search||!o.search.includes("#"),us("#","search","hash",o)));let s=e===""||o.pathname==="",i=s?"/":o.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;o.pathname=v.join("/")}l=f>=0?t[f]:"/"}let c=Ah(o,l),u=i&&i!=="/"&&i.endsWith("/"),p=(s||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||p)&&(c.pathname+="/"),c}var zt=e=>e.join("/").replace(/\/\/+/g,"/"),Lh=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Mh=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Fh=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Oh=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 Bh(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Dh(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var pf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hf(e,t){let n=e;if(typeof n!="string"||!_h.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(pf)try{let s=new URL(window.location.href),i=n.startsWith("//")?new URL(s.protocol+n):new URL(n),l=Dt(i.pathname,t);i.origin===s.origin&&l!=null?n=l+i.search+i.hash:o=!0}catch{ut(!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:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var gf=["POST","PUT","PATCH","DELETE"];new Set(gf);var Uh=["GET",...gf];new Set(Uh);var cr=d.createContext(null);cr.displayName="DataRouter";var $a=d.createContext(null);$a.displayName="DataRouterState";var Wh=d.createContext(!1),vf=d.createContext({isTransitioning:!1});vf.displayName="ViewTransition";var Hh=d.createContext(new Map);Hh.displayName="Fetchers";var Vh=d.createContext(null);Vh.displayName="Await";var nt=d.createContext(null);nt.displayName="Navigation";var so=d.createContext(null);so.displayName="Location";var St=d.createContext({outlet:null,matches:[],isDataRoute:!1});St.displayName="Route";var ml=d.createContext(null);ml.displayName="RouteError";var yf="REACT_ROUTER_ERROR",Kh="REDIRECT",Gh="ROUTE_ERROR_RESPONSE";function Yh(e){if(e.startsWith(`${yf}:${Kh}:{`))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 Qh(e){if(e.startsWith(`${yf}:${Gh}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Oh(t.status,t.statusText,t.data)}catch{}}function Jh(e,{relative:t}={}){de(ur(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=d.useContext(nt),{hash:o,pathname:s,search:i}=io(e,{relative:t}),l=s;return n!=="/"&&(l=s==="/"?n:zt([n,s])),r.createHref({pathname:l,search:i,hash:o})}function ur(){return d.useContext(so)!=null}function dt(){return de(ur(),"useLocation() may be used only in the context of a <Router> component."),d.useContext(so).location}var xf="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function wf(e){d.useContext(nt).static||d.useLayoutEffect(e)}function Wt(){let{isDataRoute:e}=d.useContext(St);return e?dg():Xh()}function Xh(){de(ur(),"useNavigate() may be used only in the context of a <Router> component.");let e=d.useContext(cr),{basename:t,navigator:n}=d.useContext(nt),{matches:r}=d.useContext(St),{pathname:o}=dt(),s=JSON.stringify(fl(r)),i=d.useRef(!1);return wf(()=>{i.current=!0}),d.useCallback((c,u={})=>{if(ut(i.current,xf),!i.current)return;if(typeof c=="number"){n.go(c);return}let p=Aa(c,JSON.parse(s),o,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:zt([t,p.pathname])),(u.replace?n.replace:n.push)(p,u.state,u)},[t,n,s,o,e])}var qh=d.createContext(null);function Zh(e){let t=d.useContext(St).outlet;return d.useMemo(()=>t&&d.createElement(qh.Provider,{value:e},t),[t,e])}function io(e,{relative:t}={}){let{matches:n}=d.useContext(St),{pathname:r}=dt(),o=JSON.stringify(fl(n));return d.useMemo(()=>Aa(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function eg(e,t){return Sf(e,t)}function Sf(e,t,n){var j;de(ur(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=d.useContext(nt),{matches:o}=d.useContext(St),s=o[o.length-1],i=s?s.params:{},l=s?s.pathname:"/",c=s?s.pathnameBase:"/",u=s&&s.route;{let h=u&&u.path||"";kf(l,!u||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${h}">) 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 Tc="popstate";function Ic(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function vh(e={}){function t(r,o){var u;let s=(u=o.state)==null?void 0:u.masked,{pathname:i,search:l,hash:c}=s||r.location;return ci("",{pathname:i,search:l,hash:c},o.state&&o.state.usr||null,o.state&&o.state.key||"default",s?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,o){return typeof o=="string"?o:eo(o)}return xh(t,n,null,e)}function de(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ut(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function yh(){return Math.random().toString(36).substring(2,10)}function Rc(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 ci(e,t,n=null,r,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?lr(t):t,state:n,key:t&&t.key||r||yh(),unstable_mask:o}}function eo({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 lr(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 xh(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:s=!1}=r,i=o.history,l="POP",c=null,u=m();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function m(){return(i.state||{idx:null}).idx}function f(){l="POP";let j=m(),h=j==null?null:j-u;u=j,c&&c({action:l,location:w.location,delta:h})}function v(j,h){l="PUSH";let p=Ic(j)?j:ci(w.location,j,h);u=m()+1;let g=Rc(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;o.location.assign(S)}s&&c&&c({action:l,location:w.location,delta:1})}function y(j,h){l="REPLACE";let p=Ic(j)?j:ci(w.location,j,h);u=m();let g=Rc(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 wh(j)}let w={get action(){return l},get location(){return e(o,i)},listen(j){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(Tc,f),c=j,()=>{o.removeEventListener(Tc,f),c=null}},createHref(j){return t(o,j)},createURL:x,encodeLocation(j){let h=x(j);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:v,replace:y,go(j){return i.go(j)}};return w}function wh(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),de(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:eo(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function df(e,t,n="/"){return Sh(e,t,n,!1)}function Sh(e,t,n,r){let o=typeof t=="string"?lr(t):t,s=Dt(o.pathname||"/",n);if(s==null)return null;let i=ff(e);jh(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let u=_h(s);l=Ih(i[c],u,r)}return l}function ff(e,t=[],n=[],r="",o=!1){let s=(i,l,c=o,u)=>{let m={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(r)&&c)return;de(m.relativePath.startsWith(r),`Absolute route path "${m.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(r.length)}let f=zt([r,m.relativePath]),v=n.concat(m);i.children&&i.children.length>0&&(de(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),ff(i.children,t,v,f,c)),!(i.path==null&&!i.index)&&t.push({path:f,score:Ph(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 pf(i.path))s(i,l,!0,u)}),t}function pf(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return o?[s,""]:[s];let i=pf(r.join("/")),l=[];return l.push(...i.map(c=>c===""?s:[s,c].join("/"))),o&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function jh(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Th(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var kh=/^:[\w-]+$/,Ch=3,bh=2,Nh=1,Eh=10,zh=-2,_c=e=>e==="*";function Ph(e,t){let n=e.split("/"),r=n.length;return n.some(_c)&&(r+=zh),t&&(r+=bh),n.filter(o=>!_c(o)).reduce((o,s)=>o+(kh.test(s)?Ch:s===""?Nh:Eh),r)}function Th(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function Ih(e,t,n=!1){let{routesMeta:r}=e,o={},s="/",i=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,m=s==="/"?t:t.slice(s.length)||"/",f=ha({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},m),v=c.route;if(!f&&u&&n&&!r[r.length-1].route.index&&(f=ha({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},m)),!f)return null;Object.assign(o,f.params),i.push({params:o,pathname:zt([s,f.pathname]),pathnameBase:Mh(zt([s,f.pathnameBase])),route:v}),f.pathnameBase!=="/"&&(s=zt([s,f.pathnameBase]))}return i}function ha(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Rh(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let s=o[0],i=s.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce((u,{paramName:m,isOptional:f},v)=>{if(m==="*"){let x=l[v]||"";i=s.slice(0,s.length-x.length).replace(/(.)\/+$/,"$1")}const y=l[v];return f&&!y?u[m]=void 0:u[m]=(y||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:i,pattern:e}}function Rh(e,t=!1,n=!0){ut(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=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c,u,m)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let f=m.charAt(u+i.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function _h(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ut(!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 Dt(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 Ah=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function $h(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?lr(e):e,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=Ac(n.substring(1),"/"):s=Ac(n,t)):s=t,{pathname:s,search:Fh(r),hash:Oh(o)}}function Ac(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function us(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 Lh(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function fl(e){let t=Lh(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Aa(e,t,n,r=!1){let o;typeof e=="string"?o=lr(e):(o={...e},de(!o.pathname||!o.pathname.includes("?"),us("?","pathname","search",o)),de(!o.pathname||!o.pathname.includes("#"),us("#","pathname","hash",o)),de(!o.search||!o.search.includes("#"),us("#","search","hash",o)));let s=e===""||o.pathname==="",i=s?"/":o.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;o.pathname=v.join("/")}l=f>=0?t[f]:"/"}let c=$h(o,l),u=i&&i!=="/"&&i.endsWith("/"),m=(s||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||m)&&(c.pathname+="/"),c}var zt=e=>e.join("/").replace(/\/\/+/g,"/"),Mh=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Fh=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Oh=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Bh=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 Dh(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Uh(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var mf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function hf(e,t){let n=e;if(typeof n!="string"||!Ah.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(mf)try{let s=new URL(window.location.href),i=n.startsWith("//")?new URL(s.protocol+n):new URL(n),l=Dt(i.pathname,t);i.origin===s.origin&&l!=null?n=l+i.search+i.hash:o=!0}catch{ut(!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:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var gf=["POST","PUT","PATCH","DELETE"];new Set(gf);var Wh=["GET",...gf];new Set(Wh);var cr=d.createContext(null);cr.displayName="DataRouter";var $a=d.createContext(null);$a.displayName="DataRouterState";var Hh=d.createContext(!1),vf=d.createContext({isTransitioning:!1});vf.displayName="ViewTransition";var Vh=d.createContext(new Map);Vh.displayName="Fetchers";var Kh=d.createContext(null);Kh.displayName="Await";var nt=d.createContext(null);nt.displayName="Navigation";var so=d.createContext(null);so.displayName="Location";var St=d.createContext({outlet:null,matches:[],isDataRoute:!1});St.displayName="Route";var pl=d.createContext(null);pl.displayName="RouteError";var yf="REACT_ROUTER_ERROR",Gh="REDIRECT",Yh="ROUTE_ERROR_RESPONSE";function Qh(e){if(e.startsWith(`${yf}:${Gh}:{`))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 Jh(e){if(e.startsWith(`${yf}:${Yh}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Bh(t.status,t.statusText,t.data)}catch{}}function Xh(e,{relative:t}={}){de(ur(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=d.useContext(nt),{hash:o,pathname:s,search:i}=io(e,{relative:t}),l=s;return n!=="/"&&(l=s==="/"?n:zt([n,s])),r.createHref({pathname:l,search:i,hash:o})}function ur(){return d.useContext(so)!=null}function dt(){return de(ur(),"useLocation() may be used only in the context of a <Router> component."),d.useContext(so).location}var xf="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function wf(e){d.useContext(nt).static||d.useLayoutEffect(e)}function Wt(){let{isDataRoute:e}=d.useContext(St);return e?fg():qh()}function qh(){de(ur(),"useNavigate() may be used only in the context of a <Router> component.");let e=d.useContext(cr),{basename:t,navigator:n}=d.useContext(nt),{matches:r}=d.useContext(St),{pathname:o}=dt(),s=JSON.stringify(fl(r)),i=d.useRef(!1);return wf(()=>{i.current=!0}),d.useCallback((c,u={})=>{if(ut(i.current,xf),!i.current)return;if(typeof c=="number"){n.go(c);return}let m=Aa(c,JSON.parse(s),o,u.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:zt([t,m.pathname])),(u.replace?n.replace:n.push)(m,u.state,u)},[t,n,s,o,e])}var Zh=d.createContext(null);function eg(e){let t=d.useContext(St).outlet;return d.useMemo(()=>t&&d.createElement(Zh.Provider,{value:e},t),[t,e])}function io(e,{relative:t}={}){let{matches:n}=d.useContext(St),{pathname:r}=dt(),o=JSON.stringify(fl(n));return d.useMemo(()=>Aa(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function tg(e,t){return Sf(e,t)}function Sf(e,t,n){var j;de(ur(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=d.useContext(nt),{matches:o}=d.useContext(St),s=o[o.length-1],i=s?s.params:{},l=s?s.pathname:"/",c=s?s.pathnameBase:"/",u=s&&s.route;{let h=u&&u.path||"";kf(l,!u||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${h}">) 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="${h}"> to <Route path="${h==="/"?"*":`${h}/*`}">.`)}let p=dt(),f;if(t){let h=typeof t=="string"?lr(t):t;de(c==="/"||((j=h.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 "${h.pathname}" was given in the \`location\` prop.`),f=h}else f=p;let v=f.pathname||"/",y=v;if(c!=="/"){let h=c.replace(/^\//,"").split("/");y="/"+v.replace(/^\//,"").split("/").slice(h.length).join("/")}let x=df(e,{pathname:y});ut(u||x!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),ut(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=ag(x&&x.map(h=>Object.assign({},h,{params:Object.assign({},i,h.params),pathname:zt([c,r.encodeLocation?r.encodeLocation(h.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?c:zt([c,r.encodeLocation?r.encodeLocation(h.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathnameBase])})),o,n);return t&&w?d.createElement(so.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...f},navigationType:"POP"}},w):w}function tg(){let e=ug(),t=Bh(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)",o={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:o},n):null,i)}var ng=d.createElement(tg,null),jf=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=Qh(e.digest);n&&(e=n)}let t=e!==void 0?d.createElement(St.Provider,{value:this.props.routeContext},d.createElement(ml.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?d.createElement(rg,{error:e},t):t}};jf.contextType=Wh;var ds=new WeakMap;function rg({children:e,error:t}){let{basename:n}=d.useContext(nt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Yh(t.digest);if(r){let o=ds.get(t);if(o)throw o;let s=hf(r.location,n);if(pf&&!ds.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 ds.set(t,i),i}return d.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function og({routeContext:e,match:t,children:n}){let r=d.useContext(cr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(St.Provider,{value:e},n)}function ag(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 o=e,s=r==null?void 0:r.errors;if(s!=null){let p=o.findIndex(f=>f.route.id&&(s==null?void 0:s[f.route.id])!==void 0);de(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),o=o.slice(0,Math.min(o.length,p+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let p=0;p<o.length;p++){let f=o[p];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=p),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?o=o.slice(0,l+1):o=[o[0]];break}}}}let c=n==null?void 0:n.onError,u=r&&c?(p,f)=>{var v,y;c(p,{location:r.location,params:((y=(v=r.matches)==null?void 0:v[0])==null?void 0:y.params)??{},unstable_pattern:Dh(r.matches),errorInfo:f})}:void 0;return o.reduceRight((p,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||ng,i&&(l<0&&v===0?(kf("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 h=t.concat(o.slice(0,v+1)),m=()=>{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=p,d.createElement(og,{match:f,routeContext:{outlet:p,matches:h,isDataRoute:r!=null},children:g})};return r&&(f.route.ErrorBoundary||f.route.errorElement||v===0)?d.createElement(jf,{location:r.location,revalidation:r.revalidation,component:w,error:y,children:m(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):m()},null)}function pl(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function sg(e){let t=d.useContext(cr);return de(t,pl(e)),t}function ig(e){let t=d.useContext($a);return de(t,pl(e)),t}function lg(e){let t=d.useContext(St);return de(t,pl(e)),t}function hl(e){let t=lg(e),n=t.matches[t.matches.length-1];return de(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function cg(){return hl("useRouteId")}function ug(){var r;let e=d.useContext(ml),t=ig("useRouteError"),n=hl("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function dg(){let{router:e}=sg("useNavigate"),t=hl("useNavigate"),n=d.useRef(!1);return wf(()=>{n.current=!0}),d.useCallback(async(o,s={})=>{ut(n.current,xf),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...s}))},[e,t])}var $c={};function kf(e,t,n){!t&&!$c[e]&&($c[e]=!0,ut(!1,n))}d.memo(fg);function fg({routes:e,future:t,state:n,isStatic:r,onError:o}){return Sf(e,void 0,{state:n,isStatic:r,onError:o})}function Yt({to:e,replace:t,state:n,relative:r}){de(ur(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=d.useContext(nt);ut(!o,"<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(St),{pathname:i}=dt(),l=Wt(),c=Aa(e,fl(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 mg(e){return Zh(e.context)}function Ce(e){de(!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 pg({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:s=!1,unstable_useTransitions:i}){de(!ur(),"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:o,static:s,unstable_useTransitions:i,future:{}}),[l,o,s,i]);typeof n=="string"&&(n=lr(n));let{pathname:u="/",search:p="",hash:f="",state:v=null,key:y="default",unstable_mask:x}=n,w=d.useMemo(()=>{let j=Dt(u,l);return j==null?null:{location:{pathname:j,search:p,hash:f,state:v,key:y,unstable_mask:x},navigationType:r}},[l,u,p,f,v,y,r,x]);return ut(w!=null,`<Router basename="${l}"> is not able to match the URL "${u}${p}${f}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:d.createElement(nt.Provider,{value:c},d.createElement(so.Provider,{children:t,value:w}))}function hg({children:e,location:t}){return eg(ui(e),t)}function ui(e,t=[]){let n=[];return d.Children.forEach(e,(r,o)=>{if(!d.isValidElement(r))return;let s=[...t,o];if(r.type===d.Fragment){n.push.apply(n,ui(r.props.children,s));return}de(r.type===Ce,`[${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>`),de(!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=ui(r.props.children,s)),n.push(i)}),n}var Uo="get",Wo="application/x-www-form-urlencoded";function La(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function gg(e){return La(e)&&e.tagName.toLowerCase()==="button"}function vg(e){return La(e)&&e.tagName.toLowerCase()==="form"}function yg(e){return La(e)&&e.tagName.toLowerCase()==="input"}function xg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function wg(e,t){return e.button===0&&(!t||t==="_self")&&!xg(e)}function di(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(o=>[n,o]):[[n,r]])},[]))}function Sg(e,t){let n=di(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(s=>{n.append(o,s)})}),n}var Eo=null;function jg(){if(Eo===null)try{new FormData(document.createElement("form"),0),Eo=!1}catch{Eo=!0}return Eo}var kg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function fs(e){return e!=null&&!kg.has(e)?(ut(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wo}"`),null):e}function Cg(e,t){let n,r,o,s,i;if(vg(e)){let l=e.getAttribute("action");r=l?Dt(l,t):null,n=e.getAttribute("method")||Uo,o=fs(e.getAttribute("enctype"))||Wo,s=new FormData(e)}else if(gg(e)||yg(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?Dt(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Uo,o=fs(e.getAttribute("formenctype"))||fs(l.getAttribute("enctype"))||Wo,s=new FormData(l,e),!jg()){let{name:u,type:p,value:f}=e;if(p==="image"){let v=u?`${u}.`:"";s.append(`${v}x`,"0"),s.append(`${v}y`,"0")}else u&&s.append(u,f)}}else{if(La(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Uo,r=null,o=Wo,i=e}return s&&o==="text/plain"&&(i=s,s=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:s,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function gl(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function bg(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Dt(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${r}`,o}async function Ng(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 Eg(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 zg(e,t,n){let r=await Promise.all(e.map(async o=>{let s=t.routes[o.route.id];if(s){let i=await Ng(s,n);return i.links?i.links():[]}return[]}));return Rg(r.flat(1).filter(Eg).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Lc(e,t,n,r,o,s){let i=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var p;return n[u].pathname!==c.pathname||((p=n[u].route.path)==null?void 0:p.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 p=r.routes[c.route.id];if(!p||!p.hasLoader)return!1;if(i(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let v=c.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.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 Pg(e,t,{includeHydrateFallback:n}={}){return Tg(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let s=[o.module];return o.clientActionModule&&(s=s.concat(o.clientActionModule)),o.clientLoaderModule&&(s=s.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(s=s.concat(o.hydrateFallbackModule)),o.imports&&(s=s.concat(o.imports)),s}).flat(1))}function Tg(e){return[...new Set(e)]}function Ig(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Rg(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let s=JSON.stringify(Ig(o));return n.has(s)||(n.add(s),r.push({key:s,link:o})),r},[])}function Cf(){let e=d.useContext(cr);return gl(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function _g(){let e=d.useContext($a);return gl(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var vl=d.createContext(void 0);vl.displayName="FrameworkContext";function bf(){let e=d.useContext(vl);return gl(e,"You must render this element inside a <HydratedRouter> element"),e}function Ag(e,t){let n=d.useContext(vl),[r,o]=d.useState(!1),[s,i]=d.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:p,onTouchStart:f}=t,v=d.useRef(null);d.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let w=h=>{h.forEach(m=>{i(m.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=()=>{o(!0)},x=()=>{o(!1),i(!1)};return n?e!=="intent"?[s,v,{}]:[s,v,{onFocus:Sr(l,y),onBlur:Sr(c,x),onMouseEnter:Sr(u,y),onMouseLeave:Sr(p,x),onTouchStart:Sr(f,y)}]:[!1,v,{}]}function Sr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function $g({page:e,...t}){let{router:n}=Cf(),r=d.useMemo(()=>df(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?d.createElement(Mg,{page:e,matches:r,...t}):null}function Lg(e){let{manifest:t,routeModules:n}=bf(),[r,o]=d.useState([]);return d.useEffect(()=>{let s=!1;return zg(e,t,n).then(i=>{s||o(i)}),()=>{s=!0}},[e,t,n]),r}function Mg({page:e,matches:t,...n}){let r=dt(),{future:o,manifest:s,routeModules:i}=bf(),{basename:l}=Cf(),{loaderData:c,matches:u}=_g(),p=d.useMemo(()=>Lc(e,t,u,s,r,"data"),[e,t,u,s,r]),f=d.useMemo(()=>Lc(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(m=>{var S;let g=s.routes[m.route.id];!g||!g.hasLoader||(!p.some(E=>E.route.id===m.route.id)&&m.route.id in c&&((S=i[m.route.id])!=null&&S.shouldRevalidate)||g.hasClientLoader?j=!0:w.add(m.route.id))}),w.size===0)return[];let h=bg(e,l,o.unstable_trailingSlashAwareDataRequests,"data");return j&&w.size>0&&h.searchParams.set("_routes",t.filter(m=>w.has(m.route.id)).map(m=>m.route.id).join(",")),[h.pathname+h.search]},[l,o.unstable_trailingSlashAwareDataRequests,c,r,s,p,t,e,i]),y=d.useMemo(()=>Pg(f,s),[f,s]),x=Lg(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 Fg(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Og=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Og&&(window.__reactRouterVersion="7.13.1")}catch{}function Bg({basename:e,children:t,unstable_useTransitions:n,window:r}){let o=d.useRef();o.current==null&&(o.current=gh({window:r,v5Compat:!0}));let s=o.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(pg,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:s,unstable_useTransitions:n})}var Nf=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Je=d.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:s,replace:i,unstable_mask:l,state:c,target:u,to:p,preventScrollReset:f,viewTransition:v,unstable_defaultShouldRevalidate:y,...x},w){let{basename:j,navigator:h,unstable_useTransitions:m}=d.useContext(nt),g=typeof p=="string"&&Nf.test(p),S=hf(p,j);p=S.to;let E=Jh(p,{relative:o}),P=dt(),k=null;if(l){let B=Aa(l,[],P.unstable_mask?P.unstable_mask.pathname:"/",!0);j!=="/"&&(B.pathname=B.pathname==="/"?j:zt([j,B.pathname])),k=h.createHref(B)}let[N,C,T]=Ag(r,x),H=Wg(p,{replace:i,unstable_mask:l,state:c,target:u,preventScrollReset:f,relative:o,viewTransition:v,unstable_defaultShouldRevalidate:y,unstable_useTransitions:m});function W(B){t&&t(B),B.defaultPrevented||H(B)}let D=!(S.isExternal||s),_=d.createElement("a",{...x,...T,href:(D?k:void 0)||S.absoluteURL||E,onClick:D?W:t,ref:Fg(w,C),target:u,"data-discover":!g&&n==="render"?"true":void 0});return N&&!g?d.createElement(d.Fragment,null,_,d.createElement($g,{page:E})):_});Je.displayName="Link";var yl=d.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:s,to:i,viewTransition:l,children:c,...u},p){let f=io(i,{relative:u.relative}),v=dt(),y=d.useContext($a),{navigator:x,basename:w}=d.useContext(nt),j=y!=null&&Yg(f)&&l===!0,h=x.encodeLocation?x.encodeLocation(f).pathname:f.pathname,m=v.pathname,g=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(m=m.toLowerCase(),g=g?g.toLowerCase():null,h=h.toLowerCase()),g&&w&&(g=Dt(g,w)||g);const S=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let E=m===h||!o&&m.startsWith(h)&&m.charAt(S)==="/",P=g!=null&&(g===h||!o&&g.startsWith(h)&&g.charAt(h.length)==="/"),k={isActive:E,isPending:P,isTransitioning:j},N=E?t:void 0,C;typeof r=="function"?C=r(k):C=[r,E?"active":null,P?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let T=typeof s=="function"?s(k):s;return d.createElement(Je,{...u,"aria-current":N,className:C,ref:p,style:T,to:i,viewTransition:l},typeof c=="function"?c(k):c)});yl.displayName="NavLink";var Dg=d.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:s,method:i=Uo,action:l,onSubmit:c,relative:u,preventScrollReset:p,viewTransition:f,unstable_defaultShouldRevalidate:v,...y},x)=>{let{unstable_useTransitions:w}=d.useContext(nt),j=Kg(),h=Gg(l,{relative:u}),m=i.toLowerCase()==="get"?"get":"post",g=typeof l=="string"&&Nf.test(l),S=E=>{if(c&&c(E),E.defaultPrevented)return;E.preventDefault();let P=E.nativeEvent.submitter,k=(P==null?void 0:P.getAttribute("formmethod"))||i,N=()=>j(P||E.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:o,state:s,relative:u,preventScrollReset:p,viewTransition:f,unstable_defaultShouldRevalidate:v});w&&n!==!1?d.startTransition(()=>N()):N()};return d.createElement("form",{ref:x,method:m,action:h,onSubmit:r?c:S,...y,"data-discover":!g&&e==="render"?"true":void 0})});Dg.displayName="Form";function Ug(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ef(e){let t=d.useContext(cr);return de(t,Ug(e)),t}function Wg(e,{target:t,replace:n,unstable_mask:r,state:o,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c,unstable_useTransitions:u}={}){let p=Wt(),f=dt(),v=io(e,{relative:i});return d.useCallback(y=>{if(wg(y,t)){y.preventDefault();let x=n!==void 0?n:eo(f)===eo(v),w=()=>p(e,{replace:x,unstable_mask:r,state:o,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c});u?d.startTransition(()=>w()):w()}},[f,p,v,n,r,o,t,e,s,i,l,c,u])}function zf(e){ut(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(di(e)),n=d.useRef(!1),r=dt(),o=d.useMemo(()=>Sg(r.search,n.current?null:t.current),[r.search]),s=Wt(),i=d.useCallback((l,c)=>{const u=di(typeof l=="function"?l(new URLSearchParams(o)):l);n.current=!0,s("?"+u,c)},[s,o]);return[o,i]}var Hg=0,Vg=()=>`__${String(++Hg)}__`;function Kg(){let{router:e}=Ef("useSubmit"),{basename:t}=d.useContext(nt),n=cg(),r=e.fetch,o=e.navigate;return d.useCallback(async(s,i={})=>{let{action:l,method:c,encType:u,formData:p,body:f}=Cg(s,t);if(i.navigate===!1){let v=i.fetcherKey||Vg();await r(v,n,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:p,body:f,formMethod:i.method||c,formEncType:i.encType||u,flushSync:i.flushSync})}else await o(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:p,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,o,t,n])}function Gg(e,{relative:t}={}){let{basename:n}=d.useContext(nt),r=d.useContext(St);de(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),s={...io(e||".",{relative:t})},i=dt();if(e==null){s.search=i.search;let l=new URLSearchParams(s.search),c=l.getAll("index");if(c.some(p=>p==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let p=l.toString();s.search=p?`?${p}`:""}}return(!e||e===".")&&o.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:zt([n,s.pathname])),eo(s)}function Yg(e,{relative:t}={}){let n=d.useContext(vf);de(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ef("useViewTransitionState"),o=io(e,{relative:t});if(!n.isTransitioning)return!1;let s=Dt(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Dt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ha(o.pathname,i)!=null||ha(o.pathname,s)!=null}class Pf extends Error{constructor(n){super("different_account");Ma(this,"summary");this.name="DifferentAccountError",this.summary=n}}class Qg{constructor(){Ma(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 Pf(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{authorization_id:s.authorization_id,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(),o=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!o.ok)throw new Error(`Failed to fetch receipts: ${o.status}`);return(await o.json()).receipts??[]}async revokeAttestation(t,n){const r=await this.fetch(`/api/authorizations/${encodeURIComponent(t)}/revoke`,{method:"POST",body:JSON.stringify({reason:n??"Revoked by user"})});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed to revoke"}));throw new Error(o.error||`Revoke failed: ${r.status}`)}}async getAttestations(t){const n=await this.fetch(`/api/attestations?authorization_id=${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(),o=r.group||r;return{id:o.id,name:o.name,myDomains:o.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(),o=r.group||r;return{id:o.id,name:o.name,myDomains:o.myDomains||[],isAdmin:o.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 aiIntentReview(t){const n=await this.fetch("/ai/intent-review",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI request failed"}))).error}}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 o=await r.json().catch(()=>({error:`Discovery failed: ${r.status}`}));throw new Error(o.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 o=await r.json();return(o==null?void 0:o.config)??null}async setTeamProfileConfig(t,n,r){const o=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(r)});if(!o.ok){const s=await o.json().catch(()=>({error:"Failed to set profile config"}));throw new Error(s.error||`setTeamProfileConfig failed: ${o.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 o=await r.json().catch(()=>({error:"Encryption failed"}));throw new Error(o.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 o=await r.json().catch(()=>({error:"Failed to delete profile config"}));throw new Error(o.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 o=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/resolve`,{method:"POST",body:JSON.stringify({action:n,domain:r})});if(!o.ok){const s=await o.json().catch(()=>({error:"Failed"}));throw new Error(s.error||`Failed: ${o.status}`)}return o.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 o=await r.json().catch(()=>({error:"Failed"}));throw new Error(o.error||`rejectProposal failed: ${r.status}`)}return r.json()}async getAttestationIntent(t){const n=await this.fetch(`/api/authorizations/${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 o=await n.json().catch(()=>({error:"Decryption failed"}));throw new Error(o.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 o=await r.json().catch(()=>({error:"Failed"}));throw new Error(o.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(o=>{var l,c;const s=o.owner??{userId:""};return{authorization_id:o.authorization_id??o.authorizationId,profile_id:o.profileId??o.profile_id,path:o.path??"",title:o.title??null,sp_status:o.status??o.sp_status??null,frame:o.bounds??o.frame??{},required_domains:o.requiredDomains??o.required_domains??[],attested_domains:o.attestedDomains??o.attested_domains??[],missing_domains:(o.requiredDomains??o.required_domains??[]).filter(u=>!(o.attestedDomains??o.attested_domains??[]).includes(u)),deferred_commitment_domains:o.deferredCommitmentDomains??o.deferred_commitment_domains??[],approvers_frozen:o.approversFrozen??o.approvers_frozen??[],above_cap:o.aboveCap??o.above_cap??!1,created_at:o.createdAt?new Date(o.createdAt*1e3).toISOString():o.created_at??"",earliest_expiry:(l=o.attestations)!=null&&l.length?new Date(Math.min(...o.attestations.map(u=>u.expiresAt))*1e3).toISOString():null,remaining_seconds:(c=o.attestations)!=null&&c.length?Math.max(0,Math.min(...o.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 getMyReceiptsPage(t){const n=new URLSearchParams;t!=null&&t.before&&n.set("before",t.before),t!=null&&t.profile&&n.set("profile",t.profile),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString(),o=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!o.ok)throw new Error(`Failed to fetch receipts: ${o.status}`);const s=await o.json();return{receipts:s.receipts??[],nextBefore:s.nextBefore??null}}async listTeamReceiptsPage(t,n){const r=new URLSearchParams;n!=null&&n.before&&r.set("before",n.before),n!=null&&n.profile&&r.set("profile",n.profile),n!=null&&n.limit&&r.set("limit",String(n.limit));const o=r.toString(),s=await this.fetch(`/api/groups/${encodeURIComponent(t)}/receipts${o?"?"+o:""}`);if(!s.ok)throw new Error(`Failed to fetch team receipts: ${s.status}`);const i=await s.json();return{receipts:i.receipts??[],nextBefore:i.nextBefore??null}}async getThread(t){const n=t.sinceDays??7,r=t.status??"pending",o=t.domain||"owner",s=await this.getProposals(o);let i=[];if(r==="all"){const l=[],c=new Date;for(let p=0;p<n;p++){const f=new Date(c);f.setUTCDate(c.getUTCDate()-p),l.push(f.toISOString().slice(0,10))}i=(await Promise.all(l.map(p=>this.getMyReceipts({date:p,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 getEnrichedAuthorizations(){const t=await this.fetch("/active-authorizations");if(!t.ok)throw new Error(`Failed to fetch authorizations: ${t.status}`);return(await t.json()).authorizations??[]}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 o=await r.json().catch(()=>({error:"Save failed"}));throw new Error(o.error||`Save failed: ${r.status}`)}}}const O=new Qg,Tf=d.createContext(null);function Jg({children:e}){const[t,n]=d.useState(null),[r,o]=d.useState("personal"),[s,i]=d.useState(null),[l,c]=d.useState(""),[u,p]=d.useState(null),[f,v]=d.useState(null),[y,x]=d.useState(!1),[w,j]=d.useState(""),h=d.useRef(!1),m=d.useRef(null),g=d.useCallback(async()=>{if(h.current)try{const N=await O.getMyTeam();if(N){const{group:C,membership:T}=N;p(C),v(T),o("team"),i(C);const H=m.current??T.domains[0]??"owner";c(H)}else p(null),v(null),o("personal")}catch{}},[]);d.useEffect(()=>{const N=()=>{document.visibilityState==="visible"&&g()};return document.addEventListener("visibilitychange",N),()=>document.removeEventListener("visibilitychange",N)},[g]);const S=d.useCallback(async(N,C={})=>{x(!0),j("");try{O.setApiKey(N),h.current=!0;const T=await O.login(N,C);n(T),m.current=T.id;const H=await O.getGroups(),W=H.find(D=>D.isPersonal)??H[0]??null;i(W),c("owner"),await g()}catch(T){throw O.clearApiKey(),h.current=!1,j(T instanceof Error?T.message:"Login failed"),T}finally{x(!1)}},[g]),E=d.useCallback(async()=>{await O.logout(),O.clearApiKey(),h.current=!1,m.current=null,n(null),i(null),c(""),p(null),v(null),o("personal"),j("")},[]),P=d.useCallback(()=>j(""),[]),k=d.useCallback((N,C)=>{i(N),c(C)},[]);return a.jsx(Tf.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:P,activeGroup:s,activeDomain:l,groups:s?[s]:[],setActiveContext:k,refreshGroups:g},children:e})}function ze(){const e=d.useContext(Tf);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const If=d.createContext(null);function Xg({children:e}){const{user:t}=ze(),n=d.useRef(null),[r,o]=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 p;(p=u.get(l))==null||p.delete(c)}},[]);return d.useEffect(()=>{if(!t){n.current&&(n.current.close(),n.current=null,o(!1));return}if(n.current)return;const l=O.getApiKey();if(!l)return;const c=new EventSource(`/events?key=${encodeURIComponent(l)}`);n.current=c,c.onopen=()=>o(!0),c.onerror=()=>o(!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 p of u)c.addEventListener(p,f=>{let v;try{v=JSON.parse(f.data)}catch{v=null}const y=s.current.get(p);if(y)for(const x of y)try{x(v)}catch(w){console.error(`[EventSource] handler for "${p}" threw:`,w)}});return()=>{c.close(),n.current=null,o(!1)}},[t]),a.jsx(If.Provider,{value:{connected:r,addListener:i},children:e})}function fe(e,t){const n=d.useContext(If);if(!n)return;const{addListener:r}=n;d.useEffect(()=>r(e,t),[e,t,r])}const Lr="suveren-theme",Mc="hap-theme";function zo(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}(function(){const t=localStorage.getItem(Mc);t!==null&&localStorage.getItem(Lr)===null&&localStorage.setItem(Lr,t),t!==null&&localStorage.removeItem(Mc)})();function Rf(){const[e,t]=d.useState(()=>{const s=localStorage.getItem(Lr);return s==="light"||s==="dark"?s:"system"}),[n,r]=d.useState(()=>zo(e));d.useEffect(()=>{const s=document.documentElement,i=zo(e);s.setAttribute("data-theme",i),e==="system"?localStorage.removeItem(Lr):localStorage.setItem(Lr,e),r(zo(e))},[e]),d.useEffect(()=>{if(e!=="system")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>r(zo("system"));return s.addEventListener("change",i),()=>s.removeEventListener("change",i)},[e]);const o=d.useCallback(()=>{t(s=>s==="system"?"light":s==="light"?"dark":"system")},[]);return{theme:e,effectiveTheme:n,toggle:o}}const qg=5*60*1e3,Zg=2e3;function _f(){const[e,t]=d.useState(!1),[n,r]=d.useState("docker"),[o,s]=d.useState(""),[i,l]=d.useState(null),[c,u]=d.useState(!1),[p,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 h=setInterval(()=>j(!1),v?Zg:qg),m=()=>{document.visibilityState==="visible"&&j(!1)};return document.addEventListener("visibilitychange",m),window.addEventListener("focus",m),()=>{w=!0,clearInterval(h),document.removeEventListener("visibilitychange",m),window.removeEventListener("focus",m)}},[v]),{updateAvailable:e&&!p,installMethod:n,version:o,latestVersion:i,serverRestarted:c,startFastPolling:()=>y(!0),dismiss:()=>f(!0)}}function ev(e){return e?e==="dev"?"dev":/^[0-9a-f]{40}$/i.test(e)?e.slice(0,7):e:""}const Fc={system:"◑",light:"☀",dark:"☾"};function tv(){const{mode:e,group:t,domain:n}=ze();return e==="personal"?a.jsx("span",{children:"personal"}):t?a.jsxs("span",{children:[t.name," / ",n]}):a.jsx("span",{children:n})}function xl({onMenuToggle:e}){const{user:t,logout:n}=ze(),{theme:r,toggle:o}=Rf(),{version:s}=_f(),i=ev(s);return a.jsx("nav",{className:"top-nav",children:a.jsxs("div",{className:"top-nav-inner",children:[a.jsxs("div",{className:"logo-group",children:[a.jsx("span",{className:"logo",children:"Suveren"}),a.jsx("span",{className:"version-badge",children:"Local Gateway"})]}),a.jsx("div",{className:"nav-spacer"}),a.jsx("div",{className:"nav-actions nav-actions-desktop",children:t?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"user-chip",children:[a.jsx("strong",{children:t.name}),a.jsx("span",{className:"dot"}),a.jsx(tv,{})]}),a.jsx("button",{className:"theme-toggle",onClick:o,title:`Theme: ${r}`,children:Fc[r]}),a.jsx("button",{className:"nav-logout",onClick:n,children:"Logout"})]}):a.jsxs(a.Fragment,{children:[i&&a.jsxs("span",{title:"Running gateway version",style:{fontSize:"0.8rem",color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums"},children:["v",i]}),a.jsx("button",{className:"theme-toggle",onClick:o,title:`Theme: ${r}`,children:Fc[r]})]})}),t&&e&&a.jsx("button",{className:"mobile-menu-btn",onClick:e,"aria-label":"Menu",children:"☰"})]})})}function Ct(e,t){var n;if((n=t==null?void 0:t.revokedSet)!=null&&n.has(e.authorization_id))return"revoked";switch(e.sp_status){case"revoked":return"revoked";case"expired":return"expired";case"active":return"active";case"pending":return"pending"}return e.remaining_seconds===null||e.remaining_seconds<=0?"expired":e.missing_domains.length>0?"pending":"active"}function Af(e,t){const n={active:[],pending:[],expired:[],revoked:[]};for(const r of e)n[Ct(r,t)].push(r);return n}function $t(e,t,n){const r=d.useRef(e);r.current=e,d.useEffect(()=>{let o=null;const s=()=>typeof document>"u"?!0:document.visibilityState==="visible",i=()=>{s()&&r.current()},l=()=>{o===null&&(o=setInterval(i,t))},c=()=>{o!==null&&(clearInterval(o),o=null)},u=()=>{s()?(r.current(),l()):c()};return s()&&(r.current(),l()),document.addEventListener("visibilitychange",u),()=>{c(),document.removeEventListener("visibilitychange",u)}},[t,n])}const $f=d.createContext(null),nv=3e4;function rv({children:e}){const[t,n]=d.useState({manifests:[],integrations:[],activeSessions:0,mcpServerUp:null,manifestsError:!1,fetchCount:0}),r=d.useRef(null),o=d.useCallback(async()=>{let c=!1;const[u,p]=await Promise.all([O.getIntegrationManifests().catch(()=>(c=!0,{manifests:[]})),O.getMcpHealth().catch(()=>null)]);n(f=>({manifests:u.manifests,integrations:(p==null?void 0:p.integrations)??f.integrations,activeSessions:(p==null?void 0:p.activeSessions)??f.activeSessions,mcpServerUp:!!p,manifestsError:c,fetchCount:f.fetchCount+1}))},[]);fe("integration-changed",o),$t(o,3e5);const s=d.useMemo(()=>{const c=new Map(t.integrations.map(v=>[v.id,v])),u=Date.now(),p=t.fetchCount>0&&t.manifests.some(v=>{const y=c.get(v.id);return y&&!y.running});p&&r.current===null?r.current=u:p||(r.current=null);const f=r.current!==null&&u-r.current<nv;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:o};return a.jsx($f.Provider,{value:l,children:e})}function wl(){const e=d.useContext($f);if(!e)throw new Error("useIntegrationStatus must be used inside IntegrationStatusProvider");return e}const ov=[{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 av(){const{activeDomain:e}=ze(),[t,n]=d.useState({}),r=d.useCallback(async()=>{try{const[o,s,i,l,c]=await Promise.all([O.getCredential("ai-config").catch(()=>null),O.getMyAttestations().catch(()=>null),O.getProposals(e||"owner").catch(()=>null),O.getProposalsForApprover().catch(()=>null),O.getAgentContext().catch(()=>"")]),u={};if(o&&!o.configured&&(u.assistant=1),s){const y=Af(s).expired.length;y>0&&(u.authorizations=y)}const p=(i==null?void 0:i.length)??0,f=(l==null?void 0:l.length)??0,v=p+f;v>0&&(u.proposals=v),(!c||!c.trim())&&(u.brief=1),n(u)}catch{}},[e]);return fe("attestation-changed",r),fe("proposal-added",r),fe("proposal-resolved",r),fe("proposal-approved",r),fe("proposal-rejected",r),fe("team-membership-changed",r),$t(r,3e5,e),t}const sv={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},iv={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 lv(){const{mode:e,group:t,domain:n,activeTeam:r}=ze(),o=av(),{attentionCount:s}=wl(),i={...o};s>0&&(i.integrations=s);const l=ov.filter(v=>!v.teamOnly||e==="team"),c=d.useRef(null),[u,p]=d.useState(null),f=dt();return d.useEffect(()=>{if(c.current===null){c.current=e;return}c.current!==e&&(e==="team"&&r?p(`You are now acting in team context — ${r.name}`):e==="personal"&&p("You have left the team — back to personal context"),c.current=e)},[e,r]),d.useEffect(()=>{p(null)},[f.pathname]),a.jsxs("div",{className:"sidebar",children:[a.jsx("ul",{className:"sidebar-nav",children:l.map(v=>{const y=v.statusKey?i[v.statusKey]:0;return a.jsx("li",{children:a.jsxs(yl,{to:v.to,end:v.to==="/",className:({isActive:x})=>`sidebar-item${x?" active":""}`,children:[a.jsx("span",{className:"icon",children:v.icon}),v.label,y?a.jsx("span",{style:sv,children:y}):null]})},v.to)})}),a.jsxs("div",{className:"sidebar-context",children:[a.jsx("div",{className:"ctx-label",children:"Active context"}),a.jsx("div",{className:"ctx-value",children:e==="personal"?"personal":t?`${t.name} / ${n}`:n})]}),u&&a.jsx("div",{style:iv,role:"status","aria-live":"polite",children:u})]})}const ms="suveren:updatedTo";function cv(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 uv(){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 dv(){const{updateAvailable:e,installMethod:t,version:n,latestVersion:r,serverRestarted:o,startFastPolling:s,dismiss:i}=_f(),[l,c]=d.useState(!1),[u,p]=d.useState(!1),[f,v]=d.useState(()=>{try{const g=sessionStorage.getItem(ms);if(g)return sessionStorage.removeItem(ms),g}catch{}return null}),y=cv(t),x=d.useRef(null),w=g=>{try{sessionStorage.setItem(ms,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||!o)return;const g=()=>uv()?!1:(w(n),!0);if(g())return;const S=setInterval(g,1500);return()=>clearInterval(S)},[l,o,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 P;const E=((P=x.current)==null?void 0:P.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 h=()=>{c(!0),s()},m=async()=>{try{await navigator.clipboard.writeText(y),p(!0),setTimeout(()=>p(!1),1800)}catch{}};return a.jsxs(a.Fragment,{children:[f&&!l&&a.jsx("div",{ref:x,className:"update-banner is-live",role:"status","aria-live":"polite",children:a.jsxs("div",{className:"update-banner-row",children:[a.jsxs("span",{className:"update-banner-text",children:["✓"," You","’","re on the latest version",f&&f!=="✓"?` — ${f} is live`:" — now live","."]}),a.jsx("button",{className:"update-banner-x",onClick:()=>v(null),"aria-label":"Dismiss",children:"×"})]})}),e&&!l&&!f&&a.jsx("div",{ref:x,className:"update-banner",role:"status","aria-live":"polite",children:a.jsxs("div",{className:"update-banner-row",children:[a.jsx("span",{className:"update-banner-text",children:"Update available."}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[a.jsx("button",{className:"btn btn-sm btn-secondary",onClick:h,children:"Update"}),a.jsx("button",{className:"update-banner-x",onClick:i,"aria-label":"Dismiss",children:"×"})]})]})}),l&&a.jsx("div",{className:"update-overlay",children:a.jsxs("div",{className:"update-overlay-card",role:"dialog","aria-modal":"true","aria-label":"Finishing the update",children:[a.jsx("div",{className:"update-spinner"}),a.jsxs("h2",{children:["Finishing the update","…"]}),a.jsxs("p",{children:["Copy this command and run it in your terminal. The gateway will restart, and"," ",a.jsx("strong",{children:"this page updates automatically"})," when it comes back ","—"," no need to refresh."]}),a.jsxs("div",{className:"update-cmd-row",children:[a.jsx("code",{className:"update-cmd",children:y}),a.jsx("button",{className:"btn btn-sm btn-primary",onClick:m,children:u?"Copied":"Copy"})]}),a.jsxs("div",{className:"update-status",children:[a.jsx("span",{className:"update-pulse"})," Waiting for the gateway to restart","…"]}),a.jsxs("div",{className:"update-overlay-actions",children:[a.jsx("button",{className:"btn btn-primary",onClick:()=>w(n),children:"Reload now"}),a.jsx("button",{className:"btn btn-secondary",onClick:()=>c(!1),children:"Cancel"})]})]})})]})}const fv={system:"◑",light:"☀",dark:"☾"},mv=[{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 pv({open:e,onClose:t}){const{user:n,activeGroup:r,activeDomain:o,logout:s}=ze(),{theme:i,toggle:l}=Rf(),c=dt();return d.useEffect(()=>{t()},[c.pathname]),e?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mobile-menu-backdrop",onClick:t}),a.jsxs("div",{className:"mobile-menu-panel",children:[n&&a.jsxs("div",{className:"mobile-menu-header",children:[a.jsx("strong",{children:n.name}),a.jsx("span",{style:{fontSize:"0.8rem",color:"var(--text-secondary)"},children:r?`${r.name} / ${o}`:o||"personal"})]}),a.jsx("nav",{className:"mobile-menu-nav",children:mv.map(u=>a.jsxs(yl,{to:u.to,end:u.to==="/",className:({isActive:p})=>`mobile-menu-item${p?" active":""}`,onClick:t,children:[a.jsx("span",{className:"icon",children:u.icon}),u.label]},u.to))}),a.jsxs("div",{className:"mobile-menu-footer",children:[a.jsxs("button",{className:"mobile-menu-action",onClick:()=>{l()},children:[a.jsx("span",{className:"icon",children:fv[i]}),"Theme: ",i]}),a.jsx("button",{className:"mobile-menu-action",onClick:()=>{s(),t()},children:"Logout"})]})]})]}):null}function hv(){const[e,t]=d.useState(!1);return a.jsxs(rv,{children:[a.jsx(xl,{onMenuToggle:()=>t(!e)}),a.jsx(dv,{}),a.jsx(lv,{}),a.jsx(pv,{open:e,onClose:()=>t(!1)}),a.jsx("div",{className:"main-content",children:a.jsx("div",{className:"page-inner",children:a.jsx(mg,{})})})]})}function gv(){const[e,t]=d.useState(""),{login:n,isLoading:r,error:o,clearError:s}=ze(),[i,l]=d.useState(null),c=async()=>{if(e.trim()){s();try{await n(e)}catch(f){if(f instanceof Pf){l(f.summary);return}}}},u=async()=>{l(null),s();try{await n(e,{confirmWipe:!0})}catch{}},p=()=>{l(null)};return a.jsxs(a.Fragment,{children:[a.jsx(xl,{}),a.jsxs("div",{className:"login-split",children:[a.jsx("div",{className:"login-split-left",children:a.jsxs("div",{style:{maxWidth:"28rem"},children:[a.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."}),a.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."})]})}),a.jsx("div",{className:"login-split-right",children:a.jsxs("div",{style:{width:"100%",maxWidth:"24rem"},children:[a.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[a.jsx("div",{style:{fontSize:"1.75rem",fontWeight:700,marginBottom:"0.5rem"},children:"Sign In"}),a.jsx("div",{style:{fontSize:"0.95rem",color:"var(--text-secondary)",lineHeight:1.5},children:"Enter your API key to manage authorizations."})]}),o&&a.jsx("div",{className:"error-message",children:o}),a.jsxs("div",{className:"form-group",style:{marginBottom:"1.5rem"},children:[a.jsx("label",{className:"form-label",children:"API Key"}),a.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"}}),a.jsx("div",{className:"form-hint",children:"From your Suveren account."})]}),a.jsx("button",{className:"btn btn-primary btn-full btn-lg",onClick:c,disabled:r,style:{marginBottom:"2rem"},children:r?"Signing in...":"Sign In"}),a.jsx("div",{className:"login-divider",children:"New here?"}),a.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[a.jsxs("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary)",marginBottom:"1rem",lineHeight:1.5},children:["Create an account on Suveren,",a.jsx("br",{}),"then come back to sign in."]}),a.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"})]}),a.jsxs("div",{style:{paddingTop:"1.75rem",borderTop:"1px solid var(--border)"},children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",marginBottom:"0.875rem"},children:"Getting started"}),a.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.8},children:[a.jsxs(a.Fragment,{children:["Create an account at ",a.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)=>a.jsxs("div",{style:{display:"flex",gap:"0.625rem",alignItems:"baseline",marginBottom:v<2?"0.5rem":0},children:[a.jsxs("span",{style:{color:"var(--accent)",fontWeight:700,fontSize:"0.95rem"},children:[v+1,"."]}),f]},v))})]})]})})]}),i&&a.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:p,children:a.jsxs("div",{className:"card",onClick:f=>f.stopPropagation(),style:{maxWidth:520,width:"100%",margin:0},children:[a.jsx("h3",{id:"wipe-warning-title",className:"card-title",style:{marginBottom:"0.5rem"},children:"Sign in with a different account?"}),a.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 ",a.jsx("strong",{children:"permanently wipe"})," the following local data:"]}),a.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[a.jsxs("li",{children:[i.credentialCount," stored service credential",i.credentialCount===1?"":"s",i.credentialIds.length>0&&a.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`:"",")"]})]}),a.jsxs("li",{children:[i.serviceCount," configured integration",i.serviceCount===1?"":"s"]}),a.jsx("li",{children:"The local E2EE keypair (a new one will be generated for this account)"}),a.jsx("li",{children:"Any unsynchronised gate content stored locally"})]}),a.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."}),a.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."}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end"},children:[a.jsx("button",{className:"btn btn-ghost",onClick:p,disabled:r,children:"Cancel"}),a.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 vv(){const{setActiveContext:e}=ze(),t=Wt(),[n,r]=d.useState(""),[o,s]=d.useState(""),[i,l]=d.useState(""),[c,u]=d.useState(!1),p=async()=>{if(n.trim()){u(!0),l("");try{const v=await O.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(o.trim()){u(!0),l("");try{const v=await O.createGroup(o.trim());e(v,v.myDomains[0]||""),t("/")}catch(v){l(v instanceof Error?v.message:"Failed to create group")}finally{u(!1)}}};return a.jsxs(a.Fragment,{children:[a.jsx(xl,{}),a.jsx("div",{className:"main-content no-sidebar",style:{marginTop:"var(--nav-height)"},children:a.jsxs("div",{style:{maxWidth:"30rem",margin:"3rem auto",padding:"0 1rem"},children:[a.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[a.jsx("h2",{style:{fontSize:"1.5rem",marginBottom:"0.5rem"},children:"Join Your Team"}),a.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&&a.jsx("div",{className:"error-message",children:i}),a.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[a.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Join an existing group"}),a.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Ask your team admin for an invite code."}),a.jsxs("div",{className:"invite-input-row",children:[a.jsx("input",{className:"form-input",placeholder:"Paste invite code...",value:n,onChange:v=>r(v.target.value),onKeyDown:v=>v.key==="Enter"&&p(),style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem"},disabled:c}),a.jsx("button",{className:"btn btn-primary",onClick:p,disabled:c,children:"Join"})]})]}),a.jsxs("div",{className:"card",children:[a.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Create a new group"}),a.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Start a new team and invite members. Assign domains after creation."}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("input",{className:"form-input",placeholder:"Group name (e.g., Acme Corp)",value:o,onChange:v=>s(v.target.value),onKeyDown:v=>v.key==="Enter"&&f(),style:{flex:1},disabled:c}),a.jsx("button",{className:"btn btn-secondary",onClick:f,disabled:c,children:"Create"})]})]})]})})]})}const fi="suveren-setup-ai-skipped",mi="suveren-setup-agent-done",pi="suveren-setup-dismissed",yv={"hap-setup-ai-skipped":fi,"hap-setup-agent-done":mi,"hap-setup-dismissed":pi};function xv(){for(const[e,t]of Object.entries(yv)){const n=localStorage.getItem(e);n!==null&&localStorage.getItem(t)===null&&localStorage.setItem(t,n),n!==null&&localStorage.removeItem(e)}}xv();const ps={"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="${h}"> to <Route path="${h==="/"?"*":`${h}/*`}">.`)}let m=dt(),f;if(t){let h=typeof t=="string"?lr(t):t;de(c==="/"||((j=h.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 "${h.pathname}" was given in the \`location\` prop.`),f=h}else f=m;let v=f.pathname||"/",y=v;if(c!=="/"){let h=c.replace(/^\//,"").split("/");y="/"+v.replace(/^\//,"").split("/").slice(h.length).join("/")}let x=df(e,{pathname:y});ut(u||x!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),ut(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=sg(x&&x.map(h=>Object.assign({},h,{params:Object.assign({},i,h.params),pathname:zt([c,r.encodeLocation?r.encodeLocation(h.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?c:zt([c,r.encodeLocation?r.encodeLocation(h.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathnameBase])})),o,n);return t&&w?d.createElement(so.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...f},navigationType:"POP"}},w):w}function ng(){let e=dg(),t=Dh(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)",o={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:o},n):null,i)}var rg=d.createElement(ng,null),jf=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=Jh(e.digest);n&&(e=n)}let t=e!==void 0?d.createElement(St.Provider,{value:this.props.routeContext},d.createElement(pl.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?d.createElement(og,{error:e},t):t}};jf.contextType=Hh;var ds=new WeakMap;function og({children:e,error:t}){let{basename:n}=d.useContext(nt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Qh(t.digest);if(r){let o=ds.get(t);if(o)throw o;let s=hf(r.location,n);if(mf&&!ds.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 ds.set(t,i),i}return d.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return e}function ag({routeContext:e,match:t,children:n}){let r=d.useContext(cr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(St.Provider,{value:e},n)}function sg(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 o=e,s=r==null?void 0:r.errors;if(s!=null){let m=o.findIndex(f=>f.route.id&&(s==null?void 0:s[f.route.id])!==void 0);de(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),o=o.slice(0,Math.min(o.length,m+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let m=0;m<o.length;m++){let f=o[m];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=m),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?o=o.slice(0,l+1):o=[o[0]];break}}}}let c=n==null?void 0:n.onError,u=r&&c?(m,f)=>{var v,y;c(m,{location:r.location,params:((y=(v=r.matches)==null?void 0:v[0])==null?void 0:y.params)??{},unstable_pattern:Uh(r.matches),errorInfo:f})}:void 0;return o.reduceRight((m,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||rg,i&&(l<0&&v===0?(kf("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 h=t.concat(o.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=m,d.createElement(ag,{match:f,routeContext:{outlet:m,matches:h,isDataRoute:r!=null},children:g})};return r&&(f.route.ErrorBoundary||f.route.errorElement||v===0)?d.createElement(jf,{location:r.location,revalidation:r.revalidation,component:w,error:y,children:p(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):p()},null)}function ml(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ig(e){let t=d.useContext(cr);return de(t,ml(e)),t}function lg(e){let t=d.useContext($a);return de(t,ml(e)),t}function cg(e){let t=d.useContext(St);return de(t,ml(e)),t}function hl(e){let t=cg(e),n=t.matches[t.matches.length-1];return de(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ug(){return hl("useRouteId")}function dg(){var r;let e=d.useContext(pl),t=lg("useRouteError"),n=hl("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function fg(){let{router:e}=ig("useNavigate"),t=hl("useNavigate"),n=d.useRef(!1);return wf(()=>{n.current=!0}),d.useCallback(async(o,s={})=>{ut(n.current,xf),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...s}))},[e,t])}var $c={};function kf(e,t,n){!t&&!$c[e]&&($c[e]=!0,ut(!1,n))}d.memo(pg);function pg({routes:e,future:t,state:n,isStatic:r,onError:o}){return Sf(e,void 0,{state:n,isStatic:r,onError:o})}function Yt({to:e,replace:t,state:n,relative:r}){de(ur(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=d.useContext(nt);ut(!o,"<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(St),{pathname:i}=dt(),l=Wt(),c=Aa(e,fl(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 mg(e){return eg(e.context)}function Ce(e){de(!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 hg({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:s=!1,unstable_useTransitions:i}){de(!ur(),"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:o,static:s,unstable_useTransitions:i,future:{}}),[l,o,s,i]);typeof n=="string"&&(n=lr(n));let{pathname:u="/",search:m="",hash:f="",state:v=null,key:y="default",unstable_mask:x}=n,w=d.useMemo(()=>{let j=Dt(u,l);return j==null?null:{location:{pathname:j,search:m,hash:f,state:v,key:y,unstable_mask:x},navigationType:r}},[l,u,m,f,v,y,r,x]);return ut(w!=null,`<Router basename="${l}"> is not able to match the URL "${u}${m}${f}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:d.createElement(nt.Provider,{value:c},d.createElement(so.Provider,{children:t,value:w}))}function gg({children:e,location:t}){return tg(ui(e),t)}function ui(e,t=[]){let n=[];return d.Children.forEach(e,(r,o)=>{if(!d.isValidElement(r))return;let s=[...t,o];if(r.type===d.Fragment){n.push.apply(n,ui(r.props.children,s));return}de(r.type===Ce,`[${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>`),de(!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=ui(r.props.children,s)),n.push(i)}),n}var Uo="get",Wo="application/x-www-form-urlencoded";function La(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function vg(e){return La(e)&&e.tagName.toLowerCase()==="button"}function yg(e){return La(e)&&e.tagName.toLowerCase()==="form"}function xg(e){return La(e)&&e.tagName.toLowerCase()==="input"}function wg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Sg(e,t){return e.button===0&&(!t||t==="_self")&&!wg(e)}function di(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(o=>[n,o]):[[n,r]])},[]))}function jg(e,t){let n=di(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(s=>{n.append(o,s)})}),n}var Eo=null;function kg(){if(Eo===null)try{new FormData(document.createElement("form"),0),Eo=!1}catch{Eo=!0}return Eo}var Cg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function fs(e){return e!=null&&!Cg.has(e)?(ut(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wo}"`),null):e}function bg(e,t){let n,r,o,s,i;if(yg(e)){let l=e.getAttribute("action");r=l?Dt(l,t):null,n=e.getAttribute("method")||Uo,o=fs(e.getAttribute("enctype"))||Wo,s=new FormData(e)}else if(vg(e)||xg(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?Dt(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Uo,o=fs(e.getAttribute("formenctype"))||fs(l.getAttribute("enctype"))||Wo,s=new FormData(l,e),!kg()){let{name:u,type:m,value:f}=e;if(m==="image"){let v=u?`${u}.`:"";s.append(`${v}x`,"0"),s.append(`${v}y`,"0")}else u&&s.append(u,f)}}else{if(La(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Uo,r=null,o=Wo,i=e}return s&&o==="text/plain"&&(i=s,s=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:s,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function gl(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ng(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Dt(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${r}`,o}async function Eg(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 zg(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 Pg(e,t,n){let r=await Promise.all(e.map(async o=>{let s=t.routes[o.route.id];if(s){let i=await Eg(s,n);return i.links?i.links():[]}return[]}));return _g(r.flat(1).filter(zg).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Lc(e,t,n,r,o,s){let i=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var m;return n[u].pathname!==c.pathname||((m=n[u].route.path)==null?void 0:m.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 m=r.routes[c.route.id];if(!m||!m.hasLoader)return!1;if(i(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let v=c.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.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 Tg(e,t,{includeHydrateFallback:n}={}){return Ig(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let s=[o.module];return o.clientActionModule&&(s=s.concat(o.clientActionModule)),o.clientLoaderModule&&(s=s.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(s=s.concat(o.hydrateFallbackModule)),o.imports&&(s=s.concat(o.imports)),s}).flat(1))}function Ig(e){return[...new Set(e)]}function Rg(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function _g(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let s=JSON.stringify(Rg(o));return n.has(s)||(n.add(s),r.push({key:s,link:o})),r},[])}function Cf(){let e=d.useContext(cr);return gl(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Ag(){let e=d.useContext($a);return gl(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var vl=d.createContext(void 0);vl.displayName="FrameworkContext";function bf(){let e=d.useContext(vl);return gl(e,"You must render this element inside a <HydratedRouter> element"),e}function $g(e,t){let n=d.useContext(vl),[r,o]=d.useState(!1),[s,i]=d.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:m,onTouchStart:f}=t,v=d.useRef(null);d.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let w=h=>{h.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=()=>{o(!0)},x=()=>{o(!1),i(!1)};return n?e!=="intent"?[s,v,{}]:[s,v,{onFocus:Sr(l,y),onBlur:Sr(c,x),onMouseEnter:Sr(u,y),onMouseLeave:Sr(m,x),onTouchStart:Sr(f,y)}]:[!1,v,{}]}function Sr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Lg({page:e,...t}){let{router:n}=Cf(),r=d.useMemo(()=>df(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?d.createElement(Fg,{page:e,matches:r,...t}):null}function Mg(e){let{manifest:t,routeModules:n}=bf(),[r,o]=d.useState([]);return d.useEffect(()=>{let s=!1;return Pg(e,t,n).then(i=>{s||o(i)}),()=>{s=!0}},[e,t,n]),r}function Fg({page:e,matches:t,...n}){let r=dt(),{future:o,manifest:s,routeModules:i}=bf(),{basename:l}=Cf(),{loaderData:c,matches:u}=Ag(),m=d.useMemo(()=>Lc(e,t,u,s,r,"data"),[e,t,u,s,r]),f=d.useMemo(()=>Lc(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||(!m.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 h=Ng(e,l,o.unstable_trailingSlashAwareDataRequests,"data");return j&&w.size>0&&h.searchParams.set("_routes",t.filter(p=>w.has(p.route.id)).map(p=>p.route.id).join(",")),[h.pathname+h.search]},[l,o.unstable_trailingSlashAwareDataRequests,c,r,s,m,t,e,i]),y=d.useMemo(()=>Tg(f,s),[f,s]),x=Mg(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 Og(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Bg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Bg&&(window.__reactRouterVersion="7.13.1")}catch{}function Dg({basename:e,children:t,unstable_useTransitions:n,window:r}){let o=d.useRef();o.current==null&&(o.current=vh({window:r,v5Compat:!0}));let s=o.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(hg,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:s,unstable_useTransitions:n})}var Nf=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Je=d.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:s,replace:i,unstable_mask:l,state:c,target:u,to:m,preventScrollReset:f,viewTransition:v,unstable_defaultShouldRevalidate:y,...x},w){let{basename:j,navigator:h,unstable_useTransitions:p}=d.useContext(nt),g=typeof m=="string"&&Nf.test(m),S=hf(m,j);m=S.to;let E=Xh(m,{relative:o}),P=dt(),k=null;if(l){let D=Aa(l,[],P.unstable_mask?P.unstable_mask.pathname:"/",!0);j!=="/"&&(D.pathname=D.pathname==="/"?j:zt([j,D.pathname])),k=h.createHref(D)}let[N,C,T]=$g(r,x),H=Hg(m,{replace:i,unstable_mask:l,state:c,target:u,preventScrollReset:f,relative:o,viewTransition:v,unstable_defaultShouldRevalidate:y,unstable_useTransitions:p});function W(D){t&&t(D),D.defaultPrevented||H(D)}let B=!(S.isExternal||s),_=d.createElement("a",{...x,...T,href:(B?k:void 0)||S.absoluteURL||E,onClick:B?W:t,ref:Og(w,C),target:u,"data-discover":!g&&n==="render"?"true":void 0});return N&&!g?d.createElement(d.Fragment,null,_,d.createElement(Lg,{page:E})):_});Je.displayName="Link";var yl=d.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:s,to:i,viewTransition:l,children:c,...u},m){let f=io(i,{relative:u.relative}),v=dt(),y=d.useContext($a),{navigator:x,basename:w}=d.useContext(nt),j=y!=null&&Qg(f)&&l===!0,h=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,h=h.toLowerCase()),g&&w&&(g=Dt(g,w)||g);const S=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let E=p===h||!o&&p.startsWith(h)&&p.charAt(S)==="/",P=g!=null&&(g===h||!o&&g.startsWith(h)&&g.charAt(h.length)==="/"),k={isActive:E,isPending:P,isTransitioning:j},N=E?t:void 0,C;typeof r=="function"?C=r(k):C=[r,E?"active":null,P?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let T=typeof s=="function"?s(k):s;return d.createElement(Je,{...u,"aria-current":N,className:C,ref:m,style:T,to:i,viewTransition:l},typeof c=="function"?c(k):c)});yl.displayName="NavLink";var Ug=d.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:s,method:i=Uo,action:l,onSubmit:c,relative:u,preventScrollReset:m,viewTransition:f,unstable_defaultShouldRevalidate:v,...y},x)=>{let{unstable_useTransitions:w}=d.useContext(nt),j=Gg(),h=Yg(l,{relative:u}),p=i.toLowerCase()==="get"?"get":"post",g=typeof l=="string"&&Nf.test(l),S=E=>{if(c&&c(E),E.defaultPrevented)return;E.preventDefault();let P=E.nativeEvent.submitter,k=(P==null?void 0:P.getAttribute("formmethod"))||i,N=()=>j(P||E.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:o,state:s,relative:u,preventScrollReset:m,viewTransition:f,unstable_defaultShouldRevalidate:v});w&&n!==!1?d.startTransition(()=>N()):N()};return d.createElement("form",{ref:x,method:p,action:h,onSubmit:r?c:S,...y,"data-discover":!g&&e==="render"?"true":void 0})});Ug.displayName="Form";function Wg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ef(e){let t=d.useContext(cr);return de(t,Wg(e)),t}function Hg(e,{target:t,replace:n,unstable_mask:r,state:o,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c,unstable_useTransitions:u}={}){let m=Wt(),f=dt(),v=io(e,{relative:i});return d.useCallback(y=>{if(Sg(y,t)){y.preventDefault();let x=n!==void 0?n:eo(f)===eo(v),w=()=>m(e,{replace:x,unstable_mask:r,state:o,preventScrollReset:s,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c});u?d.startTransition(()=>w()):w()}},[f,m,v,n,r,o,t,e,s,i,l,c,u])}function zf(e){ut(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(di(e)),n=d.useRef(!1),r=dt(),o=d.useMemo(()=>jg(r.search,n.current?null:t.current),[r.search]),s=Wt(),i=d.useCallback((l,c)=>{const u=di(typeof l=="function"?l(new URLSearchParams(o)):l);n.current=!0,s("?"+u,c)},[s,o]);return[o,i]}var Vg=0,Kg=()=>`__${String(++Vg)}__`;function Gg(){let{router:e}=Ef("useSubmit"),{basename:t}=d.useContext(nt),n=ug(),r=e.fetch,o=e.navigate;return d.useCallback(async(s,i={})=>{let{action:l,method:c,encType:u,formData:m,body:f}=bg(s,t);if(i.navigate===!1){let v=i.fetcherKey||Kg();await r(v,n,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:m,body:f,formMethod:i.method||c,formEncType:i.encType||u,flushSync:i.flushSync})}else await o(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:m,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,o,t,n])}function Yg(e,{relative:t}={}){let{basename:n}=d.useContext(nt),r=d.useContext(St);de(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),s={...io(e||".",{relative:t})},i=dt();if(e==null){s.search=i.search;let l=new URLSearchParams(s.search),c=l.getAll("index");if(c.some(m=>m==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let m=l.toString();s.search=m?`?${m}`:""}}return(!e||e===".")&&o.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:zt([n,s.pathname])),eo(s)}function Qg(e,{relative:t}={}){let n=d.useContext(vf);de(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ef("useViewTransitionState"),o=io(e,{relative:t});if(!n.isTransitioning)return!1;let s=Dt(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Dt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ha(o.pathname,i)!=null||ha(o.pathname,s)!=null}class Pf extends Error{constructor(n){super("different_account");Ma(this,"summary");this.name="DifferentAccountError",this.summary=n}}class Jg{constructor(){Ma(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 Pf(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{authorization_id:s.authorization_id,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(),o=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!o.ok)throw new Error(`Failed to fetch receipts: ${o.status}`);return(await o.json()).receipts??[]}async revokeAttestation(t,n){const r=await this.fetch(`/api/authorizations/${encodeURIComponent(t)}/revoke`,{method:"POST",body:JSON.stringify({reason:n??"Revoked by user"})});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed to revoke"}));throw new Error(o.error||`Revoke failed: ${r.status}`)}}async getAttestations(t){const n=await this.fetch(`/api/attestations?authorization_id=${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(),o=r.group||r;return{id:o.id,name:o.name,myDomains:o.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(),o=r.group||r;return{id:o.id,name:o.name,myDomains:o.myDomains||[],isAdmin:o.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 aiIntentReview(t){const n=await this.fetch("/ai/intent-review",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI request failed"}))).error}}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 o=await r.json().catch(()=>({error:`Discovery failed: ${r.status}`}));throw new Error(o.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 o=await r.json();return(o==null?void 0:o.config)??null}async setTeamProfileConfig(t,n,r){const o=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(r)});if(!o.ok){const s=await o.json().catch(()=>({error:"Failed to set profile config"}));throw new Error(s.error||`setTeamProfileConfig failed: ${o.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 o=await r.json().catch(()=>({error:"Encryption failed"}));throw new Error(o.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 o=await r.json().catch(()=>({error:"Failed to delete profile config"}));throw new Error(o.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 o=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/resolve`,{method:"POST",body:JSON.stringify({action:n,domain:r})});if(!o.ok){const s=await o.json().catch(()=>({error:"Failed"}));throw new Error(s.error||`Failed: ${o.status}`)}return o.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 o=await r.json().catch(()=>({error:"Failed"}));throw new Error(o.error||`rejectProposal failed: ${r.status}`)}return r.json()}async getAttestationIntent(t){const n=await this.fetch(`/api/authorizations/${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 o=await n.json().catch(()=>({error:"Decryption failed"}));throw new Error(o.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 o=await r.json().catch(()=>({error:"Failed"}));throw new Error(o.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(o=>{var l,c;const s=o.owner??{userId:""};return{authorization_id:o.authorization_id??o.authorizationId,profile_id:o.profileId??o.profile_id,path:o.path??"",title:o.title??null,sp_status:o.status??o.sp_status??null,frame:o.bounds??o.frame??{},required_domains:o.requiredDomains??o.required_domains??[],attested_domains:o.attestedDomains??o.attested_domains??[],missing_domains:(o.requiredDomains??o.required_domains??[]).filter(u=>!(o.attestedDomains??o.attested_domains??[]).includes(u)),deferred_commitment_domains:o.deferredCommitmentDomains??o.deferred_commitment_domains??[],approvers_frozen:o.approversFrozen??o.approvers_frozen??[],above_cap:o.aboveCap??o.above_cap??!1,created_at:o.createdAt?new Date(o.createdAt*1e3).toISOString():o.created_at??"",earliest_expiry:(l=o.attestations)!=null&&l.length?new Date(Math.min(...o.attestations.map(u=>u.expiresAt))*1e3).toISOString():null,remaining_seconds:(c=o.attestations)!=null&&c.length?Math.max(0,Math.min(...o.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 getMyReceiptsPage(t){const n=new URLSearchParams;t!=null&&t.before&&n.set("before",t.before),t!=null&&t.profile&&n.set("profile",t.profile),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString(),o=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!o.ok)throw new Error(`Failed to fetch receipts: ${o.status}`);const s=await o.json();return{receipts:s.receipts??[],nextBefore:s.nextBefore??null}}async listTeamReceiptsPage(t,n){const r=new URLSearchParams;n!=null&&n.before&&r.set("before",n.before),n!=null&&n.profile&&r.set("profile",n.profile),n!=null&&n.limit&&r.set("limit",String(n.limit));const o=r.toString(),s=await this.fetch(`/api/groups/${encodeURIComponent(t)}/receipts${o?"?"+o:""}`);if(!s.ok)throw new Error(`Failed to fetch team receipts: ${s.status}`);const i=await s.json();return{receipts:i.receipts??[],nextBefore:i.nextBefore??null}}async getThread(t){const n=t.sinceDays??7,r=t.status??"pending",o=t.domain||"owner",s=await this.getProposals(o);let i=[];if(r==="all"){const l=[],c=new Date;for(let m=0;m<n;m++){const f=new Date(c);f.setUTCDate(c.getUTCDate()-m),l.push(f.toISOString().slice(0,10))}i=(await Promise.all(l.map(m=>this.getMyReceipts({date:m,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 getEnrichedAuthorizations(){const t=await this.fetch("/active-authorizations");if(!t.ok)throw new Error(`Failed to fetch authorizations: ${t.status}`);return(await t.json()).authorizations??[]}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 o=await r.json().catch(()=>({error:"Save failed"}));throw new Error(o.error||`Save failed: ${r.status}`)}}}const O=new Jg,Tf=d.createContext(null);function Xg({children:e}){const[t,n]=d.useState(null),[r,o]=d.useState("personal"),[s,i]=d.useState(null),[l,c]=d.useState(""),[u,m]=d.useState(null),[f,v]=d.useState(null),[y,x]=d.useState(!1),[w,j]=d.useState(""),h=d.useRef(!1),p=d.useRef(null),g=d.useCallback(async()=>{if(h.current)try{const N=await O.getMyTeam();if(N){const{group:C,membership:T}=N;m(C),v(T),o("team"),i(C);const H=p.current??T.domains[0]??"owner";c(H)}else m(null),v(null),o("personal")}catch{}},[]);d.useEffect(()=>{const N=()=>{document.visibilityState==="visible"&&g()};return document.addEventListener("visibilitychange",N),()=>document.removeEventListener("visibilitychange",N)},[g]);const S=d.useCallback(async(N,C={})=>{x(!0),j("");try{O.setApiKey(N),h.current=!0;const T=await O.login(N,C);n(T),p.current=T.id;const H=await O.getGroups(),W=H.find(B=>B.isPersonal)??H[0]??null;i(W),c("owner"),await g()}catch(T){throw O.clearApiKey(),h.current=!1,j(T instanceof Error?T.message:"Login failed"),T}finally{x(!1)}},[g]),E=d.useCallback(async()=>{await O.logout(),O.clearApiKey(),h.current=!1,p.current=null,n(null),i(null),c(""),m(null),v(null),o("personal"),j("")},[]),P=d.useCallback(()=>j(""),[]),k=d.useCallback((N,C)=>{i(N),c(C)},[]);return a.jsx(Tf.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:P,activeGroup:s,activeDomain:l,groups:s?[s]:[],setActiveContext:k,refreshGroups:g},children:e})}function ze(){const e=d.useContext(Tf);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const If=d.createContext(null);function qg({children:e}){const{user:t}=ze(),n=d.useRef(null),[r,o]=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 m;(m=u.get(l))==null||m.delete(c)}},[]);return d.useEffect(()=>{if(!t){n.current&&(n.current.close(),n.current=null,o(!1));return}if(n.current)return;const l=O.getApiKey();if(!l)return;const c=new EventSource(`/events?key=${encodeURIComponent(l)}`);n.current=c,c.onopen=()=>o(!0),c.onerror=()=>o(!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 m of u)c.addEventListener(m,f=>{let v;try{v=JSON.parse(f.data)}catch{v=null}const y=s.current.get(m);if(y)for(const x of y)try{x(v)}catch(w){console.error(`[EventSource] handler for "${m}" threw:`,w)}});return()=>{c.close(),n.current=null,o(!1)}},[t]),a.jsx(If.Provider,{value:{connected:r,addListener:i},children:e})}function fe(e,t){const n=d.useContext(If);if(!n)return;const{addListener:r}=n;d.useEffect(()=>r(e,t),[e,t,r])}const Lr="suveren-theme",Mc="hap-theme";function zo(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}(function(){const t=localStorage.getItem(Mc);t!==null&&localStorage.getItem(Lr)===null&&localStorage.setItem(Lr,t),t!==null&&localStorage.removeItem(Mc)})();function Rf(){const[e,t]=d.useState(()=>{const s=localStorage.getItem(Lr);return s==="light"||s==="dark"?s:"system"}),[n,r]=d.useState(()=>zo(e));d.useEffect(()=>{const s=document.documentElement,i=zo(e);s.setAttribute("data-theme",i),e==="system"?localStorage.removeItem(Lr):localStorage.setItem(Lr,e),r(zo(e))},[e]),d.useEffect(()=>{if(e!=="system")return;const s=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>r(zo("system"));return s.addEventListener("change",i),()=>s.removeEventListener("change",i)},[e]);const o=d.useCallback(()=>{t(s=>s==="system"?"light":s==="light"?"dark":"system")},[]);return{theme:e,effectiveTheme:n,toggle:o}}const Zg=5*60*1e3,ev=2e3;function _f(){const[e,t]=d.useState(!1),[n,r]=d.useState("docker"),[o,s]=d.useState(""),[i,l]=d.useState(null),[c,u]=d.useState(!1),[m,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 h=setInterval(()=>j(!1),v?ev:Zg),p=()=>{document.visibilityState==="visible"&&j(!1)};return document.addEventListener("visibilitychange",p),window.addEventListener("focus",p),()=>{w=!0,clearInterval(h),document.removeEventListener("visibilitychange",p),window.removeEventListener("focus",p)}},[v]),{updateAvailable:e&&!m,installMethod:n,version:o,latestVersion:i,serverRestarted:c,startFastPolling:()=>y(!0),dismiss:()=>f(!0)}}function tv(e){return e?e==="dev"?"dev":/^[0-9a-f]{40}$/i.test(e)?e.slice(0,7):e:""}const Fc={system:"◑",light:"☀",dark:"☾"};function nv(){const{mode:e,group:t,domain:n}=ze();return e==="personal"?a.jsx("span",{children:"personal"}):t?a.jsxs("span",{children:[t.name," / ",n]}):a.jsx("span",{children:n})}function xl({onMenuToggle:e}){const{user:t,logout:n}=ze(),{theme:r,toggle:o}=Rf(),{version:s}=_f(),i=tv(s);return a.jsx("nav",{className:"top-nav",children:a.jsxs("div",{className:"top-nav-inner",children:[a.jsxs("div",{className:"logo-group",children:[a.jsx("span",{className:"logo",children:"Suveren"}),a.jsx("span",{className:"version-badge",children:"Local Gateway"})]}),a.jsx("div",{className:"nav-spacer"}),a.jsx("div",{className:"nav-actions nav-actions-desktop",children:t?a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"user-chip",children:[a.jsx("strong",{children:t.name}),a.jsx("span",{className:"dot"}),a.jsx(nv,{})]}),a.jsx("button",{className:"theme-toggle",onClick:o,title:`Theme: ${r}`,children:Fc[r]}),a.jsx("button",{className:"nav-logout",onClick:n,children:"Logout"})]}):a.jsxs(a.Fragment,{children:[i&&a.jsxs("span",{title:"Running gateway version",style:{fontSize:"0.8rem",color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums"},children:["v",i]}),a.jsx("button",{className:"theme-toggle",onClick:o,title:`Theme: ${r}`,children:Fc[r]})]})}),t&&e&&a.jsx("button",{className:"mobile-menu-btn",onClick:e,"aria-label":"Menu",children:"☰"})]})})}function Ct(e,t){var n;if((n=t==null?void 0:t.revokedSet)!=null&&n.has(e.authorization_id))return"revoked";switch(e.sp_status){case"revoked":return"revoked";case"expired":return"expired";case"active":return"active";case"pending":return"pending"}return e.remaining_seconds===null||e.remaining_seconds<=0?"expired":e.missing_domains.length>0?"pending":"active"}function Af(e,t){const n={active:[],pending:[],expired:[],revoked:[]};for(const r of e)n[Ct(r,t)].push(r);return n}function $t(e,t,n){const r=d.useRef(e);r.current=e,d.useEffect(()=>{let o=null;const s=()=>typeof document>"u"?!0:document.visibilityState==="visible",i=()=>{s()&&r.current()},l=()=>{o===null&&(o=setInterval(i,t))},c=()=>{o!==null&&(clearInterval(o),o=null)},u=()=>{s()?(r.current(),l()):c()};return s()&&(r.current(),l()),document.addEventListener("visibilitychange",u),()=>{c(),document.removeEventListener("visibilitychange",u)}},[t,n])}const $f=d.createContext(null),rv=3e4;function ov({children:e}){const[t,n]=d.useState({manifests:[],integrations:[],activeSessions:0,mcpServerUp:null,manifestsError:!1,fetchCount:0}),r=d.useRef(null),o=d.useCallback(async()=>{let c=!1;const[u,m]=await Promise.all([O.getIntegrationManifests().catch(()=>(c=!0,{manifests:[]})),O.getMcpHealth().catch(()=>null)]);n(f=>({manifests:u.manifests,integrations:(m==null?void 0:m.integrations)??f.integrations,activeSessions:(m==null?void 0:m.activeSessions)??f.activeSessions,mcpServerUp:!!m,manifestsError:c,fetchCount:f.fetchCount+1}))},[]);fe("integration-changed",o),$t(o,3e5);const s=d.useMemo(()=>{const c=new Map(t.integrations.map(v=>[v.id,v])),u=Date.now(),m=t.fetchCount>0&&t.manifests.some(v=>{const y=c.get(v.id);return y&&!y.running});m&&r.current===null?r.current=u:m||(r.current=null);const f=r.current!==null&&u-r.current<rv;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:o};return a.jsx($f.Provider,{value:l,children:e})}function wl(){const e=d.useContext($f);if(!e)throw new Error("useIntegrationStatus must be used inside IntegrationStatusProvider");return e}const av=[{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 sv(){const{activeDomain:e}=ze(),[t,n]=d.useState({}),r=d.useCallback(async()=>{try{const[o,s,i,l,c]=await Promise.all([O.getCredential("ai-config").catch(()=>null),O.getMyAttestations().catch(()=>null),O.getProposals(e||"owner").catch(()=>null),O.getProposalsForApprover().catch(()=>null),O.getAgentContext().catch(()=>"")]),u={};if(o&&!o.configured&&(u.assistant=1),s){const y=Af(s).expired.length;y>0&&(u.authorizations=y)}const m=(i==null?void 0:i.length)??0,f=(l==null?void 0:l.length)??0,v=m+f;v>0&&(u.proposals=v),(!c||!c.trim())&&(u.brief=1),n(u)}catch{}},[e]);return fe("attestation-changed",r),fe("proposal-added",r),fe("proposal-resolved",r),fe("proposal-approved",r),fe("proposal-rejected",r),fe("team-membership-changed",r),$t(r,3e5,e),t}const iv={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},lv={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 cv(){const{mode:e,group:t,domain:n,activeTeam:r}=ze(),o=sv(),{attentionCount:s}=wl(),i={...o};s>0&&(i.integrations=s);const l=av.filter(v=>!v.teamOnly||e==="team"),c=d.useRef(null),[u,m]=d.useState(null),f=dt();return d.useEffect(()=>{if(c.current===null){c.current=e;return}c.current!==e&&(e==="team"&&r?m(`You are now acting in team context — ${r.name}`):e==="personal"&&m("You have left the team — back to personal context"),c.current=e)},[e,r]),d.useEffect(()=>{m(null)},[f.pathname]),a.jsxs("div",{className:"sidebar",children:[a.jsx("ul",{className:"sidebar-nav",children:l.map(v=>{const y=v.statusKey?i[v.statusKey]:0;return a.jsx("li",{children:a.jsxs(yl,{to:v.to,end:v.to==="/",className:({isActive:x})=>`sidebar-item${x?" active":""}`,children:[a.jsx("span",{className:"icon",children:v.icon}),v.label,y?a.jsx("span",{style:iv,children:y}):null]})},v.to)})}),a.jsxs("div",{className:"sidebar-context",children:[a.jsx("div",{className:"ctx-label",children:"Active context"}),a.jsx("div",{className:"ctx-value",children:e==="personal"?"personal":t?`${t.name} / ${n}`:n})]}),u&&a.jsx("div",{style:lv,role:"status","aria-live":"polite",children:u})]})}const ps="suveren:updatedTo";function uv(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 dv(){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 fv(){const{updateAvailable:e,installMethod:t,version:n,latestVersion:r,serverRestarted:o,startFastPolling:s,dismiss:i}=_f(),[l,c]=d.useState(!1),[u,m]=d.useState(!1),[f,v]=d.useState(()=>{try{const g=sessionStorage.getItem(ps);if(g)return sessionStorage.removeItem(ps),g}catch{}return null}),y=uv(t),x=d.useRef(null),w=g=>{try{sessionStorage.setItem(ps,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||!o)return;const g=()=>dv()?!1:(w(n),!0);if(g())return;const S=setInterval(g,1500);return()=>clearInterval(S)},[l,o,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 P;const E=((P=x.current)==null?void 0:P.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 h=()=>{c(!0),s()},p=async()=>{try{await navigator.clipboard.writeText(y),m(!0),setTimeout(()=>m(!1),1800)}catch{}};return a.jsxs(a.Fragment,{children:[f&&!l&&a.jsx("div",{ref:x,className:"update-banner is-live",role:"status","aria-live":"polite",children:a.jsxs("div",{className:"update-banner-row",children:[a.jsxs("span",{className:"update-banner-text",children:["✓"," You","’","re on the latest version",f&&f!=="✓"?` — ${f} is live`:" — now live","."]}),a.jsx("button",{className:"update-banner-x",onClick:()=>v(null),"aria-label":"Dismiss",children:"×"})]})}),e&&!l&&!f&&a.jsx("div",{ref:x,className:"update-banner",role:"status","aria-live":"polite",children:a.jsxs("div",{className:"update-banner-row",children:[a.jsx("span",{className:"update-banner-text",children:"Update available."}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[a.jsx("button",{className:"btn btn-sm btn-secondary",onClick:h,children:"Update"}),a.jsx("button",{className:"update-banner-x",onClick:i,"aria-label":"Dismiss",children:"×"})]})]})}),l&&a.jsx("div",{className:"update-overlay",children:a.jsxs("div",{className:"update-overlay-card",role:"dialog","aria-modal":"true","aria-label":"Finishing the update",children:[a.jsx("div",{className:"update-spinner"}),a.jsxs("h2",{children:["Finishing the update","…"]}),a.jsxs("p",{children:["Copy this command and run it in your terminal. The gateway will restart, and"," ",a.jsx("strong",{children:"this page updates automatically"})," when it comes back ","—"," no need to refresh."]}),a.jsxs("div",{className:"update-cmd-row",children:[a.jsx("code",{className:"update-cmd",children:y}),a.jsx("button",{className:"btn btn-sm btn-primary",onClick:p,children:u?"Copied":"Copy"})]}),a.jsxs("div",{className:"update-status",children:[a.jsx("span",{className:"update-pulse"})," Waiting for the gateway to restart","…"]}),a.jsxs("div",{className:"update-overlay-actions",children:[a.jsx("button",{className:"btn btn-primary",onClick:()=>w(n),children:"Reload now"}),a.jsx("button",{className:"btn btn-secondary",onClick:()=>c(!1),children:"Cancel"})]})]})})]})}const pv={system:"◑",light:"☀",dark:"☾"},mv=[{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 hv({open:e,onClose:t}){const{user:n,activeGroup:r,activeDomain:o,logout:s}=ze(),{theme:i,toggle:l}=Rf(),c=dt();return d.useEffect(()=>{t()},[c.pathname]),e?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mobile-menu-backdrop",onClick:t}),a.jsxs("div",{className:"mobile-menu-panel",children:[n&&a.jsxs("div",{className:"mobile-menu-header",children:[a.jsx("strong",{children:n.name}),a.jsx("span",{style:{fontSize:"0.8rem",color:"var(--text-secondary)"},children:r?`${r.name} / ${o}`:o||"personal"})]}),a.jsx("nav",{className:"mobile-menu-nav",children:mv.map(u=>a.jsxs(yl,{to:u.to,end:u.to==="/",className:({isActive:m})=>`mobile-menu-item${m?" active":""}`,onClick:t,children:[a.jsx("span",{className:"icon",children:u.icon}),u.label]},u.to))}),a.jsxs("div",{className:"mobile-menu-footer",children:[a.jsxs("button",{className:"mobile-menu-action",onClick:()=>{l()},children:[a.jsx("span",{className:"icon",children:pv[i]}),"Theme: ",i]}),a.jsx("button",{className:"mobile-menu-action",onClick:()=>{s(),t()},children:"Logout"})]})]})]}):null}function gv(){const[e,t]=d.useState(!1);return a.jsxs(ov,{children:[a.jsx(xl,{onMenuToggle:()=>t(!e)}),a.jsx(fv,{}),a.jsx(cv,{}),a.jsx(hv,{open:e,onClose:()=>t(!1)}),a.jsx("div",{className:"main-content",children:a.jsx("div",{className:"page-inner",children:a.jsx(mg,{})})})]})}function vv(){const[e,t]=d.useState(""),{login:n,isLoading:r,error:o,clearError:s}=ze(),[i,l]=d.useState(null),c=async()=>{if(e.trim()){s();try{await n(e)}catch(f){if(f instanceof Pf){l(f.summary);return}}}},u=async()=>{l(null),s();try{await n(e,{confirmWipe:!0})}catch{}},m=()=>{l(null)};return a.jsxs(a.Fragment,{children:[a.jsx(xl,{}),a.jsxs("div",{className:"login-split",children:[a.jsx("div",{className:"login-split-left",children:a.jsxs("div",{style:{maxWidth:"28rem"},children:[a.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."}),a.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."})]})}),a.jsx("div",{className:"login-split-right",children:a.jsxs("div",{style:{width:"100%",maxWidth:"24rem"},children:[a.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[a.jsx("div",{style:{fontSize:"1.75rem",fontWeight:700,marginBottom:"0.5rem"},children:"Sign In"}),a.jsx("div",{style:{fontSize:"0.95rem",color:"var(--text-secondary)",lineHeight:1.5},children:"Enter your API key to manage authorizations."})]}),o&&a.jsx("div",{className:"error-message",children:o}),a.jsxs("div",{className:"form-group",style:{marginBottom:"1.5rem"},children:[a.jsx("label",{className:"form-label",children:"API Key"}),a.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"}}),a.jsx("div",{className:"form-hint",children:"From your Suveren account."})]}),a.jsx("button",{className:"btn btn-primary btn-full btn-lg",onClick:c,disabled:r,style:{marginBottom:"2rem"},children:r?"Signing in...":"Sign In"}),a.jsx("div",{className:"login-divider",children:"New here?"}),a.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[a.jsxs("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary)",marginBottom:"1rem",lineHeight:1.5},children:["Create an account on Suveren,",a.jsx("br",{}),"then come back to sign in."]}),a.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"})]}),a.jsxs("div",{style:{paddingTop:"1.75rem",borderTop:"1px solid var(--border)"},children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",marginBottom:"0.875rem"},children:"Getting started"}),a.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.8},children:[a.jsxs(a.Fragment,{children:["Create an account at ",a.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)=>a.jsxs("div",{style:{display:"flex",gap:"0.625rem",alignItems:"baseline",marginBottom:v<2?"0.5rem":0},children:[a.jsxs("span",{style:{color:"var(--accent)",fontWeight:700,fontSize:"0.95rem"},children:[v+1,"."]}),f]},v))})]})]})})]}),i&&a.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:m,children:a.jsxs("div",{className:"card",onClick:f=>f.stopPropagation(),style:{maxWidth:520,width:"100%",margin:0},children:[a.jsx("h3",{id:"wipe-warning-title",className:"card-title",style:{marginBottom:"0.5rem"},children:"Sign in with a different account?"}),a.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 ",a.jsx("strong",{children:"permanently wipe"})," the following local data:"]}),a.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[a.jsxs("li",{children:[i.credentialCount," stored service credential",i.credentialCount===1?"":"s",i.credentialIds.length>0&&a.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`:"",")"]})]}),a.jsxs("li",{children:[i.serviceCount," configured integration",i.serviceCount===1?"":"s"]}),a.jsx("li",{children:"The local E2EE keypair (a new one will be generated for this account)"}),a.jsx("li",{children:"Any unsynchronised gate content stored locally"})]}),a.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."}),a.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."}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end"},children:[a.jsx("button",{className:"btn btn-ghost",onClick:m,disabled:r,children:"Cancel"}),a.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 yv(){const{setActiveContext:e}=ze(),t=Wt(),[n,r]=d.useState(""),[o,s]=d.useState(""),[i,l]=d.useState(""),[c,u]=d.useState(!1),m=async()=>{if(n.trim()){u(!0),l("");try{const v=await O.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(o.trim()){u(!0),l("");try{const v=await O.createGroup(o.trim());e(v,v.myDomains[0]||""),t("/")}catch(v){l(v instanceof Error?v.message:"Failed to create group")}finally{u(!1)}}};return a.jsxs(a.Fragment,{children:[a.jsx(xl,{}),a.jsx("div",{className:"main-content no-sidebar",style:{marginTop:"var(--nav-height)"},children:a.jsxs("div",{style:{maxWidth:"30rem",margin:"3rem auto",padding:"0 1rem"},children:[a.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[a.jsx("h2",{style:{fontSize:"1.5rem",marginBottom:"0.5rem"},children:"Join Your Team"}),a.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&&a.jsx("div",{className:"error-message",children:i}),a.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[a.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Join an existing group"}),a.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Ask your team admin for an invite code."}),a.jsxs("div",{className:"invite-input-row",children:[a.jsx("input",{className:"form-input",placeholder:"Paste invite code...",value:n,onChange:v=>r(v.target.value),onKeyDown:v=>v.key==="Enter"&&m(),style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem"},disabled:c}),a.jsx("button",{className:"btn btn-primary",onClick:m,disabled:c,children:"Join"})]})]}),a.jsxs("div",{className:"card",children:[a.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Create a new group"}),a.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Start a new team and invite members. Assign domains after creation."}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("input",{className:"form-input",placeholder:"Group name (e.g., Acme Corp)",value:o,onChange:v=>s(v.target.value),onKeyDown:v=>v.key==="Enter"&&f(),style:{flex:1},disabled:c}),a.jsx("button",{className:"btn btn-secondary",onClick:f,disabled:c,children:"Create"})]})]})]})})]})}const fi="suveren-setup-ai-skipped",pi="suveren-setup-agent-done",mi="suveren-setup-dismissed",xv={"hap-setup-ai-skipped":fi,"hap-setup-agent-done":pi,"hap-setup-dismissed":mi};function wv(){for(const[e,t]of Object.entries(xv)){const n=localStorage.getItem(e);n!==null&&localStorage.getItem(t)===null&&localStorage.setItem(t,n),n!==null&&localStorage.removeItem(e)}}wv();const ms={"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 wv({aiConfigured:e,hasRunningIntegration:t,hasActiveAuth:n,hasAgentConnected:r,mcpEndpoint:o}){const[s,i]=d.useState(()=>localStorage.getItem(fi)==="true"),[l,c]=d.useState(()=>localStorage.getItem(mi)==="true"),[u,p]=d.useState(()=>localStorage.getItem(pi)==="true"),[f,v]=d.useState(null),[y,x]=d.useState("claude-code"),[w,j]=d.useState(!1),h=[{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"}],m=h.filter(C=>C.status==="done"||C.status==="skipped").length,g=m===h.length,S=d.useCallback(()=>{localStorage.setItem(fi,"true"),i(!0)},[]),E=d.useCallback(()=>{localStorage.setItem(mi,"true"),c(!0),v(null)},[]),P=d.useCallback(()=>{localStorage.setItem(pi,"true"),p(!0)},[]),k=d.useCallback(async C=>{try{await navigator.clipboard.writeText(C),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},[]);if(u||g)return null;const N=h.findIndex(C=>C.status==="pending");return a.jsxs("div",{style:{border:"2px solid var(--accent)",borderRadius:"0.75rem",padding:"1.5rem",marginBottom:"1.5rem",background:"var(--bg-elevated)"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"1.25rem"},children:[a.jsx("h2",{style:{fontSize:"1.1rem",fontWeight:700,margin:0},children:"Get Started"}),a.jsx("button",{onClick:P,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:"×"})]}),a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:h.map((C,T)=>{const H=T===N,W=C.status==="done"||C.status==="skipped"?"●":"○",D=C.status==="done"?"var(--success)":C.status==="skipped"?"var(--text-tertiary)":H?"var(--accent)":"var(--text-tertiary)";return a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:H?"0.75rem":"0.25rem 0",borderRadius:H?"0.5rem":void 0,background:H?"var(--accent-subtle)":void 0},children:[a.jsx("span",{style:{color:D,fontSize:"0.75rem",marginTop:"0.2rem",flexShrink:0},children:W}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[C.to&&C.status==="pending"?a.jsx(Je,{to:C.to,style:{fontSize:"0.9rem",fontWeight:H?600:500,color:H?"var(--accent)":"var(--text-primary)",textDecoration:"none"},children:C.label}):C.status==="pending"&&T===3?a.jsx("button",{onClick:()=>v(f===3?null:3),style:{background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"0.9rem",fontWeight:H?600:500,color:H?"var(--accent)":"var(--text-primary)"},children:C.label}):a.jsx("span",{style:{fontSize:"0.9rem",fontWeight:500,color:C.status==="done"?"var(--text-secondary)":"var(--text-tertiary)"},children:C.label}),C.optional&&C.status==="pending"&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontStyle:"italic"},children:"optional"}),C.status==="skipped"&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:"skipped"})]}),C.detail&&C.status==="pending"&&H&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.25rem",lineHeight:1.5},children:C.detail})]}),C.optional&&C.status==="pending"&&a.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"}),C.to&&C.status==="pending"&&a.jsx(Je,{to:C.to,style:{color:"var(--text-tertiary)",textDecoration:"none",fontSize:"0.8rem",flexShrink:0},children:"›"})]}),T===3&&f===3&&a.jsxs("div",{style:{marginTop:"0.75rem",marginLeft:"1.5rem",padding:"1rem",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:"0.5rem"},children:[a.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,marginBottom:"0.75rem",color:"var(--text-primary)"},children:"MCP Endpoint"}),a.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:o}),a.jsx("div",{style:{display:"flex",gap:"0.25rem",marginBottom:"0.75rem"},children:Object.entries(ps).map(([_,B])=>a.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:B.label},_))}),a.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:ps[y].snippet(o)}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>k(ps[y].snippet(o)),children:w?"Copied":"Copy"}),a.jsx("button",{className:"btn btn-primary btn-sm",onClick:E,children:"Done"})]})]})]},T)})}),a.jsxs("div",{style:{marginTop:"1.25rem"},children:[a.jsx("div",{style:{height:"4px",background:"var(--border)",borderRadius:"2px",overflow:"hidden"},children:a.jsx("div",{style:{height:"100%",width:`${m/h.length*100}%`,background:"var(--accent)",borderRadius:"2px",transition:"width 0.3s ease"}})}),a.jsxs("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.375rem"},children:[m," of ",h.length," complete"]})]})]})}function jn({variant:e="base",style:t,className:n,...r}){const o=e==="title"?"skeleton skeleton-title":e==="line"?"skeleton skeleton-line":e==="line-sm"?"skeleton skeleton-line-sm":"skeleton";return a.jsx("span",{className:`${o}${n?` ${n}`:""}`,style:t,role:"status","aria-busy":"true","aria-label":r["aria-label"]??"Loading"})}function hs(){return a.jsxs("div",{className:"skeleton-card",role:"status","aria-busy":"true","aria-label":"Loading",children:[a.jsx(jn,{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",flexShrink:0}}),a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"0.35rem"},children:[a.jsx(jn,{variant:"line",style:{width:"35%"}}),a.jsx(jn,{variant:"line-sm",style:{width:"65%"}})]})]})}const Sv=30*60;function gs(e){return e.replace(/@.*$/,"").split("/").pop()??e}function jv(){var _;const{domain:e}=ze(),[t,n]=d.useState([]),[r,o]=d.useState([]),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,p]=d.useState(!1),[f,v]=d.useState(!1),[y,x]=d.useState(!1),{entries:w,activeSessions:j,loading:h}=wl(),m=!h,g=d.useCallback(()=>{O.getMyAttestations().then(B=>{n(B),p(!0)}).catch(()=>p(!0)),O.getProposals(e||"owner").then(B=>{o(B),v(!0)}).catch(()=>v(!0)),O.getProposalsForApprover().then(B=>i(B)).catch(()=>i([])),O.getCredential("ai-config").then(B=>{c(B.configured),x(!0)}).catch(()=>x(!0))},[e]);fe("attestation-changed",g),fe("proposal-added",g),fe("proposal-resolved",g),fe("proposal-approved",g),fe("proposal-rejected",g),$t(g,3e5,e);const S=u&&f&&y&&m,E=Af(t),P=E.active,k=E.expired,N=P.filter(B=>B.remaining_seconds!==null&&B.remaining_seconds<=Sv),C=r.filter(B=>B.status==="pending"),T=w.filter(B=>B.state==="running"),H=w.filter(B=>B.state==="starting"),W=w.filter(B=>B.state==="not-running"||B.state==="error"),D=[];for(const B of s)D.push({label:"Approval needed",detail:`${B.tool} — above-cap action under ${gs(B.profileId)}`,to:"/proposals",color:"var(--warning)"});for(const B of C)D.push({label:"Approval pending",detail:`${B.tool} awaiting your approval`,to:"/proposals",color:"var(--warning)"});for(const B of N){const X=Math.ceil((B.remaining_seconds??0)/60);D.push({label:"Expiring soon",detail:`${B.title??gs(B.profile_id)} — ${X} min remaining`,to:"/authorizations",color:"var(--warning)"})}for(const B of k)D.push({label:"Expired",detail:B.title??gs(B.profile_id),to:"/authorizations",color:"var(--danger)"});for(const B of W)D.push({label:B.state==="error"?"Integration error":"Integration stopped",detail:B.state==="error"&&((_=B.integration)!=null&&_.error)?`${B.manifest.name}: ${B.integration.error}`:`${B.manifest.name} is not running`,to:"/integrations",color:"var(--danger)"});for(const B of H)D.push({label:"Integration starting",detail:`${B.manifest.name} is coming up…`,to:"/integrations",color:"var(--warning)"});return l||D.push({label:"AI Assistant",detail:"Not configured — needed for gate advisory",to:"/settings",color:"var(--text-tertiary)"}),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"page-header",children:a.jsx("h1",{className:"page-title",children:"Dashboard"})}),S&&a.jsx(wv,{aiConfigured:l,hasRunningIntegration:T.length>0,hasActiveAuth:P.length>0,hasAgentConnected:j>0,mcpEndpoint:`http://localhost:${window.location.port==="3400"?"3430":"7430"}`}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(8rem, 1fr))",gap:"0.75rem",marginBottom:"1.5rem"},children:[a.jsx(Je,{to:"/authorizations",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[u?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:P.length>0?"var(--success)":"var(--text-tertiary)"},children:P.length}):a.jsx(jn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Active"})]})}),a.jsx(Je,{to:"/proposals",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[f?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:C.length>0?"var(--warning)":"var(--text-tertiary)"},children:C.length}):a.jsx(jn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pending Approvals"})]})}),a.jsx(Je,{to:"/authorizations",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[u?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:k.length>0?"var(--danger)":"var(--text-tertiary)"},children:k.length}):a.jsx(jn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Expired"})]})}),a.jsx(Je,{to:"/integrations",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[m?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:T.length>0?"var(--success)":"var(--text-tertiary)"},children:T.length}):a.jsx(jn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Integrations Running"})]})})]}),D.length>0?a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:D.map((B,X)=>a.jsx(Je,{to:B.to,style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"0.75rem 1rem",display:"flex",alignItems:"center",gap:"0.75rem"},children:[a.jsx("span",{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",background:B.color,flexShrink:0}}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,color:"var(--text-primary)"},children:B.label}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:B.detail})]}),a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"›"})]})},X))}):S?a.jsx("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:a.jsx("div",{style:{fontSize:"0.9rem",color:"var(--text-secondary)"},children:"All clear. Nothing needs your attention."})}):a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[a.jsx(hs,{}),a.jsx(hs,{}),a.jsx(hs,{})]})]})}const kv=["Scope & Limits","Intent","Authorize"];function Lf({currentStep:e,onStepClick:t}){const n=Wt();return a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",marginBottom:"2.5rem"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",flex:1,overflow:"hidden"},children:kv.map((r,o)=>{const s=o+2,i=s<e,l=s===e;return a.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[o>0&&a.jsx("div",{style:{width:"1.5rem",height:"2px",background:i?"var(--accent)":"var(--border)",flexShrink:1}}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[a.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?"✓":o+1}),a.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)})}),a.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>n("/agent/new"),style:{flexShrink:0,fontSize:"0.8rem",marginTop:"0.15rem"},children:"Cancel"})]})}const Oc=40;function Ee(e,t){if(t)return t.slice(0,Oc);const n=e.lastIndexOf("/"),r=n>=0?e.slice(n+1):e,o=r.indexOf("@"),s=o>=0?r.slice(0,o):r;return(s.charAt(0).toUpperCase()+s.slice(1)).slice(0,Oc)}function Cv({profileId:e,bounds:t,groupName:n,domain:r,onSwitch:o}){return a.jsxs("div",{className:"context-strip",children:[n&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"context-strip-label",children:"Team:"}),a.jsxs("span",{children:[a.jsx("strong",{children:n}),r?` / ${r}`:""]})]}),e&&a.jsxs("span",{children:[a.jsx("strong",{children:"Profile:"})," ",Ee(e)]}),t&&a.jsxs("span",{children:[a.jsx("strong",{children:"Bounds:"})," ",t]}),o&&a.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginLeft:"auto",padding:"0.2rem 0.5rem",fontSize:"0.7rem"},onClick:o,children:"Switch"})]})}function bv({integrationId:e,field:t,value:n,onChange:r,disabled:o}){const[s,i]=d.useState(null),[l,c]=d.useState(null),[u,p]=d.useState(!0);d.useEffect(()=>{let y=!1;return O.discoverScopeField(e,t).then(x=>{y||(i(x.options),p(!1))}).catch(x=>{y||(c(x instanceof Error?x.message:String(x)),p(!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?a.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["Loading options from ",e,"…"]}):l||!s?a.jsxs(a.Fragment,{children:[a.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."]}),a.jsx("input",{className:"form-input",type:"text",value:n,onChange:y=>r(y.target.value),disabled:o})]}):s.length===0?a.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["No options available from ",e," for this field."]}):a.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",h=x.primary===!0;return a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.875rem",color:j?"var(--text-tertiary)":"var(--text-primary)",cursor:o||j?"not-allowed":"pointer"},title:j?"Read-only — you can authorize list/read but not writes":void 0,children:[a.jsx("input",{type:"checkbox",checked:f.has(String(y.value)),onChange:()=>v(String(y.value)),disabled:o||j}),a.jsx("span",{children:y.label||y.value}),h&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"primary"}),w&&a.jsxs("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["· ",w]})]},y.value)})})}function Nv(e){return e.replace(/@.*$/,"").split("/").pop()??e}function Ev(e,t){return t.displayName?t.displayName:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function zv(e){return e.type==="string"&&(e.format==="email"||e.format==="domain")}function Pv(e){var t;return!!(e.enum&&((t=e.constraint)!=null&&t.enforceable.includes("subset")))}function Bc(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 Tv(e){return!e||e==="count"?"":e==="minutes"?"min":e==="hours"?"hr":e==="days"?"days":e==="percent"?"%":e.startsWith("currency:")?e.slice(9):e}function Iv(e){return e?e==="minutes"?15:e==="percent"?5:e.startsWith("currency:")?10:1:1}function Rv(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 _v(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),o=n%60;return o===0?`${r} hour${r!==1?"s":""}`:`${r}h ${o}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 Av({id:e,value:t,onChange:n,disabled:r,placeholder:o,unit:s}){const i=Iv(s),l=Rv(s),c=Tv(s),u=_v(t,s),p=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 a.jsxs("div",{className:"bounded-input",children:[a.jsxs("div",{className:"bounded-input-field",children:[a.jsx("button",{type:"button",className:"stepper-btn stepper-decrement",onClick:v,disabled:r||t===""||Number(t)<=0,"aria-label":"Decrease",children:"−"}),a.jsx("input",{id:e,className:"stepper-input",type:"number",min:0,step:i,value:t,placeholder:o??"0",onChange:y=>n(y.target.value),onFocus:y=>y.target.select(),disabled:r}),a.jsx("button",{type:"button",className:"stepper-btn stepper-increment",onClick:f,disabled:r,"aria-label":"Increase",children:"+"}),c&&a.jsx("span",{className:"bounded-input-unit","aria-hidden":"true",children:c})]}),l.length>0&&!r&&a.jsx("div",{className:"bounded-input-presets",role:"group","aria-label":"Quick presets",children:l.map(y=>a.jsx("button",{type:"button",className:`preset-chip${p===y.value?" preset-chip-selected":""}`,onClick:()=>n(String(y.value)),children:y.label},y.value))}),u&&a.jsxs("div",{className:"bounded-input-echo",children:["≈ ",u]})]})}function Dc({htmlFor:e,label:t,description:n}){const[r,o]=d.useState(!1);return a.jsxs("div",{className:"field-label-with-tip",children:[a.jsx("label",{className:"form-label",htmlFor:e,children:t}),n&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"field-tip-trigger","aria-label":`What does "${t}" mean?`,"aria-expanded":r,onClick:()=>o(s=>!s),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onBlur:()=>o(!1),children:"i"}),r&&a.jsx("div",{className:"field-tip-bubble",role:"tooltip",children:n})]})]})}function $v({id:e,value:t,onChange:n,disabled:r,format:o,placeholder:s}){const[i,l]=d.useState(""),[c,u]=d.useState(!1),p=d.useRef(null),f=t?t.split(",").map(h=>h.trim()).filter(Boolean):[],v=h=>{const m=h.trim();if(!m)return;if(!Bc(m,o)){u(!0);return}u(!1);const g=f.includes(m)?f:[...f,m];n(g.join(",")),l("")},y=h=>{const m=f.filter((g,S)=>S!==h);n(m.join(","))},x=h=>{h.key==="Enter"||h.key===","||h.key==="Tab"?i.trim()&&(h.preventDefault(),v(i)):h.key==="Backspace"&&!i&&f.length>0&&y(f.length-1)},w=h=>{const m=h.clipboardData.getData("text");if(m.includes(",")){h.preventDefault();const S=m.split(",").map(P=>P.trim()).filter(Boolean).filter(P=>Bc(P,o)),E=[...new Set([...f,...S])];n(E.join(",")),l(""),u(!1)}},j=o==="email"?"Type email and press Enter...":"Type domain and press Enter...";return a.jsxs("div",{className:`tag-input${c?" tag-input-invalid":""}`,onClick:()=>{var h;return(h=p.current)==null?void 0:h.focus()},children:[f.map((h,m)=>a.jsxs("span",{className:"tag-pill",children:[h,!r&&a.jsx("button",{type:"button",className:"tag-remove",onClick:g=>{g.stopPropagation(),y(m)},"aria-label":`Remove ${h}`,children:"×"})]},h)),!r&&a.jsx("input",{ref:p,id:e,className:"tag-input-field",type:"text",value:i,onChange:h=>{l(h.target.value),u(!1)},onKeyDown:x,onPaste:w,onBlur:()=>{i.trim()&&v(i)},placeholder:f.length===0?s??j:""})]})}function Lv({id:e,options:t,value:n,onChange:r,disabled:o}){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 a.jsx("div",{className:"checkbox-group",id:e,children:t.map(l=>a.jsxs("label",{className:`checkbox-pill${s.includes(l)?" checkbox-pill-selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:s.includes(l),onChange:()=>i(l),disabled:o}),a.jsx("span",{children:l})]},l))})}function Uc({fieldKey:e,fieldDef:t,value:n,onChange:r,prefix:o,readOnly:s,twoColumn:i,discoveryIntegrationId:l}){const c=Ev(e,t),u=`${o}-field-${e}`,p=a.jsx(a.Fragment,{children:Pv(t)?a.jsx(Lv,{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)})()?a.jsxs("select",{id:u,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:s,children:[a.jsx("option",{value:"",children:"Select..."}),t.boundType.values.map(f=>a.jsx("option",{value:f,children:f},f))]}):"enum"in t&&t.enum?a.jsxs("select",{id:u,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:s,children:[a.jsx("option",{value:"",children:"Select..."}),t.enum.map(f=>a.jsx("option",{value:f,children:f},f))]}):t.type==="number"?a.jsx(Av,{id:u,value:n,onChange:f=>r(e,f),disabled:s,unit:t.unit}):zv(t)?a.jsx($v,{id:u,value:n,onChange:f=>r(e,f),disabled:s,format:t.format}):l?a.jsx(bv,{integrationId:l,field:e,value:n,onChange:f=>r(e,f),disabled:s}):a.jsx("input",{id:u,className:"form-input",type:"text",value:n,onChange:f=>r(e,f.target.value),disabled:s})});return i?a.jsxs("div",{className:"bounds-field-row",children:[a.jsx("div",{className:"bounds-field-label",children:a.jsx(Dc,{htmlFor:u,label:c,description:t.description})}),a.jsx("div",{className:"bounds-field-input",children:p})]},`${o}-${e}`):a.jsxs("div",{className:"form-group",children:[a.jsx(Dc,{htmlFor:u,label:c,description:t.description}),p]},`${o}-${e}`)}function Mv(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 Fv(e,t){const n=new Set;if(!t)return n;for(const[r,o]of Object.entries(t)){const s=e[r];if(s===""||s===void 0)continue;const i=Number(s);!isNaN(i)&&i>o&&n.add(r)}return n}function Ov({profile:e,onConfirm:t,onCancel:n,readOnly:r,initialBounds:o,initialContext:s,initialFrame:i,profileConfig:l,approverNames:c,adminName:u}){const p=e.boundsSchema??e.frameSchema,f=e.contextSchema,v=p?Object.entries(p.fields).filter(([z])=>!(z==="profile"||z==="path")):[],y=f&&f.keyOrder.length>0?Object.entries(f.fields):[],x=o??i??{},w=s??{},j={};for(const[z]of v)j[z]=x[z]!==void 0?String(x[z]):"";const h={};for(const[z]of y)h[z]=w[z]!==void 0?String(w[z]):"";const[m,g]=d.useState(j),[S,E]=d.useState(h),[P,k]=d.useState(null);d.useEffect(()=>{const z=Nv(e.id);O.getIntegrationManifests().then(({manifests:R})=>{const $=R.find(L=>L.profile===z&&L.contextDiscovery&&Object.keys(L.contextDiscovery).length>0);k($??null)}).catch(()=>k(null))},[e.id]);const N=Mv(m,l),C=Fv(m,l==null?void 0:l.caps),T=(z,R)=>{g($=>({...$,[z]:R}))},H=(z,R)=>{E($=>({...$,[z]:R}))},W=()=>{const z={profile:e.id};for(const[$,L]of v)L.type==="number"?z[$]=m[$]===""?0:Number(m[$]):z[$]=m[$];const R={};for(const[$,L]of y)L.type==="number"?R[$]=S[$]===""?0:Number(S[$]):R[$]=S[$];return[z,R]},D=()=>{const[z,R]=W();t(z,R)},_=()=>{const z=(l==null?void 0:l.caps)??{},R={...m};for(const V of C)z[V]!==void 0&&(R[V]=String(z[V]));g(R);const $={profile:e.id};for(const[V,ee]of v)if(ee.type==="number"){const J=R[V]??"";$[V]=J===""?0:Number(J)}else $[V]=R[V]??"";const L={};for(const[V,ee]of y)ee.type==="number"?L[V]=S[V]===""?0:Number(S[V]):L[V]=S[V];t($,L)},B=z=>{const R=l==null?void 0:l.caps;if(!R||R[z]===void 0)return null;const $=R[z],L=C.has(z);return N==="hard-ceiling"&&L?a.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--danger)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",$," — exceeds team ceiling"]}):N==="above-approvers"&&L?a.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--warning)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",$," — above cap"]}):a.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--success)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",$," ok"]})},X=()=>{var z;if(N==="no-config")return null;if(N==="approvers-dormant"){const R=c&&c.length>0?c.join(", "):"the configured approvers";return a.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:[a.jsxs("div",{style:{fontWeight:600,color:"var(--accent)",marginBottom:"0.25rem"},children:["Profile approvers: ",R]}),a.jsxs("div",{children:["No caps are set on this profile, so ",R," 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(N==="within-cap")return a.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:a.jsx("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:"Within all team caps — your responsibility."})});if(N==="above-approvers"){const R=c&&c.length>0?c.join(", "):"the required approvers";return a.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:[a.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.25rem"},children:"Above team cap."}),a.jsxs("div",{children:[a.jsx("strong",{children:"Over-cap actions"})," will require approval from you and ",R,". Within-cap actions run per the mode you choose."]})]})}if(N==="hard-ceiling"){const R=Array.from(C)[0],$=R?(z=l==null?void 0:l.caps)==null?void 0:z[R]:void 0,L=u??"the team admin";return a.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:[a.jsx("div",{style:{fontWeight:600,color:"var(--danger)",marginBottom:"0.25rem"},children:"Hard team ceiling."}),a.jsxs("div",{style:{marginBottom:"0.75rem"},children:["Team policy caps this at ",$??"the configured limit",". Lower your bound or ask ",L," to add an approver path above the cap."]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:_,children:"Save below cap"}),n&&a.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"})]})]})}return null},se=N==="hard-ceiling";return a.jsxs("div",{children:[y.length>0&&a.jsxs("div",{className:"context-section",children:[a.jsxs("div",{className:"bounds-section-header",children:[a.jsx("span",{className:"bounds-section-icon",children:"🛡"}),a.jsxs("div",{children:[a.jsx("div",{className:"bounds-section-title",children:"Allowed scope"}),a.jsx("div",{className:"bounds-section-subtitle",children:"Encrypted on your device, never sent to the SP"})]})]}),y.map(([z,R])=>{var L;const $=!!((L=P==null?void 0:P.contextDiscovery)!=null&&L[z]);return a.jsx(Uc,{fieldKey:z,fieldDef:R,value:S[z],onChange:H,prefix:"context",readOnly:r,discoveryIntegrationId:$?P.id:void 0},`context-${z}`)})]}),v.length>0&&a.jsxs("div",{className:"bounds-section",children:[a.jsxs("div",{className:"bounds-section-header",children:[a.jsx("span",{className:"bounds-section-icon",children:"🔒"}),a.jsxs("div",{children:[a.jsx("div",{className:"bounds-section-title",children:"Limits"}),a.jsx("div",{className:"bounds-section-subtitle",children:"Enforced by the Service Provider"})]})]}),a.jsx("div",{className:"bounds-fields-grid",children:v.map(([z,R])=>{var $;return a.jsxs("div",{style:{display:"contents"},children:[a.jsx(Uc,{fieldKey:z,fieldDef:R,value:m[z],onChange:T,prefix:"bounds",readOnly:r,twoColumn:!0}),N!=="no-config"&&(($=l==null?void 0:l.caps)==null?void 0:$[z])!==void 0&&a.jsx("div",{style:{gridColumn:"2 / 3",display:"flex",alignItems:"center",paddingBottom:"0.5rem"},children:B(z)})]},`bounds-${z}`)})}),X()]}),a.jsx("button",{className:"btn btn-primary",onClick:D,disabled:se,style:{marginTop:"0.5rem"},children:r?"Next: Gates":"Next: Problem Statement"})]})}function Bv(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 Dv(e){return e.replace(/```(?:markdown|md)?\s*\n[\s\S]*?```/,"").trim()}const Uv="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 ga({target:e,currentText:t,onApply:n,greeting:r,placeholder:o,title:s}){const[i,l]=d.useState([{role:"assistant",content:r??Uv}]),[c,u]=d.useState(""),[p,f]=d.useState(!1),[v,y]=d.useState(null),x=d.useRef(null);d.useEffect(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[i,p]);const w=async()=>{const h=c.trim();if(!h||p)return;const m=[...i,{role:"user",content:h}];l(m),u(""),y(null),f(!0);try{const g=await O.aiChat({target:e,currentText:t,messages:m.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=h=>{h.key==="Enter"&&!h.shiftKey&&!h.nativeEvent.isComposing&&(h.preventDefault(),w())};return a.jsxs("div",{className:"intent-chat",children:[a.jsx("h3",{className:"card-title",children:s??"AI Assistant"}),a.jsxs("div",{ref:x,className:"chat-messages",children:[i.map((h,m)=>{const g=h.role==="assistant"?Bv(h.content):null,S=g?Dv(h.content):h.content;return a.jsx("div",{className:`chat-msg ${h.role}`,children:a.jsxs("div",{className:"chat-msg-body",children:[S&&a.jsx("div",{className:"chat-msg-prose",children:S}),g!==null&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"chat-fenced-block",children:g}),a.jsx("button",{type:"button",className:"btn btn-primary btn-sm chat-apply-btn",onClick:()=>n(g),children:"Apply this draft"})]})]})},m)}),p&&a.jsx("div",{className:"chat-msg assistant",children:a.jsx("div",{className:"chat-msg-body chat-msg-thinking",children:"Thinking…"})})]}),v&&a.jsx("div",{className:"error-message",children:v}),a.jsxs("div",{className:"chat-composer",children:[a.jsxs("div",{className:"chat-composer-pill",children:[a.jsx("textarea",{className:"chat-input",value:c,onChange:h=>u(h.target.value),onKeyDown:j,placeholder:o??"Ask for help articulating the intent…",rows:1,disabled:p}),a.jsx("button",{type:"button",className:"chat-send-btn",onClick:w,disabled:p||!c.trim(),"aria-label":"Send",children:"↑"})]}),a.jsx("div",{className:"chat-composer-hint",children:"Enter to send · Shift+Enter for newline"})]})]})}function Mf({open:e,onClose:t,children:n,ariaLabel:r}){const o=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=o.current)==null||l.focus(),()=>{document.removeEventListener("keydown",i),document.body.style.overflow="",s.current instanceof HTMLElement&&s.current.focus()}},[e,t]),cf.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`bottom-sheet-backdrop${e?" is-open":""}`,onClick:t,"aria-hidden":"true"}),a.jsxs("aside",{ref:o,className:`bottom-sheet${e?" is-open":""}`,role:"dialog","aria-modal":"true","aria-label":r,tabIndex:-1,children:[a.jsx("div",{className:"bottom-sheet-handle","aria-hidden":"true"}),a.jsx("button",{type:"button",className:"bottom-sheet-close",onClick:t,"aria-label":"Close",children:"×"}),n]})]}),document.body)}function Wv(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hv(e,t,n){if(t.length===0)return[{text:e,label:e,matched:null}];const r=[],o=new Set;for(const c of t)if(!(!c.scope||c.scope==="all (unscoped)"))for(const u of[c.scope,...c.scope.split(",").map(p=>p.trim())]){const p=u.toLowerCase();u&&!o.has(p)&&(o.add(p),r.push(u))}r.sort((c,u)=>u.length-c.length);const s=c=>{const u=c.toLowerCase();return t.filter(p=>{var f,v;return((f=p.scope)==null?void 0:f.toLowerCase())===u||((v=p.scope)==null?void 0:v.split(",").map(y=>y.trim().toLowerCase()).includes(u))})},i=["\\[\\d+\\]",...r.map(Wv)],l=new RegExp(`(${i.join("|")})`,"gi");return e.split(l).filter(c=>c!=="").map(c=>{const u=/^\[(\d+)\]$/.exec(c);if(u){const p=t[Number(u[1])-1];if(p){const f=p.scope&&p.scope!=="all (unscoped)"?p.scope:"all recipients",v=n?`${n}: ${f}`:f;return{text:c,label:v,matched:[p]}}}else if(r.some(p=>p.toLowerCase()===c.toLowerCase())){const p=s(c);if(p.length>0)return{text:c,label:c,matched:p}}return{text:c,label:c,matched:null}})}const Wc=`Why — What's the situation? Why does this need to happen?
|
|
55
|
+
Health check: GET ${e}/health`}};function Sv({aiConfigured:e,hasRunningIntegration:t,hasActiveAuth:n,hasAgentConnected:r,mcpEndpoint:o}){const[s,i]=d.useState(()=>localStorage.getItem(fi)==="true"),[l,c]=d.useState(()=>localStorage.getItem(pi)==="true"),[u,m]=d.useState(()=>localStorage.getItem(mi)==="true"),[f,v]=d.useState(null),[y,x]=d.useState("claude-code"),[w,j]=d.useState(!1),h=[{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=h.filter(C=>C.status==="done"||C.status==="skipped").length,g=p===h.length,S=d.useCallback(()=>{localStorage.setItem(fi,"true"),i(!0)},[]),E=d.useCallback(()=>{localStorage.setItem(pi,"true"),c(!0),v(null)},[]),P=d.useCallback(()=>{localStorage.setItem(mi,"true"),m(!0)},[]),k=d.useCallback(async C=>{try{await navigator.clipboard.writeText(C),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},[]);if(u||g)return null;const N=h.findIndex(C=>C.status==="pending");return a.jsxs("div",{style:{border:"2px solid var(--accent)",borderRadius:"0.75rem",padding:"1.5rem",marginBottom:"1.5rem",background:"var(--bg-elevated)"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"1.25rem"},children:[a.jsx("h2",{style:{fontSize:"1.1rem",fontWeight:700,margin:0},children:"Get Started"}),a.jsx("button",{onClick:P,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:"×"})]}),a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:h.map((C,T)=>{const H=T===N,W=C.status==="done"||C.status==="skipped"?"●":"○",B=C.status==="done"?"var(--success)":C.status==="skipped"?"var(--text-tertiary)":H?"var(--accent)":"var(--text-tertiary)";return a.jsxs("div",{children:[a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:H?"0.75rem":"0.25rem 0",borderRadius:H?"0.5rem":void 0,background:H?"var(--accent-subtle)":void 0},children:[a.jsx("span",{style:{color:B,fontSize:"0.75rem",marginTop:"0.2rem",flexShrink:0},children:W}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[C.to&&C.status==="pending"?a.jsx(Je,{to:C.to,style:{fontSize:"0.9rem",fontWeight:H?600:500,color:H?"var(--accent)":"var(--text-primary)",textDecoration:"none"},children:C.label}):C.status==="pending"&&T===3?a.jsx("button",{onClick:()=>v(f===3?null:3),style:{background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"0.9rem",fontWeight:H?600:500,color:H?"var(--accent)":"var(--text-primary)"},children:C.label}):a.jsx("span",{style:{fontSize:"0.9rem",fontWeight:500,color:C.status==="done"?"var(--text-secondary)":"var(--text-tertiary)"},children:C.label}),C.optional&&C.status==="pending"&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontStyle:"italic"},children:"optional"}),C.status==="skipped"&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:"skipped"})]}),C.detail&&C.status==="pending"&&H&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.25rem",lineHeight:1.5},children:C.detail})]}),C.optional&&C.status==="pending"&&a.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"}),C.to&&C.status==="pending"&&a.jsx(Je,{to:C.to,style:{color:"var(--text-tertiary)",textDecoration:"none",fontSize:"0.8rem",flexShrink:0},children:"›"})]}),T===3&&f===3&&a.jsxs("div",{style:{marginTop:"0.75rem",marginLeft:"1.5rem",padding:"1rem",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:"0.5rem"},children:[a.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,marginBottom:"0.75rem",color:"var(--text-primary)"},children:"MCP Endpoint"}),a.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:o}),a.jsx("div",{style:{display:"flex",gap:"0.25rem",marginBottom:"0.75rem"},children:Object.entries(ms).map(([_,D])=>a.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:D.label},_))}),a.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:ms[y].snippet(o)}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>k(ms[y].snippet(o)),children:w?"Copied":"Copy"}),a.jsx("button",{className:"btn btn-primary btn-sm",onClick:E,children:"Done"})]})]})]},T)})}),a.jsxs("div",{style:{marginTop:"1.25rem"},children:[a.jsx("div",{style:{height:"4px",background:"var(--border)",borderRadius:"2px",overflow:"hidden"},children:a.jsx("div",{style:{height:"100%",width:`${p/h.length*100}%`,background:"var(--accent)",borderRadius:"2px",transition:"width 0.3s ease"}})}),a.jsxs("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.375rem"},children:[p," of ",h.length," complete"]})]})]})}function jn({variant:e="base",style:t,className:n,...r}){const o=e==="title"?"skeleton skeleton-title":e==="line"?"skeleton skeleton-line":e==="line-sm"?"skeleton skeleton-line-sm":"skeleton";return a.jsx("span",{className:`${o}${n?` ${n}`:""}`,style:t,role:"status","aria-busy":"true","aria-label":r["aria-label"]??"Loading"})}function hs(){return a.jsxs("div",{className:"skeleton-card",role:"status","aria-busy":"true","aria-label":"Loading",children:[a.jsx(jn,{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",flexShrink:0}}),a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"0.35rem"},children:[a.jsx(jn,{variant:"line",style:{width:"35%"}}),a.jsx(jn,{variant:"line-sm",style:{width:"65%"}})]})]})}const jv=30*60;function gs(e){return e.replace(/@.*$/,"").split("/").pop()??e}function kv(){var _;const{domain:e}=ze(),[t,n]=d.useState([]),[r,o]=d.useState([]),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,m]=d.useState(!1),[f,v]=d.useState(!1),[y,x]=d.useState(!1),{entries:w,activeSessions:j,loading:h}=wl(),p=!h,g=d.useCallback(()=>{O.getMyAttestations().then(D=>{n(D),m(!0)}).catch(()=>m(!0)),O.getProposals(e||"owner").then(D=>{o(D),v(!0)}).catch(()=>v(!0)),O.getProposalsForApprover().then(D=>i(D)).catch(()=>i([])),O.getCredential("ai-config").then(D=>{c(D.configured),x(!0)}).catch(()=>x(!0))},[e]);fe("attestation-changed",g),fe("proposal-added",g),fe("proposal-resolved",g),fe("proposal-approved",g),fe("proposal-rejected",g),$t(g,3e5,e);const S=u&&f&&y&&p,E=Af(t),P=E.active,k=E.expired,N=P.filter(D=>D.remaining_seconds!==null&&D.remaining_seconds<=jv),C=r.filter(D=>D.status==="pending"),T=w.filter(D=>D.state==="running"),H=w.filter(D=>D.state==="starting"),W=w.filter(D=>D.state==="not-running"||D.state==="error"),B=[];for(const D of s)B.push({label:"Approval needed",detail:`${D.tool} — above-cap action under ${gs(D.profileId)}`,to:"/proposals",color:"var(--warning)"});for(const D of C)B.push({label:"Approval pending",detail:`${D.tool} awaiting your approval`,to:"/proposals",color:"var(--warning)"});for(const D of N){const X=Math.ceil((D.remaining_seconds??0)/60);B.push({label:"Expiring soon",detail:`${D.title??gs(D.profile_id)} — ${X} min remaining`,to:"/authorizations",color:"var(--warning)"})}for(const D of k)B.push({label:"Expired",detail:D.title??gs(D.profile_id),to:"/authorizations",color:"var(--danger)"});for(const D of W)B.push({label:D.state==="error"?"Integration error":"Integration stopped",detail:D.state==="error"&&((_=D.integration)!=null&&_.error)?`${D.manifest.name}: ${D.integration.error}`:`${D.manifest.name} is not running`,to:"/integrations",color:"var(--danger)"});for(const D of H)B.push({label:"Integration starting",detail:`${D.manifest.name} is coming up…`,to:"/integrations",color:"var(--warning)"});return l||B.push({label:"AI Assistant",detail:"Not configured — needed for gate advisory",to:"/settings",color:"var(--text-tertiary)"}),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"page-header",children:a.jsx("h1",{className:"page-title",children:"Dashboard"})}),S&&a.jsx(Sv,{aiConfigured:l,hasRunningIntegration:T.length>0,hasActiveAuth:P.length>0,hasAgentConnected:j>0,mcpEndpoint:`http://localhost:${window.location.port==="3400"?"3430":"7430"}`}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(8rem, 1fr))",gap:"0.75rem",marginBottom:"1.5rem"},children:[a.jsx(Je,{to:"/authorizations",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[u?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:P.length>0?"var(--success)":"var(--text-tertiary)"},children:P.length}):a.jsx(jn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Active"})]})}),a.jsx(Je,{to:"/proposals",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[f?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:C.length>0?"var(--warning)":"var(--text-tertiary)"},children:C.length}):a.jsx(jn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pending Approvals"})]})}),a.jsx(Je,{to:"/authorizations",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[u?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:k.length>0?"var(--danger)":"var(--text-tertiary)"},children:k.length}):a.jsx(jn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Expired"})]})}),a.jsx(Je,{to:"/integrations",style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[p?a.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:T.length>0?"var(--success)":"var(--text-tertiary)"},children:T.length}):a.jsx(jn,{variant:"title"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Integrations Running"})]})})]}),B.length>0?a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:B.map((D,X)=>a.jsx(Je,{to:D.to,style:{textDecoration:"none"},children:a.jsxs("div",{className:"card",style:{padding:"0.75rem 1rem",display:"flex",alignItems:"center",gap:"0.75rem"},children:[a.jsx("span",{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",background:D.color,flexShrink:0}}),a.jsxs("div",{style:{flex:1,minWidth:0},children:[a.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,color:"var(--text-primary)"},children:D.label}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:D.detail})]}),a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"›"})]})},X))}):S?a.jsx("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:a.jsx("div",{style:{fontSize:"0.9rem",color:"var(--text-secondary)"},children:"All clear. Nothing needs your attention."})}):a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[a.jsx(hs,{}),a.jsx(hs,{}),a.jsx(hs,{})]})]})}const Cv=["Scope & Limits","Intent","Authorize"];function Lf({currentStep:e,onStepClick:t}){const n=Wt();return a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",marginBottom:"2.5rem"},children:[a.jsx("div",{style:{display:"flex",alignItems:"center",flex:1,overflow:"hidden"},children:Cv.map((r,o)=>{const s=o+2,i=s<e,l=s===e;return a.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[o>0&&a.jsx("div",{style:{width:"1.5rem",height:"2px",background:i?"var(--accent)":"var(--border)",flexShrink:1}}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[a.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?"✓":o+1}),a.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)})}),a.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>n("/agent/new"),style:{flexShrink:0,fontSize:"0.8rem",marginTop:"0.15rem"},children:"Cancel"})]})}const Oc=40;function Ee(e,t){if(t)return t.slice(0,Oc);const n=e.lastIndexOf("/"),r=n>=0?e.slice(n+1):e,o=r.indexOf("@"),s=o>=0?r.slice(0,o):r;return(s.charAt(0).toUpperCase()+s.slice(1)).slice(0,Oc)}function bv({profileId:e,bounds:t,groupName:n,domain:r,onSwitch:o}){return a.jsxs("div",{className:"context-strip",children:[n&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"context-strip-label",children:"Team:"}),a.jsxs("span",{children:[a.jsx("strong",{children:n}),r?` / ${r}`:""]})]}),e&&a.jsxs("span",{children:[a.jsx("strong",{children:"Profile:"})," ",Ee(e)]}),t&&a.jsxs("span",{children:[a.jsx("strong",{children:"Bounds:"})," ",t]}),o&&a.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginLeft:"auto",padding:"0.2rem 0.5rem",fontSize:"0.7rem"},onClick:o,children:"Switch"})]})}function Nv({integrationId:e,field:t,value:n,onChange:r,disabled:o}){const[s,i]=d.useState(null),[l,c]=d.useState(null),[u,m]=d.useState(!0);d.useEffect(()=>{let y=!1;return O.discoverScopeField(e,t).then(x=>{y||(i(x.options),m(!1))}).catch(x=>{y||(c(x instanceof Error?x.message:String(x)),m(!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?a.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["Loading options from ",e,"…"]}):l||!s?a.jsxs(a.Fragment,{children:[a.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."]}),a.jsx("input",{className:"form-input",type:"text",value:n,onChange:y=>r(y.target.value),disabled:o})]}):s.length===0?a.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["No options available from ",e," for this field."]}):a.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",h=x.primary===!0;return a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.875rem",color:j?"var(--text-tertiary)":"var(--text-primary)",cursor:o||j?"not-allowed":"pointer"},title:j?"Read-only — you can authorize list/read but not writes":void 0,children:[a.jsx("input",{type:"checkbox",checked:f.has(String(y.value)),onChange:()=>v(String(y.value)),disabled:o||j}),a.jsx("span",{children:y.label||y.value}),h&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"primary"}),w&&a.jsxs("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["· ",w]})]},y.value)})})}function Ev(e){return e.replace(/@.*$/,"").split("/").pop()??e}function zv(e,t){return t.displayName?t.displayName:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function Pv(e){return e.type==="string"&&(e.format==="email"||e.format==="domain")}function Tv(e){var t;return!!(e.enum&&((t=e.constraint)!=null&&t.enforceable.includes("subset")))}function Bc(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 Iv(e){return!e||e==="count"?"":e==="minutes"?"min":e==="hours"?"hr":e==="days"?"days":e==="percent"?"%":e.startsWith("currency:")?e.slice(9):e}function Rv(e){return e?e==="minutes"?15:e==="percent"?5:e.startsWith("currency:")?10:1:1}function _v(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 Av(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),o=n%60;return o===0?`${r} hour${r!==1?"s":""}`:`${r}h ${o}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 $v({id:e,value:t,onChange:n,disabled:r,placeholder:o,unit:s}){const i=Rv(s),l=_v(s),c=Iv(s),u=Av(t,s),m=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 a.jsxs("div",{className:"bounded-input",children:[a.jsxs("div",{className:"bounded-input-field",children:[a.jsx("button",{type:"button",className:"stepper-btn stepper-decrement",onClick:v,disabled:r||t===""||Number(t)<=0,"aria-label":"Decrease",children:"−"}),a.jsx("input",{id:e,className:"stepper-input",type:"number",min:0,step:i,value:t,placeholder:o??"0",onChange:y=>n(y.target.value),onFocus:y=>y.target.select(),disabled:r}),a.jsx("button",{type:"button",className:"stepper-btn stepper-increment",onClick:f,disabled:r,"aria-label":"Increase",children:"+"}),c&&a.jsx("span",{className:"bounded-input-unit","aria-hidden":"true",children:c})]}),l.length>0&&!r&&a.jsx("div",{className:"bounded-input-presets",role:"group","aria-label":"Quick presets",children:l.map(y=>a.jsx("button",{type:"button",className:`preset-chip${m===y.value?" preset-chip-selected":""}`,onClick:()=>n(String(y.value)),children:y.label},y.value))}),u&&a.jsxs("div",{className:"bounded-input-echo",children:["≈ ",u]})]})}function Dc({htmlFor:e,label:t,description:n}){const[r,o]=d.useState(!1);return a.jsxs("div",{className:"field-label-with-tip",children:[a.jsx("label",{className:"form-label",htmlFor:e,children:t}),n&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"field-tip-trigger","aria-label":`What does "${t}" mean?`,"aria-expanded":r,onClick:()=>o(s=>!s),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onBlur:()=>o(!1),children:"i"}),r&&a.jsx("div",{className:"field-tip-bubble",role:"tooltip",children:n})]})]})}function Lv({id:e,value:t,onChange:n,disabled:r,format:o,placeholder:s}){const[i,l]=d.useState(""),[c,u]=d.useState(!1),m=d.useRef(null),f=t?t.split(",").map(h=>h.trim()).filter(Boolean):[],v=h=>{const p=h.trim();if(!p)return;if(!Bc(p,o)){u(!0);return}u(!1);const g=f.includes(p)?f:[...f,p];n(g.join(",")),l("")},y=h=>{const p=f.filter((g,S)=>S!==h);n(p.join(","))},x=h=>{h.key==="Enter"||h.key===","||h.key==="Tab"?i.trim()&&(h.preventDefault(),v(i)):h.key==="Backspace"&&!i&&f.length>0&&y(f.length-1)},w=h=>{const p=h.clipboardData.getData("text");if(p.includes(",")){h.preventDefault();const S=p.split(",").map(P=>P.trim()).filter(Boolean).filter(P=>Bc(P,o)),E=[...new Set([...f,...S])];n(E.join(",")),l(""),u(!1)}},j=o==="email"?"Type email and press Enter...":"Type domain and press Enter...";return a.jsxs("div",{className:`tag-input${c?" tag-input-invalid":""}`,onClick:()=>{var h;return(h=m.current)==null?void 0:h.focus()},children:[f.map((h,p)=>a.jsxs("span",{className:"tag-pill",children:[h,!r&&a.jsx("button",{type:"button",className:"tag-remove",onClick:g=>{g.stopPropagation(),y(p)},"aria-label":`Remove ${h}`,children:"×"})]},h)),!r&&a.jsx("input",{ref:m,id:e,className:"tag-input-field",type:"text",value:i,onChange:h=>{l(h.target.value),u(!1)},onKeyDown:x,onPaste:w,onBlur:()=>{i.trim()&&v(i)},placeholder:f.length===0?s??j:""})]})}function Mv({id:e,options:t,value:n,onChange:r,disabled:o}){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 a.jsx("div",{className:"checkbox-group",id:e,children:t.map(l=>a.jsxs("label",{className:`checkbox-pill${s.includes(l)?" checkbox-pill-selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:s.includes(l),onChange:()=>i(l),disabled:o}),a.jsx("span",{children:l})]},l))})}function Uc({fieldKey:e,fieldDef:t,value:n,onChange:r,prefix:o,readOnly:s,twoColumn:i,discoveryIntegrationId:l}){const c=zv(e,t),u=`${o}-field-${e}`,m=a.jsx(a.Fragment,{children:Tv(t)?a.jsx(Mv,{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)})()?a.jsxs("select",{id:u,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:s,children:[a.jsx("option",{value:"",children:"Select..."}),t.boundType.values.map(f=>a.jsx("option",{value:f,children:f},f))]}):"enum"in t&&t.enum?a.jsxs("select",{id:u,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:s,children:[a.jsx("option",{value:"",children:"Select..."}),t.enum.map(f=>a.jsx("option",{value:f,children:f},f))]}):t.type==="number"?a.jsx($v,{id:u,value:n,onChange:f=>r(e,f),disabled:s,unit:t.unit}):Pv(t)?a.jsx(Lv,{id:u,value:n,onChange:f=>r(e,f),disabled:s,format:t.format}):l?a.jsx(Nv,{integrationId:l,field:e,value:n,onChange:f=>r(e,f),disabled:s}):a.jsx("input",{id:u,className:"form-input",type:"text",value:n,onChange:f=>r(e,f.target.value),disabled:s})});return i?a.jsxs("div",{className:"bounds-field-row",children:[a.jsx("div",{className:"bounds-field-label",children:a.jsx(Dc,{htmlFor:u,label:c,description:t.description})}),a.jsx("div",{className:"bounds-field-input",children:m})]},`${o}-${e}`):a.jsxs("div",{className:"form-group",children:[a.jsx(Dc,{htmlFor:u,label:c,description:t.description}),m]},`${o}-${e}`)}function Fv(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 Ov(e,t){const n=new Set;if(!t)return n;for(const[r,o]of Object.entries(t)){const s=e[r];if(s===""||s===void 0)continue;const i=Number(s);!isNaN(i)&&i>o&&n.add(r)}return n}function Bv({profile:e,onConfirm:t,onCancel:n,readOnly:r,initialBounds:o,initialContext:s,initialFrame:i,profileConfig:l,approverNames:c,adminName:u}){const m=e.boundsSchema??e.frameSchema,f=e.contextSchema,v=m?Object.entries(m.fields).filter(([z])=>!(z==="profile"||z==="path")):[],y=f&&f.keyOrder.length>0?Object.entries(f.fields):[],x=o??i??{},w=s??{},j={};for(const[z]of v)j[z]=x[z]!==void 0?String(x[z]):"";const h={};for(const[z]of y)h[z]=w[z]!==void 0?String(w[z]):"";const[p,g]=d.useState(j),[S,E]=d.useState(h),[P,k]=d.useState(null);d.useEffect(()=>{const z=Ev(e.id);O.getIntegrationManifests().then(({manifests:R})=>{const $=R.find(L=>L.profile===z&&L.contextDiscovery&&Object.keys(L.contextDiscovery).length>0);k($??null)}).catch(()=>k(null))},[e.id]);const N=Fv(p,l),C=Ov(p,l==null?void 0:l.caps),T=(z,R)=>{g($=>({...$,[z]:R}))},H=(z,R)=>{E($=>({...$,[z]:R}))},W=()=>{const z={profile:e.id};for(const[$,L]of v)L.type==="number"?z[$]=p[$]===""?0:Number(p[$]):z[$]=p[$];const R={};for(const[$,L]of y)L.type==="number"?R[$]=S[$]===""?0:Number(S[$]):R[$]=S[$];return[z,R]},B=()=>{const[z,R]=W();t(z,R)},_=()=>{const z=(l==null?void 0:l.caps)??{},R={...p};for(const V of C)z[V]!==void 0&&(R[V]=String(z[V]));g(R);const $={profile:e.id};for(const[V,ee]of v)if(ee.type==="number"){const J=R[V]??"";$[V]=J===""?0:Number(J)}else $[V]=R[V]??"";const L={};for(const[V,ee]of y)ee.type==="number"?L[V]=S[V]===""?0:Number(S[V]):L[V]=S[V];t($,L)},D=z=>{const R=l==null?void 0:l.caps;if(!R||R[z]===void 0)return null;const $=R[z],L=C.has(z);return N==="hard-ceiling"&&L?a.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--danger)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",$," — exceeds team ceiling"]}):N==="above-approvers"&&L?a.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--warning)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",$," — above cap"]}):a.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--success)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",$," ok"]})},X=()=>{var z;if(N==="no-config")return null;if(N==="approvers-dormant"){const R=c&&c.length>0?c.join(", "):"the configured approvers";return a.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:[a.jsxs("div",{style:{fontWeight:600,color:"var(--accent)",marginBottom:"0.25rem"},children:["Profile approvers: ",R]}),a.jsxs("div",{children:["No caps are set on this profile, so ",R," 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(N==="within-cap")return a.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:a.jsx("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:"Within all team caps — your responsibility."})});if(N==="above-approvers"){const R=c&&c.length>0?c.join(", "):"the required approvers";return a.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:[a.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.25rem"},children:"Above team cap."}),a.jsxs("div",{children:[a.jsx("strong",{children:"Over-cap actions"})," will require approval from you and ",R,". Within-cap actions run per the mode you choose."]})]})}if(N==="hard-ceiling"){const R=Array.from(C)[0],$=R?(z=l==null?void 0:l.caps)==null?void 0:z[R]:void 0,L=u??"the team admin";return a.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:[a.jsx("div",{style:{fontWeight:600,color:"var(--danger)",marginBottom:"0.25rem"},children:"Hard team ceiling."}),a.jsxs("div",{style:{marginBottom:"0.75rem"},children:["Team policy caps this at ",$??"the configured limit",". Lower your bound or ask ",L," to add an approver path above the cap."]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:_,children:"Save below cap"}),n&&a.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"})]})]})}return null},se=N==="hard-ceiling";return a.jsxs("div",{children:[y.length>0&&a.jsxs("div",{className:"context-section",children:[a.jsxs("div",{className:"bounds-section-header",children:[a.jsx("span",{className:"bounds-section-icon",children:"🛡"}),a.jsxs("div",{children:[a.jsx("div",{className:"bounds-section-title",children:"Allowed scope"}),a.jsx("div",{className:"bounds-section-subtitle",children:"Encrypted on your device, never sent to the SP"})]})]}),y.map(([z,R])=>{var L;const $=!!((L=P==null?void 0:P.contextDiscovery)!=null&&L[z]);return a.jsx(Uc,{fieldKey:z,fieldDef:R,value:S[z],onChange:H,prefix:"context",readOnly:r,discoveryIntegrationId:$?P.id:void 0},`context-${z}`)})]}),v.length>0&&a.jsxs("div",{className:"bounds-section",children:[a.jsxs("div",{className:"bounds-section-header",children:[a.jsx("span",{className:"bounds-section-icon",children:"🔒"}),a.jsxs("div",{children:[a.jsx("div",{className:"bounds-section-title",children:"Limits"}),a.jsx("div",{className:"bounds-section-subtitle",children:"Enforced by the Service Provider"})]})]}),a.jsx("div",{className:"bounds-fields-grid",children:v.map(([z,R])=>{var $;return a.jsxs("div",{style:{display:"contents"},children:[a.jsx(Uc,{fieldKey:z,fieldDef:R,value:p[z],onChange:T,prefix:"bounds",readOnly:r,twoColumn:!0}),N!=="no-config"&&(($=l==null?void 0:l.caps)==null?void 0:$[z])!==void 0&&a.jsx("div",{style:{gridColumn:"2 / 3",display:"flex",alignItems:"center",paddingBottom:"0.5rem"},children:D(z)})]},`bounds-${z}`)})}),X()]}),a.jsx("button",{className:"btn btn-primary",onClick:B,disabled:se,style:{marginTop:"0.5rem"},children:r?"Next: Gates":"Next: Problem Statement"})]})}function Dv(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 Uv(e){return e.replace(/```(?:markdown|md)?\s*\n[\s\S]*?```/,"").trim()}const Wv="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 ga({target:e,currentText:t,onApply:n,greeting:r,placeholder:o,title:s}){const[i,l]=d.useState([{role:"assistant",content:r??Wv}]),[c,u]=d.useState(""),[m,f]=d.useState(!1),[v,y]=d.useState(null),x=d.useRef(null);d.useEffect(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[i,m]);const w=async()=>{const h=c.trim();if(!h||m)return;const p=[...i,{role:"user",content:h}];l(p),u(""),y(null),f(!0);try{const g=await O.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=h=>{h.key==="Enter"&&!h.shiftKey&&!h.nativeEvent.isComposing&&(h.preventDefault(),w())};return a.jsxs("div",{className:"intent-chat",children:[a.jsx("h3",{className:"card-title",children:s??"AI Assistant"}),a.jsxs("div",{ref:x,className:"chat-messages",children:[i.map((h,p)=>{const g=h.role==="assistant"?Dv(h.content):null,S=g?Uv(h.content):h.content;return a.jsx("div",{className:`chat-msg ${h.role}`,children:a.jsxs("div",{className:"chat-msg-body",children:[S&&a.jsx("div",{className:"chat-msg-prose",children:S}),g!==null&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"chat-fenced-block",children:g}),a.jsx("button",{type:"button",className:"btn btn-primary btn-sm chat-apply-btn",onClick:()=>n(g),children:"Apply this draft"})]})]})},p)}),m&&a.jsx("div",{className:"chat-msg assistant",children:a.jsx("div",{className:"chat-msg-body chat-msg-thinking",children:"Thinking…"})})]}),v&&a.jsx("div",{className:"error-message",children:v}),a.jsxs("div",{className:"chat-composer",children:[a.jsxs("div",{className:"chat-composer-pill",children:[a.jsx("textarea",{className:"chat-input",value:c,onChange:h=>u(h.target.value),onKeyDown:j,placeholder:o??"Ask for help articulating the intent…",rows:1,disabled:m}),a.jsx("button",{type:"button",className:"chat-send-btn",onClick:w,disabled:m||!c.trim(),"aria-label":"Send",children:"↑"})]}),a.jsx("div",{className:"chat-composer-hint",children:"Enter to send · Shift+Enter for newline"})]})]})}function Mf({open:e,onClose:t,children:n,ariaLabel:r}){const o=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=o.current)==null||l.focus(),()=>{document.removeEventListener("keydown",i),document.body.style.overflow="",s.current instanceof HTMLElement&&s.current.focus()}},[e,t]),cf.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`bottom-sheet-backdrop${e?" is-open":""}`,onClick:t,"aria-hidden":"true"}),a.jsxs("aside",{ref:o,className:`bottom-sheet${e?" is-open":""}`,role:"dialog","aria-modal":"true","aria-label":r,tabIndex:-1,children:[a.jsx("div",{className:"bottom-sheet-handle","aria-hidden":"true"}),a.jsx("button",{type:"button",className:"bottom-sheet-close",onClick:t,"aria-label":"Close",children:"×"}),n]})]}),document.body)}function Hv(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Vv(e,t,n){if(t.length===0)return[{text:e,label:e,matched:null}];const r=[],o=new Set;for(const c of t)if(!(!c.scope||c.scope==="all (unscoped)"))for(const u of[c.scope,...c.scope.split(",").map(m=>m.trim())]){const m=u.toLowerCase();u&&!o.has(m)&&(o.add(m),r.push(u))}r.sort((c,u)=>u.length-c.length);const s=c=>{const u=c.toLowerCase();return t.filter(m=>{var f,v;return((f=m.scope)==null?void 0:f.toLowerCase())===u||((v=m.scope)==null?void 0:v.split(",").map(y=>y.trim().toLowerCase()).includes(u))})},i=["\\[\\d+\\]",...r.map(Hv)],l=new RegExp(`(${i.join("|")})`,"gi");return e.split(l).filter(c=>c!=="").map(c=>{const u=/^\[(\d+)\]$/.exec(c);if(u){const m=t[Number(u[1])-1];if(m){const f=m.scope&&m.scope!=="all (unscoped)"?m.scope:"all recipients",v=n?`${n}: ${f}`:f;return{text:c,label:v,matched:[m]}}}else if(r.some(m=>m.toLowerCase()===c.toLowerCase())){const m=s(c);if(m.length>0)return{text:c,label:c,matched:m}}return{text:c,label:c,matched:null}})}const Wc=`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
|
|
59
|
+
Watch out — What should the agent avoid or be careful about?`;function Kv(e,t,n,r){return Vv(e,t,r).map((o,s)=>{if(!o.matched)return a.jsx("span",{children:o.text},s);const i=o.matched;return a.jsx("button",{type:"button",onClick:()=>n(i),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--accent)",textDecoration:"underline",font:"inherit"},children:o.label},s)})}function Gv(){var A;const e=Wt(),[t]=zf(),n=Number(t.get("step"))||2,[r,o]=d.useState(null),[s,i]=d.useState(null),[l,c]=d.useState(n),[u,m]=d.useState(null),[f,v]=d.useState(null),[y,x]=d.useState(Wc),[w,j]=d.useState(!1),[h,p]=d.useState(!0),[g,S]=d.useState(null),[E,P]=d.useState([]),[k,N]=d.useState(void 0),[C,T]=d.useState(!1),[H,W]=d.useState(null),[B,_]=d.useState(null),[D,X]=d.useState(null),[se,z]=d.useState([]),[R,$]=d.useState(null);d.useEffect(()=>{var Pe;const I=sessionStorage.getItem("agentAuth");if(!I){e("/agent/new");return}const Y=JSON.parse(I);o(Y);const xe=sessionStorage.getItem("agentGate");if(xe){const ke=JSON.parse(xe);ke.bounds&&m(ke.bounds),ke.context&&v(ke.context),(Pe=ke.gateContent)!=null&&Pe.intent&&x(ke.gateContent.intent)}O.getProfile(Y.profileId).then(ke=>i(ke)).catch(()=>e("/agent/new")).finally(()=>p(!1)),Y.groupId&&Promise.all([O.getTeamProfileConfig(Y.groupId,Y.profileId).catch(()=>null),O.getGroupById(Y.groupId).catch(()=>null),O.listUsers().catch(()=>[])]).then(([ke,pn,Rn])=>{if(S(ke),ke){const Pt=new Map;for(const ne of Rn){const ft=ne.name&&ne.email?`${ne.name} (${ne.email})`:ne.name||ne.email||ne.id;Pt.set(ne.id,ft)}const Ue=(pn==null?void 0:pn.members)??[];for(const ne of Ue){const ft=ne.userId??ne.id;ft&&(ne.name&&ne.email?Pt.set(ft,`${ne.name} (${ne.email})`):ne.name&&Pt.set(ft,ne.name))}const dr=(ke.approvers??[]).map(ne=>Pt.get(ne)??ne);P(dr);const Ht=Ue.find(ne=>ne.role==="admin");if(Ht){const ne=Ht.userId??Ht.id;ne&&N(Pt.get(ne)??Ht.name)}}})},[e]);const L=u?Object.entries(u).filter(([I])=>I!=="profile"&&I!=="path").map(([I,Y])=>`${I} = ${Y}`).join(", "):"",V=(I,Y)=>{m(I),v(Y),c(3)},ee=y.trim()!==Wc.trim()&&y.trim()!=="",J=I=>{ee&&!confirm("Replace your current intent with the AI draft?")||x(I)},je=()=>{const I=s==null?void 0:s.ttl,Y={intent:y};sessionStorage.setItem("agentGate",JSON.stringify({bounds:u,context:f,gateContent:Y,ttlConfig:I})),e("/agent/review")},b=async()=>{if(r){T(!0),W(null),_(null),X(null),z([]),$(null);try{const I=await O.aiIntentReview({profileId:r.profileId,newIntent:y,context:f??void 0});z(I.grants??[]),I.success?I.review?W(I.review):_(I.note??"No other authorizations on this profile to compare against."):X(I.error??"Check failed.")}catch(I){X(I instanceof Error?I.message:"Check failed.")}finally{T(!1)}}},U=I=>{x(I),(H||B||D)&&(W(null),_(null),X(null),z([]),$(null))};return h||!r||!s?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):a.jsxs(a.Fragment,{children:[a.jsx(Lf,{currentStep:l,onStepClick:I=>{I>=2&&c(I)}}),a.jsx(bv,{profileId:r.profileId,bounds:L||void 0,groupName:r.groupName,domain:r.domain}),l===2&&a.jsx("div",{className:"card",children:a.jsx(Bv,{profile:s,onConfirm:V,onCancel:()=>e("/agent/new"),initialBounds:u||void 0,initialContext:f||void 0,profileConfig:g,approverNames:E,adminName:k})}),l===3&&a.jsxs("div",{className:"intent-layout",children:[a.jsx("div",{className:"card intent-pane chat",children:a.jsx(ga,{target:{kind:"intent",profileId:r.profileId,bounds:L||void 0},currentText:y,onApply:J})}),a.jsxs("div",{className:"card intent-pane document",children:[a.jsx("h3",{className:"card-title",children:"What should your agent know?"}),a.jsx("textarea",{className:"intent-textarea",value:y,onChange:I=>U(I.target.value)}),a.jsxs("div",{className:"char-counter",children:[y.length," / 2000"]}),a.jsxs("div",{style:{marginTop:"0.5rem"},children:[a.jsx("button",{type:"button",className:"btn btn-ghost",style:{fontSize:"0.8rem",padding:"0.4rem 0.75rem"},onClick:b,disabled:C||!ee,children:C?"Checking…":"Check against my other grants"}),D&&a.jsxs("div",{className:"hint-box",role:"note",style:{marginTop:"0.5rem",borderLeftColor:"var(--danger)"},children:[a.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"!"}),a.jsx("div",{className:"hint-body",children:D})]}),B&&a.jsxs("div",{className:"hint-box",role:"note",style:{marginTop:"0.5rem"},children:[a.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"i"}),a.jsx("div",{className:"hint-body",children:B})]}),H&&a.jsxs("div",{className:"hint-box",role:"note",style:{marginTop:"0.5rem"},children:[a.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"i"}),a.jsxs("div",{className:"hint-body",children:[a.jsx("div",{className:"hint-head",children:"Intent review (advisory)"}),a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:Kv(H,se,$,Ee(r.profileId))}),a.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.4rem"},children:"Checked with your configured assistant. AI surfaces reality — you decide."})]})]})]}),a.jsxs("div",{className:"intent-footer",children:[a.jsx("button",{className:"btn btn-ghost",onClick:()=>c(2),children:"Back"}),a.jsx("button",{className:"btn btn-primary intent-continue-btn",onClick:je,disabled:!ee,children:"Continue to Review"})]}),(((A=g==null?void 0:g.approvers)==null?void 0:A.length)??0)>0&&a.jsxs("div",{className:"hint-box",role:"note",children:[a.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"i"}),a.jsxs("div",{className:"hint-body",children:[a.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."]})]})]}),a.jsx("button",{type:"button",className:"floating-help",onClick:()=>j(!0),"aria-label":"Open intent assistant",children:"Get help with intent"}),a.jsx(Mf,{open:w,onClose:()=>j(!1),ariaLabel:"Intent assistant",children:a.jsx(ga,{target:{kind:"intent",profileId:r.profileId,bounds:L||void 0},currentText:y,onApply:I=>{J(I),j(!1)}})}),R&&a.jsx("div",{className:"modal-backdrop",onClick:I=>I.target===I.currentTarget&&$(null),children:a.jsxs("div",{className:"modal",children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{className:"modal-title",children:R.length>1?`Existing authorizations (${R.length})`:"Existing authorization"}),a.jsx("button",{className:"modal-close",onClick:()=>$(null),children:"×"})]}),a.jsx("div",{className:"modal-body",children:R.map((I,Y)=>{var xe;return a.jsxs("div",{style:{marginBottom:Y<R.length-1?"1rem":0,paddingBottom:Y<R.length-1?"1rem":0,borderBottom:Y<R.length-1?"1px solid var(--border)":"none"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Scope"}),a.jsx("div",{style:{marginBottom:"0.75rem"},children:I.scope}),a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Intent"}),a.jsx("div",{style:{whiteSpace:"pre-wrap",marginBottom:"0.75rem"},children:((xe=I.intent)==null?void 0:xe.trim())||"(no intent recorded)"}),Object.entries(I.bounds).filter(([Pe])=>Pe!=="profile"&&Pe!=="path").length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Limits"}),a.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)"},children:Object.entries(I.bounds).filter(([Pe])=>Pe!=="profile"&&Pe!=="path").map(([Pe,ke])=>`${Pe}: ${ke}`).join(" · ")})]})]},Y)})})]})})]})]})}function Yv(e){return e.normalize("NFC").replace(/\r\n?/g,`
|
|
60
60
|
`).split(`
|
|
61
61
|
`).map(o=>o.replace(/[ \t]+$/,"")).join(`
|
|
62
62
|
`).replace(/\n+$/,"")}async function hi(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 Ho(e,t){const n=t.boundsSchema??t.frameSchema;if(!n)throw new Error("Profile has no boundsSchema or frameSchema");const o=n.keyOrder.map(i=>`${i}=${String(e[i])}`).join(`
|
|
63
63
|
`);return`sha256:${await hi(o)}`}async function Ff(e,t){if(!t.contextSchema||t.contextSchema.keyOrder.length===0)return`sha256:${await hi("")}`;const r=t.contextSchema.keyOrder.map(s=>`${s}=${String(e[s])}`).join(`
|
|
64
|
-
`);return`sha256:${await hi(r)}`}async function va(e){const t=new TextEncoder().encode(Gv(e)),n=await crypto.subtle.digest("SHA-256",t);return`sha256:${Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")}`}function Of(e,t){if(!e.authorization_id)throw new Error("Attest result lacks authorization_id — the Authority Server predates per-ceremony identity. Update the Authority Server (lockstep deploy).");return{authorizationId:e.authorization_id,boundsHash:e.bounds_hash??t.boundsHash,contextHash:t.contextHash,context:t.context,gateContent:t.gateContent,...t.path?{path:t.path}:{}}}function Hc(e){return e==null?new Set:new Set(String(e).split(",").map(t=>t.trim().toLowerCase()).filter(Boolean))}function Yv(e,t){for(const n of e)if(t.has(n))return!0;return!1}function Qv(e,t,n){for(const r of e){const o=Hc(t[r]),s=Hc(n[r]);if(!(o.size===0||s.size===0)&&!Yv(o,s))return!1}return!0}function Jv(){var ft,lo,G;const e=Wt(),{user:t,mode:n,domain:r}=ze(),[o,s]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(null),[p,f]=d.useState("immediate"),[v,y]=d.useState(1800),[x,w]=d.useState(86400),[j,h]=d.useState(""),[m,g]=d.useState("hours"),[S,E]=d.useState(""),[P,k]=d.useState(!1),[N,C]=d.useState(!1),[T,H]=d.useState(""),[W,D]=d.useState(null),[_,B]=d.useState([]),[X,se]=d.useState(!1),[z,R]=d.useState([]),[$,L]=d.useState(0);d.useEffect(()=>{const F=sessionStorage.getItem("agentAuth"),Q=sessionStorage.getItem("agentGate");if(!F||!Q){e("/agent/new");return}const q=JSON.parse(F),oe=JSON.parse(Q),pn={bounds:oe.bounds??{},context:oe.context??{},gateContent:oe.gateContent};s(q),l(pn),oe.ttlConfig&&(y(oe.ttlConfig.default??1800),w(oe.ttlConfig.max??86400)),O.getProfile(q.profileId).then(Ye=>{var mt;if(u(Ye),!S){const Tt=Ye.name??((mt=q.profileId.split("/").pop())==null?void 0:mt.replace(/@.*$/,""))??"",_e=[];if(pn.context&&Ye.contextSchema)for(const fr of Ye.contextSchema.keyOrder){const re=pn.context[fr];if(re!==void 0&&re!==""){const rt=String(re).split(",").map(Uf=>Uf.trim()).filter(Boolean);_e.push(rt.join(", "))}}const hn=_e.length>0?`${Tt}: ${_e.join(" · ")}`:Tt;E(hn)}}).catch(()=>{}),q.groupId?Promise.all([O.getTeamProfileConfig(q.groupId,q.profileId).catch(()=>null),O.getGroupById(q.groupId).catch(()=>null),O.listUsers().catch(()=>[])]).then(([Ye,mt,Tt])=>{if(D(Ye),Ye){const _e=new Map;for(const re of Tt){const rt=re.name&&re.email?`${re.name} (${re.email})`:re.name||re.email||re.id;_e.set(re.id,rt)}const hn=(mt==null?void 0:mt.members)??[];for(const re of hn){const rt=re.userId??re.id;rt&&(re.name&&re.email?_e.set(rt,`${re.name} (${re.email})`):re.name&&_e.set(rt,re.name))}const fr=(Ye.approvers??[]).map(re=>_e.get(re)??re);B(fr)}}).finally(()=>{se(!0)}):se(!0)},[e]),d.useEffect(()=>{if(!(o!=null&&o.profileId))return;const F=o.profileId;O.getEnrichedAuthorizations().then(Q=>{const q=Q.filter(oe=>oe.profileId===F).map(oe=>({bounds:oe.bounds,context:oe.context??{},intent:oe.intent}));R(q)}).catch(()=>R([]))},[o==null?void 0:o.profileId]),d.useEffect(()=>{if(!i||!c||z.length===0){L(0);return}let F=!1;return(async()=>{const Q=await Ho(i.bounds,c),q=await Promise.all(z.map(oe=>Ho(oe.bounds,c).catch(()=>null)));F||L(q.filter(oe=>oe===Q).length)})().catch(()=>{F||L(0)}),()=>{F=!0}},[i,c,z]);const V=async()=>{if(!(!o||!i||!c||!t)){if(!o.groupId){H("No active group; cannot create authorization.");return}C(!0),H("");try{const F=r||o.domain||"owner",Q=await Ho(i.bounds,c),q=await Ff(i.context,c),[oe,pn]=await Promise.all([va(i.gateContent.intent),va(JSON.stringify({profile:o.profileId,domain:F,group:o.groupId}))]);let Ye,mt,Tt,_e;if(o.isTeam){const re=await O.getApproversPubkeys(o.groupId,o.profileId);if(re.length>0){const rt=await O.encryptIntent(i.gateContent.intent,re);Ye=rt.intentCiphertext,mt=rt.encryptedKeys,Tt=rt.approversFrozen,_e=rt.intentDisclosureHash}}const hn=`authz_${crypto.randomUUID()}`,fr=await O.attest({authorization_id:hn,profile_id:o.profileId,bounds:i.bounds,bounds_hash:Q,context_hash:q,domain:F,did:t.did,gate_content_hashes:{intent:oe},execution_context_hash:pn,group_id:o.groupId,ttl:v,commitment_mode:p==="per-action"?"review":"automatic",title:S.trim(),intent_ciphertext:Ye,encrypted_keys:mt,approvers_frozen:Tt,intent_disclosure_hash:_e,disclose_identity:P});try{await O.pushGateContent(Of(fr,{boundsHash:Q,contextHash:q,context:i.context,gateContent:i.gateContent}))}catch(re){try{await O.revokeAttestation(hn,"Auto-revoked: gate content push failed")}catch{}throw new Error(`Authorization signed but gate content delivery failed. The attestation was revoked. Please try again. (${re instanceof Error?re.message:"Unknown error"})`)}sessionStorage.removeItem("agentAuth"),sessionStorage.removeItem("agentGate"),e(`/authorizations?highlight=${encodeURIComponent(hn)}`)}catch(F){H(F instanceof Error?F.message:"Attestation failed")}finally{C(!1)}}};if(!o||!i)return a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."});const ee=Object.entries(i.bounds).filter(([F])=>F!=="profile"&&F!=="path"),J=Object.entries(i.context),b=((W==null?void 0:W.caps)!=null?Object.keys(W.caps):[]).length!==0,U=_.length>0?_.join(", "):((W==null?void 0:W.approvers)??[]).join(", "),A=b?`Within-cap actions run per the mode you choose above. Over-cap actions will require approval from you and ${U}, 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.",I=b?`Over-cap actions will be reviewed by you and ${U}. Within-cap actions run per the mode you chose above.`:`Approvers ${U} can read your intent but won't gate any action — no caps configured on this profile.`,Y=!!((ft=W==null?void 0:W.approvers)!=null&&ft.length),xe=v>x,Pe={flex:1,padding:"0.75rem",border:p==="immediate"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:p==="immediate"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},ke={flex:1,padding:"0.75rem",border:p==="per-action"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:p==="per-action"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},mn=((lo=c==null?void 0:c.contextSchema)==null?void 0:lo.keyOrder)??[],Rn=z.filter(F=>Qv(mn,i.context,F.context)),Pt=Rn.length>0,Ue=Ee(o.profileId),dr=F=>{const Q=Object.values(F).map(q=>String(q).trim()).filter(Boolean);return Q.length>0?Q.join(", "):"all (unscoped)"},Ht=Rn.map(F=>dr(F.context)).join("; "),ne=`This grant's scope overlaps an existing grant on ${Ue} (scoped to: ${Ht}). When two grants cover the same actions, the agent may act under either — the more permissive limits effectively apply. Confirm this is intended before authorizing.`;return a.jsxs(a.Fragment,{children:[a.jsx(Lf,{currentStep:4,onStepClick:F=>{F<=3&&e(`/agent/gate?step=${F}`)}}),a.jsxs("div",{className:"card",children:[a.jsx("h3",{className:"card-title",style:{marginBottom:"0.25rem"},children:"Review & Commit"}),a.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"1.5rem"},children:"Review your authorization details before signing."}),T&&a.jsx("div",{className:"error-message",children:T}),a.jsxs("dl",{className:"review-grid",children:[a.jsx("dt",{children:"Profile"}),a.jsxs("dd",{children:[Ee(o.profileId),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:o.profileId})]}),o.groupName&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Team"}),a.jsx("dd",{children:o.groupName})]}),o.groupId&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Approvers"}),a.jsx("dd",{children:X?(((G=W==null?void 0:W.approvers)==null?void 0:G.length)??0)===0?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"None — solo authorization"}),a.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."})]}):a.jsxs(a.Fragment,{children:[U,a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:A})]}):a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Loading…"})})]}),a.jsx("dt",{children:"TTL"}),a.jsx("dd",{children:"30 minutes"})]}),!!ee.length&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Bounds"}),a.jsx("dl",{className:"review-grid",children:ee.map(([F,Q])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:F}),a.jsx("dd",{children:String(Q)})]},F))})]}),!!J.length&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Context"}),a.jsx("dl",{className:"review-grid",children:J.map(([F,Q])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:F}),a.jsx("dd",{children:String(Q)})]},F))})]}),a.jsx("div",{className:"gate-content-block",children:a.jsxs("div",{className:"gate-content-item",children:[a.jsx("div",{className:"gate-content-label",children:"Intent"}),a.jsx("div",{className:"gate-content-text",children:i.gateContent.intent})]})}),a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.5rem"},children:"Commitment"}),a.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"1.25rem"},children:[a.jsxs("button",{onClick:()=>f("immediate"),style:Pe,children:[a.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Automatic"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Agent acts freely within your limits."})]}),a.jsxs("button",{onClick:()=>f("per-action"),style:ke,children:[a.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Review Each Action"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"You review and approve each action before it executes."})]})]}),$>0?a.jsxs("div",{style:{display:"flex",gap:"0.625rem",padding:"0.75rem 0.875rem",marginBottom:"1.25rem",border:"1px solid var(--warning)",borderLeft:"3px solid var(--warning)",borderRadius:"0.5rem",background:"var(--bg-elevated)",fontSize:"0.82rem",color:"var(--text-primary)"},children:[a.jsx("span",{"aria-hidden":"true",style:{color:"var(--warning)",fontWeight:700},children:"⚠"}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.2rem"},children:"Identical limits to an existing grant"}),a.jsxs("div",{children:[$===1?`An active grant on ${Ue} already has exactly these limits.`:`${$} active grants on ${Ue} already have exactly these limits.`," ","If you meant to give the existing grant more time, use ",a.jsx("strong",{children:"Extend"})," on the Authorizations page instead — authorizing here creates a separate, independent grant with its own intent and usage counters."]})]})]}):null,Pt?a.jsxs("div",{style:{display:"flex",gap:"0.625rem",padding:"0.75rem 0.875rem",marginBottom:"1.25rem",border:"1px solid var(--warning)",borderLeft:"3px solid var(--warning)",borderRadius:"0.5rem",background:"var(--bg-elevated)",fontSize:"0.82rem",color:"var(--text-primary)"},children:[a.jsx("span",{"aria-hidden":"true",style:{color:"var(--warning)",fontWeight:700},children:"⚠"}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.2rem"},children:"Overlapping scope"}),a.jsx("div",{children:ne})]})]}):null,a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"Duration"}),a.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(F=>F.seconds<=x).map(F=>a.jsx("button",{onClick:()=>{y(F.seconds),h("")},style:{padding:"0.5rem 0.85rem",border:v===F.seconds?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"0.375rem",background:v===F.seconds?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"inherit",color:"var(--text-primary)"},children:F.label},F.seconds)),a.jsxs("div",{style:{display:"flex",gap:"0.375rem",alignItems:"center"},children:[a.jsx("input",{type:"number",className:"form-input",style:{width:"5rem",padding:"0.45rem 0.6rem",fontSize:"0.85rem"},placeholder:"Custom",value:j,onChange:F=>{h(F.target.value);const Q=parseInt(F.target.value,10);if(Q>0){const q=m==="days"?Q*86400:Q*3600;y(Math.min(q,x))}}}),a.jsxs("select",{className:"form-input",style:{padding:"0.45rem 0.5rem",fontSize:"0.85rem"},value:m,onChange:F=>{g(F.target.value);const Q=parseInt(j,10);if(Q>0){const q=F.target.value==="days"?Q*86400:Q*3600;y(Math.min(q,x))}},children:[a.jsx("option",{value:"hours",children:"hours"}),a.jsx("option",{value:"days",children:"days"})]})]}),xe&&a.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--danger)"},children:["Maximum: ",x>=86400?`${Math.floor(x/86400)} days`:`${Math.floor(x/3600)} hours`]})]}),a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"Title"}),a.jsxs("div",{style:{marginBottom:"1.25rem"},children:[a.jsx("input",{type:"text",className:"form-input",placeholder:`e.g. ${Ee(o.profileId)}: daily operations`,value:S,onChange:F=>E(F.target.value),maxLength:80,style:{fontSize:"0.9rem"}}),a.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"A short name to identify this authorization on your dashboard."})]}),a.jsx("div",{style:{marginBottom:"1.25rem"},children:a.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"0.5rem",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:P,onChange:F=>k(F.target.checked),style:{marginTop:"0.15rem"}}),a.jsxs("span",{style:{fontSize:"0.8rem"},children:["Show my verified name on actions under this authority",a.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.15rem"},children:'Adds "verified by Suveren" with your name to outgoing content. Takes effect only if your identity is verified; otherwise actions stay pseudonymous.'})]})]})}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-ghost",onClick:()=>e("/agent/gate"),children:"Back"}),a.jsx("button",{className:"btn btn-primary btn-lg",style:{flex:1},onClick:V,disabled:N||!S.trim(),children:N?"Signing...":p==="immediate"?"Authorize":"Authorize (Review Mode)"})]}),a.jsx("div",{style:{marginTop:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)",textAlign:"center",display:Y?"block":"none"},children:I})]})]})}const Xv={card:"💳",mail:"✉️"};function qv({manifest:e,integration:t,state:n,onStatusChange:r,onSuccess:o}){var je;const[s,i]=d.useState({}),[l,c]=d.useState(!1),[u,p]=d.useState(!1),[f,v]=d.useState({}),[y,x]=d.useState(!1),[w,j]=d.useState(null),[h,m]=d.useState(!1),[g,S]=d.useState(!1),[E,P]=d.useState(!1),[k,N]=d.useState(!1),[C,T]=d.useState({});d.useEffect(()=>{let b=!1;return O.getCredential(e.id).then(U=>{var A;if(!(b||!U.configured)){if(c(!0),p(!0),U.fields){const I={};for(const Y of e.credentials.fields)U.fields[Y.key]!=null&&(I[Y.key]=U.fields[Y.key]);v(I)}if(e.oauth){const I=((A=U.fieldNames)==null?void 0:A.includes(e.oauth.tokenStorage))??!1;x(I),I&&O.getOAuthHealth(e.id).then(Y=>{b||j(Y)})}}}).catch(()=>{}),()=>{b=!0}},[e.id,e.oauth]);const H=!!e.oauth||e.credentials.fields.some(b=>!b.optional),W=e.oauth?y:l,D=!H||W,_=n==="starting"?"starting":D?t!=null&&t.running?"running":!l&&e.credentials.fields.length>0?"unconfigured":"ready":e.oauth&&l&&!y?"needs-oauth":"unconfigured",B=async()=>{if(e.credentials.fields.some(U=>{var A;return(A=s[U.key])==null?void 0:A.trim()})){m(!0);try{await O.setCredential(e.id,s),c(!0),i({}),e.oauth?o(`${e.name} credentials saved!`):(o(`${e.name} credentials saved — starting integration...`),await z())}catch{o(`Failed to save ${e.name} credentials`)}finally{m(!1)}}},X=async()=>{if(e.credentials.fields.some(U=>{var A;return(A=s[U.key])==null?void 0:A.trim()})){m(!0);try{await O.setCredential(e.id,s),i({}),c(!0),e.oauth?o(`${e.name} credentials saved — now click Connect.`):(N(!1),o(`${e.name} credentials updated — restarting...`),await z())}catch{o(`Failed to update ${e.name} credentials`)}finally{m(!1)}}},se=()=>{window.open(`/auth/oauth/${e.id}/start`,"_blank","width=600,height=700");const b=setInterval(async()=>{var U;try{const A=await O.getCredential(e.id);A.configured&&e.oauth&&((U=A.fieldNames)!=null&&U.includes(e.oauth.tokenStorage))&&(x(!0),N(!1),j(null),clearInterval(b),o(`${e.name} connected — starting integration...`),O.getOAuthHealth(e.id).then(j).catch(()=>{}),await z())}catch{}},2e3);setTimeout(()=>clearInterval(b),12e4)},z=async()=>{P(!0);try{const b=await O.activateIntegration(e.id);b.warning?o(b.warning):o(`${e.name} integration started with ${b.tools.length} tools`),r()}catch(b){o(`Failed to start ${e.name}: ${b instanceof Error?b.message:"Unknown error"}`)}finally{P(!1)}},R=async()=>{try{await O.removeMcpIntegration(e.id),o(`${e.name} integration removed`),r()}catch{o(`Failed to remove ${e.name}`)}},$=Xv[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"},V=e.oauth&&y&&(w==null?void 0:w.status)==="failed",ee=H?V?{c:"int-chip-bad",t:"Auth failed"}:W?{c:"int-chip-ok",t:"Auth OK"}:{c:"int-chip-idle",t:"Not set up"}:{c:"int-chip-idle",t:"No auth"},J=b=>b.replace(/https?:\/\/[^\s)]+\/auth\/oauth\/[a-z-]+\/callback/gi,`${window.location.origin}/auth/oauth/${e.id}/callback`);return a.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem"},children:[a.jsx("span",{style:{fontSize:"1.4rem",lineHeight:1.2},children:$}),a.jsx("h3",{className:"card-title",style:{margin:0,flex:1,alignSelf:"center"},children:e.name}),a.jsxs("div",{style:{display:"flex",gap:"0.4rem",flexWrap:"wrap",justifyContent:"flex-end"},children:[_!=="unconfigured"&&_!=="needs-oauth"&&a.jsxs("span",{className:`int-chip ${L.c}`,children:[a.jsx("span",{className:"int-dot"}),L.t]}),a.jsxs("span",{className:`int-chip ${ee.c}`,children:[a.jsx("span",{className:"int-dot"}),ee.t]})]})]}),e.oauth&&y&&a.jsx("div",{className:"int-account",style:{marginTop:"0.7rem"},children:w!=null&&w.account?a.jsxs(a.Fragment,{children:["Connected as ",a.jsx("b",{children:w.account})]}):a.jsx("span",{className:"int-none",children:"Account not recorded — reconnect to capture which account is used"})}),V&&!k&&a.jsxs("div",{style:{marginTop:"0.7rem"},children:[a.jsxs("div",{className:"status-banner status-banner-error",style:{marginBottom:"0.6rem"},children:[a.jsx("span",{className:"status-banner-icon",children:"!"}),a.jsxs("span",{className:"status-banner-text",children:["Authentication failed",w!=null&&w.error?` — ${w.error}`:"",". Reconnect to restore access."]})]}),a.jsxs("button",{className:"btn btn-primary btn-sm",onClick:se,children:["Reconnect ",e.name]})]}),a.jsxs("details",{className:"int-details",style:{marginTop:"0.85rem",marginBottom:"1.25rem"},children:[a.jsx("summary",{children:"Details"}),a.jsxs("div",{className:"int-meta",children:[a.jsx("span",{className:"int-k",children:"What"}),a.jsx("span",{children:e.description}),e.profile&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"int-k",children:"Profile"}),a.jsx("span",{children:e.profile})]}),e.oauth&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"int-k",children:"Scopes"}),a.jsx("span",{children:((je=e.oauth.scopes)==null?void 0:je.join(", "))||"—"})]}),t&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"int-k",children:"Tools"}),a.jsxs("span",{children:[t.toolCount," gated"]})]})]})]}),e.setupGuide&&e.setupGuide.length>0&&(_!=="running"||V)&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.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:[a.jsx("span",{style:{transition:"transform 0.2s",transform:g?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"}),"How to set up ",e.name]}),g&&a.jsx("div",{style:{marginTop:"0.75rem",paddingLeft:"0.25rem"},children:e.setupGuide.map((b,U)=>a.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"0.75rem"},children:[a.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:U+1}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.125rem"},children:b.title}),a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",lineHeight:1.5},children:[J(b.description),b.link&&a.jsxs(a.Fragment,{children:[" ",a.jsxs("a",{href:b.link,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"0.8rem"},children:["Open ","↗"]})]})]})]})]},U))})]}),_==="starting"&&a.jsxs("div",{className:"service-status",style:{color:"var(--warning)"},children:[a.jsx("span",{className:"service-status-dot",style:{background:"var(--warning)"}}),"Starting…"]}),k&&a.jsxs("div",{style:{marginTop:"0.7rem",paddingTop:"0.85rem",borderTop:"1px solid var(--border)"},children:[a.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,marginBottom:"0.5rem"},children:"Change credentials"}),u&&a.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(b=>a.jsxs("div",{className:"form-group",style:{marginBottom:"0.6rem"},children:[a.jsx("label",{className:"form-label",children:b.label}),b.type==="password"?a.jsxs("div",{className:"cred-field",children:[a.jsx("input",{className:"form-input",type:C[b.key]?"text":"password",placeholder:b.placeholder,value:s[b.key]||"",onChange:U=>i(A=>({...A,[b.key]:U.target.value}))}),a.jsx("button",{className:"cred-toggle",onClick:()=>T(U=>({...U,[b.key]:!U[b.key]})),children:C[b.key]?"hide":"show"})]}):a.jsx("input",{className:"form-input",type:"text",placeholder:b.placeholder,value:s[b.key]||"",onChange:U=>i(A=>({...A,[b.key]:U.target.value}))})]},b.key)),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginTop:"0.25rem"},children:[a.jsx("button",{className:"btn btn-primary btn-sm",onClick:X,disabled:h,children:h?"Saving…":"Save"}),e.oauth&&a.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:se,children:["Connect ",e.name]}),a.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>{N(!1),i({})},children:"Cancel"})]})]}),!k&&_==="running"&&t&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[a.jsx(Je,{to:"/agent/new",className:"btn btn-primary btn-sm",style:{textDecoration:"none"},children:"Authorize agent"}),(e.credentials.fields.length>0||e.oauth)&&a.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>{i({...f}),N(!0)},title:"Re-enter client ID / secret (e.g. a new OAuth client).",children:"Change credentials"}),a.jsx("span",{style:{flex:1}}),a.jsx("button",{className:"btn btn-sm btn-ghost",style:{color:"var(--danger)"},onClick:R,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"})]}),a.jsx("div",{style:{display:"none"},children:a.jsx(Je,{to:"/agent/new",className:"btn btn-ghost btn-sm",style:{textDecoration:"none",display:"block",textAlign:"center"},children:"Authorize your agent"})})]}),_==="unconfigured"&&(()=>{const b=e.credentials.fields.every(I=>I.optional),U=e.credentials.fields.some(I=>!I.optional),A=e.credentials.fields.some(I=>{var Y;return(Y=s[I.key])==null?void 0:Y.trim()});return a.jsxs(a.Fragment,{children:[u&&a.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:[a.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"," ",a.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&&a.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&&a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:e.setupHint}),e.credentials.fields.map(I=>a.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[a.jsx("label",{className:"form-label",children:I.label}),I.type==="password"?a.jsxs("div",{className:"cred-field",children:[a.jsx("input",{className:"form-input",type:C[I.key]?"text":"password",placeholder:I.placeholder,value:s[I.key]||"",onChange:Y=>i(xe=>({...xe,[I.key]:Y.target.value}))}),a.jsx("button",{className:"cred-toggle",onClick:()=>T(Y=>({...Y,[I.key]:!Y[I.key]})),children:C[I.key]?"hide":"show"})]}):a.jsx("input",{className:"form-input",type:"text",placeholder:I.placeholder,value:s[I.key]||"",onChange:Y=>i(xe=>({...xe,[I.key]:Y.target.value}))})]},I.key)),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[A&&a.jsx("button",{className:"btn btn-primary",onClick:B,disabled:h||U&&!e.credentials.fields.filter(I=>!I.optional).every(I=>{var Y;return(Y=s[I.key])==null?void 0:Y.trim()}),children:h?"Saving...":"Save & Encrypt"}),b&&!A&&a.jsx("button",{className:"btn btn-primary",onClick:z,disabled:E,children:E?"Starting...":`Activate ${e.name}`})]})]})})(),_==="needs-oauth"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.25rem"},children:["✓"," Step 1 done — credentials saved"]}),a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["Step 2: connect your ",e.name," account to authorize access."]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[a.jsxs("button",{className:"btn btn-primary",onClick:se,children:["Connect ",e.name," Account"]}),a.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Change Credentials"})]})]}),_==="ready"&&!t&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.75rem"},children:["✓"," ",e.oauth?`${e.name} account connected`:"Credentials configured"]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[a.jsx("button",{className:"btn btn-primary",onClick:z,disabled:E,children:E?"Starting...":`Start ${e.name} Integration`}),!e.oauth&&a.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Update Credentials"}),e.oauth&&a.jsx("button",{className:"btn btn-ghost",onClick:()=>{c(!1),x(!1)},children:"Change Credentials"})]})]}),_==="ready"&&t&&!t.running&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"service-status service-status-error",style:{marginBottom:"0.75rem"},children:[a.jsx("span",{className:"service-status-dot"}),"Not running"]}),t.error&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--danger)",marginBottom:"0.75rem"},children:t.error}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-primary",onClick:z,disabled:E,children:E?"Starting...":"Start"}),a.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:R,children:"Disable"})]})]})]})}function Zv(){const{loading:e,mcpServerUp:t,manifestsError:n,entries:r,refresh:o}=wl(),[s,i]=d.useState(""),l=d.useCallback(c=>{i(c),setTimeout(()=>i(""),5e3)},[]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"Integrations"}),a.jsx("p",{className:"page-subtitle",children:"Connect external services and manage MCP integrations."})]}),s&&a.jsx("div",{className:"alert alert-success",children:s}),e?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading integrations..."}):t===!1?a.jsxs("div",{className:"status-banner status-banner-error",children:[a.jsx("span",{className:"status-banner-icon",children:"!"}),a.jsx("span",{className:"status-banner-text",children:"MCP server is not reachable. Make sure it is running."})]}):a.jsxs(a.Fragment,{children:[r.map(c=>a.jsx(qv,{manifest:c.manifest,integration:c.integration,state:c.state,onStatusChange:o,onSuccess:l},c.id)),r.length===0&&(n?a.jsxs("div",{className:"status-banner status-banner-error",children:[a.jsx("span",{className:"status-banner-icon",children:"!"}),a.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"," ",a.jsx("code",{children:"SUVEREN_MCP_INTERNAL_URL"})," (dev MCP is :3431), then refresh."]})]}):a.jsx("p",{style:{color:"var(--text-tertiary)",textAlign:"center",marginTop:"2rem"},children:"No integrations available yet."}))]})]})}function ey(){var H,W,D;const{activeTeam:e,activeMembership:t,refreshGroups:n,user:r}=ze(),[o,s]=d.useState(null),[i,l]=d.useState(!1),[c,u]=d.useState(""),[p,f]=d.useState(""),[v,y]=d.useState(!1),[x,w]=d.useState(""),[j,h]=d.useState("");d.useEffect(()=>{fetch("/health").then(_=>_.json()).then(_=>{typeof _.spUrl=="string"&&h(_.spUrl)}).catch(()=>{})},[]),d.useEffect(()=>{if(!e){s(null);return}O.getGroupById(e.id).then(_=>{const B=_.group??_,X=_.members??[],se=_.isAdmin??!1,z=X.map(R=>{const $=R.userId||R.id||"",L=R.role||(se&&$===B.createdBy?"admin":"member");return{id:$,name:R.name||$.slice(0,8)||"Member",email:R.email||"",domains:R.domains||[],role:L,isAdmin:L==="admin"||se&&$===B.createdBy}});s({id:B.id,name:B.name,members:z})}).catch(()=>s(null))},[e==null?void 0:e.id]);const m=(o==null?void 0:o.members.filter(_=>_.isAdmin))??[],g=(e==null?void 0:e.isAdmin)===!0&&m.length<=1&&m.some(_=>_.id===(r==null?void 0:r.id)),S=(e==null?void 0:e.name)??"",E=x.trim()===S&&!i,P=()=>{w(""),y(!0)},k=()=>{y(!1),w("")},N=async()=>{if(!(!e||!E)){l(!0),u("");try{await O.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)}}},C=e&&j?`${j}/dashboard/groups/${e.id}`:void 0,T=j?`${j}/dashboard/groups`:void 0;return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"page-header",children:a.jsxs("div",{children:[a.jsx("h1",{className:"page-title",children:"Team"}),a.jsx("p",{className:"page-subtitle",children:"Your current team context. Team management lives in your Service Provider dashboard."})]})}),c&&a.jsx("div",{className:"error-message",children:c}),p&&a.jsx("div",{className:"alert alert-success",children:p}),e?a.jsxs("div",{className:"card",style:{marginBottom:"1.5rem"},children:[a.jsxs("div",{className:"card-header",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"card-title",children:e.name}),a.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:[((H=o==null?void 0:o.members)==null?void 0:H.length)??0," ",(((W=o==null?void 0:o.members)==null?void 0:W.length)??0)===1?"member":"members",e.isAdmin&&" · You are admin"]})]}),a.jsx("span",{className:"status-badge status-active",children:"Active"})]}),(D=o==null?void 0:o.members)==null?void 0:D.map(_=>a.jsxs("div",{className:"member-row",children:[a.jsx("div",{className:"member-avatar",children:_.name.split(" ").map(B=>B[0]).join("").slice(0,2).toUpperCase()}),a.jsxs("div",{className:"member-info",children:[a.jsx("div",{className:"member-name",children:_.name}),a.jsx("div",{className:"member-email",children:_.email})]}),a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:_.role})]},_.id)),a.jsxs("div",{style:{marginTop:"1.25rem",paddingTop:"1rem",borderTop:"1px solid var(--border)",display:"flex",alignItems:"center",gap:"0.75rem",flexWrap:"wrap"},children:[C&&a.jsx("a",{className:"btn btn-secondary btn-sm",href:C,target:"_blank",rel:"noopener noreferrer",children:"Manage this team in your Service Provider →"}),a.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:a.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--text-tertiary)"},onClick:P,disabled:i||g,children:"Leave team"})})]})]}):a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem 1.5rem"},children:[a.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem"},children:"You are working solo."}),a.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."}),T&&a.jsx("a",{className:"btn btn-primary btn-sm",href:T,target:"_blank",rel:"noopener noreferrer",children:"Open Service Provider dashboard →"})]}),v&&e&&a.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:a.jsxs("div",{className:"card",onClick:_=>_.stopPropagation(),style:{maxWidth:480,width:"100%",margin:0},children:[a.jsxs("h3",{id:"leave-team-title",className:"card-title",style:{marginBottom:"0.5rem"},children:["Leave ",S,"?"]}),a.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:"Leaving will:"}),a.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[a.jsx("li",{children:"Revoke all authorizations you created in this team's context"}),a.jsx("li",{children:"Reject any pending action proposals you authored"}),a.jsx("li",{children:"Disable your membership — rejoining requires admin reactivation"})]}),a.jsxs("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:["Your ",a.jsx("strong",{children:"personal"})," authorizations are not affected."]}),a.jsxs("div",{className:"form-group",children:[a.jsxs("label",{htmlFor:"leave-confirm-input",style:{fontSize:"0.825rem",display:"block",marginBottom:"0.375rem"},children:["Type ",a.jsx("code",{children:S})," to confirm:"]}),a.jsx("input",{id:"leave-confirm-input",className:"form-input",type:"text",value:x,onChange:_=>w(_.target.value),placeholder:S,disabled:i,autoFocus:!0})]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end",marginTop:"1rem"},children:[a.jsx("button",{className:"btn btn-ghost",onClick:k,disabled:i,children:"Cancel"}),a.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:N,disabled:!E,children:i?"Leaving...":"Leave team"})]})]})})]})}function ty({onDismiss:e}){const t=Wt(),{group:n,groupId:r,domain:o}=ze(),[s,i]=d.useState([]),[l,c]=d.useState([]),[u,p]=d.useState([]),[f,v]=d.useState(!0),[y,x]=d.useState({}),[w,j]=d.useState(null);d.useEffect(()=>{Promise.all([O.listProfiles().catch(()=>[]),O.getIntegrationManifests().then(k=>k.manifests??[]).catch(()=>[]),O.getMcpHealth().then(k=>k.integrations??[]).catch(()=>[])]).then(async([k,N,C])=>{if(i(k),c(N),p(C),r){const T=await Promise.all(k.map(W=>O.getTeamProfileConfig(r,W.id).catch(()=>null))),H={};k.forEach((W,D)=>{const _=T[D];_&&(H[W.id]=_)}),x(H)}}).finally(()=>v(!1))},[r]);const h=new Map,m=new Map;for(const k of l)k.profile&&h.set(k.profile,k);for(const k of u){const N=l.find(C=>C.id===k.id);N!=null&&N.profile&&m.set(N.profile,k)}const g=s.filter(k=>{const N=k.id.replace(/@.*$/,"").split("/").pop()??k.id;return h.has(N)}),S=k=>k in y,E=(k,N)=>{if(!r){console.error("No active group when creating authorization");return}const C=S(k);sessionStorage.setItem("agentAuth",JSON.stringify({profileId:k,groupId:r,groupName:(n==null?void 0:n.name)??null,domain:o,isTeam:C})),N?sessionStorage.setItem("agentGate",JSON.stringify({bounds:N.bounds,context:N.context,gateContent:{intent:N.intent},ttlConfig:{max:N.ttl},templateMode:N.mode,templateTtl:N.ttl})):sessionStorage.removeItem("agentGate"),j(null),e==null||e(),t("/agent/gate")},P=k=>{if(!r)return;const N=k.replace(/@.*$/,"").split("/").pop()??k,C=h.get(N);C!=null&&C.templates&&C.templates.length>0?j({profileId:k,manifest:C}):E(k)};if(w){const k=w.manifest.templates??[];return a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginBottom:"1rem"},onClick:()=>j(null),children:"← Back to profiles"}),a.jsxs("h3",{style:{margin:"0 0 0.25rem 0",fontSize:"1rem"},children:["Set up ",w.manifest.name," authorization"]}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.5rem",marginBottom:"0.75rem",fontWeight:600},children:"Quick start"}),a.jsx("div",{style:{display:"grid",gap:"0.75rem",gridTemplateColumns:`repeat(${Math.min(k.length,3)}, 1fr)`},children:k.map(N=>a.jsxs("button",{className:"template-card",onClick:()=>E(w.profileId,N),children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.375rem"},children:[a.jsx("span",{className:`template-mode template-mode-${N.mode==="automatic"?"auto":"review"}`,children:N.mode==="automatic"?"Auto":"Review"}),a.jsx("span",{className:"template-risk","data-risk":N.risk,children:N.risk})]}),a.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.25rem"},children:N.name}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",lineHeight:1.45,marginBottom:"0.5rem"},children:N.description}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.3rem"},children:N.tags.map(C=>a.jsx("span",{className:"template-tag",children:C},C))})]},N.name))}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1rem",margin:"1.5rem 0"},children:[a.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}}),a.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"or"}),a.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}})]}),a.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 a.jsxs(a.Fragment,{children:[a.jsx("style",{children:`
|
|
64
|
+
`);return`sha256:${await hi(r)}`}async function va(e){const t=new TextEncoder().encode(Yv(e)),n=await crypto.subtle.digest("SHA-256",t);return`sha256:${Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")}`}function Of(e,t){if(!e.authorization_id)throw new Error("Attest result lacks authorization_id — the Authority Server predates per-ceremony identity. Update the Authority Server (lockstep deploy).");return{authorizationId:e.authorization_id,boundsHash:e.bounds_hash??t.boundsHash,contextHash:t.contextHash,context:t.context,gateContent:t.gateContent,...t.path?{path:t.path}:{}}}function Hc(e){return e==null?new Set:new Set(String(e).split(",").map(t=>t.trim().toLowerCase()).filter(Boolean))}function Qv(e,t){for(const n of e)if(t.has(n))return!0;return!1}function Jv(e,t,n){for(const r of e){const o=Hc(t[r]),s=Hc(n[r]);if(!(o.size===0||s.size===0)&&!Qv(o,s))return!1}return!0}function Xv(){var ft,lo,G;const e=Wt(),{user:t,mode:n,domain:r}=ze(),[o,s]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(null),[m,f]=d.useState("immediate"),[v,y]=d.useState(1800),[x,w]=d.useState(86400),[j,h]=d.useState(""),[p,g]=d.useState("hours"),[S,E]=d.useState(""),[P,k]=d.useState(!1),[N,C]=d.useState(!1),[T,H]=d.useState(""),[W,B]=d.useState(null),[_,D]=d.useState([]),[X,se]=d.useState(!1),[z,R]=d.useState([]),[$,L]=d.useState(0);d.useEffect(()=>{const F=sessionStorage.getItem("agentAuth"),Q=sessionStorage.getItem("agentGate");if(!F||!Q){e("/agent/new");return}const q=JSON.parse(F),oe=JSON.parse(Q),mn={bounds:oe.bounds??{},context:oe.context??{},gateContent:oe.gateContent};s(q),l(mn),oe.ttlConfig&&(y(oe.ttlConfig.default??1800),w(oe.ttlConfig.max??86400)),O.getProfile(q.profileId).then(Ye=>{var pt;if(u(Ye),!S){const Tt=Ye.name??((pt=q.profileId.split("/").pop())==null?void 0:pt.replace(/@.*$/,""))??"",_e=[];if(mn.context&&Ye.contextSchema)for(const fr of Ye.contextSchema.keyOrder){const re=mn.context[fr];if(re!==void 0&&re!==""){const rt=String(re).split(",").map(Wf=>Wf.trim()).filter(Boolean);_e.push(rt.join(", "))}}const hn=_e.length>0?`${Tt}: ${_e.join(" · ")}`:Tt;E(hn)}}).catch(()=>{}),q.groupId?Promise.all([O.getTeamProfileConfig(q.groupId,q.profileId).catch(()=>null),O.getGroupById(q.groupId).catch(()=>null),O.listUsers().catch(()=>[])]).then(([Ye,pt,Tt])=>{if(B(Ye),Ye){const _e=new Map;for(const re of Tt){const rt=re.name&&re.email?`${re.name} (${re.email})`:re.name||re.email||re.id;_e.set(re.id,rt)}const hn=(pt==null?void 0:pt.members)??[];for(const re of hn){const rt=re.userId??re.id;rt&&(re.name&&re.email?_e.set(rt,`${re.name} (${re.email})`):re.name&&_e.set(rt,re.name))}const fr=(Ye.approvers??[]).map(re=>_e.get(re)??re);D(fr)}}).finally(()=>{se(!0)}):se(!0)},[e]),d.useEffect(()=>{if(!(o!=null&&o.profileId))return;const F=o.profileId;O.getEnrichedAuthorizations().then(Q=>{const q=Q.filter(oe=>oe.profileId===F).map(oe=>({bounds:oe.bounds,context:oe.context??{},intent:oe.intent}));R(q)}).catch(()=>R([]))},[o==null?void 0:o.profileId]),d.useEffect(()=>{if(!i||!c||z.length===0){L(0);return}let F=!1;return(async()=>{const Q=await Ho(i.bounds,c),q=await Promise.all(z.map(oe=>Ho(oe.bounds,c).catch(()=>null)));F||L(q.filter(oe=>oe===Q).length)})().catch(()=>{F||L(0)}),()=>{F=!0}},[i,c,z]);const V=async()=>{if(!(!o||!i||!c||!t)){if(!o.groupId){H("No active group; cannot create authorization.");return}C(!0),H("");try{const F=r||o.domain||"owner",Q=await Ho(i.bounds,c),q=await Ff(i.context,c),[oe,mn]=await Promise.all([va(i.gateContent.intent),va(JSON.stringify({profile:o.profileId,domain:F,group:o.groupId}))]);let Ye,pt,Tt,_e;if(o.isTeam){const re=await O.getApproversPubkeys(o.groupId,o.profileId);if(re.length>0){const rt=await O.encryptIntent(i.gateContent.intent,re);Ye=rt.intentCiphertext,pt=rt.encryptedKeys,Tt=rt.approversFrozen,_e=rt.intentDisclosureHash}}const hn=`authz_${crypto.randomUUID()}`,fr=await O.attest({authorization_id:hn,profile_id:o.profileId,bounds:i.bounds,bounds_hash:Q,context_hash:q,domain:F,did:t.did,gate_content_hashes:{intent:oe},execution_context_hash:mn,group_id:o.groupId,ttl:v,commitment_mode:m==="per-action"?"review":"automatic",title:S.trim(),intent_ciphertext:Ye,encrypted_keys:pt,approvers_frozen:Tt,intent_disclosure_hash:_e,disclose_identity:P});try{await O.pushGateContent(Of(fr,{boundsHash:Q,contextHash:q,context:i.context,gateContent:i.gateContent}))}catch(re){try{await O.revokeAttestation(hn,"Auto-revoked: gate content push failed")}catch{}throw new Error(`Authorization signed but gate content delivery failed. The attestation was revoked. Please try again. (${re instanceof Error?re.message:"Unknown error"})`)}sessionStorage.removeItem("agentAuth"),sessionStorage.removeItem("agentGate"),e(`/authorizations?highlight=${encodeURIComponent(hn)}`)}catch(F){H(F instanceof Error?F.message:"Attestation failed")}finally{C(!1)}}};if(!o||!i)return a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."});const ee=Object.entries(i.bounds).filter(([F])=>F!=="profile"&&F!=="path"),J=Object.entries(i.context),b=((W==null?void 0:W.caps)!=null?Object.keys(W.caps):[]).length!==0,U=_.length>0?_.join(", "):((W==null?void 0:W.approvers)??[]).join(", "),A=b?`Within-cap actions run per the mode you choose above. Over-cap actions will require approval from you and ${U}, 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.",I=b?`Over-cap actions will be reviewed by you and ${U}. Within-cap actions run per the mode you chose above.`:`Approvers ${U} can read your intent but won't gate any action — no caps configured on this profile.`,Y=!!((ft=W==null?void 0:W.approvers)!=null&&ft.length),xe=v>x,Pe={flex:1,padding:"0.75rem",border:m==="immediate"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:m==="immediate"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},ke={flex:1,padding:"0.75rem",border:m==="per-action"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:m==="per-action"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},pn=((lo=c==null?void 0:c.contextSchema)==null?void 0:lo.keyOrder)??[],Rn=z.filter(F=>Jv(pn,i.context,F.context)),Pt=Rn.length>0,Ue=Ee(o.profileId),dr=F=>{const Q=Object.values(F).map(q=>String(q).trim()).filter(Boolean);return Q.length>0?Q.join(", "):"all (unscoped)"},Ht=Rn.map(F=>dr(F.context)).join("; "),ne=`This grant's scope overlaps an existing grant on ${Ue} (scoped to: ${Ht}). When two grants cover the same actions, the agent may act under either — the more permissive limits effectively apply. Confirm this is intended before authorizing.`;return a.jsxs(a.Fragment,{children:[a.jsx(Lf,{currentStep:4,onStepClick:F=>{F<=3&&e(`/agent/gate?step=${F}`)}}),a.jsxs("div",{className:"card",children:[a.jsx("h3",{className:"card-title",style:{marginBottom:"0.25rem"},children:"Review & Commit"}),a.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"1.5rem"},children:"Review your authorization details before signing."}),T&&a.jsx("div",{className:"error-message",children:T}),a.jsxs("dl",{className:"review-grid",children:[a.jsx("dt",{children:"Profile"}),a.jsxs("dd",{children:[Ee(o.profileId),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:o.profileId})]}),o.groupName&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Team"}),a.jsx("dd",{children:o.groupName})]}),o.groupId&&a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:"Approvers"}),a.jsx("dd",{children:X?(((G=W==null?void 0:W.approvers)==null?void 0:G.length)??0)===0?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"None — solo authorization"}),a.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."})]}):a.jsxs(a.Fragment,{children:[U,a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:A})]}):a.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Loading…"})})]}),a.jsx("dt",{children:"TTL"}),a.jsx("dd",{children:"30 minutes"})]}),!!ee.length&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Bounds"}),a.jsx("dl",{className:"review-grid",children:ee.map(([F,Q])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:F}),a.jsx("dd",{children:String(Q)})]},F))})]}),!!J.length&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Context"}),a.jsx("dl",{className:"review-grid",children:J.map(([F,Q])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:F}),a.jsx("dd",{children:String(Q)})]},F))})]}),a.jsx("div",{className:"gate-content-block",children:a.jsxs("div",{className:"gate-content-item",children:[a.jsx("div",{className:"gate-content-label",children:"Intent"}),a.jsx("div",{className:"gate-content-text",children:i.gateContent.intent})]})}),a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.5rem"},children:"Commitment"}),a.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"1.25rem"},children:[a.jsxs("button",{onClick:()=>f("immediate"),style:Pe,children:[a.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Automatic"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Agent acts freely within your limits."})]}),a.jsxs("button",{onClick:()=>f("per-action"),style:ke,children:[a.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Review Each Action"}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"You review and approve each action before it executes."})]})]}),$>0?a.jsxs("div",{style:{display:"flex",gap:"0.625rem",padding:"0.75rem 0.875rem",marginBottom:"1.25rem",border:"1px solid var(--warning)",borderLeft:"3px solid var(--warning)",borderRadius:"0.5rem",background:"var(--bg-elevated)",fontSize:"0.82rem",color:"var(--text-primary)"},children:[a.jsx("span",{"aria-hidden":"true",style:{color:"var(--warning)",fontWeight:700},children:"⚠"}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.2rem"},children:"Identical limits to an existing grant"}),a.jsxs("div",{children:[$===1?`An active grant on ${Ue} already has exactly these limits.`:`${$} active grants on ${Ue} already have exactly these limits.`," ","If you meant to give the existing grant more time, use ",a.jsx("strong",{children:"Extend"})," on the Authorizations page instead — authorizing here creates a separate, independent grant with its own intent and usage counters."]})]})]}):null,Pt?a.jsxs("div",{style:{display:"flex",gap:"0.625rem",padding:"0.75rem 0.875rem",marginBottom:"1.25rem",border:"1px solid var(--warning)",borderLeft:"3px solid var(--warning)",borderRadius:"0.5rem",background:"var(--bg-elevated)",fontSize:"0.82rem",color:"var(--text-primary)"},children:[a.jsx("span",{"aria-hidden":"true",style:{color:"var(--warning)",fontWeight:700},children:"⚠"}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.2rem"},children:"Overlapping scope"}),a.jsx("div",{children:ne})]})]}):null,a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"Duration"}),a.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(F=>F.seconds<=x).map(F=>a.jsx("button",{onClick:()=>{y(F.seconds),h("")},style:{padding:"0.5rem 0.85rem",border:v===F.seconds?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"0.375rem",background:v===F.seconds?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"inherit",color:"var(--text-primary)"},children:F.label},F.seconds)),a.jsxs("div",{style:{display:"flex",gap:"0.375rem",alignItems:"center"},children:[a.jsx("input",{type:"number",className:"form-input",style:{width:"5rem",padding:"0.45rem 0.6rem",fontSize:"0.85rem"},placeholder:"Custom",value:j,onChange:F=>{h(F.target.value);const Q=parseInt(F.target.value,10);if(Q>0){const q=p==="days"?Q*86400:Q*3600;y(Math.min(q,x))}}}),a.jsxs("select",{className:"form-input",style:{padding:"0.45rem 0.5rem",fontSize:"0.85rem"},value:p,onChange:F=>{g(F.target.value);const Q=parseInt(j,10);if(Q>0){const q=F.target.value==="days"?Q*86400:Q*3600;y(Math.min(q,x))}},children:[a.jsx("option",{value:"hours",children:"hours"}),a.jsx("option",{value:"days",children:"days"})]})]}),xe&&a.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--danger)"},children:["Maximum: ",x>=86400?`${Math.floor(x/86400)} days`:`${Math.floor(x/3600)} hours`]})]}),a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"Title"}),a.jsxs("div",{style:{marginBottom:"1.25rem"},children:[a.jsx("input",{type:"text",className:"form-input",placeholder:`e.g. ${Ee(o.profileId)}: daily operations`,value:S,onChange:F=>E(F.target.value),maxLength:80,style:{fontSize:"0.9rem"}}),a.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"A short name to identify this authorization on your dashboard."})]}),a.jsx("div",{style:{marginBottom:"1.25rem"},children:a.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"0.5rem",cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:P,onChange:F=>k(F.target.checked),style:{marginTop:"0.15rem"}}),a.jsxs("span",{style:{fontSize:"0.8rem"},children:["Show my verified name on actions under this authority",a.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.15rem"},children:'Adds "verified by Suveren" with your name to outgoing content. Takes effect only if your identity is verified; otherwise actions stay pseudonymous.'})]})]})}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-ghost",onClick:()=>e("/agent/gate"),children:"Back"}),a.jsx("button",{className:"btn btn-primary btn-lg",style:{flex:1},onClick:V,disabled:N||!S.trim(),children:N?"Signing...":m==="immediate"?"Authorize":"Authorize (Review Mode)"})]}),a.jsx("div",{style:{marginTop:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)",textAlign:"center",display:Y?"block":"none"},children:I})]})]})}const qv={card:"💳",mail:"✉️"};function Zv({manifest:e,integration:t,state:n,onStatusChange:r,onSuccess:o}){var je;const[s,i]=d.useState({}),[l,c]=d.useState(!1),[u,m]=d.useState(!1),[f,v]=d.useState({}),[y,x]=d.useState(!1),[w,j]=d.useState(null),[h,p]=d.useState(!1),[g,S]=d.useState(!1),[E,P]=d.useState(!1),[k,N]=d.useState(!1),[C,T]=d.useState({});d.useEffect(()=>{let b=!1;return O.getCredential(e.id).then(U=>{var A;if(!(b||!U.configured)){if(c(!0),m(!0),U.fields){const I={};for(const Y of e.credentials.fields)U.fields[Y.key]!=null&&(I[Y.key]=U.fields[Y.key]);v(I)}if(e.oauth){const I=((A=U.fieldNames)==null?void 0:A.includes(e.oauth.tokenStorage))??!1;x(I),I&&O.getOAuthHealth(e.id).then(Y=>{b||j(Y)})}}}).catch(()=>{}),()=>{b=!0}},[e.id,e.oauth]);const H=!!e.oauth||e.credentials.fields.some(b=>!b.optional),W=e.oauth?y:l,B=!H||W,_=n==="starting"?"starting":B?t!=null&&t.running?"running":!l&&e.credentials.fields.length>0?"unconfigured":"ready":e.oauth&&l&&!y?"needs-oauth":"unconfigured",D=async()=>{if(e.credentials.fields.some(U=>{var A;return(A=s[U.key])==null?void 0:A.trim()})){p(!0);try{await O.setCredential(e.id,s),c(!0),i({}),e.oauth?o(`${e.name} credentials saved!`):(o(`${e.name} credentials saved — starting integration...`),await z())}catch{o(`Failed to save ${e.name} credentials`)}finally{p(!1)}}},X=async()=>{if(e.credentials.fields.some(U=>{var A;return(A=s[U.key])==null?void 0:A.trim()})){p(!0);try{await O.setCredential(e.id,s),i({}),c(!0),e.oauth?o(`${e.name} credentials saved — now click Connect.`):(N(!1),o(`${e.name} credentials updated — restarting...`),await z())}catch{o(`Failed to update ${e.name} credentials`)}finally{p(!1)}}},se=()=>{window.open(`/auth/oauth/${e.id}/start`,"_blank","width=600,height=700");const b=setInterval(async()=>{var U;try{const A=await O.getCredential(e.id);A.configured&&e.oauth&&((U=A.fieldNames)!=null&&U.includes(e.oauth.tokenStorage))&&(x(!0),N(!1),j(null),clearInterval(b),o(`${e.name} connected — starting integration...`),O.getOAuthHealth(e.id).then(j).catch(()=>{}),await z())}catch{}},2e3);setTimeout(()=>clearInterval(b),12e4)},z=async()=>{P(!0);try{const b=await O.activateIntegration(e.id);b.warning?o(b.warning):o(`${e.name} integration started with ${b.tools.length} tools`),r()}catch(b){o(`Failed to start ${e.name}: ${b instanceof Error?b.message:"Unknown error"}`)}finally{P(!1)}},R=async()=>{try{await O.removeMcpIntegration(e.id),o(`${e.name} integration removed`),r()}catch{o(`Failed to remove ${e.name}`)}},$=qv[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"},V=e.oauth&&y&&(w==null?void 0:w.status)==="failed",ee=H?V?{c:"int-chip-bad",t:"Auth failed"}:W?{c:"int-chip-ok",t:"Auth OK"}:{c:"int-chip-idle",t:"Not set up"}:{c:"int-chip-idle",t:"No auth"},J=b=>b.replace(/https?:\/\/[^\s)]+\/auth\/oauth\/[a-z-]+\/callback/gi,`${window.location.origin}/auth/oauth/${e.id}/callback`);return a.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem"},children:[a.jsx("span",{style:{fontSize:"1.4rem",lineHeight:1.2},children:$}),a.jsx("h3",{className:"card-title",style:{margin:0,flex:1,alignSelf:"center"},children:e.name}),a.jsxs("div",{style:{display:"flex",gap:"0.4rem",flexWrap:"wrap",justifyContent:"flex-end"},children:[_!=="unconfigured"&&_!=="needs-oauth"&&a.jsxs("span",{className:`int-chip ${L.c}`,children:[a.jsx("span",{className:"int-dot"}),L.t]}),a.jsxs("span",{className:`int-chip ${ee.c}`,children:[a.jsx("span",{className:"int-dot"}),ee.t]})]})]}),e.oauth&&y&&a.jsx("div",{className:"int-account",style:{marginTop:"0.7rem"},children:w!=null&&w.account?a.jsxs(a.Fragment,{children:["Connected as ",a.jsx("b",{children:w.account})]}):a.jsx("span",{className:"int-none",children:"Account not recorded — reconnect to capture which account is used"})}),V&&!k&&a.jsxs("div",{style:{marginTop:"0.7rem"},children:[a.jsxs("div",{className:"status-banner status-banner-error",style:{marginBottom:"0.6rem"},children:[a.jsx("span",{className:"status-banner-icon",children:"!"}),a.jsxs("span",{className:"status-banner-text",children:["Authentication failed",w!=null&&w.error?` — ${w.error}`:"",". Reconnect to restore access."]})]}),a.jsxs("button",{className:"btn btn-primary btn-sm",onClick:se,children:["Reconnect ",e.name]})]}),a.jsxs("details",{className:"int-details",style:{marginTop:"0.85rem",marginBottom:"1.25rem"},children:[a.jsx("summary",{children:"Details"}),a.jsxs("div",{className:"int-meta",children:[a.jsx("span",{className:"int-k",children:"What"}),a.jsx("span",{children:e.description}),e.profile&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"int-k",children:"Profile"}),a.jsx("span",{children:e.profile})]}),e.oauth&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"int-k",children:"Scopes"}),a.jsx("span",{children:((je=e.oauth.scopes)==null?void 0:je.join(", "))||"—"})]}),t&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"int-k",children:"Tools"}),a.jsxs("span",{children:[t.toolCount," gated"]})]})]})]}),e.setupGuide&&e.setupGuide.length>0&&(_!=="running"||V)&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.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:[a.jsx("span",{style:{transition:"transform 0.2s",transform:g?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"}),"How to set up ",e.name]}),g&&a.jsx("div",{style:{marginTop:"0.75rem",paddingLeft:"0.25rem"},children:e.setupGuide.map((b,U)=>a.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"0.75rem"},children:[a.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:U+1}),a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.125rem"},children:b.title}),a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",lineHeight:1.5},children:[J(b.description),b.link&&a.jsxs(a.Fragment,{children:[" ",a.jsxs("a",{href:b.link,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"0.8rem"},children:["Open ","↗"]})]})]})]})]},U))})]}),_==="starting"&&a.jsxs("div",{className:"service-status",style:{color:"var(--warning)"},children:[a.jsx("span",{className:"service-status-dot",style:{background:"var(--warning)"}}),"Starting…"]}),k&&a.jsxs("div",{style:{marginTop:"0.7rem",paddingTop:"0.85rem",borderTop:"1px solid var(--border)"},children:[a.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,marginBottom:"0.5rem"},children:"Change credentials"}),u&&a.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(b=>a.jsxs("div",{className:"form-group",style:{marginBottom:"0.6rem"},children:[a.jsx("label",{className:"form-label",children:b.label}),b.type==="password"?a.jsxs("div",{className:"cred-field",children:[a.jsx("input",{className:"form-input",type:C[b.key]?"text":"password",placeholder:b.placeholder,value:s[b.key]||"",onChange:U=>i(A=>({...A,[b.key]:U.target.value}))}),a.jsx("button",{className:"cred-toggle",onClick:()=>T(U=>({...U,[b.key]:!U[b.key]})),children:C[b.key]?"hide":"show"})]}):a.jsx("input",{className:"form-input",type:"text",placeholder:b.placeholder,value:s[b.key]||"",onChange:U=>i(A=>({...A,[b.key]:U.target.value}))})]},b.key)),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginTop:"0.25rem"},children:[a.jsx("button",{className:"btn btn-primary btn-sm",onClick:X,disabled:h,children:h?"Saving…":"Save"}),e.oauth&&a.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:se,children:["Connect ",e.name]}),a.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>{N(!1),i({})},children:"Cancel"})]})]}),!k&&_==="running"&&t&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[a.jsx(Je,{to:"/agent/new",className:"btn btn-primary btn-sm",style:{textDecoration:"none"},children:"Authorize agent"}),(e.credentials.fields.length>0||e.oauth)&&a.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>{i({...f}),N(!0)},title:"Re-enter client ID / secret (e.g. a new OAuth client).",children:"Change credentials"}),a.jsx("span",{style:{flex:1}}),a.jsx("button",{className:"btn btn-sm btn-ghost",style:{color:"var(--danger)"},onClick:R,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"})]}),a.jsx("div",{style:{display:"none"},children:a.jsx(Je,{to:"/agent/new",className:"btn btn-ghost btn-sm",style:{textDecoration:"none",display:"block",textAlign:"center"},children:"Authorize your agent"})})]}),_==="unconfigured"&&(()=>{const b=e.credentials.fields.every(I=>I.optional),U=e.credentials.fields.some(I=>!I.optional),A=e.credentials.fields.some(I=>{var Y;return(Y=s[I.key])==null?void 0:Y.trim()});return a.jsxs(a.Fragment,{children:[u&&a.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:[a.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"," ",a.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&&a.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&&a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:e.setupHint}),e.credentials.fields.map(I=>a.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[a.jsx("label",{className:"form-label",children:I.label}),I.type==="password"?a.jsxs("div",{className:"cred-field",children:[a.jsx("input",{className:"form-input",type:C[I.key]?"text":"password",placeholder:I.placeholder,value:s[I.key]||"",onChange:Y=>i(xe=>({...xe,[I.key]:Y.target.value}))}),a.jsx("button",{className:"cred-toggle",onClick:()=>T(Y=>({...Y,[I.key]:!Y[I.key]})),children:C[I.key]?"hide":"show"})]}):a.jsx("input",{className:"form-input",type:"text",placeholder:I.placeholder,value:s[I.key]||"",onChange:Y=>i(xe=>({...xe,[I.key]:Y.target.value}))})]},I.key)),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[A&&a.jsx("button",{className:"btn btn-primary",onClick:D,disabled:h||U&&!e.credentials.fields.filter(I=>!I.optional).every(I=>{var Y;return(Y=s[I.key])==null?void 0:Y.trim()}),children:h?"Saving...":"Save & Encrypt"}),b&&!A&&a.jsx("button",{className:"btn btn-primary",onClick:z,disabled:E,children:E?"Starting...":`Activate ${e.name}`})]})]})})(),_==="needs-oauth"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.25rem"},children:["✓"," Step 1 done — credentials saved"]}),a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["Step 2: connect your ",e.name," account to authorize access."]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[a.jsxs("button",{className:"btn btn-primary",onClick:se,children:["Connect ",e.name," Account"]}),a.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Change Credentials"})]})]}),_==="ready"&&!t&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.75rem"},children:["✓"," ",e.oauth?`${e.name} account connected`:"Credentials configured"]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[a.jsx("button",{className:"btn btn-primary",onClick:z,disabled:E,children:E?"Starting...":`Start ${e.name} Integration`}),!e.oauth&&a.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Update Credentials"}),e.oauth&&a.jsx("button",{className:"btn btn-ghost",onClick:()=>{c(!1),x(!1)},children:"Change Credentials"})]})]}),_==="ready"&&t&&!t.running&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"service-status service-status-error",style:{marginBottom:"0.75rem"},children:[a.jsx("span",{className:"service-status-dot"}),"Not running"]}),t.error&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--danger)",marginBottom:"0.75rem"},children:t.error}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-primary",onClick:z,disabled:E,children:E?"Starting...":"Start"}),a.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:R,children:"Disable"})]})]})]})}function ey(){const{loading:e,mcpServerUp:t,manifestsError:n,entries:r,refresh:o}=wl(),[s,i]=d.useState(""),l=d.useCallback(c=>{i(c),setTimeout(()=>i(""),5e3)},[]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"Integrations"}),a.jsx("p",{className:"page-subtitle",children:"Connect external services and manage MCP integrations."})]}),s&&a.jsx("div",{className:"alert alert-success",children:s}),e?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading integrations..."}):t===!1?a.jsxs("div",{className:"status-banner status-banner-error",children:[a.jsx("span",{className:"status-banner-icon",children:"!"}),a.jsx("span",{className:"status-banner-text",children:"MCP server is not reachable. Make sure it is running."})]}):a.jsxs(a.Fragment,{children:[r.map(c=>a.jsx(Zv,{manifest:c.manifest,integration:c.integration,state:c.state,onStatusChange:o,onSuccess:l},c.id)),r.length===0&&(n?a.jsxs("div",{className:"status-banner status-banner-error",children:[a.jsx("span",{className:"status-banner-icon",children:"!"}),a.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"," ",a.jsx("code",{children:"SUVEREN_MCP_INTERNAL_URL"})," (dev MCP is :3431), then refresh."]})]}):a.jsx("p",{style:{color:"var(--text-tertiary)",textAlign:"center",marginTop:"2rem"},children:"No integrations available yet."}))]})]})}function ty(){var H,W,B;const{activeTeam:e,activeMembership:t,refreshGroups:n,user:r}=ze(),[o,s]=d.useState(null),[i,l]=d.useState(!1),[c,u]=d.useState(""),[m,f]=d.useState(""),[v,y]=d.useState(!1),[x,w]=d.useState(""),[j,h]=d.useState("");d.useEffect(()=>{fetch("/health").then(_=>_.json()).then(_=>{typeof _.spUrl=="string"&&h(_.spUrl)}).catch(()=>{})},[]),d.useEffect(()=>{if(!e){s(null);return}O.getGroupById(e.id).then(_=>{const D=_.group??_,X=_.members??[],se=_.isAdmin??!1,z=X.map(R=>{const $=R.userId||R.id||"",L=R.role||(se&&$===D.createdBy?"admin":"member");return{id:$,name:R.name||$.slice(0,8)||"Member",email:R.email||"",domains:R.domains||[],role:L,isAdmin:L==="admin"||se&&$===D.createdBy}});s({id:D.id,name:D.name,members:z})}).catch(()=>s(null))},[e==null?void 0:e.id]);const p=(o==null?void 0:o.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,P=()=>{w(""),y(!0)},k=()=>{y(!1),w("")},N=async()=>{if(!(!e||!E)){l(!0),u("");try{await O.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)}}},C=e&&j?`${j}/dashboard/groups/${e.id}`:void 0,T=j?`${j}/dashboard/groups`:void 0;return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"page-header",children:a.jsxs("div",{children:[a.jsx("h1",{className:"page-title",children:"Team"}),a.jsx("p",{className:"page-subtitle",children:"Your current team context. Team management lives in your Service Provider dashboard."})]})}),c&&a.jsx("div",{className:"error-message",children:c}),m&&a.jsx("div",{className:"alert alert-success",children:m}),e?a.jsxs("div",{className:"card",style:{marginBottom:"1.5rem"},children:[a.jsxs("div",{className:"card-header",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"card-title",children:e.name}),a.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:[((H=o==null?void 0:o.members)==null?void 0:H.length)??0," ",(((W=o==null?void 0:o.members)==null?void 0:W.length)??0)===1?"member":"members",e.isAdmin&&" · You are admin"]})]}),a.jsx("span",{className:"status-badge status-active",children:"Active"})]}),(B=o==null?void 0:o.members)==null?void 0:B.map(_=>a.jsxs("div",{className:"member-row",children:[a.jsx("div",{className:"member-avatar",children:_.name.split(" ").map(D=>D[0]).join("").slice(0,2).toUpperCase()}),a.jsxs("div",{className:"member-info",children:[a.jsx("div",{className:"member-name",children:_.name}),a.jsx("div",{className:"member-email",children:_.email})]}),a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:_.role})]},_.id)),a.jsxs("div",{style:{marginTop:"1.25rem",paddingTop:"1rem",borderTop:"1px solid var(--border)",display:"flex",alignItems:"center",gap:"0.75rem",flexWrap:"wrap"},children:[C&&a.jsx("a",{className:"btn btn-secondary btn-sm",href:C,target:"_blank",rel:"noopener noreferrer",children:"Manage this team in your Service Provider →"}),a.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:a.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--text-tertiary)"},onClick:P,disabled:i||g,children:"Leave team"})})]})]}):a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem 1.5rem"},children:[a.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem"},children:"You are working solo."}),a.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."}),T&&a.jsx("a",{className:"btn btn-primary btn-sm",href:T,target:"_blank",rel:"noopener noreferrer",children:"Open Service Provider dashboard →"})]}),v&&e&&a.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:a.jsxs("div",{className:"card",onClick:_=>_.stopPropagation(),style:{maxWidth:480,width:"100%",margin:0},children:[a.jsxs("h3",{id:"leave-team-title",className:"card-title",style:{marginBottom:"0.5rem"},children:["Leave ",S,"?"]}),a.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:"Leaving will:"}),a.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[a.jsx("li",{children:"Revoke all authorizations you created in this team's context"}),a.jsx("li",{children:"Reject any pending action proposals you authored"}),a.jsx("li",{children:"Disable your membership — rejoining requires admin reactivation"})]}),a.jsxs("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:["Your ",a.jsx("strong",{children:"personal"})," authorizations are not affected."]}),a.jsxs("div",{className:"form-group",children:[a.jsxs("label",{htmlFor:"leave-confirm-input",style:{fontSize:"0.825rem",display:"block",marginBottom:"0.375rem"},children:["Type ",a.jsx("code",{children:S})," to confirm:"]}),a.jsx("input",{id:"leave-confirm-input",className:"form-input",type:"text",value:x,onChange:_=>w(_.target.value),placeholder:S,disabled:i,autoFocus:!0})]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end",marginTop:"1rem"},children:[a.jsx("button",{className:"btn btn-ghost",onClick:k,disabled:i,children:"Cancel"}),a.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:N,disabled:!E,children:i?"Leaving...":"Leave team"})]})]})})]})}function ny({onDismiss:e}){const t=Wt(),{group:n,groupId:r,domain:o}=ze(),[s,i]=d.useState([]),[l,c]=d.useState([]),[u,m]=d.useState([]),[f,v]=d.useState(!0),[y,x]=d.useState({}),[w,j]=d.useState(null);d.useEffect(()=>{Promise.all([O.listProfiles().catch(()=>[]),O.getIntegrationManifests().then(k=>k.manifests??[]).catch(()=>[]),O.getMcpHealth().then(k=>k.integrations??[]).catch(()=>[])]).then(async([k,N,C])=>{if(i(k),c(N),m(C),r){const T=await Promise.all(k.map(W=>O.getTeamProfileConfig(r,W.id).catch(()=>null))),H={};k.forEach((W,B)=>{const _=T[B];_&&(H[W.id]=_)}),x(H)}}).finally(()=>v(!1))},[r]);const h=new Map,p=new Map;for(const k of l)k.profile&&h.set(k.profile,k);for(const k of u){const N=l.find(C=>C.id===k.id);N!=null&&N.profile&&p.set(N.profile,k)}const g=s.filter(k=>{const N=k.id.replace(/@.*$/,"").split("/").pop()??k.id;return h.has(N)}),S=k=>k in y,E=(k,N)=>{if(!r){console.error("No active group when creating authorization");return}const C=S(k);sessionStorage.setItem("agentAuth",JSON.stringify({profileId:k,groupId:r,groupName:(n==null?void 0:n.name)??null,domain:o,isTeam:C})),N?sessionStorage.setItem("agentGate",JSON.stringify({bounds:N.bounds,context:N.context,gateContent:{intent:N.intent},ttlConfig:{max:N.ttl},templateMode:N.mode,templateTtl:N.ttl})):sessionStorage.removeItem("agentGate"),j(null),e==null||e(),t("/agent/gate")},P=k=>{if(!r)return;const N=k.replace(/@.*$/,"").split("/").pop()??k,C=h.get(N);C!=null&&C.templates&&C.templates.length>0?j({profileId:k,manifest:C}):E(k)};if(w){const k=w.manifest.templates??[];return a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginBottom:"1rem"},onClick:()=>j(null),children:"← Back to profiles"}),a.jsxs("h3",{style:{margin:"0 0 0.25rem 0",fontSize:"1rem"},children:["Set up ",w.manifest.name," authorization"]}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.5rem",marginBottom:"0.75rem",fontWeight:600},children:"Quick start"}),a.jsx("div",{style:{display:"grid",gap:"0.75rem",gridTemplateColumns:`repeat(${Math.min(k.length,3)}, 1fr)`},children:k.map(N=>a.jsxs("button",{className:"template-card",onClick:()=>E(w.profileId,N),children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.375rem"},children:[a.jsx("span",{className:`template-mode template-mode-${N.mode==="automatic"?"auto":"review"}`,children:N.mode==="automatic"?"Auto":"Review"}),a.jsx("span",{className:"template-risk","data-risk":N.risk,children:N.risk})]}),a.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.25rem"},children:N.name}),a.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",lineHeight:1.45,marginBottom:"0.5rem"},children:N.description}),a.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.3rem"},children:N.tags.map(C=>a.jsx("span",{className:"template-tag",children:C},C))})]},N.name))}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1rem",margin:"1.5rem 0"},children:[a.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}}),a.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"or"}),a.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}})]}),a.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 a.jsxs(a.Fragment,{children:[a.jsx("style",{children:`
|
|
65
65
|
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; align-items: stretch; }
|
|
66
66
|
.profile-grid .card { display: flex; flex-direction: column; height: 100%; margin-top: 0 !important; }
|
|
67
67
|
@media (max-width: 900px) { .profile-grid { grid-template-columns: repeat(2, 1fr); } }
|
|
68
68
|
@media (max-width: 560px) { .profile-grid { grid-template-columns: 1fr; } }
|
|
69
|
-
`}),f?a.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem"},children:"Loading..."}):g.length===0?a.jsxs("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:[a.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"0.9rem",marginBottom:"1rem"},children:"No integrations set up yet. Connect a service first."}),a.jsx(Je,{to:"/integrations",className:"btn btn-primary btn-sm",onClick:()=>e==null?void 0:e(),children:"Go to Integrations"})]}):a.jsx("div",{className:"profile-grid",children:g.map(k=>{const N=S(k.id),C=k.id.replace(/@.*$/,"").split("/").pop()??k.id,T=h.get(C),H=m.get(C),W=(H==null?void 0:H.running)===!0;return a.jsxs("div",{className:"card",style:W?void 0:{opacity:.7},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.125rem"},children:[a.jsx("h3",{className:"card-title",style:{margin:0},children:Ee(k.id,k.name)}),N?a.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"}):a.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"})]}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"1rem",flex:1},children:k.description}),W?a.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>P(k.id),children:"Authorize"}):a.jsxs(Je,{to:`/integrations?setup=${(T==null?void 0:T.id)??""}`,className:"btn btn-secondary btn-sm",style:{textDecoration:"none",textAlign:"center"},onClick:()=>e==null?void 0:e(),children:["Set up ",(T==null?void 0:T.name)??"integration"]})]},k.id)})})]})}const ny={active:"Active",pending:"Pending",expired:"Expired",revoked:"Revoked"};function ry({status:e,label:t}){return a.jsx("span",{className:`status-badge status-${e}`,children:t||ny[e]})}function oy({domain:e,attested:t}){const n=t===!0?"domain-attested":t===!1?"domain-missing":"";return a.jsx("span",{className:`domain-badge ${n}`,style:{fontSize:"0.75rem"},children:e})}const yn=86400,Nr=3600,Po=60,ay=30*yn;function sy(e){if(e<=0)return"Expired";if(e>90*yn){const t=Math.floor(e/ay);return`${t} ${t===1?"month":"months"} remaining`}if(e>7*yn){const t=Math.floor(e/yn);return`${t} ${t===1?"day":"days"} remaining`}if(e>=2*yn){const t=Math.floor(e/yn),n=Math.floor(e%yn/Nr);return`${t} ${t===1?"day":"days"} ${n}h remaining`}if(e>=2*Nr){const t=Math.floor(e/Nr),n=Math.floor(e%Nr/Po);return`${t}h ${String(n).padStart(2,"0")}m remaining`}if(e>=Po){const t=Math.floor(e/Po),n=Math.floor(e%Po);return`${t}m ${String(n).padStart(2,"0")}s remaining`}return`${Math.floor(e)}s remaining`}function iy({expiresAt:e}){const[t,n]=d.useState(()=>e-Date.now()/1e3),r=t<2*Nr;d.useEffect(()=>{const s=setInterval(()=>n(e-Date.now()/1e3),r?1e3:6e4);return()=>clearInterval(s)},[e,r]);const o=t<300;return a.jsx("span",{className:`ttl-badge ${o?"ttl-warn":"ttl-ok"}`,children:sy(t)})}function Bf({icon:e,title:t,text:n,children:r}){return a.jsxs("div",{className:"empty-state",children:[e&&a.jsx("div",{className:"empty-state-icon",children:e}),a.jsx("div",{className:"empty-state-title",children:t}),n&&a.jsx("div",{className:"empty-state-text",children:n}),r]})}function ly(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 cy=[{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 uy({item:e,onClose:t,onSuccess:n}){var h;const{user:r,activeDomain:o,groupId:s}=ze(),i=e.remaining_seconds??0,l=cy.filter(m=>m.seconds>i),c=((h=l[0])==null?void 0:h.seconds)??2592e3,[u,p]=d.useState(c),[f,v]=d.useState(!1),[y,x]=d.useState(""),w=Object.entries(e.frame).filter(([m])=>m!=="profile"&&m!=="path"),j=async()=>{var m;if(r){v(!0),x("");try{const g=e.authorization_id,S=await O.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 O.getProfile(e.profile_id),P=e.frame,k=S.context??{},N=e.attested_domains[0]||o||"owner",C=await Ho(P,E),T=await Ff(k,E),[H,W]=await Promise.all([va(S.gateContent.intent),va(JSON.stringify({profile:e.profile_id,path:e.path,domain:N}))]);if(!s)throw new Error("No active group; cannot extend authorization.");const D=(((m=e.deferred_commitment_domains)==null?void 0:m.length)??0)>0?"review":"automatic",_=await O.attest({authorization_id:e.authorization_id,renew:!0,profile_id:e.profile_id,bounds:P,bounds_hash:C,context_hash:T,domain:N,did:r.did,gate_content_hashes:{intent:H},execution_context_hash:W,group_id:s,commitment_mode:D,ttl:u});await O.pushGateContent(Of(_,{boundsHash:C,contextHash:T,context:k,path:e.path,gateContent:S.gateContent})),n()}catch(g){x(g instanceof Error?g.message:"Extension failed")}finally{v(!1)}}};return a.jsx("div",{className:"modal-backdrop",onClick:m=>m.target===m.currentTarget&&t(),children:a.jsxs("div",{className:"modal",children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{className:"modal-title",children:"Extend Authorization"}),a.jsx("button",{className:"modal-close",onClick:t,children:"×"})]}),a.jsxs("div",{className:"modal-body",children:[a.jsxs("div",{style:{marginBottom:"1rem"},children:[a.jsxs("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:[Ee(e.profile_id)," / ",e.path]}),w.length>0&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:w.map(([m,g])=>`${m}=${g}`).join(" · ")})]}),a.jsxs("div",{style:{marginBottom:"1rem"},children:[a.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&&a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["Currently valid for ",ly(i),". Only longer durations are shown."]}),a.jsx("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:l.length===0?a.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(m=>a.jsx("button",{className:`btn ${u===m.seconds?"btn-primary":"btn-secondary"}`,onClick:()=>p(m.seconds),style:{minWidth:"3.5rem"},children:m.label},m.seconds))})]}),a.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&&a.jsx("div",{className:"error-message",children:y})]}),a.jsxs("div",{className:"modal-footer",children:[a.jsx("button",{className:"btn btn-secondary",onClick:t,disabled:f,children:"Cancel"}),a.jsx("button",{className:"btn btn-primary",onClick:j,disabled:f,children:f?"Extending...":"Extend"})]})]})})}function dy(e,t,n){return[...e].sort((r,o)=>{if(n){if(r.authorization_id===n&&o.authorization_id!==n)return-1;if(o.authorization_id===n&&r.authorization_id!==n)return 1}const s=Ct(r,{revokedSet:t}),i=Ct(o,{revokedSet:t}),l={active:0,pending:1,expired:2,revoked:3};return l[s]!==l[i]?l[s]-l[i]:new Date(o.created_at).getTime()-new Date(r.created_at).getTime()})}function fy({item:e,revokedSet:t,expandedHash:n,gateCache:r,gateLoading:o,copiedHash:s,revokingHash:i,copyingHash:l,profileConfigCache:c,mode:u,ownerLabel:p,isAdmin:f,onExpand:v,onCopyHash:y,onCopy:x,onRevoke:w,onExtend:j,highlightHash:h}){var $;const m=Ct(e,{revokedSet:t}),g=n===e.authorization_id,S=r[e.authorization_id],E=m==="active"||m==="pending"||m==="expired",P=Object.entries(e.frame).filter(([L])=>L!=="profile"&&L!=="path"),k=c.get(e.profile_id)??null,N=((($=k==null?void 0:k.approvers)==null?void 0:$.length)??0)>0,C=new Map;if(k!=null&&k.caps&&u==="team")for(const[L,V]of P){const ee=k.caps[L];ee!==void 0&&Number(V)>ee&&C.set(L,{authorized:Number(V),cap:ee})}const T=C.size>0,H=e.approvers_frozen??[],W=(k==null?void 0:k.approvers)??[],D=u==="team"&&H.length>0&&W.length>0&&(H.length!==W.length||H.some(L=>!W.includes(L))||W.some(L=>!H.includes(L))),_=Array.from(C.entries()).map(([L,V])=>`${L}: ${V.authorized} (cap ${V.cap})`).join(", "),B=Array.from(C.entries()).map(([L,V])=>`${L}: ${V.authorized} → ${V.cap}`).join(", "),X=T?N?C.size===1?`Above team cap: ${_} — actions require approval`:`Above team cap (${C.size}): ${_} — actions require approval`:C.size===1?`Reduced by hard cap: ${B}`:`Reduced by hard cap (${C.size}): ${B}`:"",se=T?N?"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,z=Ee(e.profile_id),R=h!=null&&e.authorization_id===h;return a.jsxs("div",{className:`card${R?" card-highlight":""}`,style:{marginBottom:0},children:[p&&a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner: ",a.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:p})]}),a.jsxs("div",{className:"auth-card-header",children:[a.jsx("span",{style:{fontWeight:700,fontSize:"1rem",color:"var(--text-primary)",letterSpacing:"0.01em"},children:z}),e.title&&a.jsx("span",{style:{fontWeight:500,fontSize:"0.85rem",color:"var(--text-secondary)"},children:e.title}),a.jsx(ry,{status:m}),m==="active"&&e.earliest_expiry&&a.jsx(iy,{expiresAt:new Date(e.earliest_expiry).getTime()/1e3}),m==="expired"&&a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:new Date(e.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.5rem",alignItems:"center"},children:[e.required_domains.map(L=>a.jsx(oy,{domain:L,attested:e.attested_domains.includes(L)},L)),e.deferred_commitment_domains.length>0&&a.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"}),T&&a.jsx("span",{title:se,style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:N?"var(--accent-subtle)":"var(--danger-subtle)",color:N?"var(--accent)":"var(--danger)",fontWeight:600,cursor:"help"},children:X}),D&&a.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.authorization_id,title:"The approver list for this profile has changed since this authority was created. Copy to reissue with the current approvers.",children:l===e.authorization_id?"Copying...":"Approver list updated · Copy with new approvers"})]}),P.length>0&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:P.map(([L,V],ee)=>{const J=C.get(L);return a.jsxs("span",{children:[ee>0&&" · ",J?N?a.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:[a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[L,"=",String(V)]}),a.jsxs("span",{style:{color:"var(--accent)",marginLeft:"0.25rem",fontWeight:600},children:["↑ approval at ",J.cap]})]}):a.jsxs("span",{title:`Team cap on ${L} is ${J.cap} with no approvers configured (hard cap). Authorized for ${J.authorized}; effective ${J.cap}.`,children:[a.jsxs("span",{style:{textDecoration:"line-through",color:"var(--text-tertiary)"},children:[L,"=",String(V)]}),a.jsxs("span",{style:{color:"var(--danger)",marginLeft:"0.25rem",fontWeight:600},children:["→"," ",J.cap]})]}):a.jsxs("span",{children:[L,"=",String(V)]})]},L)})}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:a.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>v(e),children:g?"▲ Hide Details":"▼ Details"})}),g&&a.jsxs("div",{style:{borderTop:"1px solid var(--border)",marginTop:"0.75rem",paddingTop:"0.75rem"},children:[P.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Bounds"}),a.jsx("dl",{className:"review-grid",children:P.map(([L,V])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:L}),a.jsx("dd",{children:String(V)})]},L))})]}),(S==null?void 0:S.context)&&Object.keys(S.context).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Context"}),a.jsx("dl",{className:"review-grid",children:Object.entries(S.context).map(([L,V])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:L}),a.jsx("dd",{children:String(V)})]},L))})]}),a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Intent"}),o===e.authorization_id?a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Loading gate content..."}):S?a.jsx("div",{className:"gate-content-block",children:a.jsx("div",{className:"gate-content-item",children:a.jsx("div",{className:"gate-content-text",children:S.gateContent.intent})})}):a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Gate content not available."}),a.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()}`]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginTop:"0.25rem"},children:[a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontFamily:"'SF Mono', Monaco, monospace",wordBreak:"break-all"},children:e.authorization_id}),a.jsx("button",{className:"btn btn-ghost btn-sm",style:{fontSize:"0.7rem",padding:"0.125rem 0.375rem"},onClick:()=>y(e.authorization_id),children:s===e.authorization_id?"copied":"copy"})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.75rem"},children:[!p&&a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>x(e),disabled:l===e.authorization_id,title:"Start a new authorization pre-filled with these bounds, context, and intent",children:l===e.authorization_id?"Copying…":"⧉ Copy"}),!p&&E&&a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>j(e),children:"↻ Extend"}),p&&f&&m!=="revoked"?a.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.authorization_id,p,z),disabled:i===e.authorization_id,children:i===e.authorization_id?"Revoking…":"Revoke"}):!p&&(m==="active"||m==="pending")?a.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.authorization_id),disabled:i===e.authorization_id,children:i===e.authorization_id?"Revoking…":"Revoke"}):null]})]})]},e.authorization_id)}function my(){const[e,t]=d.useState([]),[n,r]=d.useState(!0),[o,s]=d.useState([]),[i,l]=d.useState(!1),[c,u]=d.useState("mine"),[p,f]=d.useState("active"),[v,y]=d.useState(null),[x,w]=d.useState(null),[j,h]=zf(),[m,g]=d.useState(()=>j.get("new")==="1"),[S,E]=d.useState(()=>j.get("highlight")),[P,k]=d.useState(null),[N,C]=d.useState({}),[T,H]=d.useState(null),[W,D]=d.useState(null),[_,B]=d.useState(null),[X,se]=d.useState(new Set),[z,R]=d.useState(null),[$,L]=d.useState(null),V=Wt(),{group:ee,groupId:J,domain:je,mode:b,activeTeam:U}=ze(),A=(U==null?void 0:U.isAdmin)===!0,[I,Y]=d.useState(()=>new Map),xe=d.useCallback(()=>{r(!0),O.getMyAttestations().then(t).catch(()=>{}).finally(()=>r(!1))},[]),Pe=d.useCallback(()=>{J&&(l(!0),O.listTeamAuthorizations(J).then(s).catch(()=>{}).finally(()=>l(!1)))},[J]);fe("attestation-changed",()=>{xe(),A&&J&&Pe()}),d.useEffect(()=>{if(!S)return;j.get("highlight")&&(j.delete("highlight"),h(j,{replace:!0}));const G=window.setTimeout(()=>E(null),3e3);return()=>window.clearTimeout(G)},[]),$t(xe,3e5),d.useEffect(()=>{c==="team"&&A&&J&&o.length===0&&!i&&Pe()},[c,A,J,o.length,i,Pe]),d.useEffect(()=>{if(b!=="team"||!J)return;const G=c==="mine"?e:o;if(G.length===0)return;const F=[...new Set(G.map(Q=>Q.profile_id))].filter(Q=>!I.has(Q));if(F.length!==0){Y(Q=>{const q=new Map(Q);for(const oe of F)q.set(oe,null);return q});for(const Q of F)O.getTeamProfileConfig(J,Q).then(q=>{Y(oe=>new Map(oe).set(Q,q))}).catch(()=>{})}},[e,o,c,J,b,I]);const ke=async G=>{if(P===G.authorization_id){k(null);return}k(G.authorization_id);const F=G.authorization_id;if(!(F in N)){H(G.authorization_id);try{const Q=await O.getGateContent(F);C(q=>({...q,[F]:Q}))}catch{C(Q=>({...Q,[F]:null}))}finally{H(null)}}},mn=G=>{navigator.clipboard.writeText(G).then(()=>{B(G),setTimeout(()=>B(null),2e3)})},Rn=async G=>{var F;if(!J){alert("No active group; cannot copy authorization.");return}L(G.authorization_id);try{const Q=G.authorization_id;let q=N[Q]??null;Q in N||(q=await O.getGateContent(Q),C(_e=>({..._e,[Q]:q})));const oe=Object.fromEntries(Object.entries(G.frame).filter(([_e])=>_e!=="profile"&&_e!=="path")),pn=(q==null?void 0:q.context)??{},Ye=((F=q==null?void 0:q.gateContent)==null?void 0:F.intent)??"",mt=G.deferred_commitment_domains.length>0?"review":"automatic",Tt=G.attested_domains[0]||je||"owner";sessionStorage.setItem("agentAuth",JSON.stringify({profileId:G.profile_id,groupId:J,groupName:(ee==null?void 0:ee.name)??null,domain:Tt})),sessionStorage.setItem("agentGate",JSON.stringify({bounds:oe,context:pn,gateContent:{intent:Ye},templateMode:mt})),V("/agent/gate")}catch(Q){alert(Q instanceof Error?Q.message:"Failed to copy authorization")}finally{L(null)}},Pt=async(G,F,Q)=>{const q=F&&Q?`Revoke ${F}'s ${Q} authorization? This cannot be undone.`:"Revoke this authorization? The agent will no longer be able to execute actions under this attestation.";if(confirm(q)){R(G);try{await O.revokeAttestation(G),se(oe=>new Set(oe).add(G)),F&&J&&Pe()}catch(oe){alert(oe instanceof Error?oe.message:"Failed to revoke authorization")}finally{R(null)}}},Ue=c==="mine"?e:o,dr=c==="mine"?n:i,Ht={active:Ue.filter(G=>Ct(G,{revokedSet:X})==="active").length,pending:Ue.filter(G=>Ct(G,{revokedSet:X})==="pending").length,expired:Ue.filter(G=>Ct(G,{revokedSet:X})==="expired").length,revoked:Ue.filter(G=>Ct(G,{revokedSet:X})==="revoked").length},ne=(()=>{const G=new Map;for(const F of Ue){if(Ct(F,{revokedSet:X})!==p)continue;const Q=G.get(F.profile_id)??{count:0,review:!1};Q.count+=1,F.deferred_commitment_domains.length>0&&(Q.review=!0),G.set(F.profile_id,Q)}return Array.from(G.entries()).map(([F,Q])=>({profileId:F,...Q})).sort((F,Q)=>Ee(F.profileId).localeCompare(Ee(Q.profileId)))})(),ft=dy(Ue.filter(G=>{if(Ct(G,{revokedSet:X})!==p||v!==null&&G.profile_id!==v)return!1;if(x!==null){const F=G.deferred_commitment_domains.length>0;if(x==="review"&&!F||x==="auto"&&F)return!1}return!0}),X,S),lo={revokedSet:X,expandedHash:P,gateCache:N,gateLoading:T,copiedHash:_,revokingHash:z,copyingHash:$,profileConfigCache:I,mode:b,activeDomain:je,group:ee,groupId:J,onExpand:ke,onCopyHash:mn,onCopy:Rn,onRevoke:Pt,onExtend:D,highlightHash:S};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"1rem",flexWrap:"wrap"},children:[a.jsxs("div",{children:[a.jsx("h1",{className:"page-title",children:"Authorizations"}),a.jsx("p",{className:"page-subtitle",children:"Active, pending, and expired agent authorizations."})]}),a.jsx("button",{className:"btn btn-primary",onClick:()=>g(!0),children:"+ New authorization"})]}),m&&a.jsx("div",{className:"modal-backdrop",onClick:()=>{g(!1),j.get("new")&&(j.delete("new"),h(j,{replace:!0}))},children:a.jsxs("div",{className:"modal",onClick:G=>G.stopPropagation(),style:{maxWidth:"960px",width:"90vw"},children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h2",{className:"modal-title",children:"New authorization"}),a.jsx("button",{className:"modal-close",onClick:()=>{g(!1),j.get("new")&&(j.delete("new"),h(j,{replace:!0}))},children:"×"})]}),a.jsxs("div",{className:"modal-body",children:[a.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."}),a.jsx(ty,{onDismiss:()=>g(!1)})]})]})}),A&&a.jsxs("div",{className:"nav-tabs",style:{marginBottom:"0.5rem"},children:[a.jsx("button",{className:`nav-tab${c==="mine"?" active":""}`,onClick:()=>{u("mine"),f("active"),y(null),w(null),k(null)},children:"Mine"}),a.jsx("button",{className:`nav-tab${c==="team"?" active":""}`,onClick:()=>{u("team"),f("active"),y(null),w(null),k(null)},children:"Team"})]}),a.jsx("div",{className:"nav-tabs",children:["active","pending","expired","revoked"].map(G=>a.jsxs("button",{className:`nav-tab${p===G?" active":""}`,onClick:()=>{f(G),y(null),w(null)},children:[G.charAt(0).toUpperCase()+G.slice(1)," (",Ht[G],")"]},G))}),ne.length>0&&a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"center",marginTop:"-0.25rem",marginBottom:"1rem"},children:[ne.map(G=>{const F=v===G.profileId;return a.jsx("button",{className:`btn btn-sm ${F?"btn-primary":"btn-secondary"}`,onClick:()=>y(F?null:G.profileId),children:Ee(G.profileId)},G.profileId)}),a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border)",fontSize:"1.1rem",padding:"0 0.25rem",userSelect:"none"},children:"|"}),["auto","review"].map(G=>{const F=x===G;return a.jsx("button",{className:`btn btn-sm ${F?"btn-primary":"btn-secondary"}`,onClick:()=>w(F?null:G),children:G==="auto"?"Auto":"Review"},G)})]}),dr&&Ue.length===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):ft.length===0?a.jsx(Bf,{icon:"☰",title:"No authorizations",text:`No ${p} authorizations found.`}):a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:ft.map(G=>{const F=c==="team"?G:null,Q=F!=null&&F.owner?F.owner.name??F.owner.email??F.owner.userId:void 0;return a.jsx(fy,{item:G,ownerLabel:Q,isAdmin:A,...lo},G.authorization_id)})}),W&&a.jsx(uy,{item:W,onClose:()=>D(null),onSuccess:()=>{D(null),xe()}})]})}function Df({profileId:e}){return a.jsx("span",{className:"profile-badge",children:Ee(e)})}function py(e){return new Date(e*1e3).toLocaleString()}function hy(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 gy(e,t){if(!t)return!0;const n=t.toLowerCase();return e.profileId.toLowerCase().includes(n)||Ee(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 Vc(e,t){const n=new Map(e.map(r=>[r.id,r]));for(const r of t)n.set(r.id,r);return[...n.values()].sort((r,o)=>o.timestamp-r.timestamp)}function vy(){const{activeTeam:e,groupId:t}=ze(),n=(e==null?void 0:e.isAdmin)===!0,[r,o]=d.useState("mine"),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,p]=d.useState({}),[f,v]=d.useState(new Set),[y,x]=d.useState(""),[w,j]=d.useState(new Set),[h,m]=d.useState(new Set),[g,S]=d.useState("all"),[E,P]=d.useState(!1),[k,N]=d.useState(null),[C,T]=d.useState(!1),[H,W]=d.useState(!1),D=d.useRef(""),_=d.useCallback(b=>r==="team"&&n&&t?O.listTeamReceiptsPage(t,{before:b,limit:200}):O.getMyReceiptsPage({before:b,limit:200}),[r,n,t]),B=d.useCallback(()=>{const b=r==="team"?`team:${t}`:"mine",U=D.current!==b;D.current=b,c(!0),W(!1),_().then(A=>{i(I=>U?A.receipts:Vc(I,A.receipts)),N(I=>U?A.nextBefore:I??A.nextBefore)}).catch(()=>{U&&i([]),W(!0)}).finally(()=>c(!1))},[_,r,t]),X=d.useCallback(()=>{!k||C||(T(!0),W(!1),_(k).then(b=>{i(U=>Vc(U,b.receipts)),N(b.nextBefore)}).catch(()=>W(!0)).finally(()=>T(!1)))},[k,C,_]);$t(B,12e4),d.useEffect(()=>{r!=="team"||Object.keys(u).length>0||O.listUsers().then(b=>{const U={};for(const A of b)U[A.id]={name:A.name,email:A.email};p(U)}).catch(()=>{})},[r,u]);const se=d.useMemo(()=>{const b=new Set;for(const U of s)b.add(Ee(U.profileId));return[...b].sort()},[s]),z=d.useMemo(()=>{const b=new Set;for(const U of s)b.add(U.action);return[...b].sort()},[s]),R=d.useMemo(()=>{if(r!=="team")return[];const b=new Set;for(const U of s)U.userId&&b.add(U.userId);return[...b].map(U=>{var A;return{id:U,label:(A=u[U])!=null&&A.name?`${u[U].name} (${u[U].email})`:U}}).sort((U,A)=>U.label.localeCompare(A.label))},[r,s,u]),$=d.useMemo(()=>s.filter(b=>!(!gy(b,y)||w.size>0&&!w.has(Ee(b.profileId))||h.size>0&&!h.has(b.action)||f.size>0&&b.userId&&!f.has(b.userId)||!hy(b,g))),[s,y,w,h,f,g]),L=w.size>0||h.size>0||f.size>0||g!=="all";function V(b){j(U=>{const A=new Set(U);return A.has(b)?A.delete(b):A.add(b),A})}function ee(b){m(U=>{const A=new Set(U);return A.has(b)?A.delete(b):A.add(b),A})}function J(b){v(U=>{const A=new Set(U);return A.has(b)?A.delete(b):A.add(b),A})}function je(){j(new Set),m(new Set),v(new Set),S("all"),x("")}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"Receipts"}),a.jsx("p",{className:"page-subtitle",children:"Execution history for agent actions."})]}),n&&a.jsx("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem",borderBottom:"1px solid var(--border)"},children:["mine","team"].map(b=>a.jsx("button",{onClick:()=>o(b),className:"btn btn-ghost",style:{borderRadius:0,padding:"0.5rem 0.875rem",borderBottom:r===b?"2px solid var(--accent)":"2px solid transparent",color:r===b?"var(--text-primary)":"var(--text-tertiary)",fontWeight:r===b?600:500},children:b==="mine"?"Mine":"Team"},b))}),a.jsxs("div",{className:"search-filter-bar",children:[a.jsxs("div",{className:"search-input-wrap",children:[a.jsx("span",{className:"search-icon",children:"⌕"}),a.jsx("input",{type:"text",className:"form-input search-input",placeholder:"Search by profile, action, path, or hash\\u2026",value:y,onChange:b=>x(b.target.value)}),y&&a.jsx("button",{className:"search-clear",onClick:()=>x(""),children:"×"})]}),a.jsxs("button",{className:`btn btn-sm btn-secondary${E?" active":""}`,onClick:()=>P(!E),children:["Filters",L?` (${w.size+h.size+(g!=="all"?1:0)})`:""]})]}),E&&a.jsxs("div",{className:"filter-panel",children:[se.length>1&&a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Profile"}),a.jsx("div",{className:"filter-chips",children:se.map(b=>a.jsx("button",{className:`filter-chip${w.has(b)?" selected":""}`,onClick:()=>V(b),children:b},b))})]}),z.length>1&&a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Action"}),a.jsx("div",{className:"filter-chips",children:z.map(b=>a.jsx("button",{className:`filter-chip${h.has(b)?" selected":""}`,onClick:()=>ee(b),children:b},b))})]}),r==="team"&&R.length>1&&a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Owner"}),a.jsx("div",{className:"filter-chips",children:R.map(b=>a.jsx("button",{className:`filter-chip${f.has(b.id)?" selected":""}`,onClick:()=>J(b.id),children:b.label},b.id))})]}),a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Time range"}),a.jsx("div",{className:"filter-chips",children:[["1d","Today"],["7d","7 days"],["30d","30 days"],["all","All time"]].map(([b,U])=>a.jsx("button",{className:`filter-chip${g===b?" selected":""}`,onClick:()=>S(b),children:U},b))})]})]}),L&&a.jsxs("div",{className:"active-filters",children:[[...w].map(b=>a.jsxs("span",{className:"active-chip",onClick:()=>V(b),children:[b," ",a.jsx("span",{className:"chip-remove",children:"×"})]},b)),[...h].map(b=>a.jsxs("span",{className:"active-chip",onClick:()=>ee(b),children:[b," ",a.jsx("span",{className:"chip-remove",children:"×"})]},b)),[...f].map(b=>{const U=u[b],A=U?U.name:b;return a.jsxs("span",{className:"active-chip",onClick:()=>J(b),children:[A," ",a.jsx("span",{className:"chip-remove",children:"×"})]},b)}),g!=="all"&&a.jsxs("span",{className:"active-chip",onClick:()=>S("all"),children:[g==="1d"?"Today":g==="7d"?"7 days":"30 days"," ",a.jsx("span",{className:"chip-remove",children:"×"})]}),a.jsx("button",{className:"clear-filters",onClick:je,children:"Clear all"})]}),H&&a.jsx("div",{className:"card",style:{borderColor:"var(--danger, #c0392b)",marginBottom:"0.75rem"},children:a.jsx("span",{style:{color:"var(--danger, #c0392b)",fontSize:"0.85rem"},children:"Couldn’t load receipts — your session may have expired. Try signing out and back in."})}),l&&s.length===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):$.length===0?a.jsx(Bf,{icon:"⌕",title:s.length===0?"No receipts in the last 30 days":"No matching receipts",text:s.length===0?"Execution receipts appear here after an agent uses an authorized tool. Older receipts can be loaded below.":"Try adjusting your search or filters."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:$.length===s.length?`${s.length} receipt${s.length!==1?"s":""}`:`${$.length} of ${s.length} receipts`}),a.jsx("div",{className:"timeline",children:$.map(b=>{var U;return a.jsx("div",{className:"timeline-event",children:a.jsxs("div",{className:"card",style:{marginBottom:0},children:[a.jsxs("div",{className:"auth-card-header",children:[a.jsx(Df,{profileId:b.profileId}),a.jsx("span",{className:"auth-card-path",children:b.path}),a.jsx("span",{className:"receipt-action",children:b.action}),a.jsx("span",{className:"auth-card-time",children:py(b.timestamp)})]}),r==="team"&&b.userId&&a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner:"," ",a.jsx("span",{style:{color:"var(--text-secondary)"},children:(U=u[b.userId])!=null&&U.name?`${u[b.userId].name} (${u[b.userId].email})`:b.userId})]}),Object.keys(b.executionContext).length>0&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:Object.entries(b.executionContext).map(([A,I])=>`${A}=${I}`).join(" · ")}),a.jsxs("div",{style:{display:"flex",gap:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:["Daily: ",b.cumulativeState.daily.count," calls, $",b.cumulativeState.daily.amount]}),a.jsxs("span",{children:["Monthly: ",b.cumulativeState.monthly.count," calls, $",b.cumulativeState.monthly.amount]})]}),a.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontFamily:"'SF Mono', Monaco, monospace",wordBreak:"break-all",marginTop:"0.375rem"},children:b.attestationHash})]})},b.id)})})]}),k&&a.jsx("div",{style:{textAlign:"center",marginTop:"1rem"},children:a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:X,disabled:C,children:C?"Loading…":"Load older"})})]})}const Kc={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 yy(){const[e,t]=d.useState(""),[n,r]=d.useState("openrouter"),[o,s]=d.useState("openai-compatible"),[i,l]=d.useState("https://openrouter.ai/api/v1"),[c,u]=d.useState("google/gemma-4-31b-it"),[p,f]=d.useState(""),[v,y]=d.useState(!1),[x,w]=d.useState(!1),[j,h]=d.useState(!1),[m,g]=d.useState(null),S=d.useCallback(C=>{t(C),setTimeout(()=>t(""),3e3)},[]),E=d.useCallback(async()=>{try{const C=await O.getCredential("ai-config");if(y(C.configured),C.configured&&C.fields){C.fields.provider&&s(C.fields.provider),C.fields.endpoint&&l(C.fields.endpoint),C.fields.model&&u(C.fields.model);const T=C.fields.endpoint??"";T.includes("openai.com")?r("openai"):T.includes("groq.com")?r("groq"):T.includes("together.xyz")?r("together"):T.includes("openrouter.ai")?r("openrouter"):r("ollama")}}catch{}},[]);d.useEffect(()=>{E()},[E]);const P=C=>{r(C);const T=Kc[C];T&&(s(T.provider),l(T.endpoint),u(T.models[0]))},k=async()=>{w(!0);try{await O.setCredential("ai-config",{provider:o,endpoint:i,model:c,...p?{apiKey:p}:{}}),y(!0),S("AI configuration saved!")}catch{S("Failed to save AI config")}finally{w(!1)}},N=async()=>{h(!0),g(null);try{const C=await O.aiTest(p?{provider:o,endpoint:i,model:c,apiKey:p}:{});g(C.ok?`OK: ${C.message}`:`Failed: ${C.message}`)}catch(C){g(`Error: ${C instanceof Error?C.message:"Unknown"}`)}finally{h(!1)}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"AI Assistant"}),a.jsx("p",{className:"page-subtitle",children:"Advisory AI to help you think through intent when authorizing agents."})]}),e&&a.jsx("div",{className:"alert alert-success",children:e}),a.jsxs("div",{className:"card",children:[a.jsx("h3",{className:"card-title",children:"Configuration"}),a.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&&a.jsxs("div",{className:"status-banner status-banner-success",style:{marginBottom:"1rem",fontSize:"0.8rem"},children:[a.jsx("span",{className:"status-banner-icon",children:"✓"}),a.jsx("span",{className:"status-banner-text",children:"AI configured"})]}),a.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[a.jsx("label",{className:"form-label",children:"Provider Preset"}),a.jsxs("select",{className:"form-input",value:n,onChange:C=>P(C.target.value),children:[a.jsx("option",{value:"openrouter",children:"OpenRouter (recommended)"}),a.jsx("option",{value:"ollama",children:"Ollama (local)"}),a.jsx("option",{value:"openai",children:"OpenAI"}),a.jsx("option",{value:"groq",children:"Groq"}),a.jsx("option",{value:"together",children:"Together"})]})]}),a.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[a.jsx("label",{className:"form-label",children:"Model"}),(()=>{var H;const C=((H=Kc[n])==null?void 0:H.models)??[],T=C.includes(c);return a.jsxs(a.Fragment,{children:[a.jsxs("select",{className:"form-input",value:T?c:"__custom__",onChange:W=>{W.target.value==="__custom__"?u(""):u(W.target.value)},style:{marginBottom:T?void 0:"0.375rem"},children:[C.map(W=>a.jsx("option",{value:W,children:W},W)),a.jsx("option",{value:"__custom__",children:"Custom model..."})]}),!T&&a.jsx("input",{className:"form-input",value:c,onChange:W=>u(W.target.value),placeholder:"Enter model name"})]})})()]}),a.jsxs("div",{className:"form-group",style:{marginBottom:"1rem"},children:[a.jsx("label",{className:"form-label",children:"API Key (if required)"}),a.jsx("input",{className:"form-input",type:"password",value:p,onChange:C=>f(C.target.value),placeholder:v?"••••••••••••••••":"sk-... (not needed for Ollama)"})]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[a.jsx("button",{className:"btn btn-primary",onClick:k,disabled:x,children:x?"Saving...":"Save & Encrypt"}),v&&a.jsx("button",{className:"btn btn-ghost",onClick:N,disabled:j,children:j?"Testing...":"Test Connection"})]}),m&&a.jsx("div",{className:`alert ${m.startsWith("OK")?"alert-success":"alert-error"}`,style:{marginTop:"0.75rem"},children:m})]}),a.jsx(xy,{}),a.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[a.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,marginBottom:"1rem"},children:"Security"}),a.jsxs("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.7},children:[a.jsxs("div",{style:{marginBottom:"1rem"},children:[a.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"What the gateway protects"}),a.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[a.jsx("li",{children:"Every tool call verified against your authorization bounds"}),a.jsx("li",{children:"Credentials never exposed to agents through MCP"}),a.jsx("li",{children:"Every action produces a signed receipt"})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"Your responsibility"}),a.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[a.jsx("li",{children:"If your AI agent has full access to your computer, it could bypass the gateway"}),a.jsx("li",{children:"For best security, run agents in sandboxed environments"}),a.jsx("li",{children:"The gateway secures what agents do through tools — not what they do on your machine"})]})]})]})]})]})}function xy(){const[e,t]=d.useState(null),[n,r]=d.useState({intent:"",context:""}),[o,s]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(null),[p,f]=d.useState(!1),v=d.useCallback(async()=>{if(!p)try{const w=await O.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")}},[p]),y=async w=>{if(e){s(w),l(null);try{const j=n[w],h=j.trim()===e[w].default.trim()?"":j;await O.setAIPrompt(w,h);const m=await O.getAIPrompts();t(m),r({intent:m.intent.current,context:m.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 O.setAIPrompt(w,"");const j=await O.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 a.jsxs("details",{className:"card",style:{padding:"1.5rem",marginTop:"1rem"},onToggle:w=>{w.currentTarget.open&&v()},children:[a.jsx("summary",{style:{fontSize:"1rem",fontWeight:700,cursor:"pointer",listStyle:"revert",userSelect:"none"},children:"Advanced — AI assistant prompts"}),a.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&&a.jsx("div",{className:"alert alert-error",style:{marginBottom:"0.75rem"},children:i}),!p&&!i&&a.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem"},children:"Loading prompts…"}),e&&a.jsxs(a.Fragment,{children:[a.jsx(Gc,{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:o==="intent",justSaved:c==="intent"}),a.jsx(Gc,{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:o==="context",justSaved:c==="context"})]})]})}function Gc({kind:e,label:t,description:n,state:r,draft:o,onChange:s,onSave:i,onRevert:l,saving:c,justSaved:u}){const p=o!==r.current;return a.jsxs("section",{style:{marginBottom:"1.5rem"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:"0.25rem",gap:"1rem",flexWrap:"wrap"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,fontSize:"0.9rem"},children:t}),a.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text-secondary)"},children:n})]}),r.overridden&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Custom"})]}),a.jsx("textarea",{className:"form-textarea",value:o,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`}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center",marginTop:"0.5rem",flexWrap:"wrap"},children:[a.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:i,disabled:c||!p,children:c?"Saving…":"Save"}),r.overridden&&a.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&&a.jsx("span",{style:{fontSize:"0.78rem",color:"var(--success)"},children:"Saved"}),p&&!c&&!u&&a.jsx("span",{style:{fontSize:"0.78rem",color:"var(--text-muted)"},children:"Unsaved changes"})]}),a.jsxs("details",{style:{marginTop:"0.5rem"},children:[a.jsx("summary",{style:{fontSize:"0.78rem",color:"var(--text-muted)",cursor:"pointer"},children:"Show built-in default"}),a.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})]}),a.jsx("span",{style:{display:"none"},children:e})]})}function wy(e){return e.proposalId?"review":"automatic"}function Yc(e,t,n={}){const r=n.status??"pending",o=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=wy(i);!o&&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 Sy={pending:"Pending",committed:"Approved",executed:"Executed",rejected:"Rejected",expired:"Expired"},jy={pending:"status-pending",committed:"status-active",executed:"status-active",rejected:"status-revoked",expired:"status-expired"};function ky(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 Cy(e){return e.split("__").pop()??e}function by(e){const t=e.toLowerCase();return t.includes("delete")||t.includes("refund")||t.includes("cancel")||t.includes("revoke")}const Ny=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]),Ey=/^(image|img|photo|picture|thumbnail)(_?url)?$/i;function zy(e,t){return typeof t!="string"?!1:/^data:image\//i.test(t)?!0:Ey.test(e)?/^https?:\/\//.test(t):/^https?:\/\/.+\.(jpe?g|png|gif|webp|svg|avif)(\?|$)/i.test(t)}function gi(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=>gi(t)).join(", ");try{const t=JSON.stringify(e);return t.length>160?t.slice(0,157)+"…":t}catch{return String(e)}}function Qc({item:e,onApprove:t,onReject:n,resolving:r}){const o=e.kind==="proposal",s=o?e.proposal.status:"executed",i=o?e.proposal.tool:e.receipt.action,l=Cy(i),c=by(i),u=o?e.proposal.toolArgs:null,p=o?e.proposal.executionContext:e.receipt.executionContext,f=o?null:e.receipt.cumulativeState,v=u?Object.entries(u).filter(([x])=>!Ny.has(x)):[],y=Object.entries(p??{});return a.jsxs("div",{className:"card",children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.75rem",flexWrap:"wrap"},children:[a.jsx(Df,{profileId:e.profileId}),a.jsx("code",{style:{fontSize:"0.85rem"},children:l}),e.commitmentMode==="automatic"&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"autonomous"}),a.jsxs("span",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"0.5rem"},children:[a.jsx("span",{className:`status-badge ${jy[s]}`,children:Sy[s]}),a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:ky(e.sortTimestamp)})]})]}),c&&a.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:[a.jsx("span",{children:"⚠"}),a.jsx("span",{children:"Irreversible action"})]}),o&&typeof(u==null?void 0:u._imagePreview)=="string"&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Preview"}),a.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)"}})]}),o&&v.length>0&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Arguments"}),a.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:v.map(([x,w])=>a.jsxs(d.Fragment,{children:[a.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:x}),a.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word"},children:zy(x,w)?a.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 h=j.currentTarget,m=h.parentElement;if(!m)return;h.style.display="none";const g=document.createElement("span");g.textContent=w,g.style.color="var(--text-tertiary)",m.appendChild(g)}}):gi(w)})]},x))})]}),y.length>0&&a.jsx("div",{style:{marginBottom:"0.75rem",fontSize:"0.8rem",color:"var(--text-secondary)"},children:y.map(([x,w])=>`${x}=${gi(w)}`).join(" · ")}),f&&a.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}`:""]}),o&&s==="pending"&&a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-primary",onClick:()=>t==null?void 0:t(e.id),disabled:r,children:r?"Approving…":"Approve"}),a.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:()=>n==null?void 0:n(e.id),disabled:r,children:"Reject"})]}),a.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:[o?"Proposal":"Receipt",": ",e.id]})]})}const Py=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]);function vi(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=>vi(t)).join(", ");try{const t=JSON.stringify(e);return t.length>200?t.slice(0,197)+"...":t}catch{return String(e)}}function Ty(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 Iy({proposal:e,currentUserId:t,onAction:n,onMessage:r}){const[o,s]=d.useState(!1),[i,l]=d.useState(!1),[c,u]=d.useState(null),[p,f]=d.useState(!1),[v,y]=d.useState(null),[x,w]=d.useState(!1),j=e.tool.split("__").pop()??e.tool,h=Object.entries(e.toolArgs).filter(([D])=>!Py.has(D)),m=Object.entries(e.executionContext),g=e.pendingApprovers??[],S=e.approvedBy??{},E=Object.keys(S).length,P=g.filter(D=>!(D in S)).length,k=t in S,N=async()=>{if(c===null){f(!0),y(null);try{const D=await O.getAttestationIntent(e.authorizationId);if(!D){y("Intent not available or you are not an authorized approver.");return}const _=await O.decryptIntent({intentCiphertext:D.intentCiphertext,encryptedKey:D.encryptedKey,approverId:t});u(_)}catch(D){y(D instanceof Error?D.message:"Failed to decrypt intent")}finally{f(!1)}}},C=async()=>{x?w(!1):(w(!0),await N())},T=async()=>{s(!0),r("");try{await O.approveProposal(e.id);try{if(c===null){const D=await O.getAttestationIntent(e.authorizationId);if(D){const _=await O.decryptIntent({intentCiphertext:D.intentCiphertext,encryptedKey:D.encryptedKey,approverId:t});u(_),await O.storeApprovedIntent(e.authorizationId,_)}}else await O.storeApprovedIntent(e.authorizationId,c)}catch{}r(`Approved. ${P-1>0?`${P-1} more approver(s) still needed.`:"All approvers signed off — action is ready to execute."}`),n()}catch(D){r(D instanceof Error?D.message:"Approval failed")}finally{s(!1)}},H=async()=>{const D=prompt("Rejection reason (optional):");if(D!==null){l(!0),r("");try{await O.rejectProposal(e.id,D||void 0),r("Action rejected."),n()}catch(_){r(_ instanceof Error?_.message:"Rejection failed")}finally{l(!1)}}},W=o||i;return a.jsxs("div",{className:"card",children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[a.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:Ee(e.profileId)}),a.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"}),a.jsx("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:Ty(e.createdAt)})]}),a.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(D=>{const _=D in S;return a.jsxs("span",{style:{marginLeft:"0.5rem",color:_?"var(--success, green)":"var(--text-tertiary)"},children:[_?"✓":"○"," ",D===t?"You":D]},D)})]}),a.jsxs("div",{style:{marginBottom:"0.5rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Proposed action"}),a.jsx("code",{style:{fontSize:"0.85rem"},children:j})]}),h.length>0&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Arguments"}),a.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:h.map(([D,_])=>a.jsxs(d.Fragment,{children:[a.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:D}),a.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word"},children:vi(_)})]},D))})]}),m.length>0&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:m.map(([D,_])=>`${D}=${vi(_)}`).join(" · ")}),a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsxs("button",{className:"btn btn-ghost btn-sm",style:{padding:"0.2rem 0",fontSize:"0.75rem"},onClick:C,disabled:p,children:[x?"▲ Hide intent":"▼ Show intent",p&&" (decrypting...)"]}),x&&a.jsx("div",{style:{marginTop:"0.5rem",padding:"0.75rem",background:"var(--bg-main)",borderRadius:"0.375rem",border:"1px solid var(--border)"},children:v?a.jsx("p",{style:{color:"var(--danger)",fontSize:"0.8rem",margin:0},children:v}):c!==null?a.jsx("p",{style:{fontSize:"0.85rem",margin:0,whiteSpace:"pre-wrap",color:"var(--text-primary)"},children:c}):a.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.8rem",margin:0},children:"No intent available for this authority."})})]}),!k&&a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.25rem"},children:[a.jsx("button",{className:"btn btn-primary",onClick:T,disabled:W,children:o?"Approving...":"Approve"}),a.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:H,disabled:W,children:i?"Rejecting...":"Reject"})]}),k&&a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"You approved this action. Waiting on other approvers."}),a.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["Proposal: ",e.id]})]})}function Ry(){const{domain:e,user:t}=ze(),n=(t==null?void 0:t.id)??"",[r,o]=d.useState("awaiting-me"),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,p]=d.useState(""),f=d.useCallback(async()=>{try{const A=await O.getProposalsForApprover();i(A)}catch{}finally{c(!1)}},[]);fe("proposal-added",f),fe("proposal-approved",f),fe("proposal-rejected",f),fe("proposal-resolved",f),$t(f,3e4);const[v,y]=d.useState([]),x=d.useCallback(async()=>{try{const A=await O.getProposals(e||"owner");y(A)}catch{}},[e]);fe("proposal-added",x),fe("proposal-approved",x),fe("proposal-rejected",x),fe("proposal-resolved",x),$t(x,3e4,e);const w=d.useMemo(()=>v.filter(A=>{var I;return A.status==="pending"&&(((I=A.pendingApprovers)==null?void 0:I.length)??0)===0}),[v]),j=d.useMemo(()=>Yc(w,[],{status:"pending"}),[w]),[h,m]=d.useState([]),g=d.useCallback(async()=>{if(n)try{const I=(await O.getProposals(e||"owner")).filter(Y=>Y.status==="pending"&&Y.pendingApprovers&&Y.pendingApprovers.includes(n)&&Y.approvedBy&&n in Y.approvedBy);m(I)}catch{}},[n,e]);fe("proposal-approved",g),fe("proposal-rejected",g),$t(g,3e4,`${n}:${e}`),d.useEffect(()=>{f(),x(),g()},[]);const[S,E]=d.useState([]),[P,k]=d.useState([]),[N,C]=d.useState(!0),[T,H]=d.useState(null),[W,D]=d.useState(""),[_,B]=d.useState("pending"),[X,se]=d.useState(null),[z,R]=d.useState(!1),$=d.useCallback(async()=>{try{const{proposals:A,receipts:I}=await O.getThread({domain:e,status:_,sinceDays:7});E(A),k(I)}catch{}finally{C(!1)}},[e,_]);$t($,3e4,`${e}:${_}`);const L=async(A,I)=>{H(A),D("");try{const Y=e||"owner",xe=await O.resolveProposal(A,I,Y);D(I==="commit"?`Action approved. Status: ${xe.status}`:"Action rejected."),await Promise.all([$(),x()])}catch(Y){D(Y instanceof Error?Y.message:"Failed")}finally{H(null)}},V=d.useMemo(()=>{const A=new Set;for(const I of S)A.add(I.profileId);for(const I of P)A.add(I.profileId);return Array.from(A).sort()},[S,P]),ee=d.useMemo(()=>Yc(S,P,{status:_,profile:X??void 0,includeAutonomous:z}),[S,P,_,X,z]),J=d.useCallback(()=>{f(),g()},[f,g]),je=d.useMemo(()=>{const A=new Set,I=[];for(const Y of h)A.has(Y.id)||(A.add(Y.id),I.push(Y));return I.sort((Y,xe)=>xe.createdAt-Y.createdAt)},[h]),b=s.length+j.length,U=je.length;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"Pending Approvals"}),a.jsx("p",{className:"page-subtitle",children:"Actions awaiting approval, plus recent activity from the last 7 days."})]}),a.jsxs("div",{className:"nav-tabs",style:{marginBottom:"1rem"},children:[a.jsxs("button",{className:`nav-tab${r==="awaiting-me"?" active":""}`,onClick:()=>o("awaiting-me"),children:["Awaiting me ",b>0&&a.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:b})]}),a.jsxs("button",{className:`nav-tab${r==="awaiting-others"?" active":""}`,onClick:()=>o("awaiting-others"),children:["Awaiting others ",U>0&&a.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:U})]}),a.jsx("button",{className:`nav-tab${r==="all"?" active":""}`,onClick:()=>{o("all"),$()},children:"All"})]}),r==="awaiting-me"&&a.jsx(a.Fragment,{children:l&&b===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):b===0?a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[a.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions awaiting your approval."}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Review-mode actions and above-cap actions you must approve will appear here."})]}):a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(u||W)&&a.jsx("div",{className:"alert alert-success",children:u||W}),j.map(A=>a.jsx(Qc,{item:A,onApprove:I=>L(I,"commit"),onReject:I=>L(I,"reject"),resolving:T===A.id},A.id)),s.map(A=>a.jsx(Iy,{proposal:A,currentUserId:n,onAction:J,onMessage:p},A.id))]})}),r==="awaiting-others"&&a.jsx(a.Fragment,{children:je.length===0?a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[a.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions waiting on others."}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Actions you proposed or approved that are pending other approvers will appear here."})]}):a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:je.map(A=>a.jsx(Ay,{proposal:A,currentUserId:n,onCancel:async()=>{try{await O.rejectProposal(A.id,"cancelled by creator"),g(),x()}catch(I){alert(I instanceof Error?I.message:"Cancel failed")}}},A.id))})}),r==="all"&&a.jsxs(a.Fragment,{children:[W&&a.jsx("div",{className:"alert alert-success",style:{marginBottom:"1rem"},children:W}),a.jsxs("div",{className:"filter-chips",style:{marginBottom:"1rem"},children:[a.jsx("button",{className:`filter-chip ${_==="pending"?"selected":""}`,onClick:()=>B("pending"),children:"Pending"}),a.jsx("button",{className:`filter-chip ${_==="all"?"selected":""}`,onClick:()=>B("all"),children:"All"}),V.length>0&&a.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),V.map(A=>a.jsx("button",{className:`filter-chip ${X===A?"selected":""}`,onClick:()=>se(X===A?null:A),children:Ee(A)},A)),_==="all"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),a.jsxs("button",{className:`filter-chip ${z?"selected":""}`,onClick:()=>R(!z),title:"Include actions executed without human review (automatic commitment mode)",children:[z?"✓ ":"","Autonomous actions"]})]})]}),N&&ee.length===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):ee.length===0?a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[a.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:_==="pending"?"No actions awaiting your approval.":"Nothing here yet."}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:_==="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."})]}):a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:ee.map(A=>a.jsx(Qc,{item:A,onApprove:I=>L(I,"commit"),onReject:I=>L(I,"reject"),resolving:T===A.id},A.id))})]})]})}function _y(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 Ay({proposal:e,currentUserId:t,onCancel:n}){var u;const[r,o]=d.useState(!1),s=Object.keys(e.approvedBy??{}),i=(e.pendingApprovers??[]).filter(p=>!(p 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.")){o(!0);try{await n()}finally{o(!1)}}};return a.jsxs("div",{className:"card",children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[a.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:Ee(e.profileId)}),l&&a.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"}),a.jsx("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:_y(e.createdAt)})]}),a.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:a.jsx("code",{children:e.tool.split("__").pop()??e.tool})}),l&&a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[s.map(p=>a.jsx("span",{style:{marginRight:"0.75rem",color:"var(--success, green)"},children:p===t?"You approved":`${p} approved`},p)),i.map(p=>a.jsxs("span",{style:{marginRight:"0.75rem",color:"var(--text-tertiary)"},children:["Waiting on ",p===t?"you":p]},p))]}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:a.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--danger)"},onClick:c,disabled:r,children:r?"Cancelling...":"Cancel"})})]})}const $y=`# Agent Brief
|
|
69
|
+
`}),f?a.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem"},children:"Loading..."}):g.length===0?a.jsxs("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:[a.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"0.9rem",marginBottom:"1rem"},children:"No integrations set up yet. Connect a service first."}),a.jsx(Je,{to:"/integrations",className:"btn btn-primary btn-sm",onClick:()=>e==null?void 0:e(),children:"Go to Integrations"})]}):a.jsx("div",{className:"profile-grid",children:g.map(k=>{const N=S(k.id),C=k.id.replace(/@.*$/,"").split("/").pop()??k.id,T=h.get(C),H=p.get(C),W=(H==null?void 0:H.running)===!0;return a.jsxs("div",{className:"card",style:W?void 0:{opacity:.7},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.125rem"},children:[a.jsx("h3",{className:"card-title",style:{margin:0},children:Ee(k.id,k.name)}),N?a.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"}):a.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"})]}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"1rem",flex:1},children:k.description}),W?a.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>P(k.id),children:"Authorize"}):a.jsxs(Je,{to:`/integrations?setup=${(T==null?void 0:T.id)??""}`,className:"btn btn-secondary btn-sm",style:{textDecoration:"none",textAlign:"center"},onClick:()=>e==null?void 0:e(),children:["Set up ",(T==null?void 0:T.name)??"integration"]})]},k.id)})})]})}const ry={active:"Active",pending:"Pending",expired:"Expired",revoked:"Revoked"};function oy({status:e,label:t}){return a.jsx("span",{className:`status-badge status-${e}`,children:t||ry[e]})}function ay({domain:e,attested:t}){const n=t===!0?"domain-attested":t===!1?"domain-missing":"";return a.jsx("span",{className:`domain-badge ${n}`,style:{fontSize:"0.75rem"},children:e})}const yn=86400,Nr=3600,Po=60,sy=30*yn;function iy(e){if(e<=0)return"Expired";if(e>90*yn){const t=Math.floor(e/sy);return`${t} ${t===1?"month":"months"} remaining`}if(e>7*yn){const t=Math.floor(e/yn);return`${t} ${t===1?"day":"days"} remaining`}if(e>=2*yn){const t=Math.floor(e/yn),n=Math.floor(e%yn/Nr);return`${t} ${t===1?"day":"days"} ${n}h remaining`}if(e>=2*Nr){const t=Math.floor(e/Nr),n=Math.floor(e%Nr/Po);return`${t}h ${String(n).padStart(2,"0")}m remaining`}if(e>=Po){const t=Math.floor(e/Po),n=Math.floor(e%Po);return`${t}m ${String(n).padStart(2,"0")}s remaining`}return`${Math.floor(e)}s remaining`}function ly({expiresAt:e}){const[t,n]=d.useState(()=>e-Date.now()/1e3),r=t<2*Nr;d.useEffect(()=>{const s=setInterval(()=>n(e-Date.now()/1e3),r?1e3:6e4);return()=>clearInterval(s)},[e,r]);const o=t<300;return a.jsx("span",{className:`ttl-badge ${o?"ttl-warn":"ttl-ok"}`,children:iy(t)})}function Bf({icon:e,title:t,text:n,children:r}){return a.jsxs("div",{className:"empty-state",children:[e&&a.jsx("div",{className:"empty-state-icon",children:e}),a.jsx("div",{className:"empty-state-title",children:t}),n&&a.jsx("div",{className:"empty-state-text",children:n}),r]})}function cy(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 uy=[{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 dy({item:e,onClose:t,onSuccess:n}){var h;const{user:r,activeDomain:o,groupId:s}=ze(),i=e.remaining_seconds??0,l=uy.filter(p=>p.seconds>i),c=((h=l[0])==null?void 0:h.seconds)??2592e3,[u,m]=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.authorization_id,S=await O.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 O.getProfile(e.profile_id),P=e.frame,k=S.context??{},N=e.attested_domains[0]||o||"owner",C=await Ho(P,E),T=await Ff(k,E),[H,W]=await Promise.all([va(S.gateContent.intent),va(JSON.stringify({profile:e.profile_id,path:e.path,domain:N}))]);if(!s)throw new Error("No active group; cannot extend authorization.");const B=(((p=e.deferred_commitment_domains)==null?void 0:p.length)??0)>0?"review":"automatic",_=await O.attest({authorization_id:e.authorization_id,renew:!0,profile_id:e.profile_id,bounds:P,bounds_hash:C,context_hash:T,domain:N,did:r.did,gate_content_hashes:{intent:H},execution_context_hash:W,group_id:s,commitment_mode:B,ttl:u});await O.pushGateContent(Of(_,{boundsHash:C,contextHash:T,context:k,path:e.path,gateContent:S.gateContent})),n()}catch(g){x(g instanceof Error?g.message:"Extension failed")}finally{v(!1)}}};return a.jsx("div",{className:"modal-backdrop",onClick:p=>p.target===p.currentTarget&&t(),children:a.jsxs("div",{className:"modal",children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{className:"modal-title",children:"Extend Authorization"}),a.jsx("button",{className:"modal-close",onClick:t,children:"×"})]}),a.jsxs("div",{className:"modal-body",children:[a.jsxs("div",{style:{marginBottom:"1rem"},children:[a.jsxs("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:[Ee(e.profile_id)," / ",e.path]}),w.length>0&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:w.map(([p,g])=>`${p}=${g}`).join(" · ")})]}),a.jsxs("div",{style:{marginBottom:"1rem"},children:[a.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&&a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["Currently valid for ",cy(i),". Only longer durations are shown."]}),a.jsx("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:l.length===0?a.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=>a.jsx("button",{className:`btn ${u===p.seconds?"btn-primary":"btn-secondary"}`,onClick:()=>m(p.seconds),style:{minWidth:"3.5rem"},children:p.label},p.seconds))})]}),a.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&&a.jsx("div",{className:"error-message",children:y})]}),a.jsxs("div",{className:"modal-footer",children:[a.jsx("button",{className:"btn btn-secondary",onClick:t,disabled:f,children:"Cancel"}),a.jsx("button",{className:"btn btn-primary",onClick:j,disabled:f,children:f?"Extending...":"Extend"})]})]})})}function fy(e,t,n){return[...e].sort((r,o)=>{if(n){if(r.authorization_id===n&&o.authorization_id!==n)return-1;if(o.authorization_id===n&&r.authorization_id!==n)return 1}const s=Ct(r,{revokedSet:t}),i=Ct(o,{revokedSet:t}),l={active:0,pending:1,expired:2,revoked:3};return l[s]!==l[i]?l[s]-l[i]:new Date(o.created_at).getTime()-new Date(r.created_at).getTime()})}function py({item:e,revokedSet:t,expandedHash:n,gateCache:r,gateLoading:o,copiedHash:s,revokingHash:i,copyingHash:l,profileConfigCache:c,mode:u,ownerLabel:m,isAdmin:f,onExpand:v,onCopyHash:y,onCopy:x,onRevoke:w,onExtend:j,highlightHash:h}){var $;const p=Ct(e,{revokedSet:t}),g=n===e.authorization_id,S=r[e.authorization_id],E=p==="active"||p==="pending"||p==="expired",P=Object.entries(e.frame).filter(([L])=>L!=="profile"&&L!=="path"),k=c.get(e.profile_id)??null,N=((($=k==null?void 0:k.approvers)==null?void 0:$.length)??0)>0,C=new Map;if(k!=null&&k.caps&&u==="team")for(const[L,V]of P){const ee=k.caps[L];ee!==void 0&&Number(V)>ee&&C.set(L,{authorized:Number(V),cap:ee})}const T=C.size>0,H=e.approvers_frozen??[],W=(k==null?void 0:k.approvers)??[],B=u==="team"&&H.length>0&&W.length>0&&(H.length!==W.length||H.some(L=>!W.includes(L))||W.some(L=>!H.includes(L))),_=Array.from(C.entries()).map(([L,V])=>`${L}: ${V.authorized} (cap ${V.cap})`).join(", "),D=Array.from(C.entries()).map(([L,V])=>`${L}: ${V.authorized} → ${V.cap}`).join(", "),X=T?N?C.size===1?`Above team cap: ${_} — actions require approval`:`Above team cap (${C.size}): ${_} — actions require approval`:C.size===1?`Reduced by hard cap: ${D}`:`Reduced by hard cap (${C.size}): ${D}`:"",se=T?N?"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,z=Ee(e.profile_id),R=h!=null&&e.authorization_id===h;return a.jsxs("div",{className:`card${R?" card-highlight":""}`,style:{marginBottom:0},children:[m&&a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner: ",a.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:m})]}),a.jsxs("div",{className:"auth-card-header",children:[a.jsx("span",{style:{fontWeight:700,fontSize:"1rem",color:"var(--text-primary)",letterSpacing:"0.01em"},children:z}),e.title&&a.jsx("span",{style:{fontWeight:500,fontSize:"0.85rem",color:"var(--text-secondary)"},children:e.title}),a.jsx(oy,{status:p}),p==="active"&&e.earliest_expiry&&a.jsx(ly,{expiresAt:new Date(e.earliest_expiry).getTime()/1e3}),p==="expired"&&a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:new Date(e.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.5rem",alignItems:"center"},children:[e.required_domains.map(L=>a.jsx(ay,{domain:L,attested:e.attested_domains.includes(L)},L)),e.deferred_commitment_domains.length>0&&a.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"}),T&&a.jsx("span",{title:se,style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:N?"var(--accent-subtle)":"var(--danger-subtle)",color:N?"var(--accent)":"var(--danger)",fontWeight:600,cursor:"help"},children:X}),B&&a.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.authorization_id,title:"The approver list for this profile has changed since this authority was created. Copy to reissue with the current approvers.",children:l===e.authorization_id?"Copying...":"Approver list updated · Copy with new approvers"})]}),P.length>0&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:P.map(([L,V],ee)=>{const J=C.get(L);return a.jsxs("span",{children:[ee>0&&" · ",J?N?a.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:[a.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[L,"=",String(V)]}),a.jsxs("span",{style:{color:"var(--accent)",marginLeft:"0.25rem",fontWeight:600},children:["↑ approval at ",J.cap]})]}):a.jsxs("span",{title:`Team cap on ${L} is ${J.cap} with no approvers configured (hard cap). Authorized for ${J.authorized}; effective ${J.cap}.`,children:[a.jsxs("span",{style:{textDecoration:"line-through",color:"var(--text-tertiary)"},children:[L,"=",String(V)]}),a.jsxs("span",{style:{color:"var(--danger)",marginLeft:"0.25rem",fontWeight:600},children:["→"," ",J.cap]})]}):a.jsxs("span",{children:[L,"=",String(V)]})]},L)})}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:a.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>v(e),children:g?"▲ Hide Details":"▼ Details"})}),g&&a.jsxs("div",{style:{borderTop:"1px solid var(--border)",marginTop:"0.75rem",paddingTop:"0.75rem"},children:[P.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Bounds"}),a.jsx("dl",{className:"review-grid",children:P.map(([L,V])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:L}),a.jsx("dd",{children:String(V)})]},L))})]}),(S==null?void 0:S.context)&&Object.keys(S.context).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Context"}),a.jsx("dl",{className:"review-grid",children:Object.entries(S.context).map(([L,V])=>a.jsxs("span",{style:{display:"contents"},children:[a.jsx("dt",{children:L}),a.jsx("dd",{children:String(V)})]},L))})]}),a.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Intent"}),o===e.authorization_id?a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Loading gate content..."}):S?a.jsx("div",{className:"gate-content-block",children:a.jsx("div",{className:"gate-content-item",children:a.jsx("div",{className:"gate-content-text",children:S.gateContent.intent})})}):a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Gate content not available."}),a.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()}`]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginTop:"0.25rem"},children:[a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontFamily:"'SF Mono', Monaco, monospace",wordBreak:"break-all"},children:e.authorization_id}),a.jsx("button",{className:"btn btn-ghost btn-sm",style:{fontSize:"0.7rem",padding:"0.125rem 0.375rem"},onClick:()=>y(e.authorization_id),children:s===e.authorization_id?"copied":"copy"})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.75rem"},children:[!m&&a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>x(e),disabled:l===e.authorization_id,title:"Start a new authorization pre-filled with these bounds, context, and intent",children:l===e.authorization_id?"Copying…":"⧉ Copy"}),!m&&E&&a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>j(e),children:"↻ Extend"}),m&&f&&p!=="revoked"?a.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.authorization_id,m,z),disabled:i===e.authorization_id,children:i===e.authorization_id?"Revoking…":"Revoke"}):!m&&(p==="active"||p==="pending")?a.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.authorization_id),disabled:i===e.authorization_id,children:i===e.authorization_id?"Revoking…":"Revoke"}):null]})]})]},e.authorization_id)}function my(){const[e,t]=d.useState([]),[n,r]=d.useState(!0),[o,s]=d.useState([]),[i,l]=d.useState(!1),[c,u]=d.useState("mine"),[m,f]=d.useState("active"),[v,y]=d.useState(null),[x,w]=d.useState(null),[j,h]=zf(),[p,g]=d.useState(()=>j.get("new")==="1"),[S,E]=d.useState(()=>j.get("highlight")),[P,k]=d.useState(null),[N,C]=d.useState({}),[T,H]=d.useState(null),[W,B]=d.useState(null),[_,D]=d.useState(null),[X,se]=d.useState(new Set),[z,R]=d.useState(null),[$,L]=d.useState(null),V=Wt(),{group:ee,groupId:J,domain:je,mode:b,activeTeam:U}=ze(),A=(U==null?void 0:U.isAdmin)===!0,[I,Y]=d.useState(()=>new Map),xe=d.useCallback(()=>{r(!0),O.getMyAttestations().then(t).catch(()=>{}).finally(()=>r(!1))},[]),Pe=d.useCallback(()=>{J&&(l(!0),O.listTeamAuthorizations(J).then(s).catch(()=>{}).finally(()=>l(!1)))},[J]);fe("attestation-changed",()=>{xe(),A&&J&&Pe()}),d.useEffect(()=>{if(!S)return;j.get("highlight")&&(j.delete("highlight"),h(j,{replace:!0}));const G=window.setTimeout(()=>E(null),3e3);return()=>window.clearTimeout(G)},[]),$t(xe,3e5),d.useEffect(()=>{c==="team"&&A&&J&&o.length===0&&!i&&Pe()},[c,A,J,o.length,i,Pe]),d.useEffect(()=>{if(b!=="team"||!J)return;const G=c==="mine"?e:o;if(G.length===0)return;const F=[...new Set(G.map(Q=>Q.profile_id))].filter(Q=>!I.has(Q));if(F.length!==0){Y(Q=>{const q=new Map(Q);for(const oe of F)q.set(oe,null);return q});for(const Q of F)O.getTeamProfileConfig(J,Q).then(q=>{Y(oe=>new Map(oe).set(Q,q))}).catch(()=>{})}},[e,o,c,J,b,I]);const ke=async G=>{if(P===G.authorization_id){k(null);return}k(G.authorization_id);const F=G.authorization_id;if(!(F in N)){H(G.authorization_id);try{const Q=await O.getGateContent(F);C(q=>({...q,[F]:Q}))}catch{C(Q=>({...Q,[F]:null}))}finally{H(null)}}},pn=G=>{navigator.clipboard.writeText(G).then(()=>{D(G),setTimeout(()=>D(null),2e3)})},Rn=async G=>{var F;if(!J){alert("No active group; cannot copy authorization.");return}L(G.authorization_id);try{const Q=G.authorization_id;let q=N[Q]??null;Q in N||(q=await O.getGateContent(Q),C(_e=>({..._e,[Q]:q})));const oe=Object.fromEntries(Object.entries(G.frame).filter(([_e])=>_e!=="profile"&&_e!=="path")),mn=(q==null?void 0:q.context)??{},Ye=((F=q==null?void 0:q.gateContent)==null?void 0:F.intent)??"",pt=G.deferred_commitment_domains.length>0?"review":"automatic",Tt=G.attested_domains[0]||je||"owner";sessionStorage.setItem("agentAuth",JSON.stringify({profileId:G.profile_id,groupId:J,groupName:(ee==null?void 0:ee.name)??null,domain:Tt})),sessionStorage.setItem("agentGate",JSON.stringify({bounds:oe,context:mn,gateContent:{intent:Ye},templateMode:pt})),V("/agent/gate")}catch(Q){alert(Q instanceof Error?Q.message:"Failed to copy authorization")}finally{L(null)}},Pt=async(G,F,Q)=>{const q=F&&Q?`Revoke ${F}'s ${Q} authorization? This cannot be undone.`:"Revoke this authorization? The agent will no longer be able to execute actions under this attestation.";if(confirm(q)){R(G);try{await O.revokeAttestation(G),se(oe=>new Set(oe).add(G)),F&&J&&Pe()}catch(oe){alert(oe instanceof Error?oe.message:"Failed to revoke authorization")}finally{R(null)}}},Ue=c==="mine"?e:o,dr=c==="mine"?n:i,Ht={active:Ue.filter(G=>Ct(G,{revokedSet:X})==="active").length,pending:Ue.filter(G=>Ct(G,{revokedSet:X})==="pending").length,expired:Ue.filter(G=>Ct(G,{revokedSet:X})==="expired").length,revoked:Ue.filter(G=>Ct(G,{revokedSet:X})==="revoked").length},ne=(()=>{const G=new Map;for(const F of Ue){if(Ct(F,{revokedSet:X})!==m)continue;const Q=G.get(F.profile_id)??{count:0,review:!1};Q.count+=1,F.deferred_commitment_domains.length>0&&(Q.review=!0),G.set(F.profile_id,Q)}return Array.from(G.entries()).map(([F,Q])=>({profileId:F,...Q})).sort((F,Q)=>Ee(F.profileId).localeCompare(Ee(Q.profileId)))})(),ft=fy(Ue.filter(G=>{if(Ct(G,{revokedSet:X})!==m||v!==null&&G.profile_id!==v)return!1;if(x!==null){const F=G.deferred_commitment_domains.length>0;if(x==="review"&&!F||x==="auto"&&F)return!1}return!0}),X,S),lo={revokedSet:X,expandedHash:P,gateCache:N,gateLoading:T,copiedHash:_,revokingHash:z,copyingHash:$,profileConfigCache:I,mode:b,activeDomain:je,group:ee,groupId:J,onExpand:ke,onCopyHash:pn,onCopy:Rn,onRevoke:Pt,onExtend:B,highlightHash:S};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"1rem",flexWrap:"wrap"},children:[a.jsxs("div",{children:[a.jsx("h1",{className:"page-title",children:"Authorizations"}),a.jsx("p",{className:"page-subtitle",children:"Active, pending, and expired agent authorizations."})]}),a.jsx("button",{className:"btn btn-primary",onClick:()=>g(!0),children:"+ New authorization"})]}),p&&a.jsx("div",{className:"modal-backdrop",onClick:()=>{g(!1),j.get("new")&&(j.delete("new"),h(j,{replace:!0}))},children:a.jsxs("div",{className:"modal",onClick:G=>G.stopPropagation(),style:{maxWidth:"960px",width:"90vw"},children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h2",{className:"modal-title",children:"New authorization"}),a.jsx("button",{className:"modal-close",onClick:()=>{g(!1),j.get("new")&&(j.delete("new"),h(j,{replace:!0}))},children:"×"})]}),a.jsxs("div",{className:"modal-body",children:[a.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."}),a.jsx(ny,{onDismiss:()=>g(!1)})]})]})}),A&&a.jsxs("div",{className:"nav-tabs",style:{marginBottom:"0.5rem"},children:[a.jsx("button",{className:`nav-tab${c==="mine"?" active":""}`,onClick:()=>{u("mine"),f("active"),y(null),w(null),k(null)},children:"Mine"}),a.jsx("button",{className:`nav-tab${c==="team"?" active":""}`,onClick:()=>{u("team"),f("active"),y(null),w(null),k(null)},children:"Team"})]}),a.jsx("div",{className:"nav-tabs",children:["active","pending","expired","revoked"].map(G=>a.jsxs("button",{className:`nav-tab${m===G?" active":""}`,onClick:()=>{f(G),y(null),w(null)},children:[G.charAt(0).toUpperCase()+G.slice(1)," (",Ht[G],")"]},G))}),ne.length>0&&a.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"center",marginTop:"-0.25rem",marginBottom:"1rem"},children:[ne.map(G=>{const F=v===G.profileId;return a.jsx("button",{className:`btn btn-sm ${F?"btn-primary":"btn-secondary"}`,onClick:()=>y(F?null:G.profileId),children:Ee(G.profileId)},G.profileId)}),a.jsx("span",{"aria-hidden":"true",style:{color:"var(--border)",fontSize:"1.1rem",padding:"0 0.25rem",userSelect:"none"},children:"|"}),["auto","review"].map(G=>{const F=x===G;return a.jsx("button",{className:`btn btn-sm ${F?"btn-primary":"btn-secondary"}`,onClick:()=>w(F?null:G),children:G==="auto"?"Auto":"Review"},G)})]}),dr&&Ue.length===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):ft.length===0?a.jsx(Bf,{icon:"☰",title:"No authorizations",text:`No ${m} authorizations found.`}):a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:ft.map(G=>{const F=c==="team"?G:null,Q=F!=null&&F.owner?F.owner.name??F.owner.email??F.owner.userId:void 0;return a.jsx(py,{item:G,ownerLabel:Q,isAdmin:A,...lo},G.authorization_id)})}),W&&a.jsx(dy,{item:W,onClose:()=>B(null),onSuccess:()=>{B(null),xe()}})]})}function Df({profileId:e}){return a.jsx("span",{className:"profile-badge",children:Ee(e)})}function hy(e){return new Date(e*1e3).toLocaleString()}function gy(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 vy(e,t){if(!t)return!0;const n=t.toLowerCase();return e.profileId.toLowerCase().includes(n)||Ee(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 Vc(e,t){const n=new Map(e.map(r=>[r.id,r]));for(const r of t)n.set(r.id,r);return[...n.values()].sort((r,o)=>o.timestamp-r.timestamp)}function yy(){const{activeTeam:e,groupId:t}=ze(),n=(e==null?void 0:e.isAdmin)===!0,[r,o]=d.useState("mine"),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,m]=d.useState({}),[f,v]=d.useState(new Set),[y,x]=d.useState(""),[w,j]=d.useState(new Set),[h,p]=d.useState(new Set),[g,S]=d.useState("all"),[E,P]=d.useState(!1),[k,N]=d.useState(null),[C,T]=d.useState(!1),[H,W]=d.useState(!1),B=d.useRef(""),_=d.useCallback(b=>r==="team"&&n&&t?O.listTeamReceiptsPage(t,{before:b,limit:200}):O.getMyReceiptsPage({before:b,limit:200}),[r,n,t]),D=d.useCallback(()=>{const b=r==="team"?`team:${t}`:"mine",U=B.current!==b;B.current=b,c(!0),W(!1),_().then(A=>{i(I=>U?A.receipts:Vc(I,A.receipts)),N(I=>U?A.nextBefore:I??A.nextBefore)}).catch(()=>{U&&i([]),W(!0)}).finally(()=>c(!1))},[_,r,t]),X=d.useCallback(()=>{!k||C||(T(!0),W(!1),_(k).then(b=>{i(U=>Vc(U,b.receipts)),N(b.nextBefore)}).catch(()=>W(!0)).finally(()=>T(!1)))},[k,C,_]);$t(D,12e4),d.useEffect(()=>{r!=="team"||Object.keys(u).length>0||O.listUsers().then(b=>{const U={};for(const A of b)U[A.id]={name:A.name,email:A.email};m(U)}).catch(()=>{})},[r,u]);const se=d.useMemo(()=>{const b=new Set;for(const U of s)b.add(Ee(U.profileId));return[...b].sort()},[s]),z=d.useMemo(()=>{const b=new Set;for(const U of s)b.add(U.action);return[...b].sort()},[s]),R=d.useMemo(()=>{if(r!=="team")return[];const b=new Set;for(const U of s)U.userId&&b.add(U.userId);return[...b].map(U=>{var A;return{id:U,label:(A=u[U])!=null&&A.name?`${u[U].name} (${u[U].email})`:U}}).sort((U,A)=>U.label.localeCompare(A.label))},[r,s,u]),$=d.useMemo(()=>s.filter(b=>!(!vy(b,y)||w.size>0&&!w.has(Ee(b.profileId))||h.size>0&&!h.has(b.action)||f.size>0&&b.userId&&!f.has(b.userId)||!gy(b,g))),[s,y,w,h,f,g]),L=w.size>0||h.size>0||f.size>0||g!=="all";function V(b){j(U=>{const A=new Set(U);return A.has(b)?A.delete(b):A.add(b),A})}function ee(b){p(U=>{const A=new Set(U);return A.has(b)?A.delete(b):A.add(b),A})}function J(b){v(U=>{const A=new Set(U);return A.has(b)?A.delete(b):A.add(b),A})}function je(){j(new Set),p(new Set),v(new Set),S("all"),x("")}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"Receipts"}),a.jsx("p",{className:"page-subtitle",children:"Execution history for agent actions."})]}),n&&a.jsx("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem",borderBottom:"1px solid var(--border)"},children:["mine","team"].map(b=>a.jsx("button",{onClick:()=>o(b),className:"btn btn-ghost",style:{borderRadius:0,padding:"0.5rem 0.875rem",borderBottom:r===b?"2px solid var(--accent)":"2px solid transparent",color:r===b?"var(--text-primary)":"var(--text-tertiary)",fontWeight:r===b?600:500},children:b==="mine"?"Mine":"Team"},b))}),a.jsxs("div",{className:"search-filter-bar",children:[a.jsxs("div",{className:"search-input-wrap",children:[a.jsx("span",{className:"search-icon",children:"⌕"}),a.jsx("input",{type:"text",className:"form-input search-input",placeholder:"Search by profile, action, path, or hash\\u2026",value:y,onChange:b=>x(b.target.value)}),y&&a.jsx("button",{className:"search-clear",onClick:()=>x(""),children:"×"})]}),a.jsxs("button",{className:`btn btn-sm btn-secondary${E?" active":""}`,onClick:()=>P(!E),children:["Filters",L?` (${w.size+h.size+(g!=="all"?1:0)})`:""]})]}),E&&a.jsxs("div",{className:"filter-panel",children:[se.length>1&&a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Profile"}),a.jsx("div",{className:"filter-chips",children:se.map(b=>a.jsx("button",{className:`filter-chip${w.has(b)?" selected":""}`,onClick:()=>V(b),children:b},b))})]}),z.length>1&&a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Action"}),a.jsx("div",{className:"filter-chips",children:z.map(b=>a.jsx("button",{className:`filter-chip${h.has(b)?" selected":""}`,onClick:()=>ee(b),children:b},b))})]}),r==="team"&&R.length>1&&a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Owner"}),a.jsx("div",{className:"filter-chips",children:R.map(b=>a.jsx("button",{className:`filter-chip${f.has(b.id)?" selected":""}`,onClick:()=>J(b.id),children:b.label},b.id))})]}),a.jsxs("div",{className:"filter-section",children:[a.jsx("div",{className:"filter-label",children:"Time range"}),a.jsx("div",{className:"filter-chips",children:[["1d","Today"],["7d","7 days"],["30d","30 days"],["all","All time"]].map(([b,U])=>a.jsx("button",{className:`filter-chip${g===b?" selected":""}`,onClick:()=>S(b),children:U},b))})]})]}),L&&a.jsxs("div",{className:"active-filters",children:[[...w].map(b=>a.jsxs("span",{className:"active-chip",onClick:()=>V(b),children:[b," ",a.jsx("span",{className:"chip-remove",children:"×"})]},b)),[...h].map(b=>a.jsxs("span",{className:"active-chip",onClick:()=>ee(b),children:[b," ",a.jsx("span",{className:"chip-remove",children:"×"})]},b)),[...f].map(b=>{const U=u[b],A=U?U.name:b;return a.jsxs("span",{className:"active-chip",onClick:()=>J(b),children:[A," ",a.jsx("span",{className:"chip-remove",children:"×"})]},b)}),g!=="all"&&a.jsxs("span",{className:"active-chip",onClick:()=>S("all"),children:[g==="1d"?"Today":g==="7d"?"7 days":"30 days"," ",a.jsx("span",{className:"chip-remove",children:"×"})]}),a.jsx("button",{className:"clear-filters",onClick:je,children:"Clear all"})]}),H&&a.jsx("div",{className:"card",style:{borderColor:"var(--danger, #c0392b)",marginBottom:"0.75rem"},children:a.jsx("span",{style:{color:"var(--danger, #c0392b)",fontSize:"0.85rem"},children:"Couldn’t load receipts — your session may have expired. Try signing out and back in."})}),l&&s.length===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):$.length===0?a.jsx(Bf,{icon:"⌕",title:s.length===0?"No receipts in the last 30 days":"No matching receipts",text:s.length===0?"Execution receipts appear here after an agent uses an authorized tool. Older receipts can be loaded below.":"Try adjusting your search or filters."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:$.length===s.length?`${s.length} receipt${s.length!==1?"s":""}`:`${$.length} of ${s.length} receipts`}),a.jsx("div",{className:"timeline",children:$.map(b=>{var U;return a.jsx("div",{className:"timeline-event",children:a.jsxs("div",{className:"card",style:{marginBottom:0},children:[a.jsxs("div",{className:"auth-card-header",children:[a.jsx(Df,{profileId:b.profileId}),a.jsx("span",{className:"auth-card-path",children:b.path}),a.jsx("span",{className:"receipt-action",children:b.action}),a.jsx("span",{className:"auth-card-time",children:hy(b.timestamp)})]}),r==="team"&&b.userId&&a.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner:"," ",a.jsx("span",{style:{color:"var(--text-secondary)"},children:(U=u[b.userId])!=null&&U.name?`${u[b.userId].name} (${u[b.userId].email})`:b.userId})]}),Object.keys(b.executionContext).length>0&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:Object.entries(b.executionContext).map(([A,I])=>`${A}=${I}`).join(" · ")}),a.jsxs("div",{style:{display:"flex",gap:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:[a.jsxs("span",{children:["Daily: ",b.cumulativeState.daily.count," calls, $",b.cumulativeState.daily.amount]}),a.jsxs("span",{children:["Monthly: ",b.cumulativeState.monthly.count," calls, $",b.cumulativeState.monthly.amount]})]}),a.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontFamily:"'SF Mono', Monaco, monospace",wordBreak:"break-all",marginTop:"0.375rem"},children:b.attestationHash})]})},b.id)})})]}),k&&a.jsx("div",{style:{textAlign:"center",marginTop:"1rem"},children:a.jsx("button",{className:"btn btn-secondary btn-sm",onClick:X,disabled:C,children:C?"Loading…":"Load older"})})]})}const Kc={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 xy(){const[e,t]=d.useState(""),[n,r]=d.useState("openrouter"),[o,s]=d.useState("openai-compatible"),[i,l]=d.useState("https://openrouter.ai/api/v1"),[c,u]=d.useState("google/gemma-4-31b-it"),[m,f]=d.useState(""),[v,y]=d.useState(!1),[x,w]=d.useState(!1),[j,h]=d.useState(!1),[p,g]=d.useState(null),S=d.useCallback(C=>{t(C),setTimeout(()=>t(""),3e3)},[]),E=d.useCallback(async()=>{try{const C=await O.getCredential("ai-config");if(y(C.configured),C.configured&&C.fields){C.fields.provider&&s(C.fields.provider),C.fields.endpoint&&l(C.fields.endpoint),C.fields.model&&u(C.fields.model);const T=C.fields.endpoint??"";T.includes("openai.com")?r("openai"):T.includes("groq.com")?r("groq"):T.includes("together.xyz")?r("together"):T.includes("openrouter.ai")?r("openrouter"):r("ollama")}}catch{}},[]);d.useEffect(()=>{E()},[E]);const P=C=>{r(C);const T=Kc[C];T&&(s(T.provider),l(T.endpoint),u(T.models[0]))},k=async()=>{w(!0);try{await O.setCredential("ai-config",{provider:o,endpoint:i,model:c,...m?{apiKey:m}:{}}),y(!0),S("AI configuration saved!")}catch{S("Failed to save AI config")}finally{w(!1)}},N=async()=>{h(!0),g(null);try{const C=await O.aiTest(m?{provider:o,endpoint:i,model:c,apiKey:m}:{});g(C.ok?`OK: ${C.message}`:`Failed: ${C.message}`)}catch(C){g(`Error: ${C instanceof Error?C.message:"Unknown"}`)}finally{h(!1)}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"AI Assistant"}),a.jsx("p",{className:"page-subtitle",children:"Advisory AI to help you think through intent when authorizing agents."})]}),e&&a.jsx("div",{className:"alert alert-success",children:e}),a.jsxs("div",{className:"card",children:[a.jsx("h3",{className:"card-title",children:"Configuration"}),a.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&&a.jsxs("div",{className:"status-banner status-banner-success",style:{marginBottom:"1rem",fontSize:"0.8rem"},children:[a.jsx("span",{className:"status-banner-icon",children:"✓"}),a.jsx("span",{className:"status-banner-text",children:"AI configured"})]}),a.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[a.jsx("label",{className:"form-label",children:"Provider Preset"}),a.jsxs("select",{className:"form-input",value:n,onChange:C=>P(C.target.value),children:[a.jsx("option",{value:"openrouter",children:"OpenRouter (recommended)"}),a.jsx("option",{value:"ollama",children:"Ollama (local)"}),a.jsx("option",{value:"openai",children:"OpenAI"}),a.jsx("option",{value:"groq",children:"Groq"}),a.jsx("option",{value:"together",children:"Together"})]})]}),a.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[a.jsx("label",{className:"form-label",children:"Model"}),(()=>{var H;const C=((H=Kc[n])==null?void 0:H.models)??[],T=C.includes(c);return a.jsxs(a.Fragment,{children:[a.jsxs("select",{className:"form-input",value:T?c:"__custom__",onChange:W=>{W.target.value==="__custom__"?u(""):u(W.target.value)},style:{marginBottom:T?void 0:"0.375rem"},children:[C.map(W=>a.jsx("option",{value:W,children:W},W)),a.jsx("option",{value:"__custom__",children:"Custom model..."})]}),!T&&a.jsx("input",{className:"form-input",value:c,onChange:W=>u(W.target.value),placeholder:"Enter model name"})]})})()]}),a.jsxs("div",{className:"form-group",style:{marginBottom:"1rem"},children:[a.jsx("label",{className:"form-label",children:"API Key (if required)"}),a.jsx("input",{className:"form-input",type:"password",value:m,onChange:C=>f(C.target.value),placeholder:v?"••••••••••••••••":"sk-... (not needed for Ollama)"})]}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[a.jsx("button",{className:"btn btn-primary",onClick:k,disabled:x,children:x?"Saving...":"Save & Encrypt"}),v&&a.jsx("button",{className:"btn btn-ghost",onClick:N,disabled:j,children:j?"Testing...":"Test Connection"})]}),p&&a.jsx("div",{className:`alert ${p.startsWith("OK")?"alert-success":"alert-error"}`,style:{marginTop:"0.75rem"},children:p})]}),a.jsx(wy,{}),a.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[a.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,marginBottom:"1rem"},children:"Security"}),a.jsxs("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.7},children:[a.jsxs("div",{style:{marginBottom:"1rem"},children:[a.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"What the gateway protects"}),a.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[a.jsx("li",{children:"Every tool call verified against your authorization bounds"}),a.jsx("li",{children:"Credentials never exposed to agents through MCP"}),a.jsx("li",{children:"Every action produces a signed receipt"})]})]}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"Your responsibility"}),a.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[a.jsx("li",{children:"If your AI agent has full access to your computer, it could bypass the gateway"}),a.jsx("li",{children:"For best security, run agents in sandboxed environments"}),a.jsx("li",{children:"The gateway secures what agents do through tools — not what they do on your machine"})]})]})]})]})]})}function wy(){const[e,t]=d.useState(null),[n,r]=d.useState({intent:"",context:""}),[o,s]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(null),[m,f]=d.useState(!1),v=d.useCallback(async()=>{if(!m)try{const w=await O.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")}},[m]),y=async w=>{if(e){s(w),l(null);try{const j=n[w],h=j.trim()===e[w].default.trim()?"":j;await O.setAIPrompt(w,h);const p=await O.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 O.setAIPrompt(w,"");const j=await O.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 a.jsxs("details",{className:"card",style:{padding:"1.5rem",marginTop:"1rem"},onToggle:w=>{w.currentTarget.open&&v()},children:[a.jsx("summary",{style:{fontSize:"1rem",fontWeight:700,cursor:"pointer",listStyle:"revert",userSelect:"none"},children:"Advanced — AI assistant prompts"}),a.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&&a.jsx("div",{className:"alert alert-error",style:{marginBottom:"0.75rem"},children:i}),!m&&!i&&a.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem"},children:"Loading prompts…"}),e&&a.jsxs(a.Fragment,{children:[a.jsx(Gc,{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:o==="intent",justSaved:c==="intent"}),a.jsx(Gc,{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:o==="context",justSaved:c==="context"})]})]})}function Gc({kind:e,label:t,description:n,state:r,draft:o,onChange:s,onSave:i,onRevert:l,saving:c,justSaved:u}){const m=o!==r.current;return a.jsxs("section",{style:{marginBottom:"1.5rem"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:"0.25rem",gap:"1rem",flexWrap:"wrap"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,fontSize:"0.9rem"},children:t}),a.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text-secondary)"},children:n})]}),r.overridden&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Custom"})]}),a.jsx("textarea",{className:"form-textarea",value:o,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`}),a.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center",marginTop:"0.5rem",flexWrap:"wrap"},children:[a.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:i,disabled:c||!m,children:c?"Saving…":"Save"}),r.overridden&&a.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&&a.jsx("span",{style:{fontSize:"0.78rem",color:"var(--success)"},children:"Saved"}),m&&!c&&!u&&a.jsx("span",{style:{fontSize:"0.78rem",color:"var(--text-muted)"},children:"Unsaved changes"})]}),a.jsxs("details",{style:{marginTop:"0.5rem"},children:[a.jsx("summary",{style:{fontSize:"0.78rem",color:"var(--text-muted)",cursor:"pointer"},children:"Show built-in default"}),a.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})]}),a.jsx("span",{style:{display:"none"},children:e})]})}function Sy(e){return e.proposalId?"review":"automatic"}function Yc(e,t,n={}){const r=n.status??"pending",o=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=Sy(i);!o&&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}function Uf(e,t){const n=e-Math.floor(t/1e3);if(n<=0)return{label:"expired",urgent:!1,expired:!0};const r=Math.floor(n/86400),o=Math.floor(n%86400/3600),s=Math.floor(n%3600/60);let i;return r>0?i=`expires in ${r}d ${o}h`:o>0?i=`expires in ${o}h ${s}m`:i=`expires in ${Math.max(1,s)}m`,{label:i,urgent:n<2*3600,expired:!1}}const jy={pending:"Pending",committed:"Approved",executed:"Executed",rejected:"Rejected",expired:"Expired"},ky={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 by(e){return e.split("__").pop()??e}function Ny(e){const t=e.toLowerCase();return t.includes("delete")||t.includes("refund")||t.includes("cancel")||t.includes("revoke")}const Ey=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]),zy=/^(image|img|photo|picture|thumbnail)(_?url)?$/i;function Py(e,t){return typeof t!="string"?!1:/^data:image\//i.test(t)?!0:zy.test(e)?/^https?:\/\//.test(t):/^https?:\/\/.+\.(jpe?g|png|gif|webp|svg|avif)(\?|$)/i.test(t)}function gi(e){if(e==null)return"—";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>gi(t)).join(", ");try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Qc({item:e,onApprove:t,onReject:n,resolving:r}){const o=e.kind==="proposal",s=o?e.proposal.status:"executed",i=o?e.proposal.tool:e.receipt.action,l=by(i),c=Ny(i),u=o?e.proposal.toolArgs:null,m=o?e.proposal.executionContext:e.receipt.executionContext,f=o?null:e.receipt.cumulativeState,v=u?Object.entries(u).filter(([x])=>!Ey.has(x)):[],y=Object.entries(m??{});return a.jsxs("div",{className:"card",children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.75rem",flexWrap:"wrap"},children:[a.jsx(Df,{profileId:e.profileId}),a.jsx("code",{style:{fontSize:"0.85rem"},children:l}),e.commitmentMode==="automatic"&&a.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"autonomous"}),a.jsxs("span",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"0.5rem"},children:[o&&s==="pending"&&(()=>{const x=Uf(e.proposal.expiresAt,Date.now());return a.jsx("span",{style:{fontSize:"0.72rem",color:x.urgent?"var(--warning)":"var(--text-tertiary)",fontWeight:x.urgent?600:400,whiteSpace:"nowrap"},children:x.label})})(),a.jsx("span",{className:`status-badge ${ky[s]}`,children:jy[s]}),a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:Cy(e.sortTimestamp)})]})]}),c&&a.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:[a.jsx("span",{children:"⚠"}),a.jsx("span",{children:"Irreversible action"})]}),o&&typeof(u==null?void 0:u._imagePreview)=="string"&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Preview"}),a.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)"}})]}),o&&v.length>0&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Arguments"}),a.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:v.map(([x,w])=>a.jsxs(d.Fragment,{children:[a.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:x}),a.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word",whiteSpace:"pre-wrap"},children:Py(x,w)?a.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 h=j.currentTarget,p=h.parentElement;if(!p)return;h.style.display="none";const g=document.createElement("span");g.textContent=w,g.style.color="var(--text-tertiary)",p.appendChild(g)}}):gi(w)})]},x))})]}),y.length>0&&a.jsx("div",{style:{marginBottom:"0.75rem",fontSize:"0.8rem",color:"var(--text-secondary)"},children:y.map(([x,w])=>`${x}=${gi(w)}`).join(" · ")}),f&&a.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}`:""]}),o&&s==="pending"&&a.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[a.jsx("button",{className:"btn btn-primary",onClick:()=>t==null?void 0:t(e.id),disabled:r,children:r?"Approving…":"Approve"}),a.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:()=>n==null?void 0:n(e.id),disabled:r,children:"Reject"})]}),a.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:[o?"Proposal":"Receipt",": ",e.id]})]})}const Ty=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]);function vi(e){if(e==null)return"—";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>vi(t)).join(", ");try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Iy(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 Ry({proposal:e,currentUserId:t,onAction:n,onMessage:r}){const[o,s]=d.useState(!1),[i,l]=d.useState(!1),[c,u]=d.useState(null),[m,f]=d.useState(!1),[v,y]=d.useState(null),[x,w]=d.useState(!1),j=e.tool.split("__").pop()??e.tool,h=Object.entries(e.toolArgs).filter(([B])=>!Ty.has(B)),p=Object.entries(e.executionContext),g=e.pendingApprovers??[],S=e.approvedBy??{},E=Object.keys(S).length,P=g.filter(B=>!(B in S)).length,k=t in S,N=async()=>{if(c===null){f(!0),y(null);try{const B=await O.getAttestationIntent(e.authorizationId);if(!B){y("Intent not available or you are not an authorized approver.");return}const _=await O.decryptIntent({intentCiphertext:B.intentCiphertext,encryptedKey:B.encryptedKey,approverId:t});u(_)}catch(B){y(B instanceof Error?B.message:"Failed to decrypt intent")}finally{f(!1)}}},C=async()=>{x?w(!1):(w(!0),await N())},T=async()=>{s(!0),r("");try{await O.approveProposal(e.id);try{if(c===null){const B=await O.getAttestationIntent(e.authorizationId);if(B){const _=await O.decryptIntent({intentCiphertext:B.intentCiphertext,encryptedKey:B.encryptedKey,approverId:t});u(_),await O.storeApprovedIntent(e.authorizationId,_)}}else await O.storeApprovedIntent(e.authorizationId,c)}catch{}r(`Approved. ${P-1>0?`${P-1} more approver(s) still needed.`:"All approvers signed off — action is ready to execute."}`),n()}catch(B){r(B instanceof Error?B.message:"Approval failed")}finally{s(!1)}},H=async()=>{const B=prompt("Rejection reason (optional):");if(B!==null){l(!0),r("");try{await O.rejectProposal(e.id,B||void 0),r("Action rejected."),n()}catch(_){r(_ instanceof Error?_.message:"Rejection failed")}finally{l(!1)}}},W=o||i;return a.jsxs("div",{className:"card",children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[a.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:Ee(e.profileId)}),a.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"}),a.jsxs("span",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"0.5rem"},children:[(()=>{const B=Uf(e.expiresAt,Date.now());return a.jsx("span",{style:{fontSize:"0.72rem",color:B.urgent?"var(--warning)":"var(--text-tertiary)",fontWeight:B.urgent?600:400,whiteSpace:"nowrap"},children:B.label})})(),a.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:Iy(e.createdAt)})]})]}),a.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(B=>{const _=B in S;return a.jsxs("span",{style:{marginLeft:"0.5rem",color:_?"var(--success, green)":"var(--text-tertiary)"},children:[_?"✓":"○"," ",B===t?"You":B]},B)})]}),a.jsxs("div",{style:{marginBottom:"0.5rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Proposed action"}),a.jsx("code",{style:{fontSize:"0.85rem"},children:j})]}),h.length>0&&a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Arguments"}),a.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:h.map(([B,_])=>a.jsxs(d.Fragment,{children:[a.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:B}),a.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word",whiteSpace:"pre-wrap"},children:vi(_)})]},B))})]}),p.length>0&&a.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:p.map(([B,_])=>`${B}=${vi(_)}`).join(" · ")}),a.jsxs("div",{style:{marginBottom:"0.75rem"},children:[a.jsxs("button",{className:"btn btn-ghost btn-sm",style:{padding:"0.2rem 0",fontSize:"0.75rem"},onClick:C,disabled:m,children:[x?"▲ Hide intent":"▼ Show intent",m&&" (decrypting...)"]}),x&&a.jsx("div",{style:{marginTop:"0.5rem",padding:"0.75rem",background:"var(--bg-main)",borderRadius:"0.375rem",border:"1px solid var(--border)"},children:v?a.jsx("p",{style:{color:"var(--danger)",fontSize:"0.8rem",margin:0},children:v}):c!==null?a.jsx("p",{style:{fontSize:"0.85rem",margin:0,whiteSpace:"pre-wrap",color:"var(--text-primary)"},children:c}):a.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.8rem",margin:0},children:"No intent available for this authority."})})]}),!k&&a.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.25rem"},children:[a.jsx("button",{className:"btn btn-primary",onClick:T,disabled:W,children:o?"Approving...":"Approve"}),a.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:H,disabled:W,children:i?"Rejecting...":"Reject"})]}),k&&a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"You approved this action. Waiting on other approvers."}),a.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["Proposal: ",e.id]})]})}function _y(){const{domain:e,user:t}=ze(),n=(t==null?void 0:t.id)??"",[r,o]=d.useState("awaiting-me"),[s,i]=d.useState([]),[l,c]=d.useState(!0),[u,m]=d.useState(""),f=d.useCallback(async()=>{try{const A=await O.getProposalsForApprover();i(A)}catch{}finally{c(!1)}},[]);fe("proposal-added",f),fe("proposal-approved",f),fe("proposal-rejected",f),fe("proposal-resolved",f),$t(f,3e4);const[v,y]=d.useState([]),x=d.useCallback(async()=>{try{const A=await O.getProposals(e||"owner");y(A)}catch{}},[e]);fe("proposal-added",x),fe("proposal-approved",x),fe("proposal-rejected",x),fe("proposal-resolved",x),$t(x,3e4,e);const w=d.useMemo(()=>v.filter(A=>{var I;return A.status==="pending"&&(((I=A.pendingApprovers)==null?void 0:I.length)??0)===0}),[v]),j=d.useMemo(()=>Yc(w,[],{status:"pending"}),[w]),[h,p]=d.useState([]),g=d.useCallback(async()=>{if(n)try{const I=(await O.getProposals(e||"owner")).filter(Y=>Y.status==="pending"&&Y.pendingApprovers&&Y.pendingApprovers.includes(n)&&Y.approvedBy&&n in Y.approvedBy);p(I)}catch{}},[n,e]);fe("proposal-approved",g),fe("proposal-rejected",g),$t(g,3e4,`${n}:${e}`),d.useEffect(()=>{f(),x(),g()},[]);const[S,E]=d.useState([]),[P,k]=d.useState([]),[N,C]=d.useState(!0),[T,H]=d.useState(null),[W,B]=d.useState(""),[_,D]=d.useState("pending"),[X,se]=d.useState(null),[z,R]=d.useState(!1),$=d.useCallback(async()=>{try{const{proposals:A,receipts:I}=await O.getThread({domain:e,status:_,sinceDays:7});E(A),k(I)}catch{}finally{C(!1)}},[e,_]);$t($,3e4,`${e}:${_}`);const L=async(A,I)=>{H(A),B("");try{const Y=e||"owner",xe=await O.resolveProposal(A,I,Y);B(I==="commit"?`Action approved. Status: ${xe.status}`:"Action rejected."),await Promise.all([$(),x()])}catch(Y){B(Y instanceof Error?Y.message:"Failed")}finally{H(null)}},V=d.useMemo(()=>{const A=new Set;for(const I of S)A.add(I.profileId);for(const I of P)A.add(I.profileId);return Array.from(A).sort()},[S,P]),ee=d.useMemo(()=>Yc(S,P,{status:_,profile:X??void 0,includeAutonomous:z}),[S,P,_,X,z]),J=d.useCallback(()=>{f(),g()},[f,g]),je=d.useMemo(()=>{const A=new Set,I=[];for(const Y of h)A.has(Y.id)||(A.add(Y.id),I.push(Y));return I.sort((Y,xe)=>xe.createdAt-Y.createdAt)},[h]),b=s.length+j.length,U=je.length;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"Pending Approvals"}),a.jsx("p",{className:"page-subtitle",children:"Actions awaiting approval, plus recent activity from the last 7 days."})]}),a.jsxs("div",{className:"nav-tabs",style:{marginBottom:"1rem"},children:[a.jsxs("button",{className:`nav-tab${r==="awaiting-me"?" active":""}`,onClick:()=>o("awaiting-me"),children:["Awaiting me ",b>0&&a.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:b})]}),a.jsxs("button",{className:`nav-tab${r==="awaiting-others"?" active":""}`,onClick:()=>o("awaiting-others"),children:["Awaiting others ",U>0&&a.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:U})]}),a.jsx("button",{className:`nav-tab${r==="all"?" active":""}`,onClick:()=>{o("all"),$()},children:"All"})]}),r==="awaiting-me"&&a.jsx(a.Fragment,{children:l&&b===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):b===0?a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[a.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions awaiting your approval."}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Review-mode actions and above-cap actions you must approve will appear here."})]}):a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(u||W)&&a.jsx("div",{className:"alert alert-success",children:u||W}),j.map(A=>a.jsx(Qc,{item:A,onApprove:I=>L(I,"commit"),onReject:I=>L(I,"reject"),resolving:T===A.id},A.id)),s.map(A=>a.jsx(Ry,{proposal:A,currentUserId:n,onAction:J,onMessage:m},A.id))]})}),r==="awaiting-others"&&a.jsx(a.Fragment,{children:je.length===0?a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[a.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions waiting on others."}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Actions you proposed or approved that are pending other approvers will appear here."})]}):a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:je.map(A=>a.jsx($y,{proposal:A,currentUserId:n,onCancel:async()=>{try{await O.rejectProposal(A.id,"cancelled by creator"),g(),x()}catch(I){alert(I instanceof Error?I.message:"Cancel failed")}}},A.id))})}),r==="all"&&a.jsxs(a.Fragment,{children:[W&&a.jsx("div",{className:"alert alert-success",style:{marginBottom:"1rem"},children:W}),a.jsxs("div",{className:"filter-chips",style:{marginBottom:"1rem"},children:[a.jsx("button",{className:`filter-chip ${_==="pending"?"selected":""}`,onClick:()=>D("pending"),children:"Pending"}),a.jsx("button",{className:`filter-chip ${_==="all"?"selected":""}`,onClick:()=>D("all"),children:"All"}),V.length>0&&a.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),V.map(A=>a.jsx("button",{className:`filter-chip ${X===A?"selected":""}`,onClick:()=>se(X===A?null:A),children:Ee(A)},A)),_==="all"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),a.jsxs("button",{className:`filter-chip ${z?"selected":""}`,onClick:()=>R(!z),title:"Include actions executed without human review (automatic commitment mode)",children:[z?"✓ ":"","Autonomous actions"]})]})]}),N&&ee.length===0?a.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):ee.length===0?a.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[a.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:_==="pending"?"No actions awaiting your approval.":"Nothing here yet."}),a.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:_==="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."})]}):a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:ee.map(A=>a.jsx(Qc,{item:A,onApprove:I=>L(I,"commit"),onReject:I=>L(I,"reject"),resolving:T===A.id},A.id))})]})]})}function Ay(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 $y({proposal:e,currentUserId:t,onCancel:n}){var u;const[r,o]=d.useState(!1),s=Object.keys(e.approvedBy??{}),i=(e.pendingApprovers??[]).filter(m=>!(m 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.")){o(!0);try{await n()}finally{o(!1)}}};return a.jsxs("div",{className:"card",children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[a.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:Ee(e.profileId)}),l&&a.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"}),a.jsx("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:Ay(e.createdAt)})]}),a.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:a.jsx("code",{children:e.tool.split("__").pop()??e.tool})}),l&&a.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[s.map(m=>a.jsx("span",{style:{marginRight:"0.75rem",color:"var(--success, green)"},children:m===t?"You approved":`${m} approved`},m)),i.map(m=>a.jsxs("span",{style:{marginRight:"0.75rem",color:"var(--text-tertiary)"},children:["Waiting on ",m===t?"you":m]},m))]}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:a.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--danger)"},onClick:c,disabled:r,children:r?"Cancelling...":"Cancel"})})]})}const Ly=`# Agent Brief
|
|
70
70
|
|
|
71
71
|
You act on my behalf through Suveren — the gateway that gates every
|
|
72
72
|
privileged tool call you make. Suveren implements the bounded-authority
|
|
@@ -102,4 +102,4 @@ executes. When you propose an action:
|
|
|
102
102
|
next.
|
|
103
103
|
- Never email anyone outside the company without asking first.
|
|
104
104
|
- When drafting posts, prefer plain language over marketing copy.
|
|
105
|
-
`;function
|
|
105
|
+
`;function My(){const[e,t]=d.useState(""),[n,r]=d.useState(""),[o,s]=d.useState(!0),[i,l]=d.useState(!1),[c,u]=d.useState(null),[m,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,N;if(S.defaultPrevented||S.button!==0||S.metaKey||S.ctrlKey||S.shiftKey||S.altKey)return;const E=(N=(k=S.target)==null?void 0:k.closest)==null?void 0:N.call(k,"a");if(!E||!E.href)return;let P;try{P=new URL(E.href)}catch{return}P.origin===window.location.origin&&P.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 O.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 O.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)},h=()=>{e.trim()&&!confirm("Replace current context with the starter template?")||t(Ly)};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"page-header",children:[a.jsx("h1",{className:"page-title",children:"Agent Brief"}),a.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()&&!o&&a.jsx("button",{className:"btn btn-primary btn-sm",onClick:h,disabled:i,title:"Insert a starter brief covering Suveren basics and example standing orders",style:{marginTop:"0.5rem"},children:"Insert starter template"})]}),c&&a.jsx("div",{className:c.kind==="ok"?"alert alert-success":"error-message",style:{marginBottom:"1rem"},children:c.text}),a.jsxs("div",{className:"intent-layout",style:{marginBottom:"1rem"},children:[a.jsx("div",{className:"card intent-pane chat",children:a.jsx(ga,{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…"})}),a.jsxs("div",{className:"card intent-pane document",children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.5rem"},children:[a.jsx("h3",{className:"card-title",style:{marginBottom:0},children:"context.md"}),a.jsxs("span",{style:{fontSize:"0.75rem",color:y>x?"var(--danger)":"var(--text-muted)"},children:[y.toLocaleString()," / ",x.toLocaleString()," bytes"]})]}),a.jsx("textarea",{className:"form-textarea",value:e,onChange:p=>t(p.target.value),placeholder:o?"Loading…":'Type your standing orders here, or click "Insert starter template" below.',disabled:o,rows:18,style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem",lineHeight:1.5,minHeight:"22rem"}}),a.jsxs("div",{className:"intent-footer",style:{marginTop:"0.75rem"},children:[a.jsx("button",{className:"btn btn-ghost",onClick:j,disabled:i||!v,children:"Revert"}),a.jsx("button",{className:"btn btn-primary",style:{flex:1},onClick:w,disabled:i||!v||y>x||o,children:i?"Saving…":"Save"})]})]}),a.jsx("button",{type:"button",className:"floating-help",onClick:()=>f(!0),"aria-label":"Open brief assistant",children:"Get help with brief"}),a.jsx(Mf,{open:m,onClose:()=>f(!1),ariaLabel:"Brief assistant",children:a.jsx(ga,{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 Fy({children:e}){const{user:t,mode:n,domain:r}=ze();return t?n==="team"&&!r?a.jsx(Yt,{to:"/onboarding",replace:!0}):a.jsx(a.Fragment,{children:e}):a.jsx(Yt,{to:"/login",replace:!0})}function Oy(){const{user:e}=ze();return a.jsxs(gg,{children:[a.jsx(Ce,{path:"/login",element:e?a.jsx(Yt,{to:"/",replace:!0}):a.jsx(vv,{})}),a.jsx(Ce,{path:"/onboarding",element:e?a.jsx(yv,{}):a.jsx(Yt,{to:"/login",replace:!0})}),a.jsxs(Ce,{element:a.jsx(Fy,{children:a.jsx(gv,{})}),children:[a.jsx(Ce,{path:"/",element:a.jsx(kv,{})}),a.jsx(Ce,{path:"/agent/new",element:a.jsx(Yt,{to:"/authorizations?new=1",replace:!0})}),a.jsx(Ce,{path:"/agent/gate",element:a.jsx(Gv,{})}),a.jsx(Ce,{path:"/agent/review",element:a.jsx(Xv,{})}),a.jsx(Ce,{path:"/integrations",element:a.jsx(ey,{})}),a.jsx(Ce,{path:"/groups",element:a.jsx(ty,{})}),a.jsx(Ce,{path:"/authorizations",element:a.jsx(my,{})}),a.jsx(Ce,{path:"/audit",element:a.jsx(yy,{})}),a.jsx(Ce,{path:"/proposals",element:a.jsx(_y,{})}),a.jsx(Ce,{path:"/agent-brief",element:a.jsx(My,{})}),a.jsx(Ce,{path:"/settings",element:a.jsx(xy,{})}),a.jsx(Ce,{path:"/settings/services",element:a.jsx(Yt,{to:"/settings",replace:!0})}),a.jsx(Ce,{path:"/deploy",element:a.jsx(Yt,{to:"/integrations",replace:!0})})]}),a.jsx(Ce,{path:"*",element:a.jsx(Yt,{to:"/",replace:!0})})]})}function By(){return a.jsx(Dg,{children:a.jsx(Xg,{children:a.jsx(qg,{children:a.jsx(Oy,{})})})})}uf(document.getElementById("root")).render(a.jsx(d.StrictMode,{children:a.jsx(By,{})}));
|