@suveren/gateway 0.6.2 → 0.6.4
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.
- package/content/integrations/calendar.json +6 -3
- package/content/integrations/crm.json +6 -3
- package/content/integrations/deploy-github.json +5 -1
- package/content/integrations/gmail.json +16 -6
- package/content/integrations/linkedin.json +75 -16
- package/content/integrations/records.json +76 -14
- package/dist/mcp-server/http.mjs +215 -28
- package/dist/ui/assets/index-DIcuh0I4.css +1 -0
- package/dist/ui/assets/index-Dl5isaOV.js +105 -0
- package/dist/ui/index.html +2 -2
- package/dist/ui/mockups/audit-and-header.html +192 -0
- package/node_modules/@hap/core/dist/index.d.mts +139 -6
- package/node_modules/@hap/core/dist/index.d.ts +139 -6
- package/node_modules/@hap/core/dist/index.js +93 -0
- package/node_modules/@hap/core/dist/index.mjs +88 -0
- package/node_modules/@hap/core/package.json +1 -1
- package/node_modules/@hap/core/src/content-binding.ts +168 -0
- package/node_modules/@hap/core/src/types.ts +85 -5
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +8 -0
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +1 -1
- package/node_modules/jose/dist/webapi/jwks/local.js +3 -3
- package/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +3 -3
- package/node_modules/jose/dist/webapi/key/generate_secret.js +2 -2
- package/node_modules/jose/dist/webapi/lib/asn1.js +3 -3
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +6 -15
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +2 -5
- package/node_modules/jose/dist/webapi/lib/key.js +1 -1
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +8 -8
- package/node_modules/jose/package.json +1 -1
- package/package.json +2 -2
- package/profiles/deploy/0.7.profile.json +2 -1
- package/profiles/email/0.5.profile.json +200 -0
- package/profiles/index.json +1 -0
- package/dist/ui/assets/index-DoZvxHLN.js +0 -105
- package/dist/ui/assets/index-JHaCddDE.css +0 -1
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
var Qf=Object.defineProperty;var Jf=(e,t,n)=>t in e?Qf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Fs=(e,t,n)=>Jf(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();var qc={exports:{}},xs={},Zc={exports:{}},se={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var aa=Symbol.for("react.element"),Xf=Symbol.for("react.portal"),qf=Symbol.for("react.fragment"),Zf=Symbol.for("react.strict_mode"),em=Symbol.for("react.profiler"),tm=Symbol.for("react.provider"),nm=Symbol.for("react.context"),rm=Symbol.for("react.forward_ref"),am=Symbol.for("react.suspense"),sm=Symbol.for("react.memo"),om=Symbol.for("react.lazy"),Cl=Symbol.iterator;function im(e){return e===null||typeof e!="object"?null:(e=Cl&&e[Cl]||e["@@iterator"],typeof e=="function"?e:null)}var eu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},tu=Object.assign,nu={};function ur(e,t,n){this.props=e,this.context=t,this.refs=nu,this.updater=n||eu}ur.prototype.isReactComponent={};ur.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")};ur.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function ru(){}ru.prototype=ur.prototype;function Si(e,t,n){this.props=e,this.context=t,this.refs=nu,this.updater=n||eu}var ji=Si.prototype=new ru;ji.constructor=Si;tu(ji,ur.prototype);ji.isPureReactComponent=!0;var Nl=Array.isArray,au=Object.prototype.hasOwnProperty,ki={current:null},su={key:!0,ref:!0,__self:!0,__source:!0};function ou(e,t,n){var r,a={},o=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(o=""+t.key),t)au.call(t,r)&&!su.hasOwnProperty(r)&&(a[r]=t[r]);var l=arguments.length-2;if(l===1)a.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];a.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)a[r]===void 0&&(a[r]=l[r]);return{$$typeof:aa,type:e,key:o,ref:i,props:a,_owner:ki.current}}function lm(e,t){return{$$typeof:aa,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function bi(e){return typeof e=="object"&&e!==null&&e.$$typeof===aa}function cm(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var El=/\/+/g;function Os(e,t){return typeof e=="object"&&e!==null&&e.key!=null?cm(""+e.key):t.toString(36)}function Pa(e,t,n,r,a){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(o){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case aa:case Xf:i=!0}}if(i)return i=e,a=a(i),e=r===""?"."+Os(i,0):r,Nl(a)?(n="",e!=null&&(n=e.replace(El,"$&/")+"/"),Pa(a,t,n,"",function(d){return d})):a!=null&&(bi(a)&&(a=lm(a,n+(!a.key||i&&i.key===a.key?"":(""+a.key).replace(El,"$&/")+"/")+e)),t.push(a)),1;if(i=0,r=r===""?".":r+":",Nl(e))for(var l=0;l<e.length;l++){o=e[l];var c=r+Os(o,l);i+=Pa(o,t,n,c,a)}else if(c=im(e),typeof c=="function")for(e=c.call(e),l=0;!(o=e.next()).done;)o=o.value,c=r+Os(o,l++),i+=Pa(o,t,n,c,a);else if(o==="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 da(e,t,n){if(e==null)return e;var r=[],a=0;return Pa(e,r,"","",function(o){return t.call(n,o,a++)}),r}function um(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 Qe={current:null},Ra={transition:null},dm={ReactCurrentDispatcher:Qe,ReactCurrentBatchConfig:Ra,ReactCurrentOwner:ki};function iu(){throw Error("act(...) is not supported in production builds of React.")}se.Children={map:da,forEach:function(e,t,n){da(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return da(e,function(){t++}),t},toArray:function(e){return da(e,function(t){return t})||[]},only:function(e){if(!bi(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};se.Component=ur;se.Fragment=qf;se.Profiler=em;se.PureComponent=Si;se.StrictMode=Zf;se.Suspense=am;se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=dm;se.act=iu;se.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=tu({},e.props),a=e.key,o=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,i=ki.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)au.call(t,c)&&!su.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 d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:aa,type:e.type,key:a,ref:o,props:r,_owner:i}};se.createContext=function(e){return e={$$typeof:nm,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:tm,_context:e},e.Consumer=e};se.createElement=ou;se.createFactory=function(e){var t=ou.bind(null,e);return t.type=e,t};se.createRef=function(){return{current:null}};se.forwardRef=function(e){return{$$typeof:rm,render:e}};se.isValidElement=bi;se.lazy=function(e){return{$$typeof:om,_payload:{_status:-1,_result:e},_init:um}};se.memo=function(e,t){return{$$typeof:sm,type:e,compare:t===void 0?null:t}};se.startTransition=function(e){var t=Ra.transition;Ra.transition={};try{e()}finally{Ra.transition=t}};se.unstable_act=iu;se.useCallback=function(e,t){return Qe.current.useCallback(e,t)};se.useContext=function(e){return Qe.current.useContext(e)};se.useDebugValue=function(){};se.useDeferredValue=function(e){return Qe.current.useDeferredValue(e)};se.useEffect=function(e,t){return Qe.current.useEffect(e,t)};se.useId=function(){return Qe.current.useId()};se.useImperativeHandle=function(e,t,n){return Qe.current.useImperativeHandle(e,t,n)};se.useInsertionEffect=function(e,t){return Qe.current.useInsertionEffect(e,t)};se.useLayoutEffect=function(e,t){return Qe.current.useLayoutEffect(e,t)};se.useMemo=function(e,t){return Qe.current.useMemo(e,t)};se.useReducer=function(e,t,n){return Qe.current.useReducer(e,t,n)};se.useRef=function(e){return Qe.current.useRef(e)};se.useState=function(e){return Qe.current.useState(e)};se.useSyncExternalStore=function(e,t,n){return Qe.current.useSyncExternalStore(e,t,n)};se.useTransition=function(){return Qe.current.useTransition()};se.version="18.3.1";Zc.exports=se;var u=Zc.exports;/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var fm=u,mm=Symbol.for("react.element"),pm=Symbol.for("react.fragment"),hm=Object.prototype.hasOwnProperty,gm=fm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ym={key:!0,ref:!0,__self:!0,__source:!0};function lu(e,t,n){var r,a={},o=null,i=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)hm.call(t,r)&&!ym.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)a[r]===void 0&&(a[r]=t[r]);return{$$typeof:mm,type:e,key:o,ref:i,props:a,_owner:gm.current}}xs.Fragment=pm;xs.jsx=lu;xs.jsxs=lu;qc.exports=xs;var s=qc.exports,cu={exports:{}},ct={},uu={exports:{}},du={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(L,R){var D=L.length;L.push(R);e:for(;0<D;){var C=D-1>>>1,_=L[C];if(0<a(_,R))L[C]=R,L[D]=_,D=C;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var R=L[0],D=L.pop();if(D!==R){L[0]=D;e:for(var C=0,_=L.length,H=_>>>1;C<H;){var B=2*(C+1)-1,ie=L[B],I=B+1,Y=L[I];if(0>a(ie,D))I<_&&0>a(Y,ie)?(L[C]=Y,L[I]=D,C=I):(L[C]=ie,L[B]=D,C=B);else if(I<_&&0>a(Y,D))L[C]=Y,L[I]=D,C=I;else break e}}return R}function a(L,R){var D=L.sortIndex-R.sortIndex;return D!==0?D:L.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var c=[],d=[],f=1,g=null,p=3,x=!1,w=!1,v=!1,j=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,m=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(L){for(var R=n(d);R!==null;){if(R.callback===null)r(d);else if(R.startTime<=L)r(d),R.sortIndex=R.expirationTime,t(c,R);else break;R=n(d)}}function S(L){if(v=!1,y(L),!w)if(n(c)!==null)w=!0,X(b);else{var R=n(d);R!==null&&re(S,R.startTime-L)}}function b(L,R){w=!1,v&&(v=!1,h(P),P=-1),x=!0;var D=p;try{for(y(R),g=n(c);g!==null&&(!(g.expirationTime>R)||L&&!O());){var C=g.callback;if(typeof C=="function"){g.callback=null,p=g.priorityLevel;var _=C(g.expirationTime<=R);R=e.unstable_now(),typeof _=="function"?g.callback=_:g===n(c)&&r(c),y(R)}else r(c);g=n(c)}if(g!==null)var H=!0;else{var B=n(d);B!==null&&re(S,B.startTime-R),H=!1}return H}finally{g=null,p=D,x=!1}}var T=!1,E=null,P=-1,k=5,z=-1;function O(){return!(e.unstable_now()-z<k)}function K(){if(E!==null){var L=e.unstable_now();z=L;var R=!0;try{R=E(!0,L)}finally{R?V():(T=!1,E=null)}}else T=!1}var V;if(typeof m=="function")V=function(){m(K)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,N=U.port2;U.port1.onmessage=K,V=function(){N.postMessage(null)}}else V=function(){j(K,0)};function X(L){E=L,T||(T=!0,V())}function re(L,R){P=j(function(){L(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(L){L.callback=null},e.unstable_continueExecution=function(){w||x||(w=!0,X(b))},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(L){switch(p){case 1:case 2:case 3:var R=3;break;default:R=p}var D=p;p=R;try{return L()}finally{p=D}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(L,R){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var D=p;p=L;try{return R()}finally{p=D}},e.unstable_scheduleCallback=function(L,R,D){var C=e.unstable_now();switch(typeof D=="object"&&D!==null?(D=D.delay,D=typeof D=="number"&&0<D?C+D:C):D=C,L){case 1:var _=-1;break;case 2:_=250;break;case 5:_=1073741823;break;case 4:_=1e4;break;default:_=5e3}return _=D+_,L={id:f++,callback:R,priorityLevel:L,startTime:D,expirationTime:_,sortIndex:-1},D>C?(L.sortIndex=D,t(d,L),n(c)===null&&L===n(d)&&(v?(h(P),P=-1):v=!0,re(S,D-C))):(L.sortIndex=_,t(c,L),w||x||(w=!0,X(b))),L},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(L){var R=p;return function(){var D=p;p=R;try{return L.apply(this,arguments)}finally{p=D}}}})(du);uu.exports=du;var vm=uu.exports;/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var xm=u,lt=vm;function F(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 fu=new Set,Br={};function $n(e,t){rr(e,t),rr(e+"Capture",t)}function rr(e,t){for(Br[e]=t,e=0;e<t.length;e++)fu.add(t[e])}var Wt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wo=Object.prototype.hasOwnProperty,wm=/^[: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]*$/,Tl={},zl={};function Sm(e){return wo.call(zl,e)?!0:wo.call(Tl,e)?!1:wm.test(e)?zl[e]=!0:(Tl[e]=!0,!1)}function jm(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 km(e,t,n,r){if(t===null||typeof t>"u"||jm(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 Je(e,t,n,r,a,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var Oe={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Oe[e]=new Je(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Oe[t]=new Je(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Oe[e]=new Je(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Oe[e]=new Je(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){Oe[e]=new Je(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Oe[e]=new Je(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Oe[e]=new Je(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Oe[e]=new Je(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Oe[e]=new Je(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ci=/[\-:]([a-z])/g;function Ni(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(Ci,Ni);Oe[t]=new Je(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(Ci,Ni);Oe[t]=new Je(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(Ci,Ni);Oe[t]=new Je(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Oe[e]=new Je(e,1,!1,e.toLowerCase(),null,!1,!1)});Oe.xlinkHref=new Je("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Oe[e]=new Je(e,1,!1,e.toLowerCase(),null,!0,!0)});function Ei(e,t,n,r){var a=Oe.hasOwnProperty(t)?Oe[t]:null;(a!==null?a.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(km(t,n,a,r)&&(n=null),r||a===null?Sm(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):a.mustUseProperty?e[a.propertyName]=n===null?a.type===3?!1:"":n:(t=a.attributeName,r=a.attributeNamespace,n===null?e.removeAttribute(t):(a=a.type,n=a===3||a===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Yt=xm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,fa=Symbol.for("react.element"),On=Symbol.for("react.portal"),Bn=Symbol.for("react.fragment"),Ti=Symbol.for("react.strict_mode"),So=Symbol.for("react.profiler"),mu=Symbol.for("react.provider"),pu=Symbol.for("react.context"),zi=Symbol.for("react.forward_ref"),jo=Symbol.for("react.suspense"),ko=Symbol.for("react.suspense_list"),Ii=Symbol.for("react.memo"),Xt=Symbol.for("react.lazy"),hu=Symbol.for("react.offscreen"),Il=Symbol.iterator;function gr(e){return e===null||typeof e!="object"?null:(e=Il&&e[Il]||e["@@iterator"],typeof e=="function"?e:null)}var je=Object.assign,Bs;function Cr(e){if(Bs===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Bs=t&&t[1]||""}return`
|
|
34
|
-
`+Bs+e}var Ds=!1;function Us(e,t){if(!e||Ds)return"";Ds=!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(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var a=d.stack.split(`
|
|
35
|
-
`),o=r.stack.split(`
|
|
36
|
-
`),i=a.length-1,l=o.length-1;1<=i&&0<=l&&a[i]!==o[l];)l--;for(;1<=i&&0<=l;i--,l--)if(a[i]!==o[l]){if(i!==1||l!==1)do if(i--,l--,0>l||a[i]!==o[l]){var c=`
|
|
37
|
-
`+a[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=i&&0<=l);break}}}finally{Ds=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Cr(e):""}function bm(e){switch(e.tag){case 5:return Cr(e.type);case 16:return Cr("Lazy");case 13:return Cr("Suspense");case 19:return Cr("SuspenseList");case 0:case 2:case 15:return e=Us(e.type,!1),e;case 11:return e=Us(e.type.render,!1),e;case 1:return e=Us(e.type,!0),e;default:return""}}function bo(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 Bn:return"Fragment";case On:return"Portal";case So:return"Profiler";case Ti:return"StrictMode";case jo:return"Suspense";case ko:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case pu:return(e.displayName||"Context")+".Consumer";case mu:return(e._context.displayName||"Context")+".Provider";case zi:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ii:return t=e.displayName||null,t!==null?t:bo(e.type)||"Memo";case Xt:t=e._payload,e=e._init;try{return bo(e(t))}catch{}}return null}function Cm(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 bo(t);case 8:return t===Ti?"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 mn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function gu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Nm(e){var t=gu(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(i){r=""+i,o.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 ma(e){e._valueTracker||(e._valueTracker=Nm(e))}function yu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=gu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ka(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 Co(e,t){var n=t.checked;return je({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Pl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=mn(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 vu(e,t){t=t.checked,t!=null&&Ei(e,"checked",t,!1)}function No(e,t){vu(e,t);var n=mn(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")?Eo(e,t.type,n):t.hasOwnProperty("defaultValue")&&Eo(e,t.type,mn(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Rl(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 Eo(e,t,n){(t!=="number"||Ka(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Nr=Array.isArray;function Xn(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+mn(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function To(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(F(91));return je({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function _l(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(F(92));if(Nr(n)){if(1<n.length)throw Error(F(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:mn(n)}}function xu(e,t){var n=mn(t.value),r=mn(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 Al(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function wu(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 zo(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?wu(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var pa,Su=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,a){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,a)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(pa=pa||document.createElement("div"),pa.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=pa.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Dr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ir={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},Em=["Webkit","ms","Moz","O"];Object.keys(Ir).forEach(function(e){Em.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ir[t]=Ir[e]})});function ju(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ir.hasOwnProperty(e)&&Ir[e]?(""+t).trim():t+"px"}function ku(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=ju(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var Tm=je({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 Io(e,t){if(t){if(Tm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(F(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(F(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(F(61))}if(t.style!=null&&typeof t.style!="object")throw Error(F(62))}}function Po(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 Ro=null;function Pi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var _o=null,qn=null,Zn=null;function $l(e){if(e=ia(e)){if(typeof _o!="function")throw Error(F(280));var t=e.stateNode;t&&(t=bs(t),_o(e.stateNode,e.type,t))}}function bu(e){qn?Zn?Zn.push(e):Zn=[e]:qn=e}function Cu(){if(qn){var e=qn,t=Zn;if(Zn=qn=null,$l(e),t)for(e=0;e<t.length;e++)$l(t[e])}}function Nu(e,t){return e(t)}function Eu(){}var Ws=!1;function Tu(e,t,n){if(Ws)return e(t,n);Ws=!0;try{return Nu(e,t,n)}finally{Ws=!1,(qn!==null||Zn!==null)&&(Eu(),Cu())}}function Ur(e,t){var n=e.stateNode;if(n===null)return null;var r=bs(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(F(231,t,typeof n));return n}var Ao=!1;if(Wt)try{var yr={};Object.defineProperty(yr,"passive",{get:function(){Ao=!0}}),window.addEventListener("test",yr,yr),window.removeEventListener("test",yr,yr)}catch{Ao=!1}function zm(e,t,n,r,a,o,i,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(f){this.onError(f)}}var Pr=!1,Ga=null,Ya=!1,$o=null,Im={onError:function(e){Pr=!0,Ga=e}};function Pm(e,t,n,r,a,o,i,l,c){Pr=!1,Ga=null,zm.apply(Im,arguments)}function Rm(e,t,n,r,a,o,i,l,c){if(Pm.apply(this,arguments),Pr){if(Pr){var d=Ga;Pr=!1,Ga=null}else throw Error(F(198));Ya||(Ya=!0,$o=d)}}function Ln(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 zu(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 Ll(e){if(Ln(e)!==e)throw Error(F(188))}function _m(e){var t=e.alternate;if(!t){if(t=Ln(e),t===null)throw Error(F(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return Ll(a),e;if(o===r)return Ll(a),t;o=o.sibling}throw Error(F(188))}if(n.return!==r.return)n=a,r=o;else{for(var i=!1,l=a.child;l;){if(l===n){i=!0,n=a,r=o;break}if(l===r){i=!0,r=a,n=o;break}l=l.sibling}if(!i){for(l=o.child;l;){if(l===n){i=!0,n=o,r=a;break}if(l===r){i=!0,r=o,n=a;break}l=l.sibling}if(!i)throw Error(F(189))}}if(n.alternate!==r)throw Error(F(190))}if(n.tag!==3)throw Error(F(188));return n.stateNode.current===n?e:t}function Iu(e){return e=_m(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 Ru=lt.unstable_scheduleCallback,Ml=lt.unstable_cancelCallback,Am=lt.unstable_shouldYield,$m=lt.unstable_requestPaint,Ne=lt.unstable_now,Lm=lt.unstable_getCurrentPriorityLevel,Ri=lt.unstable_ImmediatePriority,_u=lt.unstable_UserBlockingPriority,Qa=lt.unstable_NormalPriority,Mm=lt.unstable_LowPriority,Au=lt.unstable_IdlePriority,ws=null,$t=null;function Fm(e){if($t&&typeof $t.onCommitFiberRoot=="function")try{$t.onCommitFiberRoot(ws,e,void 0,(e.current.flags&128)===128)}catch{}}var Nt=Math.clz32?Math.clz32:Dm,Om=Math.log,Bm=Math.LN2;function Dm(e){return e>>>=0,e===0?32:31-(Om(e)/Bm|0)|0}var ha=64,ga=4194304;function Er(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 Ja(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,a=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~a;l!==0?r=Er(l):(o&=i,o!==0&&(r=Er(o)))}else i=n&~a,i!==0?r=Er(i):o!==0&&(r=Er(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,o=t&-t,a>=o||a===16&&(o&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-Nt(t),a=1<<n,r|=e[n],t&=~a;return r}function Um(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 Wm(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-Nt(o),l=1<<i,c=a[i];c===-1?(!(l&n)||l&r)&&(a[i]=Um(l,t)):c<=t&&(e.expiredLanes|=l),o&=~l}}function Lo(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function $u(){var e=ha;return ha<<=1,!(ha&4194240)&&(ha=64),e}function Hs(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function sa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Nt(t),e[t]=n}function Hm(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-Nt(n),o=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~o}}function _i(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Nt(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var de=0;function Lu(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Mu,Ai,Fu,Ou,Bu,Mo=!1,ya=[],an=null,sn=null,on=null,Wr=new Map,Hr=new Map,en=[],Vm="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 Fl(e,t){switch(e){case"focusin":case"focusout":an=null;break;case"dragenter":case"dragleave":sn=null;break;case"mouseover":case"mouseout":on=null;break;case"pointerover":case"pointerout":Wr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hr.delete(t.pointerId)}}function vr(e,t,n,r,a,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[a]},t!==null&&(t=ia(t),t!==null&&Ai(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function Km(e,t,n,r,a){switch(t){case"focusin":return an=vr(an,e,t,n,r,a),!0;case"dragenter":return sn=vr(sn,e,t,n,r,a),!0;case"mouseover":return on=vr(on,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return Wr.set(o,vr(Wr.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,Hr.set(o,vr(Hr.get(o)||null,e,t,n,r,a)),!0}return!1}function Du(e){var t=bn(e.target);if(t!==null){var n=Ln(t);if(n!==null){if(t=n.tag,t===13){if(t=zu(n),t!==null){e.blockedOn=t,Bu(e.priority,function(){Fu(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 _a(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Fo(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ro=r,n.target.dispatchEvent(r),Ro=null}else return t=ia(n),t!==null&&Ai(t),e.blockedOn=n,!1;t.shift()}return!0}function Ol(e,t,n){_a(e)&&n.delete(t)}function Gm(){Mo=!1,an!==null&&_a(an)&&(an=null),sn!==null&&_a(sn)&&(sn=null),on!==null&&_a(on)&&(on=null),Wr.forEach(Ol),Hr.forEach(Ol)}function xr(e,t){e.blockedOn===t&&(e.blockedOn=null,Mo||(Mo=!0,lt.unstable_scheduleCallback(lt.unstable_NormalPriority,Gm)))}function Vr(e){function t(a){return xr(a,e)}if(0<ya.length){xr(ya[0],e);for(var n=1;n<ya.length;n++){var r=ya[n];r.blockedOn===e&&(r.blockedOn=null)}}for(an!==null&&xr(an,e),sn!==null&&xr(sn,e),on!==null&&xr(on,e),Wr.forEach(t),Hr.forEach(t),n=0;n<en.length;n++)r=en[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<en.length&&(n=en[0],n.blockedOn===null);)Du(n),n.blockedOn===null&&en.shift()}var er=Yt.ReactCurrentBatchConfig,Xa=!0;function Ym(e,t,n,r){var a=de,o=er.transition;er.transition=null;try{de=1,$i(e,t,n,r)}finally{de=a,er.transition=o}}function Qm(e,t,n,r){var a=de,o=er.transition;er.transition=null;try{de=4,$i(e,t,n,r)}finally{de=a,er.transition=o}}function $i(e,t,n,r){if(Xa){var a=Fo(e,t,n,r);if(a===null)eo(e,t,r,qa,n),Fl(e,r);else if(Km(a,e,t,n,r))r.stopPropagation();else if(Fl(e,r),t&4&&-1<Vm.indexOf(e)){for(;a!==null;){var o=ia(a);if(o!==null&&Mu(o),o=Fo(e,t,n,r),o===null&&eo(e,t,r,qa,n),o===a)break;a=o}a!==null&&r.stopPropagation()}else eo(e,t,r,null,n)}}var qa=null;function Fo(e,t,n,r){if(qa=null,e=Pi(r),e=bn(e),e!==null)if(t=Ln(e),t===null)e=null;else if(n=t.tag,n===13){if(e=zu(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 qa=e,null}function Uu(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(Lm()){case Ri:return 1;case _u:return 4;case Qa:case Mm:return 16;case Au:return 536870912;default:return 16}default:return 16}}var nn=null,Li=null,Aa=null;function Wu(){if(Aa)return Aa;var e,t=Li,n=t.length,r,a="value"in nn?nn.value:nn.textContent,o=a.length;for(e=0;e<n&&t[e]===a[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===a[o-r];r++);return Aa=a.slice(e,1<r?1-r:void 0)}function $a(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 va(){return!0}function Bl(){return!1}function ut(e){function t(n,r,a,o,i){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=o,this.target=i,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?va:Bl,this.isPropagationStopped=Bl,this}return je(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=va)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=va)},persist:function(){},isPersistent:va}),t}var dr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Mi=ut(dr),oa=je({},dr,{view:0,detail:0}),Jm=ut(oa),Vs,Ks,wr,Ss=je({},oa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fi,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!==wr&&(wr&&e.type==="mousemove"?(Vs=e.screenX-wr.screenX,Ks=e.screenY-wr.screenY):Ks=Vs=0,wr=e),Vs)},movementY:function(e){return"movementY"in e?e.movementY:Ks}}),Dl=ut(Ss),Xm=je({},Ss,{dataTransfer:0}),qm=ut(Xm),Zm=je({},oa,{relatedTarget:0}),Gs=ut(Zm),ep=je({},dr,{animationName:0,elapsedTime:0,pseudoElement:0}),tp=ut(ep),np=je({},dr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),rp=ut(np),ap=je({},dr,{data:0}),Ul=ut(ap),sp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},op={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"},ip={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ip[e])?!!t[e]:!1}function Fi(){return lp}var cp=je({},oa,{key:function(e){if(e.key){var t=sp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=$a(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?op[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fi,charCode:function(e){return e.type==="keypress"?$a(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?$a(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),up=ut(cp),dp=je({},Ss,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wl=ut(dp),fp=je({},oa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fi}),mp=ut(fp),pp=je({},dr,{propertyName:0,elapsedTime:0,pseudoElement:0}),hp=ut(pp),gp=je({},Ss,{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}),yp=ut(gp),vp=[9,13,27,32],Oi=Wt&&"CompositionEvent"in window,Rr=null;Wt&&"documentMode"in document&&(Rr=document.documentMode);var xp=Wt&&"TextEvent"in window&&!Rr,Hu=Wt&&(!Oi||Rr&&8<Rr&&11>=Rr),Hl=" ",Vl=!1;function Vu(e,t){switch(e){case"keyup":return vp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ku(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Dn=!1;function wp(e,t){switch(e){case"compositionend":return Ku(t);case"keypress":return t.which!==32?null:(Vl=!0,Hl);case"textInput":return e=t.data,e===Hl&&Vl?null:e;default:return null}}function Sp(e,t){if(Dn)return e==="compositionend"||!Oi&&Vu(e,t)?(e=Wu(),Aa=Li=nn=null,Dn=!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 Hu&&t.locale!=="ko"?null:t.data;default:return null}}var jp={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 Kl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!jp[e.type]:t==="textarea"}function Gu(e,t,n,r){bu(r),t=Za(t,"onChange"),0<t.length&&(n=new Mi("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var _r=null,Kr=null;function kp(e){ad(e,0)}function js(e){var t=Hn(e);if(yu(t))return e}function bp(e,t){if(e==="change")return t}var Yu=!1;if(Wt){var Ys;if(Wt){var Qs="oninput"in document;if(!Qs){var Gl=document.createElement("div");Gl.setAttribute("oninput","return;"),Qs=typeof Gl.oninput=="function"}Ys=Qs}else Ys=!1;Yu=Ys&&(!document.documentMode||9<document.documentMode)}function Yl(){_r&&(_r.detachEvent("onpropertychange",Qu),Kr=_r=null)}function Qu(e){if(e.propertyName==="value"&&js(Kr)){var t=[];Gu(t,Kr,e,Pi(e)),Tu(kp,t)}}function Cp(e,t,n){e==="focusin"?(Yl(),_r=t,Kr=n,_r.attachEvent("onpropertychange",Qu)):e==="focusout"&&Yl()}function Np(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return js(Kr)}function Ep(e,t){if(e==="click")return js(t)}function Tp(e,t){if(e==="input"||e==="change")return js(t)}function zp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Tt=typeof Object.is=="function"?Object.is:zp;function Gr(e,t){if(Tt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!wo.call(t,a)||!Tt(e[a],t[a]))return!1}return!0}function Ql(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Jl(e,t){var n=Ql(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=Ql(n)}}function Ju(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ju(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Xu(){for(var e=window,t=Ka();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ka(e.document)}return t}function Bi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Ip(e){var t=Xu(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ju(n.ownerDocument.documentElement,n)){if(r!==null&&Bi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,o=Math.min(r.start,a);r=r.end===void 0?o:Math.min(r.end,a),!e.extend&&o>r&&(a=r,r=o,o=a),a=Jl(n,o);var i=Jl(n,r);a&&i&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),o>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 Pp=Wt&&"documentMode"in document&&11>=document.documentMode,Un=null,Oo=null,Ar=null,Bo=!1;function Xl(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bo||Un==null||Un!==Ka(r)||(r=Un,"selectionStart"in r&&Bi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ar&&Gr(Ar,r)||(Ar=r,r=Za(Oo,"onSelect"),0<r.length&&(t=new Mi("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Un)))}function xa(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Wn={animationend:xa("Animation","AnimationEnd"),animationiteration:xa("Animation","AnimationIteration"),animationstart:xa("Animation","AnimationStart"),transitionend:xa("Transition","TransitionEnd")},Js={},qu={};Wt&&(qu=document.createElement("div").style,"AnimationEvent"in window||(delete Wn.animationend.animation,delete Wn.animationiteration.animation,delete Wn.animationstart.animation),"TransitionEvent"in window||delete Wn.transitionend.transition);function ks(e){if(Js[e])return Js[e];if(!Wn[e])return e;var t=Wn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in qu)return Js[e]=t[n];return e}var Zu=ks("animationend"),ed=ks("animationiteration"),td=ks("animationstart"),nd=ks("transitionend"),rd=new Map,ql="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 hn(e,t){rd.set(e,t),$n(t,[e])}for(var Xs=0;Xs<ql.length;Xs++){var qs=ql[Xs],Rp=qs.toLowerCase(),_p=qs[0].toUpperCase()+qs.slice(1);hn(Rp,"on"+_p)}hn(Zu,"onAnimationEnd");hn(ed,"onAnimationIteration");hn(td,"onAnimationStart");hn("dblclick","onDoubleClick");hn("focusin","onFocus");hn("focusout","onBlur");hn(nd,"onTransitionEnd");rr("onMouseEnter",["mouseout","mouseover"]);rr("onMouseLeave",["mouseout","mouseover"]);rr("onPointerEnter",["pointerout","pointerover"]);rr("onPointerLeave",["pointerout","pointerover"]);$n("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));$n("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));$n("onBeforeInput",["compositionend","keypress","textInput","paste"]);$n("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));$n("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));$n("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tr="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(" "),Ap=new Set("cancel close invalid load scroll toggle".split(" ").concat(Tr));function Zl(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Rm(r,t,void 0,e),e.currentTarget=null}function ad(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==o&&a.isPropagationStopped())break e;Zl(a,l,d),o=c}else for(i=0;i<r.length;i++){if(l=r[i],c=l.instance,d=l.currentTarget,l=l.listener,c!==o&&a.isPropagationStopped())break e;Zl(a,l,d),o=c}}}if(Ya)throw e=$o,Ya=!1,$o=null,e}function he(e,t){var n=t[Vo];n===void 0&&(n=t[Vo]=new Set);var r=e+"__bubble";n.has(r)||(sd(t,e,2,!1),n.add(r))}function Zs(e,t,n){var r=0;t&&(r|=4),sd(n,e,r,t)}var wa="_reactListening"+Math.random().toString(36).slice(2);function Yr(e){if(!e[wa]){e[wa]=!0,fu.forEach(function(n){n!=="selectionchange"&&(Ap.has(n)||Zs(n,!1,e),Zs(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wa]||(t[wa]=!0,Zs("selectionchange",!1,t))}}function sd(e,t,n,r){switch(Uu(t)){case 1:var a=Ym;break;case 4:a=Qm;break;default:a=$i}n=a.bind(null,t,n,e),a=void 0,!Ao||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function eo(e,t,n,r,a){var o=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var l=r.stateNode.containerInfo;if(l===a||l.nodeType===8&&l.parentNode===a)break;if(i===4)for(i=r.return;i!==null;){var c=i.tag;if((c===3||c===4)&&(c=i.stateNode.containerInfo,c===a||c.nodeType===8&&c.parentNode===a))return;i=i.return}for(;l!==null;){if(i=bn(l),i===null)return;if(c=i.tag,c===5||c===6){r=o=i;continue e}l=l.parentNode}}r=r.return}Tu(function(){var d=o,f=Pi(n),g=[];e:{var p=rd.get(e);if(p!==void 0){var x=Mi,w=e;switch(e){case"keypress":if($a(n)===0)break e;case"keydown":case"keyup":x=up;break;case"focusin":w="focus",x=Gs;break;case"focusout":w="blur",x=Gs;break;case"beforeblur":case"afterblur":x=Gs;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":x=Dl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":x=qm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":x=mp;break;case Zu:case ed:case td:x=tp;break;case nd:x=hp;break;case"scroll":x=Jm;break;case"wheel":x=yp;break;case"copy":case"cut":case"paste":x=rp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":x=Wl}var v=(t&4)!==0,j=!v&&e==="scroll",h=v?p!==null?p+"Capture":null:p;v=[];for(var m=d,y;m!==null;){y=m;var S=y.stateNode;if(y.tag===5&&S!==null&&(y=S,h!==null&&(S=Ur(m,h),S!=null&&v.push(Qr(m,S,y)))),j)break;m=m.return}0<v.length&&(p=new x(p,w,null,n,f),g.push({event:p,listeners:v}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",x=e==="mouseout"||e==="pointerout",p&&n!==Ro&&(w=n.relatedTarget||n.fromElement)&&(bn(w)||w[Ht]))break e;if((x||p)&&(p=f.window===f?f:(p=f.ownerDocument)?p.defaultView||p.parentWindow:window,x?(w=n.relatedTarget||n.toElement,x=d,w=w?bn(w):null,w!==null&&(j=Ln(w),w!==j||w.tag!==5&&w.tag!==6)&&(w=null)):(x=null,w=d),x!==w)){if(v=Dl,S="onMouseLeave",h="onMouseEnter",m="mouse",(e==="pointerout"||e==="pointerover")&&(v=Wl,S="onPointerLeave",h="onPointerEnter",m="pointer"),j=x==null?p:Hn(x),y=w==null?p:Hn(w),p=new v(S,m+"leave",x,n,f),p.target=j,p.relatedTarget=y,S=null,bn(f)===d&&(v=new v(h,m+"enter",w,n,f),v.target=y,v.relatedTarget=j,S=v),j=S,x&&w)t:{for(v=x,h=w,m=0,y=v;y;y=Fn(y))m++;for(y=0,S=h;S;S=Fn(S))y++;for(;0<m-y;)v=Fn(v),m--;for(;0<y-m;)h=Fn(h),y--;for(;m--;){if(v===h||h!==null&&v===h.alternate)break t;v=Fn(v),h=Fn(h)}v=null}else v=null;x!==null&&ec(g,p,x,v,!1),w!==null&&j!==null&&ec(g,j,w,v,!0)}}e:{if(p=d?Hn(d):window,x=p.nodeName&&p.nodeName.toLowerCase(),x==="select"||x==="input"&&p.type==="file")var b=bp;else if(Kl(p))if(Yu)b=Tp;else{b=Np;var T=Cp}else(x=p.nodeName)&&x.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(b=Ep);if(b&&(b=b(e,d))){Gu(g,b,n,f);break e}T&&T(e,p,d),e==="focusout"&&(T=p._wrapperState)&&T.controlled&&p.type==="number"&&Eo(p,"number",p.value)}switch(T=d?Hn(d):window,e){case"focusin":(Kl(T)||T.contentEditable==="true")&&(Un=T,Oo=d,Ar=null);break;case"focusout":Ar=Oo=Un=null;break;case"mousedown":Bo=!0;break;case"contextmenu":case"mouseup":case"dragend":Bo=!1,Xl(g,n,f);break;case"selectionchange":if(Pp)break;case"keydown":case"keyup":Xl(g,n,f)}var E;if(Oi)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Dn?Vu(e,n)&&(P="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(P="onCompositionStart");P&&(Hu&&n.locale!=="ko"&&(Dn||P!=="onCompositionStart"?P==="onCompositionEnd"&&Dn&&(E=Wu()):(nn=f,Li="value"in nn?nn.value:nn.textContent,Dn=!0)),T=Za(d,P),0<T.length&&(P=new Ul(P,e,null,n,f),g.push({event:P,listeners:T}),E?P.data=E:(E=Ku(n),E!==null&&(P.data=E)))),(E=xp?wp(e,n):Sp(e,n))&&(d=Za(d,"onBeforeInput"),0<d.length&&(f=new Ul("onBeforeInput","beforeinput",null,n,f),g.push({event:f,listeners:d}),f.data=E))}ad(g,t)})}function Qr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Za(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,o=a.stateNode;a.tag===5&&o!==null&&(a=o,o=Ur(e,n),o!=null&&r.unshift(Qr(e,o,a)),o=Ur(e,t),o!=null&&r.push(Qr(e,o,a))),e=e.return}return r}function Fn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function ec(e,t,n,r,a){for(var o=t._reactName,i=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,a?(c=Ur(n,o),c!=null&&i.unshift(Qr(n,c,l))):a||(c=Ur(n,o),c!=null&&i.push(Qr(n,c,l)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var $p=/\r\n?/g,Lp=/\u0000|\uFFFD/g;function tc(e){return(typeof e=="string"?e:""+e).replace($p,`
|
|
38
|
-
`).replace(Lp,"")}function Sa(e,t,n){if(t=tc(t),tc(e)!==t&&n)throw Error(F(425))}function es(){}var Do=null,Uo=null;function Wo(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 Ho=typeof setTimeout=="function"?setTimeout:void 0,Mp=typeof clearTimeout=="function"?clearTimeout:void 0,nc=typeof Promise=="function"?Promise:void 0,Fp=typeof queueMicrotask=="function"?queueMicrotask:typeof nc<"u"?function(e){return nc.resolve(null).then(e).catch(Op)}:Ho;function Op(e){setTimeout(function(){throw e})}function to(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(r===0){e.removeChild(a),Vr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);Vr(t)}function ln(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 rc(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 fr=Math.random().toString(36).slice(2),_t="__reactFiber$"+fr,Jr="__reactProps$"+fr,Ht="__reactContainer$"+fr,Vo="__reactEvents$"+fr,Bp="__reactListeners$"+fr,Dp="__reactHandles$"+fr;function bn(e){var t=e[_t];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ht]||n[_t]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=rc(e);e!==null;){if(n=e[_t])return n;e=rc(e)}return t}e=n,n=e.parentNode}return null}function ia(e){return e=e[_t]||e[Ht],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Hn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(F(33))}function bs(e){return e[Jr]||null}var Ko=[],Vn=-1;function gn(e){return{current:e}}function ge(e){0>Vn||(e.current=Ko[Vn],Ko[Vn]=null,Vn--)}function me(e,t){Vn++,Ko[Vn]=e.current,e.current=t}var pn={},He=gn(pn),tt=gn(!1),In=pn;function ar(e,t){var n=e.type.contextTypes;if(!n)return pn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},o;for(o in n)a[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function nt(e){return e=e.childContextTypes,e!=null}function ts(){ge(tt),ge(He)}function ac(e,t,n){if(He.current!==pn)throw Error(F(168));me(He,t),me(tt,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 a in r)if(!(a in t))throw Error(F(108,Cm(e)||"Unknown",a));return je({},n,r)}function ns(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pn,In=He.current,me(He,e),me(tt,tt.current),!0}function sc(e,t,n){var r=e.stateNode;if(!r)throw Error(F(169));n?(e=od(e,t,In),r.__reactInternalMemoizedMergedChildContext=e,ge(tt),ge(He),me(He,e)):ge(tt),me(tt,n)}var Ot=null,Cs=!1,no=!1;function id(e){Ot===null?Ot=[e]:Ot.push(e)}function Up(e){Cs=!0,id(e)}function yn(){if(!no&&Ot!==null){no=!0;var e=0,t=de;try{var n=Ot;for(de=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Ot=null,Cs=!1}catch(a){throw Ot!==null&&(Ot=Ot.slice(e+1)),Ru(Ri,yn),a}finally{de=t,no=!1}}return null}var Kn=[],Gn=0,rs=null,as=0,pt=[],ht=0,Pn=null,Bt=1,Dt="";function Sn(e,t){Kn[Gn++]=as,Kn[Gn++]=rs,rs=e,as=t}function ld(e,t,n){pt[ht++]=Bt,pt[ht++]=Dt,pt[ht++]=Pn,Pn=e;var r=Bt;e=Dt;var a=32-Nt(r)-1;r&=~(1<<a),n+=1;var o=32-Nt(t)+a;if(30<o){var i=a-a%5;o=(r&(1<<i)-1).toString(32),r>>=i,a-=i,Bt=1<<32-Nt(t)+a|n<<a|r,Dt=o+e}else Bt=1<<o|n<<a|r,Dt=e}function Di(e){e.return!==null&&(Sn(e,1),ld(e,1,0))}function Ui(e){for(;e===rs;)rs=Kn[--Gn],Kn[Gn]=null,as=Kn[--Gn],Kn[Gn]=null;for(;e===Pn;)Pn=pt[--ht],pt[ht]=null,Dt=pt[--ht],pt[ht]=null,Bt=pt[--ht],pt[ht]=null}var it=null,ot=null,ye=!1,Ct=null;function cd(e,t){var n=gt(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 oc(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,it=e,ot=ln(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,it=e,ot=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Pn!==null?{id:Bt,overflow:Dt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=gt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,it=e,ot=null,!0):!1;default:return!1}}function Go(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Yo(e){if(ye){var t=ot;if(t){var n=t;if(!oc(e,t)){if(Go(e))throw Error(F(418));t=ln(n.nextSibling);var r=it;t&&oc(e,t)?cd(r,n):(e.flags=e.flags&-4097|2,ye=!1,it=e)}}else{if(Go(e))throw Error(F(418));e.flags=e.flags&-4097|2,ye=!1,it=e}}}function ic(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;it=e}function ja(e){if(e!==it)return!1;if(!ye)return ic(e),ye=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Wo(e.type,e.memoizedProps)),t&&(t=ot)){if(Go(e))throw ud(),Error(F(418));for(;t;)cd(e,t),t=ln(t.nextSibling)}if(ic(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(F(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){ot=ln(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}ot=null}}else ot=it?ln(e.stateNode.nextSibling):null;return!0}function ud(){for(var e=ot;e;)e=ln(e.nextSibling)}function sr(){ot=it=null,ye=!1}function Wi(e){Ct===null?Ct=[e]:Ct.push(e)}var Wp=Yt.ReactCurrentBatchConfig;function Sr(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(F(309));var r=n.stateNode}if(!r)throw Error(F(147,e));var a=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(i){var l=a.refs;i===null?delete l[o]:l[o]=i},t._stringRef=o,t)}if(typeof e!="string")throw Error(F(284));if(!n._owner)throw Error(F(290,e))}return e}function ka(e,t){throw e=Object.prototype.toString.call(t),Error(F(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function lc(e){var t=e._init;return t(e._payload)}function dd(e){function t(h,m){if(e){var y=h.deletions;y===null?(h.deletions=[m],h.flags|=16):y.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 a(h,m){return h=fn(h,m),h.index=0,h.sibling=null,h}function o(h,m,y){return h.index=y,e?(y=h.alternate,y!==null?(y=y.index,y<m?(h.flags|=2,m):y):(h.flags|=2,m)):(h.flags|=1048576,m)}function i(h){return e&&h.alternate===null&&(h.flags|=2),h}function l(h,m,y,S){return m===null||m.tag!==6?(m=co(y,h.mode,S),m.return=h,m):(m=a(m,y),m.return=h,m)}function c(h,m,y,S){var b=y.type;return b===Bn?f(h,m,y.props.children,S,y.key):m!==null&&(m.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Xt&&lc(b)===m.type)?(S=a(m,y.props),S.ref=Sr(h,m,y),S.return=h,S):(S=Ua(y.type,y.key,y.props,null,h.mode,S),S.ref=Sr(h,m,y),S.return=h,S)}function d(h,m,y,S){return m===null||m.tag!==4||m.stateNode.containerInfo!==y.containerInfo||m.stateNode.implementation!==y.implementation?(m=uo(y,h.mode,S),m.return=h,m):(m=a(m,y.children||[]),m.return=h,m)}function f(h,m,y,S,b){return m===null||m.tag!==7?(m=zn(y,h.mode,S,b),m.return=h,m):(m=a(m,y),m.return=h,m)}function g(h,m,y){if(typeof m=="string"&&m!==""||typeof m=="number")return m=co(""+m,h.mode,y),m.return=h,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case fa:return y=Ua(m.type,m.key,m.props,null,h.mode,y),y.ref=Sr(h,null,m),y.return=h,y;case On:return m=uo(m,h.mode,y),m.return=h,m;case Xt:var S=m._init;return g(h,S(m._payload),y)}if(Nr(m)||gr(m))return m=zn(m,h.mode,y,null),m.return=h,m;ka(h,m)}return null}function p(h,m,y,S){var b=m!==null?m.key:null;if(typeof y=="string"&&y!==""||typeof y=="number")return b!==null?null:l(h,m,""+y,S);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case fa:return y.key===b?c(h,m,y,S):null;case On:return y.key===b?d(h,m,y,S):null;case Xt:return b=y._init,p(h,m,b(y._payload),S)}if(Nr(y)||gr(y))return b!==null?null:f(h,m,y,S,null);ka(h,y)}return null}function x(h,m,y,S,b){if(typeof S=="string"&&S!==""||typeof S=="number")return h=h.get(y)||null,l(m,h,""+S,b);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case fa:return h=h.get(S.key===null?y:S.key)||null,c(m,h,S,b);case On:return h=h.get(S.key===null?y:S.key)||null,d(m,h,S,b);case Xt:var T=S._init;return x(h,m,y,T(S._payload),b)}if(Nr(S)||gr(S))return h=h.get(y)||null,f(m,h,S,b,null);ka(m,S)}return null}function w(h,m,y,S){for(var b=null,T=null,E=m,P=m=0,k=null;E!==null&&P<y.length;P++){E.index>P?(k=E,E=null):k=E.sibling;var z=p(h,E,y[P],S);if(z===null){E===null&&(E=k);break}e&&E&&z.alternate===null&&t(h,E),m=o(z,m,P),T===null?b=z:T.sibling=z,T=z,E=k}if(P===y.length)return n(h,E),ye&&Sn(h,P),b;if(E===null){for(;P<y.length;P++)E=g(h,y[P],S),E!==null&&(m=o(E,m,P),T===null?b=E:T.sibling=E,T=E);return ye&&Sn(h,P),b}for(E=r(h,E);P<y.length;P++)k=x(E,h,P,y[P],S),k!==null&&(e&&k.alternate!==null&&E.delete(k.key===null?P:k.key),m=o(k,m,P),T===null?b=k:T.sibling=k,T=k);return e&&E.forEach(function(O){return t(h,O)}),ye&&Sn(h,P),b}function v(h,m,y,S){var b=gr(y);if(typeof b!="function")throw Error(F(150));if(y=b.call(y),y==null)throw Error(F(151));for(var T=b=null,E=m,P=m=0,k=null,z=y.next();E!==null&&!z.done;P++,z=y.next()){E.index>P?(k=E,E=null):k=E.sibling;var O=p(h,E,z.value,S);if(O===null){E===null&&(E=k);break}e&&E&&O.alternate===null&&t(h,E),m=o(O,m,P),T===null?b=O:T.sibling=O,T=O,E=k}if(z.done)return n(h,E),ye&&Sn(h,P),b;if(E===null){for(;!z.done;P++,z=y.next())z=g(h,z.value,S),z!==null&&(m=o(z,m,P),T===null?b=z:T.sibling=z,T=z);return ye&&Sn(h,P),b}for(E=r(h,E);!z.done;P++,z=y.next())z=x(E,h,P,z.value,S),z!==null&&(e&&z.alternate!==null&&E.delete(z.key===null?P:z.key),m=o(z,m,P),T===null?b=z:T.sibling=z,T=z);return e&&E.forEach(function(K){return t(h,K)}),ye&&Sn(h,P),b}function j(h,m,y,S){if(typeof y=="object"&&y!==null&&y.type===Bn&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case fa:e:{for(var b=y.key,T=m;T!==null;){if(T.key===b){if(b=y.type,b===Bn){if(T.tag===7){n(h,T.sibling),m=a(T,y.props.children),m.return=h,h=m;break e}}else if(T.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Xt&&lc(b)===T.type){n(h,T.sibling),m=a(T,y.props),m.ref=Sr(h,T,y),m.return=h,h=m;break e}n(h,T);break}else t(h,T);T=T.sibling}y.type===Bn?(m=zn(y.props.children,h.mode,S,y.key),m.return=h,h=m):(S=Ua(y.type,y.key,y.props,null,h.mode,S),S.ref=Sr(h,m,y),S.return=h,h=S)}return i(h);case On:e:{for(T=y.key;m!==null;){if(m.key===T)if(m.tag===4&&m.stateNode.containerInfo===y.containerInfo&&m.stateNode.implementation===y.implementation){n(h,m.sibling),m=a(m,y.children||[]),m.return=h,h=m;break e}else{n(h,m);break}else t(h,m);m=m.sibling}m=uo(y,h.mode,S),m.return=h,h=m}return i(h);case Xt:return T=y._init,j(h,m,T(y._payload),S)}if(Nr(y))return w(h,m,y,S);if(gr(y))return v(h,m,y,S);ka(h,y)}return typeof y=="string"&&y!==""||typeof y=="number"?(y=""+y,m!==null&&m.tag===6?(n(h,m.sibling),m=a(m,y),m.return=h,h=m):(n(h,m),m=co(y,h.mode,S),m.return=h,h=m),i(h)):n(h,m)}return j}var or=dd(!0),fd=dd(!1),ss=gn(null),os=null,Yn=null,Hi=null;function Vi(){Hi=Yn=os=null}function Ki(e){var t=ss.current;ge(ss),e._currentValue=t}function Qo(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 tr(e,t){os=e,Hi=Yn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(et=!0),e.firstContext=null)}function vt(e){var t=e._currentValue;if(Hi!==e)if(e={context:e,memoizedValue:t,next:null},Yn===null){if(os===null)throw Error(F(308));Yn=e,os.dependencies={lanes:0,firstContext:e}}else Yn=Yn.next=e;return t}var Cn=null;function Gi(e){Cn===null?Cn=[e]:Cn.push(e)}function md(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,Gi(t)):(n.next=a.next,a.next=n),t.interleaved=n,Vt(e,r)}function Vt(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 qt=!1;function Yi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function pd(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 Ut(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function cn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,le&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Vt(e,n)}return a=r.interleaved,a===null?(t.next=t,Gi(r)):(t.next=a.next,a.next=t),r.interleaved=t,Vt(e,n)}function La(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,_i(e,n)}}function cc(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,o=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};o===null?a=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?a=o=t:o=o.next=t}else a=o=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:o,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 is(e,t,n,r){var a=e.updateQueue;qt=!1;var o=a.firstBaseUpdate,i=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,d=c.next;c.next=null,i===null?o=d:i.next=d,i=c;var f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==i&&(l===null?f.firstBaseUpdate=d:l.next=d,f.lastBaseUpdate=c))}if(o!==null){var g=a.baseState;i=0,f=d=c=null,l=o;do{var p=l.lane,x=l.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:x,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var w=e,v=l;switch(p=t,x=n,v.tag){case 1:if(w=v.payload,typeof w=="function"){g=w.call(x,g,p);break e}g=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=v.payload,p=typeof w=="function"?w.call(x,g,p):w,p==null)break e;g=je({},g,p);break e;case 2:qt=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=a.effects,p===null?a.effects=[l]:p.push(l))}else x={eventTime:x,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(d=f=x,c=g):f=f.next=x,i|=p;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;p=l,l=p.next,p.next=null,a.lastBaseUpdate=p,a.shared.pending=null}}while(!0);if(f===null&&(c=g),a.baseState=c,a.firstBaseUpdate=d,a.lastBaseUpdate=f,t=a.shared.interleaved,t!==null){a=t;do i|=a.lane,a=a.next;while(a!==t)}else o===null&&(a.shared.lanes=0);_n|=i,e.lanes=i,e.memoizedState=g}}function uc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(a!==null){if(r.callback=null,r=n,typeof a!="function")throw Error(F(191,a));a.call(r)}}}var la={},Lt=gn(la),Xr=gn(la),qr=gn(la);function Nn(e){if(e===la)throw Error(F(174));return e}function Qi(e,t){switch(me(qr,t),me(Xr,e),me(Lt,la),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:zo(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=zo(t,e)}ge(Lt),me(Lt,t)}function ir(){ge(Lt),ge(Xr),ge(qr)}function hd(e){Nn(qr.current);var t=Nn(Lt.current),n=zo(t,e.type);t!==n&&(me(Xr,e),me(Lt,n))}function Ji(e){Xr.current===e&&(ge(Lt),ge(Xr))}var we=gn(0);function ls(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 ro=[];function Xi(){for(var e=0;e<ro.length;e++)ro[e]._workInProgressVersionPrimary=null;ro.length=0}var Ma=Yt.ReactCurrentDispatcher,ao=Yt.ReactCurrentBatchConfig,Rn=0,Se=null,Ie=null,_e=null,cs=!1,$r=!1,Zr=0,Hp=0;function De(){throw Error(F(321))}function qi(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Tt(e[n],t[n]))return!1;return!0}function Zi(e,t,n,r,a,o){if(Rn=o,Se=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Ma.current=e===null||e.memoizedState===null?Yp:Qp,e=n(r,a),$r){o=0;do{if($r=!1,Zr=0,25<=o)throw Error(F(301));o+=1,_e=Ie=null,t.updateQueue=null,Ma.current=Jp,e=n(r,a)}while($r)}if(Ma.current=us,t=Ie!==null&&Ie.next!==null,Rn=0,_e=Ie=Se=null,cs=!1,t)throw Error(F(300));return e}function el(){var e=Zr!==0;return Zr=0,e}function Pt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _e===null?Se.memoizedState=_e=e:_e=_e.next=e,_e}function xt(){if(Ie===null){var e=Se.alternate;e=e!==null?e.memoizedState:null}else e=Ie.next;var t=_e===null?Se.memoizedState:_e.next;if(t!==null)_e=t,Ie=e;else{if(e===null)throw Error(F(310));Ie=e,e={memoizedState:Ie.memoizedState,baseState:Ie.baseState,baseQueue:Ie.baseQueue,queue:Ie.queue,next:null},_e===null?Se.memoizedState=_e=e:_e=_e.next=e}return _e}function ea(e,t){return typeof t=="function"?t(e):t}function so(e){var t=xt(),n=t.queue;if(n===null)throw Error(F(311));n.lastRenderedReducer=e;var r=Ie,a=r.baseQueue,o=n.pending;if(o!==null){if(a!==null){var i=a.next;a.next=o.next,o.next=i}r.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,r=r.baseState;var l=i=null,c=null,d=o;do{var f=d.lane;if((Rn&f)===f)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var g={lane:f,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=g,i=r):c=c.next=g,Se.lanes|=f,_n|=f}d=d.next}while(d!==null&&d!==o);c===null?i=r:c.next=l,Tt(r,t.memoizedState)||(et=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){a=e;do o=a.lane,Se.lanes|=o,_n|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function oo(e){var t=xt(),n=t.queue;if(n===null)throw Error(F(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var i=a=a.next;do o=e(o,i.action),i=i.next;while(i!==a);Tt(o,t.memoizedState)||(et=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function gd(){}function yd(e,t){var n=Se,r=xt(),a=t(),o=!Tt(r.memoizedState,a);if(o&&(r.memoizedState=a,et=!0),r=r.queue,tl(wd.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||_e!==null&&_e.memoizedState.tag&1){if(n.flags|=2048,ta(9,xd.bind(null,n,r,a,t),void 0,null),Ae===null)throw Error(F(349));Rn&30||vd(n,t,a)}return a}function vd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Se.updateQueue,t===null?(t={lastEffect:null,stores:null},Se.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function xd(e,t,n,r){t.value=n,t.getSnapshot=r,Sd(t)&&jd(e)}function wd(e,t,n){return n(function(){Sd(t)&&jd(e)})}function Sd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Tt(e,n)}catch{return!0}}function jd(e){var t=Vt(e,1);t!==null&&Et(t,e,1,-1)}function dc(e){var t=Pt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:e},t.queue=e,e=e.dispatch=Gp.bind(null,Se,e),[t.memoizedState,e]}function ta(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Se.updateQueue,t===null?(t={lastEffect:null,stores:null},Se.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 kd(){return xt().memoizedState}function Fa(e,t,n,r){var a=Pt();Se.flags|=e,a.memoizedState=ta(1|t,n,void 0,r===void 0?null:r)}function Ns(e,t,n,r){var a=xt();r=r===void 0?null:r;var o=void 0;if(Ie!==null){var i=Ie.memoizedState;if(o=i.destroy,r!==null&&qi(r,i.deps)){a.memoizedState=ta(t,n,o,r);return}}Se.flags|=e,a.memoizedState=ta(1|t,n,o,r)}function fc(e,t){return Fa(8390656,8,e,t)}function tl(e,t){return Ns(2048,8,e,t)}function bd(e,t){return Ns(4,2,e,t)}function Cd(e,t){return Ns(4,4,e,t)}function Nd(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 Ed(e,t,n){return n=n!=null?n.concat([e]):null,Ns(4,4,Nd.bind(null,t,e),n)}function nl(){}function Td(e,t){var n=xt();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 zd(e,t){var n=xt();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 Id(e,t,n){return Rn&21?(Tt(n,t)||(n=$u(),Se.lanes|=n,_n|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,et=!0),e.memoizedState=n)}function Vp(e,t){var n=de;de=n!==0&&4>n?n:4,e(!0);var r=ao.transition;ao.transition={};try{e(!1),t()}finally{de=n,ao.transition=r}}function Pd(){return xt().memoizedState}function Kp(e,t,n){var r=dn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Rd(e))_d(t,n);else if(n=md(e,t,n,r),n!==null){var a=Ye();Et(n,e,r,a),Ad(n,t,r)}}function Gp(e,t,n){var r=dn(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rd(e))_d(t,a);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,l=o(i,n);if(a.hasEagerState=!0,a.eagerState=l,Tt(l,i)){var c=t.interleaved;c===null?(a.next=a,Gi(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=md(e,t,a,r),n!==null&&(a=Ye(),Et(n,e,r,a),Ad(n,t,r))}}function Rd(e){var t=e.alternate;return e===Se||t!==null&&t===Se}function _d(e,t){$r=cs=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ad(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,_i(e,n)}}var us={readContext:vt,useCallback:De,useContext:De,useEffect:De,useImperativeHandle:De,useInsertionEffect:De,useLayoutEffect:De,useMemo:De,useReducer:De,useRef:De,useState:De,useDebugValue:De,useDeferredValue:De,useTransition:De,useMutableSource:De,useSyncExternalStore:De,useId:De,unstable_isNewReconciler:!1},Yp={readContext:vt,useCallback:function(e,t){return Pt().memoizedState=[e,t===void 0?null:t],e},useContext:vt,useEffect:fc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Fa(4194308,4,Nd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Fa(4194308,4,e,t)},useInsertionEffect:function(e,t){return Fa(4,2,e,t)},useMemo:function(e,t){var n=Pt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Pt();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=Kp.bind(null,Se,e),[r.memoizedState,e]},useRef:function(e){var t=Pt();return e={current:e},t.memoizedState=e},useState:dc,useDebugValue:nl,useDeferredValue:function(e){return Pt().memoizedState=e},useTransition:function(){var e=dc(!1),t=e[0];return e=Vp.bind(null,e[1]),Pt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Se,a=Pt();if(ye){if(n===void 0)throw Error(F(407));n=n()}else{if(n=t(),Ae===null)throw Error(F(349));Rn&30||vd(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,fc(wd.bind(null,r,o,e),[e]),r.flags|=2048,ta(9,xd.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Pt(),t=Ae.identifierPrefix;if(ye){var n=Dt,r=Bt;n=(r&~(1<<32-Nt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Zr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Hp++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Qp={readContext:vt,useCallback:Td,useContext:vt,useEffect:tl,useImperativeHandle:Ed,useInsertionEffect:bd,useLayoutEffect:Cd,useMemo:zd,useReducer:so,useRef:kd,useState:function(){return so(ea)},useDebugValue:nl,useDeferredValue:function(e){var t=xt();return Id(t,Ie.memoizedState,e)},useTransition:function(){var e=so(ea)[0],t=xt().memoizedState;return[e,t]},useMutableSource:gd,useSyncExternalStore:yd,useId:Pd,unstable_isNewReconciler:!1},Jp={readContext:vt,useCallback:Td,useContext:vt,useEffect:tl,useImperativeHandle:Ed,useInsertionEffect:bd,useLayoutEffect:Cd,useMemo:zd,useReducer:oo,useRef:kd,useState:function(){return oo(ea)},useDebugValue:nl,useDeferredValue:function(e){var t=xt();return Ie===null?t.memoizedState=e:Id(t,Ie.memoizedState,e)},useTransition:function(){var e=oo(ea)[0],t=xt().memoizedState;return[e,t]},useMutableSource:gd,useSyncExternalStore:yd,useId:Pd,unstable_isNewReconciler:!1};function kt(e,t){if(e&&e.defaultProps){t=je({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Jo(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:je({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Es={isMounted:function(e){return(e=e._reactInternals)?Ln(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Ye(),a=dn(e),o=Ut(r,a);o.payload=t,n!=null&&(o.callback=n),t=cn(e,o,a),t!==null&&(Et(t,e,a,r),La(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Ye(),a=dn(e),o=Ut(r,a);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=cn(e,o,a),t!==null&&(Et(t,e,a,r),La(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Ye(),r=dn(e),a=Ut(n,r);a.tag=2,t!=null&&(a.callback=t),t=cn(e,a,r),t!==null&&(Et(t,e,r,n),La(t,e,r))}};function mc(e,t,n,r,a,o,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,i):t.prototype&&t.prototype.isPureReactComponent?!Gr(n,r)||!Gr(a,o):!0}function $d(e,t,n){var r=!1,a=pn,o=t.contextType;return typeof o=="object"&&o!==null?o=vt(o):(a=nt(t)?In:He.current,r=t.contextTypes,o=(r=r!=null)?ar(e,a):pn),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Es,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=o),t}function pc(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&&Es.enqueueReplaceState(t,t.state,null)}function Xo(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},Yi(e);var o=t.contextType;typeof o=="object"&&o!==null?a.context=vt(o):(o=nt(t)?In:He.current,a.context=ar(e,o)),a.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Jo(e,t,o,n),a.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(t=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),t!==a.state&&Es.enqueueReplaceState(a,a.state,null),is(e,n,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function lr(e,t){try{var n="",r=t;do n+=bm(r),r=r.return;while(r);var a=n}catch(o){a=`
|
|
39
|
-
Error generating stack: `+o.message+`
|
|
40
|
-
`+o.stack}return{value:e,source:t,stack:a,digest:null}}function io(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function qo(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Xp=typeof WeakMap=="function"?WeakMap:Map;function Ld(e,t,n){n=Ut(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){fs||(fs=!0,li=r),qo(e,t)},n}function Md(e,t,n){n=Ut(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){qo(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){qo(e,t),typeof r!="function"&&(un===null?un=new Set([this]):un.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function hc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Xp;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=dh.bind(null,e,t,n),t.then(e,e))}function gc(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 yc(e,t,n,r,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Ut(-1,1),t.tag=2,cn(n,t,1))),n.lanes|=1),e)}var qp=Yt.ReactCurrentOwner,et=!1;function Ke(e,t,n,r){t.child=e===null?fd(t,null,n,r):or(t,e.child,n,r)}function vc(e,t,n,r,a){n=n.render;var o=t.ref;return tr(t,a),r=Zi(e,t,n,r,o,a),n=el(),e!==null&&!et?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Kt(e,t,a)):(ye&&n&&Di(t),t.flags|=1,Ke(e,t,r,a),t.child)}function xc(e,t,n,r,a){if(e===null){var o=n.type;return typeof o=="function"&&!ul(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Fd(e,t,o,r,a)):(e=Ua(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&a)){var i=o.memoizedProps;if(n=n.compare,n=n!==null?n:Gr,n(i,r)&&e.ref===t.ref)return Kt(e,t,a)}return t.flags|=1,e=fn(o,r),e.ref=t.ref,e.return=t,t.child=e}function Fd(e,t,n,r,a){if(e!==null){var o=e.memoizedProps;if(Gr(o,r)&&e.ref===t.ref)if(et=!1,t.pendingProps=r=o,(e.lanes&a)!==0)e.flags&131072&&(et=!0);else return t.lanes=e.lanes,Kt(e,t,a)}return Zo(e,t,n,r,a)}function Od(e,t,n){var r=t.pendingProps,a=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},me(Jn,st),st|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,me(Jn,st),st|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,me(Jn,st),st|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,me(Jn,st),st|=r;return Ke(e,t,a,n),t.child}function Bd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Zo(e,t,n,r,a){var o=nt(n)?In:He.current;return o=ar(t,o),tr(t,a),n=Zi(e,t,n,r,o,a),r=el(),e!==null&&!et?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Kt(e,t,a)):(ye&&r&&Di(t),t.flags|=1,Ke(e,t,n,a),t.child)}function wc(e,t,n,r,a){if(nt(n)){var o=!0;ns(t)}else o=!1;if(tr(t,a),t.stateNode===null)Oa(e,t),$d(t,n,r),Xo(t,n,r,a),r=!0;else if(e===null){var i=t.stateNode,l=t.memoizedProps;i.props=l;var c=i.context,d=n.contextType;typeof d=="object"&&d!==null?d=vt(d):(d=nt(n)?In:He.current,d=ar(t,d));var f=n.getDerivedStateFromProps,g=typeof f=="function"||typeof i.getSnapshotBeforeUpdate=="function";g||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==r||c!==d)&&pc(t,i,r,d),qt=!1;var p=t.memoizedState;i.state=p,is(t,r,i,a),c=t.memoizedState,l!==r||p!==c||tt.current||qt?(typeof f=="function"&&(Jo(t,n,f,r),c=t.memoizedState),(l=qt||mc(t,n,l,r,p,c,d))?(g||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=d,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,pd(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:kt(t.type,l),i.props=d,g=t.pendingProps,p=i.context,c=n.contextType,typeof c=="object"&&c!==null?c=vt(c):(c=nt(n)?In:He.current,c=ar(t,c));var x=n.getDerivedStateFromProps;(f=typeof x=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==g||p!==c)&&pc(t,i,r,c),qt=!1,p=t.memoizedState,i.state=p,is(t,r,i,a);var w=t.memoizedState;l!==g||p!==w||tt.current||qt?(typeof x=="function"&&(Jo(t,n,x,r),w=t.memoizedState),(d=qt||mc(t,n,d,r,p,w,c)||!1)?(f||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,w,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,w,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),i.props=r,i.state=w,i.context=c,r=d):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return ei(e,t,n,r,o,a)}function ei(e,t,n,r,a,o){Bd(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return a&&sc(t,n,!1),Kt(e,t,o);r=t.stateNode,qp.current=t;var l=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=or(t,e.child,null,o),t.child=or(t,null,l,o)):Ke(e,t,l,o),t.memoizedState=r.state,a&&sc(t,n,!0),t.child}function Dd(e){var t=e.stateNode;t.pendingContext?ac(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ac(e,t.context,!1),Qi(e,t.containerInfo)}function Sc(e,t,n,r,a){return sr(),Wi(a),t.flags|=256,Ke(e,t,n,r),t.child}var ti={dehydrated:null,treeContext:null,retryLane:0};function ni(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ud(e,t,n){var r=t.pendingProps,a=we.current,o=!1,i=(t.flags&128)!==0,l;if((l=i)||(l=e!==null&&e.memoizedState===null?!1:(a&2)!==0),l?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),me(we,a&1),e===null)return Yo(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,o?(r=t.mode,o=t.child,i={mode:"hidden",children:i},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=i):o=Is(i,r,0,null),e=zn(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=ni(n),t.memoizedState=ti,e):rl(t,i));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return Zp(e,t,i,r,l,a,n);if(o){o=r.fallback,i=t.mode,a=e.child,l=a.sibling;var c={mode:"hidden",children:r.children};return!(i&1)&&t.child!==a?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=fn(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?o=fn(l,o):(o=zn(o,i,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,i=e.child.memoizedState,i=i===null?ni(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~n,t.memoizedState=ti,r}return o=e.child,e=o.sibling,r=fn(o,{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 rl(e,t){return t=Is({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ba(e,t,n,r){return r!==null&&Wi(r),or(t,e.child,null,n),e=rl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Zp(e,t,n,r,a,o,i){if(n)return t.flags&256?(t.flags&=-257,r=io(Error(F(422))),ba(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,a=t.mode,r=Is({mode:"visible",children:r.children},a,0,null),o=zn(o,a,i,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&or(t,e.child,null,i),t.child.memoizedState=ni(i),t.memoizedState=ti,o);if(!(t.mode&1))return ba(e,t,i,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,o=Error(F(419)),r=io(o,r,void 0),ba(e,t,i,r)}if(l=(i&e.childLanes)!==0,et||l){if(r=Ae,r!==null){switch(i&-i){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(r.suspendedLanes|i)?0:a,a!==0&&a!==o.retryLane&&(o.retryLane=a,Vt(e,a),Et(r,e,a,-1))}return cl(),r=io(Error(F(421))),ba(e,t,i,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=fh.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,ot=ln(a.nextSibling),it=t,ye=!0,Ct=null,e!==null&&(pt[ht++]=Bt,pt[ht++]=Dt,pt[ht++]=Pn,Bt=e.id,Dt=e.overflow,Pn=t),t=rl(t,r.children),t.flags|=4096,t)}function jc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Qo(e.return,t,n)}function lo(e,t,n,r,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=a)}function Wd(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;if(Ke(e,t,r.children,n),r=we.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&&jc(e,n,t);else if(e.tag===19)jc(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(me(we,r),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&ls(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),lo(t,!1,a,n,o);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&ls(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}lo(t,!0,n,null,o);break;case"together":lo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Oa(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Kt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),_n|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(F(153));if(t.child!==null){for(e=t.child,n=fn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=fn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function eh(e,t,n){switch(t.tag){case 3:Dd(t),sr();break;case 5:hd(t);break;case 1:nt(t.type)&&ns(t);break;case 4:Qi(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;me(ss,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(me(we,we.current&1),t.flags|=128,null):n&t.child.childLanes?Ud(e,t,n):(me(we,we.current&1),e=Kt(e,t,n),e!==null?e.sibling:null);me(we,we.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Wd(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),me(we,we.current),r)break;return null;case 22:case 23:return t.lanes=0,Od(e,t,n)}return Kt(e,t,n)}var Hd,ri,Vd,Kd;Hd=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}};ri=function(){};Vd=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,Nn(Lt.current);var o=null;switch(n){case"input":a=Co(e,a),r=Co(e,r),o=[];break;case"select":a=je({},a,{value:void 0}),r=je({},r,{value:void 0}),o=[];break;case"textarea":a=To(e,a),r=To(e,r),o=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=es)}Io(n,r);var i;n=null;for(d in a)if(!r.hasOwnProperty(d)&&a.hasOwnProperty(d)&&a[d]!=null)if(d==="style"){var l=a[d];for(i in l)l.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Br.hasOwnProperty(d)?o||(o=[]):(o=o||[]).push(d,null));for(d in r){var c=r[d];if(l=a!=null?a[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="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||(o||(o=[]),o.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(o=o||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Br.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&he("scroll",e),o||l===c||(o=[])):(o=o||[]).push(d,c))}n&&(o=o||[]).push("style",n);var d=o;(t.updateQueue=d)&&(t.flags|=4)}};Kd=function(e,t,n,r){n!==r&&(t.flags|=4)};function jr(e,t){if(!ye)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 Ue(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&14680064,r|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function th(e,t,n){var r=t.pendingProps;switch(Ui(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ue(t),null;case 1:return nt(t.type)&&ts(),Ue(t),null;case 3:return r=t.stateNode,ir(),ge(tt),ge(He),Xi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ja(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ct!==null&&(di(Ct),Ct=null))),ri(e,t),Ue(t),null;case 5:Ji(t);var a=Nn(qr.current);if(n=t.type,e!==null&&t.stateNode!=null)Vd(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(F(166));return Ue(t),null}if(e=Nn(Lt.current),ja(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[_t]=t,r[Jr]=o,e=(t.mode&1)!==0,n){case"dialog":he("cancel",r),he("close",r);break;case"iframe":case"object":case"embed":he("load",r);break;case"video":case"audio":for(a=0;a<Tr.length;a++)he(Tr[a],r);break;case"source":he("error",r);break;case"img":case"image":case"link":he("error",r),he("load",r);break;case"details":he("toggle",r);break;case"input":Pl(r,o),he("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},he("invalid",r);break;case"textarea":_l(r,o),he("invalid",r)}Io(n,o),a=null;for(var i in o)if(o.hasOwnProperty(i)){var l=o[i];i==="children"?typeof l=="string"?r.textContent!==l&&(o.suppressHydrationWarning!==!0&&Sa(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&Sa(r.textContent,l,e),a=["children",""+l]):Br.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&he("scroll",r)}switch(n){case"input":ma(r),Rl(r,o,!0);break;case"textarea":ma(r),Al(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=es)}r=a,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=wu(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[_t]=t,e[Jr]=r,Hd(e,t,!1,!1),t.stateNode=e;e:{switch(i=Po(n,r),n){case"dialog":he("cancel",e),he("close",e),a=r;break;case"iframe":case"object":case"embed":he("load",e),a=r;break;case"video":case"audio":for(a=0;a<Tr.length;a++)he(Tr[a],e);a=r;break;case"source":he("error",e),a=r;break;case"img":case"image":case"link":he("error",e),he("load",e),a=r;break;case"details":he("toggle",e),a=r;break;case"input":Pl(e,r),a=Co(e,r),he("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=je({},r,{value:void 0}),he("invalid",e);break;case"textarea":_l(e,r),a=To(e,r),he("invalid",e);break;default:a=r}Io(n,a),l=a;for(o in l)if(l.hasOwnProperty(o)){var c=l[o];o==="style"?ku(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Su(e,c)):o==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Dr(e,c):typeof c=="number"&&Dr(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Br.hasOwnProperty(o)?c!=null&&o==="onScroll"&&he("scroll",e):c!=null&&Ei(e,o,c,i))}switch(n){case"input":ma(e),Rl(e,r,!1);break;case"textarea":ma(e),Al(e);break;case"option":r.value!=null&&e.setAttribute("value",""+mn(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?Xn(e,!!r.multiple,o,!1):r.defaultValue!=null&&Xn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=es)}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 Ue(t),null;case 6:if(e&&t.stateNode!=null)Kd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(F(166));if(n=Nn(qr.current),Nn(Lt.current),ja(t)){if(r=t.stateNode,n=t.memoizedProps,r[_t]=t,(o=r.nodeValue!==n)&&(e=it,e!==null))switch(e.tag){case 3:Sa(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Sa(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[_t]=t,t.stateNode=r}return Ue(t),null;case 13:if(ge(we),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ye&&ot!==null&&t.mode&1&&!(t.flags&128))ud(),sr(),t.flags|=98560,o=!1;else if(o=ja(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(F(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(F(317));o[_t]=t}else sr(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ue(t),o=!1}else Ct!==null&&(di(Ct),Ct=null),o=!0;if(!o)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||we.current&1?Pe===0&&(Pe=3):cl())),t.updateQueue!==null&&(t.flags|=4),Ue(t),null);case 4:return ir(),ri(e,t),e===null&&Yr(t.stateNode.containerInfo),Ue(t),null;case 10:return Ki(t.type._context),Ue(t),null;case 17:return nt(t.type)&&ts(),Ue(t),null;case 19:if(ge(we),o=t.memoizedState,o===null)return Ue(t),null;if(r=(t.flags&128)!==0,i=o.rendering,i===null)if(r)jr(o,!1);else{if(Pe!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=ls(e),i!==null){for(t.flags|=128,jr(o,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,i=o.alternate,i===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,o.type=i.type,e=i.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return me(we,we.current&1|2),t.child}e=e.sibling}o.tail!==null&&Ne()>cr&&(t.flags|=128,r=!0,jr(o,!1),t.lanes=4194304)}else{if(!r)if(e=ls(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),jr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!ye)return Ue(t),null}else 2*Ne()-o.renderingStartTime>cr&&n!==1073741824&&(t.flags|=128,r=!0,jr(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ne(),t.sibling=null,n=we.current,me(we,r?n&1|2:n&1),t):(Ue(t),null);case 22:case 23:return ll(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?st&1073741824&&(Ue(t),t.subtreeFlags&6&&(t.flags|=8192)):Ue(t),null;case 24:return null;case 25:return null}throw Error(F(156,t.tag))}function nh(e,t){switch(Ui(t),t.tag){case 1:return nt(t.type)&&ts(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ir(),ge(tt),ge(He),Xi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ji(t),null;case 13:if(ge(we),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(F(340));sr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ge(we),null;case 4:return ir(),null;case 10:return Ki(t.type._context),null;case 22:case 23:return ll(),null;case 24:return null;default:return null}}var Ca=!1,We=!1,rh=typeof WeakSet=="function"?WeakSet:Set,G=null;function Qn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){be(e,t,r)}else n.current=null}function ai(e,t,n){try{n()}catch(r){be(e,t,r)}}var kc=!1;function ah(e,t){if(Do=Xa,e=Xu(),Bi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,l=-1,c=-1,d=0,f=0,g=e,p=null;t:for(;;){for(var x;g!==n||a!==0&&g.nodeType!==3||(l=i+a),g!==o||r!==0&&g.nodeType!==3||(c=i+r),g.nodeType===3&&(i+=g.nodeValue.length),(x=g.firstChild)!==null;)p=g,g=x;for(;;){if(g===e)break t;if(p===n&&++d===a&&(l=i),p===o&&++f===r&&(c=i),(x=g.nextSibling)!==null)break;g=p,p=g.parentNode}g=x}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Uo={focusedElem:e,selectionRange:n},Xa=!1,G=t;G!==null;)if(t=G,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var v=w.memoizedProps,j=w.memoizedState,h=t.stateNode,m=h.getSnapshotBeforeUpdate(t.elementType===t.type?v:kt(t.type,v),j);h.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent="":y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(F(163))}}catch(S){be(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return w=kc,kc=!1,w}function Lr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var o=a.destroy;a.destroy=void 0,o!==void 0&&ai(t,n,o)}a=a.next}while(a!==r)}}function Ts(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 si(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 Gd(e){var t=e.alternate;t!==null&&(e.alternate=null,Gd(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[_t],delete t[Jr],delete t[Vo],delete t[Bp],delete t[Dp])),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 Yd(e){return e.tag===5||e.tag===3||e.tag===4}function bc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yd(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 oi(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=es));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}function ii(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(ii(e,t,n),e=e.sibling;e!==null;)ii(e,t,n),e=e.sibling}var Le=null,bt=!1;function Jt(e,t,n){for(n=n.child;n!==null;)Qd(e,t,n),n=n.sibling}function Qd(e,t,n){if($t&&typeof $t.onCommitFiberUnmount=="function")try{$t.onCommitFiberUnmount(ws,n)}catch{}switch(n.tag){case 5:We||Qn(n,t);case 6:var r=Le,a=bt;Le=null,Jt(e,t,n),Le=r,bt=a,Le!==null&&(bt?(e=Le,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Le.removeChild(n.stateNode));break;case 18:Le!==null&&(bt?(e=Le,n=n.stateNode,e.nodeType===8?to(e.parentNode,n):e.nodeType===1&&to(e,n),Vr(e)):to(Le,n.stateNode));break;case 4:r=Le,a=bt,Le=n.stateNode.containerInfo,bt=!0,Jt(e,t,n),Le=r,bt=a;break;case 0:case 11:case 14:case 15:if(!We&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var o=a,i=o.destroy;o=o.tag,i!==void 0&&(o&2||o&4)&&ai(n,t,i),a=a.next}while(a!==r)}Jt(e,t,n);break;case 1:if(!We&&(Qn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){be(n,t,l)}Jt(e,t,n);break;case 21:Jt(e,t,n);break;case 22:n.mode&1?(We=(r=We)||n.memoizedState!==null,Jt(e,t,n),We=r):Jt(e,t,n);break;default:Jt(e,t,n)}}function Cc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new rh),t.forEach(function(r){var a=mh.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function jt(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r];try{var o=e,i=t,l=i;e:for(;l!==null;){switch(l.tag){case 5:Le=l.stateNode,bt=!1;break e;case 3:Le=l.stateNode.containerInfo,bt=!0;break e;case 4:Le=l.stateNode.containerInfo,bt=!0;break e}l=l.return}if(Le===null)throw Error(F(160));Qd(o,i,a),Le=null,bt=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(d){be(a,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Jd(t,e),t=t.sibling}function Jd(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(jt(t,e),It(e),r&4){try{Lr(3,e,e.return),Ts(3,e)}catch(v){be(e,e.return,v)}try{Lr(5,e,e.return)}catch(v){be(e,e.return,v)}}break;case 1:jt(t,e),It(e),r&512&&n!==null&&Qn(n,n.return);break;case 5:if(jt(t,e),It(e),r&512&&n!==null&&Qn(n,n.return),e.flags&32){var a=e.stateNode;try{Dr(a,"")}catch(v){be(e,e.return,v)}}if(r&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,i=n!==null?n.memoizedProps:o,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&vu(a,o),Po(l,i);var d=Po(l,o);for(i=0;i<c.length;i+=2){var f=c[i],g=c[i+1];f==="style"?ku(a,g):f==="dangerouslySetInnerHTML"?Su(a,g):f==="children"?Dr(a,g):Ei(a,f,g,d)}switch(l){case"input":No(a,o);break;case"textarea":xu(a,o);break;case"select":var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var x=o.value;x!=null?Xn(a,!!o.multiple,x,!1):p!==!!o.multiple&&(o.defaultValue!=null?Xn(a,!!o.multiple,o.defaultValue,!0):Xn(a,!!o.multiple,o.multiple?[]:"",!1))}a[Jr]=o}catch(v){be(e,e.return,v)}}break;case 6:if(jt(t,e),It(e),r&4){if(e.stateNode===null)throw Error(F(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(v){be(e,e.return,v)}}break;case 3:if(jt(t,e),It(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Vr(t.containerInfo)}catch(v){be(e,e.return,v)}break;case 4:jt(t,e),It(e);break;case 13:jt(t,e),It(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(ol=Ne())),r&4&&Cc(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(We=(d=We)||f,jt(t,e),We=d):jt(t,e),It(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!f&&e.mode&1)for(G=e,f=e.child;f!==null;){for(g=G=f;G!==null;){switch(p=G,x=p.child,p.tag){case 0:case 11:case 14:case 15:Lr(4,p,p.return);break;case 1:Qn(p,p.return);var w=p.stateNode;if(typeof w.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(v){be(r,n,v)}}break;case 5:Qn(p,p.return);break;case 22:if(p.memoizedState!==null){Ec(g);continue}}x!==null?(x.return=p,G=x):Ec(g)}f=f.sibling}e:for(f=null,g=e;;){if(g.tag===5){if(f===null){f=g;try{a=g.stateNode,d?(o=a.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=g.stateNode,c=g.memoizedProps.style,i=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=ju("display",i))}catch(v){be(e,e.return,v)}}}else if(g.tag===6){if(f===null)try{g.stateNode.nodeValue=d?"":g.memoizedProps}catch(v){be(e,e.return,v)}}else if((g.tag!==22&&g.tag!==23||g.memoizedState===null||g===e)&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===e)break e;for(;g.sibling===null;){if(g.return===null||g.return===e)break e;f===g&&(f=null),g=g.return}f===g&&(f=null),g.sibling.return=g.return,g=g.sibling}}break;case 19:jt(t,e),It(e),r&4&&Cc(e);break;case 21:break;default:jt(t,e),It(e)}}function It(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Yd(n)){var r=n;break e}n=n.return}throw Error(F(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Dr(a,""),r.flags&=-33);var o=bc(e);ii(e,o,a);break;case 3:case 4:var i=r.stateNode.containerInfo,l=bc(e);oi(e,l,i);break;default:throw Error(F(161))}}catch(c){be(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function sh(e,t,n){G=e,Xd(e)}function Xd(e,t,n){for(var r=(e.mode&1)!==0;G!==null;){var a=G,o=a.child;if(a.tag===22&&r){var i=a.memoizedState!==null||Ca;if(!i){var l=a.alternate,c=l!==null&&l.memoizedState!==null||We;l=Ca;var d=We;if(Ca=i,(We=c)&&!d)for(G=a;G!==null;)i=G,c=i.child,i.tag===22&&i.memoizedState!==null?Tc(a):c!==null?(c.return=i,G=c):Tc(a);for(;o!==null;)G=o,Xd(o),o=o.sibling;G=a,Ca=l,We=d}Nc(e)}else a.subtreeFlags&8772&&o!==null?(o.return=a,G=o):Nc(e)}}function Nc(e){for(;G!==null;){var t=G;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:We||Ts(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!We)if(n===null)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:kt(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&uc(t,o,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}uc(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 d=t.alternate;if(d!==null){var f=d.memoizedState;if(f!==null){var g=f.dehydrated;g!==null&&Vr(g)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(F(163))}We||t.flags&512&&si(t)}catch(p){be(t,t.return,p)}}if(t===e){G=null;break}if(n=t.sibling,n!==null){n.return=t.return,G=n;break}G=t.return}}function Ec(e){for(;G!==null;){var t=G;if(t===e){G=null;break}var n=t.sibling;if(n!==null){n.return=t.return,G=n;break}G=t.return}}function Tc(e){for(;G!==null;){var t=G;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Ts(4,t)}catch(c){be(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){be(t,a,c)}}var o=t.return;try{si(t)}catch(c){be(t,o,c)}break;case 5:var i=t.return;try{si(t)}catch(c){be(t,i,c)}}}catch(c){be(t,t.return,c)}if(t===e){G=null;break}var l=t.sibling;if(l!==null){l.return=t.return,G=l;break}G=t.return}}var oh=Math.ceil,ds=Yt.ReactCurrentDispatcher,al=Yt.ReactCurrentOwner,yt=Yt.ReactCurrentBatchConfig,le=0,Ae=null,Te=null,Me=0,st=0,Jn=gn(0),Pe=0,na=null,_n=0,zs=0,sl=0,Mr=null,Ze=null,ol=0,cr=1/0,Ft=null,fs=!1,li=null,un=null,Na=!1,rn=null,ms=0,Fr=0,ci=null,Ba=-1,Da=0;function Ye(){return le&6?Ne():Ba!==-1?Ba:Ba=Ne()}function dn(e){return e.mode&1?le&2&&Me!==0?Me&-Me:Wp.transition!==null?(Da===0&&(Da=$u()),Da):(e=de,e!==0||(e=window.event,e=e===void 0?16:Uu(e.type)),e):1}function Et(e,t,n,r){if(50<Fr)throw Fr=0,ci=null,Error(F(185));sa(e,n,r),(!(le&2)||e!==Ae)&&(e===Ae&&(!(le&2)&&(zs|=n),Pe===4&&tn(e,Me)),rt(e,r),n===1&&le===0&&!(t.mode&1)&&(cr=Ne()+500,Cs&&yn()))}function rt(e,t){var n=e.callbackNode;Wm(e,t);var r=Ja(e,e===Ae?Me:0);if(r===0)n!==null&&Ml(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Ml(n),t===1)e.tag===0?Up(zc.bind(null,e)):id(zc.bind(null,e)),Fp(function(){!(le&6)&&yn()}),n=null;else{switch(Lu(r)){case 1:n=Ri;break;case 4:n=_u;break;case 16:n=Qa;break;case 536870912:n=Au;break;default:n=Qa}n=sf(n,qd.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function qd(e,t){if(Ba=-1,Da=0,le&6)throw Error(F(327));var n=e.callbackNode;if(nr()&&e.callbackNode!==n)return null;var r=Ja(e,e===Ae?Me:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ps(e,r);else{t=r;var a=le;le|=2;var o=ef();(Ae!==e||Me!==t)&&(Ft=null,cr=Ne()+500,Tn(e,t));do try{ch();break}catch(l){Zd(e,l)}while(!0);Vi(),ds.current=o,le=a,Te!==null?t=0:(Ae=null,Me=0,t=Pe)}if(t!==0){if(t===2&&(a=Lo(e),a!==0&&(r=a,t=ui(e,a))),t===1)throw n=na,Tn(e,0),tn(e,r),rt(e,Ne()),n;if(t===6)tn(e,r);else{if(a=e.current.alternate,!(r&30)&&!ih(a)&&(t=ps(e,r),t===2&&(o=Lo(e),o!==0&&(r=o,t=ui(e,o))),t===1))throw n=na,Tn(e,0),tn(e,r),rt(e,Ne()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(F(345));case 2:jn(e,Ze,Ft);break;case 3:if(tn(e,r),(r&130023424)===r&&(t=ol+500-Ne(),10<t)){if(Ja(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){Ye(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Ho(jn.bind(null,e,Ze,Ft),t);break}jn(e,Ze,Ft);break;case 4:if(tn(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var i=31-Nt(r);o=1<<i,i=t[i],i>a&&(a=i),r&=~o}if(r=a,r=Ne()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*oh(r/1960))-r,10<r){e.timeoutHandle=Ho(jn.bind(null,e,Ze,Ft),r);break}jn(e,Ze,Ft);break;case 5:jn(e,Ze,Ft);break;default:throw Error(F(329))}}}return rt(e,Ne()),e.callbackNode===n?qd.bind(null,e):null}function ui(e,t){var n=Mr;return e.current.memoizedState.isDehydrated&&(Tn(e,t).flags|=256),e=ps(e,t),e!==2&&(t=Ze,Ze=n,t!==null&&di(t)),e}function di(e){Ze===null?Ze=e:Ze.push.apply(Ze,e)}function ih(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var a=n[r],o=a.getSnapshot;a=a.value;try{if(!Tt(o(),a))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function tn(e,t){for(t&=~sl,t&=~zs,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Nt(t),r=1<<n;e[n]=-1,t&=~r}}function zc(e){if(le&6)throw Error(F(327));nr();var t=Ja(e,0);if(!(t&1))return rt(e,Ne()),null;var n=ps(e,t);if(e.tag!==0&&n===2){var r=Lo(e);r!==0&&(t=r,n=ui(e,r))}if(n===1)throw n=na,Tn(e,0),tn(e,t),rt(e,Ne()),n;if(n===6)throw Error(F(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,jn(e,Ze,Ft),rt(e,Ne()),null}function il(e,t){var n=le;le|=1;try{return e(t)}finally{le=n,le===0&&(cr=Ne()+500,Cs&&yn())}}function An(e){rn!==null&&rn.tag===0&&!(le&6)&&nr();var t=le;le|=1;var n=yt.transition,r=de;try{if(yt.transition=null,de=1,e)return e()}finally{de=r,yt.transition=n,le=t,!(le&6)&&yn()}}function ll(){st=Jn.current,ge(Jn)}function Tn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Mp(n)),Te!==null)for(n=Te.return;n!==null;){var r=n;switch(Ui(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&ts();break;case 3:ir(),ge(tt),ge(He),Xi();break;case 5:Ji(r);break;case 4:ir();break;case 13:ge(we);break;case 19:ge(we);break;case 10:Ki(r.type._context);break;case 22:case 23:ll()}n=n.return}if(Ae=e,Te=e=fn(e.current,null),Me=st=t,Pe=0,na=null,sl=zs=_n=0,Ze=Mr=null,Cn!==null){for(t=0;t<Cn.length;t++)if(n=Cn[t],r=n.interleaved,r!==null){n.interleaved=null;var a=r.next,o=n.pending;if(o!==null){var i=o.next;o.next=a,r.next=i}n.pending=r}Cn=null}return e}function Zd(e,t){do{var n=Te;try{if(Vi(),Ma.current=us,cs){for(var r=Se.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}cs=!1}if(Rn=0,_e=Ie=Se=null,$r=!1,Zr=0,al.current=null,n===null||n.return===null){Pe=1,na=t,Te=null;break}e:{var o=e,i=n.return,l=n,c=t;if(t=Me,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,f=l,g=f.tag;if(!(f.mode&1)&&(g===0||g===11||g===15)){var p=f.alternate;p?(f.updateQueue=p.updateQueue,f.memoizedState=p.memoizedState,f.lanes=p.lanes):(f.updateQueue=null,f.memoizedState=null)}var x=gc(i);if(x!==null){x.flags&=-257,yc(x,i,l,o,t),x.mode&1&&hc(o,d,t),t=x,c=d;var w=t.updateQueue;if(w===null){var v=new Set;v.add(c),t.updateQueue=v}else w.add(c);break e}else{if(!(t&1)){hc(o,d,t),cl();break e}c=Error(F(426))}}else if(ye&&l.mode&1){var j=gc(i);if(j!==null){!(j.flags&65536)&&(j.flags|=256),yc(j,i,l,o,t),Wi(lr(c,l));break e}}o=c=lr(c,l),Pe!==4&&(Pe=2),Mr===null?Mr=[o]:Mr.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var h=Ld(o,c,t);cc(o,h);break e;case 1:l=c;var m=o.type,y=o.stateNode;if(!(o.flags&128)&&(typeof m.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(un===null||!un.has(y)))){o.flags|=65536,t&=-t,o.lanes|=t;var S=Md(o,l,t);cc(o,S);break e}}o=o.return}while(o!==null)}nf(n)}catch(b){t=b,Te===n&&n!==null&&(Te=n=n.return);continue}break}while(!0)}function ef(){var e=ds.current;return ds.current=us,e===null?us:e}function cl(){(Pe===0||Pe===3||Pe===2)&&(Pe=4),Ae===null||!(_n&268435455)&&!(zs&268435455)||tn(Ae,Me)}function ps(e,t){var n=le;le|=2;var r=ef();(Ae!==e||Me!==t)&&(Ft=null,Tn(e,t));do try{lh();break}catch(a){Zd(e,a)}while(!0);if(Vi(),le=n,ds.current=r,Te!==null)throw Error(F(261));return Ae=null,Me=0,Pe}function lh(){for(;Te!==null;)tf(Te)}function ch(){for(;Te!==null&&!Am();)tf(Te)}function tf(e){var t=af(e.alternate,e,st);e.memoizedProps=e.pendingProps,t===null?nf(e):Te=t,al.current=null}function nf(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=nh(n,t),n!==null){n.flags&=32767,Te=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Pe=6,Te=null;return}}else if(n=th(n,t,st),n!==null){Te=n;return}if(t=t.sibling,t!==null){Te=t;return}Te=t=e}while(t!==null);Pe===0&&(Pe=5)}function jn(e,t,n){var r=de,a=yt.transition;try{yt.transition=null,de=1,uh(e,t,n,r)}finally{yt.transition=a,de=r}return null}function uh(e,t,n,r){do nr();while(rn!==null);if(le&6)throw Error(F(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(F(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Hm(e,o),e===Ae&&(Te=Ae=null,Me=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Na||(Na=!0,sf(Qa,function(){return nr(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=yt.transition,yt.transition=null;var i=de;de=1;var l=le;le|=4,al.current=null,ah(e,n),Jd(n,e),Ip(Uo),Xa=!!Do,Uo=Do=null,e.current=n,sh(n),$m(),le=l,de=i,yt.transition=o}else e.current=n;if(Na&&(Na=!1,rn=e,ms=a),o=e.pendingLanes,o===0&&(un=null),Fm(n.stateNode),rt(e,Ne()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(fs)throw fs=!1,e=li,li=null,e;return ms&1&&e.tag!==0&&nr(),o=e.pendingLanes,o&1?e===ci?Fr++:(Fr=0,ci=e):Fr=0,yn(),null}function nr(){if(rn!==null){var e=Lu(ms),t=yt.transition,n=de;try{if(yt.transition=null,de=16>e?16:e,rn===null)var r=!1;else{if(e=rn,rn=null,ms=0,le&6)throw Error(F(331));var a=le;for(le|=4,G=e.current;G!==null;){var o=G,i=o.child;if(G.flags&16){var l=o.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(G=d;G!==null;){var f=G;switch(f.tag){case 0:case 11:case 15:Lr(8,f,o)}var g=f.child;if(g!==null)g.return=f,G=g;else for(;G!==null;){f=G;var p=f.sibling,x=f.return;if(Gd(f),f===d){G=null;break}if(p!==null){p.return=x,G=p;break}G=x}}}var w=o.alternate;if(w!==null){var v=w.child;if(v!==null){w.child=null;do{var j=v.sibling;v.sibling=null,v=j}while(v!==null)}}G=o}}if(o.subtreeFlags&2064&&i!==null)i.return=o,G=i;else e:for(;G!==null;){if(o=G,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Lr(9,o,o.return)}var h=o.sibling;if(h!==null){h.return=o.return,G=h;break e}G=o.return}}var m=e.current;for(G=m;G!==null;){i=G;var y=i.child;if(i.subtreeFlags&2064&&y!==null)y.return=i,G=y;else e:for(i=m;G!==null;){if(l=G,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Ts(9,l)}}catch(b){be(l,l.return,b)}if(l===i){G=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,G=S;break e}G=l.return}}if(le=a,yn(),$t&&typeof $t.onPostCommitFiberRoot=="function")try{$t.onPostCommitFiberRoot(ws,e)}catch{}r=!0}return r}finally{de=n,yt.transition=t}}return!1}function Ic(e,t,n){t=lr(n,t),t=Ld(e,t,1),e=cn(e,t,1),t=Ye(),e!==null&&(sa(e,1,t),rt(e,t))}function be(e,t,n){if(e.tag===3)Ic(e,e,n);else for(;t!==null;){if(t.tag===3){Ic(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(un===null||!un.has(r))){e=lr(n,e),e=Md(t,e,1),t=cn(t,e,1),e=Ye(),t!==null&&(sa(t,1,e),rt(t,e));break}}t=t.return}}function dh(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Ye(),e.pingedLanes|=e.suspendedLanes&n,Ae===e&&(Me&n)===n&&(Pe===4||Pe===3&&(Me&130023424)===Me&&500>Ne()-ol?Tn(e,0):sl|=n),rt(e,t)}function rf(e,t){t===0&&(e.mode&1?(t=ga,ga<<=1,!(ga&130023424)&&(ga=4194304)):t=1);var n=Ye();e=Vt(e,t),e!==null&&(sa(e,t,n),rt(e,n))}function fh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),rf(e,n)}function mh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(F(314))}r!==null&&r.delete(t),rf(e,n)}var af;af=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||tt.current)et=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return et=!1,eh(e,t,n);et=!!(e.flags&131072)}else et=!1,ye&&t.flags&1048576&&ld(t,as,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Oa(e,t),e=t.pendingProps;var a=ar(t,He.current);tr(t,n),a=Zi(null,t,r,e,a,n);var o=el();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,nt(r)?(o=!0,ns(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Yi(t),a.updater=Es,t.stateNode=a,a._reactInternals=t,Xo(t,r,e,n),t=ei(null,t,r,!0,o,n)):(t.tag=0,ye&&o&&Di(t),Ke(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Oa(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=hh(r),e=kt(r,e),a){case 0:t=Zo(null,t,r,e,n);break e;case 1:t=wc(null,t,r,e,n);break e;case 11:t=vc(null,t,r,e,n);break e;case 14:t=xc(null,t,r,kt(r.type,e),n);break e}throw Error(F(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:kt(r,a),Zo(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:kt(r,a),wc(e,t,r,a,n);case 3:e:{if(Dd(t),e===null)throw Error(F(387));r=t.pendingProps,o=t.memoizedState,a=o.element,pd(e,t),is(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=lr(Error(F(423)),t),t=Sc(e,t,r,n,a);break e}else if(r!==a){a=lr(Error(F(424)),t),t=Sc(e,t,r,n,a);break e}else for(ot=ln(t.stateNode.containerInfo.firstChild),it=t,ye=!0,Ct=null,n=fd(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(sr(),r===a){t=Kt(e,t,n);break e}Ke(e,t,r,n)}t=t.child}return t;case 5:return hd(t),e===null&&Yo(t),r=t.type,a=t.pendingProps,o=e!==null?e.memoizedProps:null,i=a.children,Wo(r,a)?i=null:o!==null&&Wo(r,o)&&(t.flags|=32),Bd(e,t),Ke(e,t,i,n),t.child;case 6:return e===null&&Yo(t),null;case 13:return Ud(e,t,n);case 4:return Qi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=or(t,null,r,n):Ke(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:kt(r,a),vc(e,t,r,a,n);case 7:return Ke(e,t,t.pendingProps,n),t.child;case 8:return Ke(e,t,t.pendingProps.children,n),t.child;case 12:return Ke(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,i=a.value,me(ss,r._currentValue),r._currentValue=i,o!==null)if(Tt(o.value,i)){if(o.children===a.children&&!tt.current){t=Kt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){i=o.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(o.tag===1){c=Ut(-1,n&-n),c.tag=2;var d=o.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?c.next=c:(c.next=f.next,f.next=c),d.pending=c}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Qo(o.return,n,t),l.lanes|=n;break}c=c.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(F(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Qo(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}Ke(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,tr(t,n),a=vt(a),r=r(a),t.flags|=1,Ke(e,t,r,n),t.child;case 14:return r=t.type,a=kt(r,t.pendingProps),a=kt(r.type,a),xc(e,t,r,a,n);case 15:return Fd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:kt(r,a),Oa(e,t),t.tag=1,nt(r)?(e=!0,ns(t)):e=!1,tr(t,n),$d(t,r,a),Xo(t,r,a,n),ei(null,t,r,!0,e,n);case 19:return Wd(e,t,n);case 22:return Od(e,t,n)}throw Error(F(156,t.tag))};function sf(e,t){return Ru(e,t)}function ph(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 gt(e,t,n,r){return new ph(e,t,n,r)}function ul(e){return e=e.prototype,!(!e||!e.isReactComponent)}function hh(e){if(typeof e=="function")return ul(e)?1:0;if(e!=null){if(e=e.$$typeof,e===zi)return 11;if(e===Ii)return 14}return 2}function fn(e,t){var n=e.alternate;return n===null?(n=gt(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 Ua(e,t,n,r,a,o){var i=2;if(r=e,typeof e=="function")ul(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Bn:return zn(n.children,a,o,t);case Ti:i=8,a|=8;break;case So:return e=gt(12,n,t,a|2),e.elementType=So,e.lanes=o,e;case jo:return e=gt(13,n,t,a),e.elementType=jo,e.lanes=o,e;case ko:return e=gt(19,n,t,a),e.elementType=ko,e.lanes=o,e;case hu:return Is(n,a,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case mu:i=10;break e;case pu:i=9;break e;case zi:i=11;break e;case Ii:i=14;break e;case Xt:i=16,r=null;break e}throw Error(F(130,e==null?e:typeof e,""))}return t=gt(i,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function zn(e,t,n,r){return e=gt(7,e,r,t),e.lanes=n,e}function Is(e,t,n,r){return e=gt(22,e,r,t),e.elementType=hu,e.lanes=n,e.stateNode={isHidden:!1},e}function co(e,t,n){return e=gt(6,e,null,t),e.lanes=n,e}function uo(e,t,n){return t=gt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gh(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hs(0),this.expirationTimes=Hs(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hs(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function dl(e,t,n,r,a,o,i,l,c){return e=new gh(e,t,n,l,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=gt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yi(o),e}function yh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:On,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function of(e){if(!e)return pn;e=e._reactInternals;e:{if(Ln(e)!==e||e.tag!==1)throw Error(F(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(nt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(F(171))}if(e.tag===1){var n=e.type;if(nt(n))return od(e,n,t)}return t}function lf(e,t,n,r,a,o,i,l,c){return e=dl(n,r,!0,e,a,o,i,l,c),e.context=of(null),n=e.current,r=Ye(),a=dn(n),o=Ut(r,a),o.callback=t??null,cn(n,o,a),e.current.lanes=a,sa(e,a,r),rt(e,r),e}function Ps(e,t,n,r){var a=t.current,o=Ye(),i=dn(a);return n=of(n),t.context===null?t.context=n:t.pendingContext=n,t=Ut(o,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=cn(a,t,i),e!==null&&(Et(e,a,i,o),La(e,a,i)),i}function hs(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 Pc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fl(e,t){Pc(e,t),(e=e.alternate)&&Pc(e,t)}function vh(){return null}var cf=typeof reportError=="function"?reportError:function(e){console.error(e)};function ml(e){this._internalRoot=e}Rs.prototype.render=ml.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(F(409));Ps(e,t,null,null)};Rs.prototype.unmount=ml.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;An(function(){Ps(null,e,null,null)}),t[Ht]=null}};function Rs(e){this._internalRoot=e}Rs.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ou();e={blockedOn:null,target:e,priority:t};for(var n=0;n<en.length&&t!==0&&t<en[n].priority;n++);en.splice(n,0,e),n===0&&Du(e)}};function pl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function _s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Rc(){}function xh(e,t,n,r,a){if(a){if(typeof r=="function"){var o=r;r=function(){var d=hs(i);o.call(d)}}var i=lf(t,r,e,0,null,!1,!1,"",Rc);return e._reactRootContainer=i,e[Ht]=i.current,Yr(e.nodeType===8?e.parentNode:e),An(),i}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var d=hs(c);l.call(d)}}var c=dl(e,0,!1,null,null,!1,!1,"",Rc);return e._reactRootContainer=c,e[Ht]=c.current,Yr(e.nodeType===8?e.parentNode:e),An(function(){Ps(t,c,n,r)}),c}function As(e,t,n,r,a){var o=n._reactRootContainer;if(o){var i=o;if(typeof a=="function"){var l=a;a=function(){var c=hs(i);l.call(c)}}Ps(t,i,e,a)}else i=xh(n,t,e,a,r);return hs(i)}Mu=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Er(t.pendingLanes);n!==0&&(_i(t,n|1),rt(t,Ne()),!(le&6)&&(cr=Ne()+500,yn()))}break;case 13:An(function(){var r=Vt(e,1);if(r!==null){var a=Ye();Et(r,e,1,a)}}),fl(e,1)}};Ai=function(e){if(e.tag===13){var t=Vt(e,134217728);if(t!==null){var n=Ye();Et(t,e,134217728,n)}fl(e,134217728)}};Fu=function(e){if(e.tag===13){var t=dn(e),n=Vt(e,t);if(n!==null){var r=Ye();Et(n,e,t,r)}fl(e,t)}};Ou=function(){return de};Bu=function(e,t){var n=de;try{return de=e,t()}finally{de=n}};_o=function(e,t,n){switch(t){case"input":if(No(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=bs(r);if(!a)throw Error(F(90));yu(r),No(r,a)}}}break;case"textarea":xu(e,n);break;case"select":t=n.value,t!=null&&Xn(e,!!n.multiple,t,!1)}};Nu=il;Eu=An;var wh={usingClientEntryPoint:!1,Events:[ia,Hn,bs,bu,Cu,il]},kr={findFiberByHostInstance:bn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Sh={bundleType:kr.bundleType,version:kr.version,rendererPackageName:kr.rendererPackageName,rendererConfig:kr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Yt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Iu(e),e===null?null:e.stateNode},findFiberByHostInstance:kr.findFiberByHostInstance||vh,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 Ea=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ea.isDisabled&&Ea.supportsFiber)try{ws=Ea.inject(Sh),$t=Ea}catch{}}ct.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=wh;ct.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!pl(t))throw Error(F(200));return yh(e,t,null,n)};ct.createRoot=function(e,t){if(!pl(e))throw Error(F(299));var n=!1,r="",a=cf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=dl(e,1,!1,null,null,n,!1,r,a),e[Ht]=t.current,Yr(e.nodeType===8?e.parentNode:e),new ml(t)};ct.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(F(188)):(e=Object.keys(e).join(","),Error(F(268,e)));return e=Iu(t),e=e===null?null:e.stateNode,e};ct.flushSync=function(e){return An(e)};ct.hydrate=function(e,t,n){if(!_s(t))throw Error(F(200));return As(null,e,t,!0,n)};ct.hydrateRoot=function(e,t,n){if(!pl(e))throw Error(F(405));var r=n!=null&&n.hydratedSources||null,a=!1,o="",i=cf;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=lf(t,null,e,1,n??null,a,!1,o,i),e[Ht]=t.current,Yr(e),r)for(e=0;e<r.length;e++)n=r[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new Rs(t)};ct.render=function(e,t,n){if(!_s(t))throw Error(F(200));return As(null,e,t,!1,n)};ct.unmountComponentAtNode=function(e){if(!_s(e))throw Error(F(40));return e._reactRootContainer?(An(function(){As(null,null,e,!1,function(){e._reactRootContainer=null,e[Ht]=null})}),!0):!1};ct.unstable_batchedUpdates=il;ct.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!_s(n))throw Error(F(200));if(e==null||e._reactInternals===void 0)throw Error(F(38));return As(e,t,n,!1,r)};ct.version="18.3.1-next-f1338f8080-20240426";function uf(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uf)}catch(e){console.error(e)}}uf(),cu.exports=ct;var df=cu.exports,ff,_c=df;ff=_c.createRoot,_c.hydrateRoot;/**
|
|
41
|
-
* react-router v7.13.1
|
|
42
|
-
*
|
|
43
|
-
* Copyright (c) Remix Software Inc.
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the MIT license found in the
|
|
46
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
-
*
|
|
48
|
-
* @license MIT
|
|
49
|
-
*/var Ac="popstate";function $c(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function jh(e={}){function t(r,a){var d;let o=(d=a.state)==null?void 0:d.masked,{pathname:i,search:l,hash:c}=o||r.location;return fi("",{pathname:i,search:l,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default",o?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,a){return typeof a=="string"?a:ra(a)}return bh(t,n,null,e)}function ve(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function wt(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function kh(){return Math.random().toString(36).substring(2,10)}function Lc(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 fi(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?mr(t):t,state:n,key:t&&t.key||r||kh(),unstable_mask:a}}function ra({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 mr(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 bh(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:o=!1}=r,i=a.history,l="POP",c=null,d=f();d==null&&(d=0,i.replaceState({...i.state,idx:d},""));function f(){return(i.state||{idx:null}).idx}function g(){l="POP";let j=f(),h=j==null?null:j-d;d=j,c&&c({action:l,location:v.location,delta:h})}function p(j,h){l="PUSH";let m=$c(j)?j:fi(v.location,j,h);d=f()+1;let y=Lc(m,d),S=v.createHref(m.unstable_mask||m);try{i.pushState(y,"",S)}catch(b){if(b instanceof DOMException&&b.name==="DataCloneError")throw b;a.location.assign(S)}o&&c&&c({action:l,location:v.location,delta:1})}function x(j,h){l="REPLACE";let m=$c(j)?j:fi(v.location,j,h);d=f();let y=Lc(m,d),S=v.createHref(m.unstable_mask||m);i.replaceState(y,"",S),o&&c&&c({action:l,location:v.location,delta:0})}function w(j){return Ch(j)}let v={get action(){return l},get location(){return e(a,i)},listen(j){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Ac,g),c=j,()=>{a.removeEventListener(Ac,g),c=null}},createHref(j){return t(a,j)},createURL:w,encodeLocation(j){let h=w(j);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:p,replace:x,go(j){return i.go(j)}};return v}function Ch(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ve(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:ra(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function mf(e,t,n="/"){return Nh(e,t,n,!1)}function Nh(e,t,n,r){let a=typeof t=="string"?mr(t):t,o=Gt(a.pathname||"/",n);if(o==null)return null;let i=pf(e);Eh(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let d=Fh(o);l=Lh(i[c],d,r)}return l}function pf(e,t=[],n=[],r="",a=!1){let o=(i,l,c=a,d)=>{let f={relativePath:d===void 0?i.path||"":d,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(r)&&c)return;ve(f.relativePath.startsWith(r),`Absolute route path "${f.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(r.length)}let g=Mt([r,f.relativePath]),p=n.concat(f);i.children&&i.children.length>0&&(ve(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),pf(i.children,t,p,g,c)),!(i.path==null&&!i.index)&&t.push({path:g,score:Ah(g,i.index),routesMeta:p})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))o(i,l);else for(let d of hf(i.path))o(i,l,!0,d)}),t}function hf(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return a?[o,""]:[o];let i=hf(r.join("/")),l=[];return l.push(...i.map(c=>c===""?o:[o,c].join("/"))),a&&l.push(...i),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function Eh(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:$h(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var Th=/^:[\w-]+$/,zh=3,Ih=2,Ph=1,Rh=10,_h=-2,Mc=e=>e==="*";function Ah(e,t){let n=e.split("/"),r=n.length;return n.some(Mc)&&(r+=_h),t&&(r+=Ih),n.filter(a=>!Mc(a)).reduce((a,o)=>a+(Th.test(o)?zh:o===""?Ph:Rh),r)}function $h(e,t){return e.length===t.length&&e.slice(0,-1).every((r,a)=>r===t[a])?e[e.length-1]-t[t.length-1]:0}function Lh(e,t,n=!1){let{routesMeta:r}=e,a={},o="/",i=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,f=o==="/"?t:t.slice(o.length)||"/",g=gs({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},f),p=c.route;if(!g&&d&&n&&!r[r.length-1].route.index&&(g=gs({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},f)),!g)return null;Object.assign(a,g.params),i.push({params:a,pathname:Mt([o,g.pathname]),pathnameBase:Uh(Mt([o,g.pathnameBase])),route:p}),g.pathnameBase!=="/"&&(o=Mt([o,g.pathnameBase]))}return i}function gs(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Mh(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let o=a[0],i=o.replace(/(.)\/+$/,"$1"),l=a.slice(1);return{params:r.reduce((d,{paramName:f,isOptional:g},p)=>{if(f==="*"){let w=l[p]||"";i=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const x=l[p];return g&&!x?d[f]=void 0:d[f]=(x||"").replace(/%2F/g,"/"),d},{}),pathname:o,pathnameBase:i,pattern:e}}function Mh(e,t=!1,n=!0){wt(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c,d,f)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let g=f.charAt(d+i.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function Fh(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return wt(!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 Gt(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 Oh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Bh(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?mr(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=Fc(n.substring(1),"/"):o=Fc(n,t)):o=t,{pathname:o,search:Wh(r),hash:Hh(a)}}function Fc(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function fo(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 Dh(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function hl(e){let t=Dh(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function $s(e,t,n,r=!1){let a;typeof e=="string"?a=mr(e):(a={...e},ve(!a.pathname||!a.pathname.includes("?"),fo("?","pathname","search",a)),ve(!a.pathname||!a.pathname.includes("#"),fo("#","pathname","hash",a)),ve(!a.search||!a.search.includes("#"),fo("#","search","hash",a)));let o=e===""||a.pathname==="",i=o?"/":a.pathname,l;if(i==null)l=n;else{let g=t.length-1;if(!r&&i.startsWith("..")){let p=i.split("/");for(;p[0]==="..";)p.shift(),g-=1;a.pathname=p.join("/")}l=g>=0?t[g]:"/"}let c=Bh(a,l),d=i&&i!=="/"&&i.endsWith("/"),f=(o||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||f)&&(c.pathname+="/"),c}var Mt=e=>e.join("/").replace(/\/\/+/g,"/"),Uh=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Wh=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Hh=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Vh=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 Kh(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Gh(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var gf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function yf(e,t){let n=e;if(typeof n!="string"||!Oh.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(gf)try{let o=new URL(window.location.href),i=n.startsWith("//")?new URL(o.protocol+n):new URL(n),l=Gt(i.pathname,t);i.origin===o.origin&&l!=null?n=l+i.search+i.hash:a=!0}catch{wt(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var vf=["POST","PUT","PATCH","DELETE"];new Set(vf);var Yh=["GET",...vf];new Set(Yh);var pr=u.createContext(null);pr.displayName="DataRouter";var Ls=u.createContext(null);Ls.displayName="DataRouterState";var Qh=u.createContext(!1),xf=u.createContext({isTransitioning:!1});xf.displayName="ViewTransition";var Jh=u.createContext(new Map);Jh.displayName="Fetchers";var Xh=u.createContext(null);Xh.displayName="Await";var dt=u.createContext(null);dt.displayName="Navigation";var ca=u.createContext(null);ca.displayName="Location";var zt=u.createContext({outlet:null,matches:[],isDataRoute:!1});zt.displayName="Route";var gl=u.createContext(null);gl.displayName="RouteError";var wf="REACT_ROUTER_ERROR",qh="REDIRECT",Zh="ROUTE_ERROR_RESPONSE";function eg(e){if(e.startsWith(`${wf}:${qh}:{`))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 tg(e){if(e.startsWith(`${wf}:${Zh}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Vh(t.status,t.statusText,t.data)}catch{}}function ng(e,{relative:t}={}){ve(hr(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=u.useContext(dt),{hash:a,pathname:o,search:i}=ua(e,{relative:t}),l=o;return n!=="/"&&(l=o==="/"?n:Mt([n,o])),r.createHref({pathname:l,search:i,hash:a})}function hr(){return u.useContext(ca)!=null}function St(){return ve(hr(),"useLocation() may be used only in the context of a <Router> component."),u.useContext(ca).location}var Sf="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function jf(e){u.useContext(dt).static||u.useLayoutEffect(e)}function Qt(){let{isDataRoute:e}=u.useContext(zt);return e?yg():rg()}function rg(){ve(hr(),"useNavigate() may be used only in the context of a <Router> component.");let e=u.useContext(pr),{basename:t,navigator:n}=u.useContext(dt),{matches:r}=u.useContext(zt),{pathname:a}=St(),o=JSON.stringify(hl(r)),i=u.useRef(!1);return jf(()=>{i.current=!0}),u.useCallback((c,d={})=>{if(wt(i.current,Sf),!i.current)return;if(typeof c=="number"){n.go(c);return}let f=$s(c,JSON.parse(o),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Mt([t,f.pathname])),(d.replace?n.replace:n.push)(f,d.state,d)},[t,n,o,a,e])}var ag=u.createContext(null);function sg(e){let t=u.useContext(zt).outlet;return u.useMemo(()=>t&&u.createElement(ag.Provider,{value:e},t),[t,e])}function ua(e,{relative:t}={}){let{matches:n}=u.useContext(zt),{pathname:r}=St(),a=JSON.stringify(hl(n));return u.useMemo(()=>$s(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function og(e,t){return kf(e,t)}function kf(e,t,n){var j;ve(hr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=u.useContext(dt),{matches:a}=u.useContext(zt),o=a[a.length-1],i=o?o.params:{},l=o?o.pathname:"/",c=o?o.pathnameBase:"/",d=o&&o.route;{let h=d&&d.path||"";Cf(l,!d||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
|
-
|
|
51
|
-
Please change the parent <Route path="${h}"> to <Route path="${h==="/"?"*":`${h}/*`}">.`)}let f=St(),g;if(t){let h=typeof t=="string"?mr(t):t;ve(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.`),g=h}else g=f;let p=g.pathname||"/",x=p;if(c!=="/"){let h=c.replace(/^\//,"").split("/");x="/"+p.replace(/^\//,"").split("/").slice(h.length).join("/")}let w=mf(e,{pathname:x});wt(d||w!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),wt(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.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 v=dg(w&&w.map(h=>Object.assign({},h,{params:Object.assign({},i,h.params),pathname:Mt([c,r.encodeLocation?r.encodeLocation(h.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?c:Mt([c,r.encodeLocation?r.encodeLocation(h.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathnameBase])})),a,n);return t&&v?u.createElement(ca.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},v):v}function ig(){let e=gg(),t=Kh(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:r},o={padding:"2px 4px",backgroundColor:r},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=u.createElement(u.Fragment,null,u.createElement("p",null,"💿 Hey developer 👋"),u.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",u.createElement("code",{style:o},"ErrorBoundary")," or"," ",u.createElement("code",{style:o},"errorElement")," prop on your route.")),u.createElement(u.Fragment,null,u.createElement("h2",null,"Unexpected Application Error!"),u.createElement("h3",{style:{fontStyle:"italic"}},t),n?u.createElement("pre",{style:a},n):null,i)}var lg=u.createElement(ig,null),bf=class extends u.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=tg(e.digest);n&&(e=n)}let t=e!==void 0?u.createElement(zt.Provider,{value:this.props.routeContext},u.createElement(gl.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?u.createElement(cg,{error:e},t):t}};bf.contextType=Qh;var mo=new WeakMap;function cg({children:e,error:t}){let{basename:n}=u.useContext(dt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=eg(t.digest);if(r){let a=mo.get(t);if(a)throw a;let o=yf(r.location,n);if(gf&&!mo.get(t))if(o.isExternal||r.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:r.replace}));throw mo.set(t,i),i}return u.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function ug({routeContext:e,match:t,children:n}){let r=u.useContext(pr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),u.createElement(zt.Provider,{value:e},n)}function dg(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let a=e,o=r==null?void 0:r.errors;if(o!=null){let f=a.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);ve(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,f+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let f=0;f<a.length;f++){let g=a[f];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(l=f),g.route.id){let{loaderData:p,errors:x}=r,w=g.route.loader&&!p.hasOwnProperty(g.route.id)&&(!x||x[g.route.id]===void 0);if(g.route.lazy||w){n.isStatic&&(i=!0),l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,d=r&&c?(f,g)=>{var p,x;c(f,{location:r.location,params:((x=(p=r.matches)==null?void 0:p[0])==null?void 0:x.params)??{},unstable_pattern:Gh(r.matches),errorInfo:g})}:void 0;return a.reduceRight((f,g,p)=>{let x,w=!1,v=null,j=null;r&&(x=o&&g.route.id?o[g.route.id]:void 0,v=g.route.errorElement||lg,i&&(l<0&&p===0?(Cf("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,j=null):l===p&&(w=!0,j=g.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,p+1)),m=()=>{let y;return x?y=v:w?y=j:g.route.Component?y=u.createElement(g.route.Component,null):g.route.element?y=g.route.element:y=f,u.createElement(ug,{match:g,routeContext:{outlet:f,matches:h,isDataRoute:r!=null},children:y})};return r&&(g.route.ErrorBoundary||g.route.errorElement||p===0)?u.createElement(bf,{location:r.location,revalidation:r.revalidation,component:v,error:x,children:m(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:d}):m()},null)}function yl(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fg(e){let t=u.useContext(pr);return ve(t,yl(e)),t}function mg(e){let t=u.useContext(Ls);return ve(t,yl(e)),t}function pg(e){let t=u.useContext(zt);return ve(t,yl(e)),t}function vl(e){let t=pg(e),n=t.matches[t.matches.length-1];return ve(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function hg(){return vl("useRouteId")}function gg(){var r;let e=u.useContext(gl),t=mg("useRouteError"),n=vl("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function yg(){let{router:e}=fg("useNavigate"),t=vl("useNavigate"),n=u.useRef(!1);return jf(()=>{n.current=!0}),u.useCallback(async(a,o={})=>{wt(n.current,Sf),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...o}))},[e,t])}var Oc={};function Cf(e,t,n){!t&&!Oc[e]&&(Oc[e]=!0,wt(!1,n))}u.memo(vg);function vg({routes:e,future:t,state:n,isStatic:r,onError:a}){return kf(e,void 0,{state:n,isStatic:r,onError:a})}function Zt({to:e,replace:t,state:n,relative:r}){ve(hr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=u.useContext(dt);wt(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=u.useContext(zt),{pathname:i}=St(),l=Qt(),c=$s(e,hl(o),i,r==="path"),d=JSON.stringify(c);return u.useEffect(()=>{l(JSON.parse(d),{replace:t,state:n,relative:r})},[l,d,r,t,n]),null}function xg(e){return sg(e.context)}function Re(e){ve(!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 wg({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:o=!1,unstable_useTransitions:i}){ve(!hr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=u.useMemo(()=>({basename:l,navigator:a,static:o,unstable_useTransitions:i,future:{}}),[l,a,o,i]);typeof n=="string"&&(n=mr(n));let{pathname:d="/",search:f="",hash:g="",state:p=null,key:x="default",unstable_mask:w}=n,v=u.useMemo(()=>{let j=Gt(d,l);return j==null?null:{location:{pathname:j,search:f,hash:g,state:p,key:x,unstable_mask:w},navigationType:r}},[l,d,f,g,p,x,r,w]);return wt(v!=null,`<Router basename="${l}"> is not able to match the URL "${d}${f}${g}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:u.createElement(dt.Provider,{value:c},u.createElement(ca.Provider,{children:t,value:v}))}function Sg({children:e,location:t}){return og(mi(e),t)}function mi(e,t=[]){let n=[];return u.Children.forEach(e,(r,a)=>{if(!u.isValidElement(r))return;let o=[...t,a];if(r.type===u.Fragment){n.push.apply(n,mi(r.props.children,o));return}ve(r.type===Re,`[${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>`),ve(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||o.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=mi(r.props.children,o)),n.push(i)}),n}var Wa="get",Ha="application/x-www-form-urlencoded";function Ms(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function jg(e){return Ms(e)&&e.tagName.toLowerCase()==="button"}function kg(e){return Ms(e)&&e.tagName.toLowerCase()==="form"}function bg(e){return Ms(e)&&e.tagName.toLowerCase()==="input"}function Cg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ng(e,t){return e.button===0&&(!t||t==="_self")&&!Cg(e)}function pi(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(a=>[n,a]):[[n,r]])},[]))}function Eg(e,t){let n=pi(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(o=>{n.append(a,o)})}),n}var Ta=null;function Tg(){if(Ta===null)try{new FormData(document.createElement("form"),0),Ta=!1}catch{Ta=!0}return Ta}var zg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function po(e){return e!=null&&!zg.has(e)?(wt(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ha}"`),null):e}function Ig(e,t){let n,r,a,o,i;if(kg(e)){let l=e.getAttribute("action");r=l?Gt(l,t):null,n=e.getAttribute("method")||Wa,a=po(e.getAttribute("enctype"))||Ha,o=new FormData(e)}else if(jg(e)||bg(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?Gt(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Wa,a=po(e.getAttribute("formenctype"))||po(l.getAttribute("enctype"))||Ha,o=new FormData(l,e),!Tg()){let{name:d,type:f,value:g}=e;if(f==="image"){let p=d?`${d}.`:"";o.append(`${p}x`,"0"),o.append(`${p}y`,"0")}else d&&o.append(d,g)}}else{if(Ms(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Wa,r=null,a=Ha,i=e}return o&&a==="text/plain"&&(i=o,o=void 0),{action:r,method:n.toLowerCase(),encType:a,formData:o,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function xl(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Pg(e,t,n,r){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${r}`:a.pathname=`${a.pathname}.${r}`:a.pathname==="/"?a.pathname=`_root.${r}`:t&&Gt(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${r}`,a}async function Rg(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 _g(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 Ag(e,t,n){let r=await Promise.all(e.map(async a=>{let o=t.routes[a.route.id];if(o){let i=await Rg(o,n);return i.links?i.links():[]}return[]}));return Fg(r.flat(1).filter(_g).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function Bc(e,t,n,r,a,o){let i=(c,d)=>n[d]?c.route.id!==n[d].route.id:!0,l=(c,d)=>{var f;return n[d].pathname!==c.pathname||((f=n[d].route.path)==null?void 0:f.endsWith("*"))&&n[d].params["*"]!==c.params["*"]};return o==="assets"?t.filter((c,d)=>i(c,d)||l(c,d)):o==="data"?t.filter((c,d)=>{var g;let f=r.routes[c.route.id];if(!f||!f.hasLoader)return!1;if(i(c,d)||l(c,d))return!0;if(c.route.shouldRevalidate){let p=c.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof p=="boolean")return p}return!0}):[]}function $g(e,t,{includeHydrateFallback:n}={}){return Lg(e.map(r=>{let a=t.routes[r.route.id];if(!a)return[];let o=[a.module];return a.clientActionModule&&(o=o.concat(a.clientActionModule)),a.clientLoaderModule&&(o=o.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(o=o.concat(a.hydrateFallbackModule)),a.imports&&(o=o.concat(a.imports)),o}).flat(1))}function Lg(e){return[...new Set(e)]}function Mg(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Fg(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let o=JSON.stringify(Mg(a));return n.has(o)||(n.add(o),r.push({key:o,link:a})),r},[])}function Nf(){let e=u.useContext(pr);return xl(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Og(){let e=u.useContext(Ls);return xl(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var wl=u.createContext(void 0);wl.displayName="FrameworkContext";function Ef(){let e=u.useContext(wl);return xl(e,"You must render this element inside a <HydratedRouter> element"),e}function Bg(e,t){let n=u.useContext(wl),[r,a]=u.useState(!1),[o,i]=u.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:d,onMouseLeave:f,onTouchStart:g}=t,p=u.useRef(null);u.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let v=h=>{h.forEach(m=>{i(m.isIntersecting)})},j=new IntersectionObserver(v,{threshold:.5});return p.current&&j.observe(p.current),()=>{j.disconnect()}}},[e]),u.useEffect(()=>{if(r){let v=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(v)}}},[r]);let x=()=>{a(!0)},w=()=>{a(!1),i(!1)};return n?e!=="intent"?[o,p,{}]:[o,p,{onFocus:br(l,x),onBlur:br(c,w),onMouseEnter:br(d,x),onMouseLeave:br(f,w),onTouchStart:br(g,x)}]:[!1,p,{}]}function br(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Dg({page:e,...t}){let{router:n}=Nf(),r=u.useMemo(()=>mf(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?u.createElement(Wg,{page:e,matches:r,...t}):null}function Ug(e){let{manifest:t,routeModules:n}=Ef(),[r,a]=u.useState([]);return u.useEffect(()=>{let o=!1;return Ag(e,t,n).then(i=>{o||a(i)}),()=>{o=!0}},[e,t,n]),r}function Wg({page:e,matches:t,...n}){let r=St(),{future:a,manifest:o,routeModules:i}=Ef(),{basename:l}=Nf(),{loaderData:c,matches:d}=Og(),f=u.useMemo(()=>Bc(e,t,d,o,r,"data"),[e,t,d,o,r]),g=u.useMemo(()=>Bc(e,t,d,o,r,"assets"),[e,t,d,o,r]),p=u.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let v=new Set,j=!1;if(t.forEach(m=>{var S;let y=o.routes[m.route.id];!y||!y.hasLoader||(!f.some(b=>b.route.id===m.route.id)&&m.route.id in c&&((S=i[m.route.id])!=null&&S.shouldRevalidate)||y.hasClientLoader?j=!0:v.add(m.route.id))}),v.size===0)return[];let h=Pg(e,l,a.unstable_trailingSlashAwareDataRequests,"data");return j&&v.size>0&&h.searchParams.set("_routes",t.filter(m=>v.has(m.route.id)).map(m=>m.route.id).join(",")),[h.pathname+h.search]},[l,a.unstable_trailingSlashAwareDataRequests,c,r,o,f,t,e,i]),x=u.useMemo(()=>$g(g,o),[g,o]),w=Ug(g);return u.createElement(u.Fragment,null,p.map(v=>u.createElement("link",{key:v,rel:"prefetch",as:"fetch",href:v,...n})),x.map(v=>u.createElement("link",{key:v,rel:"modulepreload",href:v,...n})),w.map(({key:v,link:j})=>u.createElement("link",{key:v,nonce:n.nonce,...j,crossOrigin:j.crossOrigin??n.crossOrigin})))}function Hg(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Vg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Vg&&(window.__reactRouterVersion="7.13.1")}catch{}function Kg({basename:e,children:t,unstable_useTransitions:n,window:r}){let a=u.useRef();a.current==null&&(a.current=jh({window:r,v5Compat:!0}));let o=a.current,[i,l]=u.useState({action:o.action,location:o.location}),c=u.useCallback(d=>{n===!1?l(d):u.startTransition(()=>l(d))},[n]);return u.useLayoutEffect(()=>o.listen(c),[o,c]),u.createElement(wg,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,unstable_useTransitions:n})}var Tf=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ge=u.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:o,replace:i,unstable_mask:l,state:c,target:d,to:f,preventScrollReset:g,viewTransition:p,unstable_defaultShouldRevalidate:x,...w},v){let{basename:j,navigator:h,unstable_useTransitions:m}=u.useContext(dt),y=typeof f=="string"&&Tf.test(f),S=yf(f,j);f=S.to;let b=ng(f,{relative:a}),T=St(),E=null;if(l){let N=$s(l,[],T.unstable_mask?T.unstable_mask.pathname:"/",!0);j!=="/"&&(N.pathname=N.pathname==="/"?j:Mt([j,N.pathname])),E=h.createHref(N)}let[P,k,z]=Bg(r,w),O=Qg(f,{replace:i,unstable_mask:l,state:c,target:d,preventScrollReset:g,relative:a,viewTransition:p,unstable_defaultShouldRevalidate:x,unstable_useTransitions:m});function K(N){t&&t(N),N.defaultPrevented||O(N)}let V=!(S.isExternal||o),U=u.createElement("a",{...w,...z,href:(V?E:void 0)||S.absoluteURL||b,onClick:V?K:t,ref:Hg(v,k),target:d,"data-discover":!y&&n==="render"?"true":void 0});return P&&!y?u.createElement(u.Fragment,null,U,u.createElement(Dg,{page:b})):U});Ge.displayName="Link";var Sl=u.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:o,to:i,viewTransition:l,children:c,...d},f){let g=ua(i,{relative:d.relative}),p=St(),x=u.useContext(Ls),{navigator:w,basename:v}=u.useContext(dt),j=x!=null&&ey(g)&&l===!0,h=w.encodeLocation?w.encodeLocation(g).pathname:g.pathname,m=p.pathname,y=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(m=m.toLowerCase(),y=y?y.toLowerCase():null,h=h.toLowerCase()),y&&v&&(y=Gt(y,v)||y);const S=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let b=m===h||!a&&m.startsWith(h)&&m.charAt(S)==="/",T=y!=null&&(y===h||!a&&y.startsWith(h)&&y.charAt(h.length)==="/"),E={isActive:b,isPending:T,isTransitioning:j},P=b?t:void 0,k;typeof r=="function"?k=r(E):k=[r,b?"active":null,T?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let z=typeof o=="function"?o(E):o;return u.createElement(Ge,{...d,"aria-current":P,className:k,ref:f,style:z,to:i,viewTransition:l},typeof c=="function"?c(E):c)});Sl.displayName="NavLink";var Gg=u.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:i=Wa,action:l,onSubmit:c,relative:d,preventScrollReset:f,viewTransition:g,unstable_defaultShouldRevalidate:p,...x},w)=>{let{unstable_useTransitions:v}=u.useContext(dt),j=qg(),h=Zg(l,{relative:d}),m=i.toLowerCase()==="get"?"get":"post",y=typeof l=="string"&&Tf.test(l),S=b=>{if(c&&c(b),b.defaultPrevented)return;b.preventDefault();let T=b.nativeEvent.submitter,E=(T==null?void 0:T.getAttribute("formmethod"))||i,P=()=>j(T||b.currentTarget,{fetcherKey:t,method:E,navigate:n,replace:a,state:o,relative:d,preventScrollReset:f,viewTransition:g,unstable_defaultShouldRevalidate:p});v&&n!==!1?u.startTransition(()=>P()):P()};return u.createElement("form",{ref:w,method:m,action:h,onSubmit:r?c:S,...x,"data-discover":!y&&e==="render"?"true":void 0})});Gg.displayName="Form";function Yg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function zf(e){let t=u.useContext(pr);return ve(t,Yg(e)),t}function Qg(e,{target:t,replace:n,unstable_mask:r,state:a,preventScrollReset:o,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c,unstable_useTransitions:d}={}){let f=Qt(),g=St(),p=ua(e,{relative:i});return u.useCallback(x=>{if(Ng(x,t)){x.preventDefault();let w=n!==void 0?n:ra(g)===ra(p),v=()=>f(e,{replace:w,unstable_mask:r,state:a,preventScrollReset:o,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c});d?u.startTransition(()=>v()):v()}},[g,f,p,n,r,a,t,e,o,i,l,c,d])}function If(e){wt(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=u.useRef(pi(e)),n=u.useRef(!1),r=St(),a=u.useMemo(()=>Eg(r.search,n.current?null:t.current),[r.search]),o=Qt(),i=u.useCallback((l,c)=>{const d=pi(typeof l=="function"?l(new URLSearchParams(a)):l);n.current=!0,o("?"+d,c)},[o,a]);return[a,i]}var Jg=0,Xg=()=>`__${String(++Jg)}__`;function qg(){let{router:e}=zf("useSubmit"),{basename:t}=u.useContext(dt),n=hg(),r=e.fetch,a=e.navigate;return u.useCallback(async(o,i={})=>{let{action:l,method:c,encType:d,formData:f,body:g}=Ig(o,t);if(i.navigate===!1){let p=i.fetcherKey||Xg();await r(p,n,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:f,body:g,formMethod:i.method||c,formEncType:i.encType||d,flushSync:i.flushSync})}else await a(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:f,body:g,formMethod:i.method||c,formEncType:i.encType||d,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,a,t,n])}function Zg(e,{relative:t}={}){let{basename:n}=u.useContext(dt),r=u.useContext(zt);ve(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),o={...ua(e||".",{relative:t})},i=St();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),c=l.getAll("index");if(c.some(f=>f==="")){l.delete("index"),c.filter(g=>g).forEach(g=>l.append("index",g));let f=l.toString();o.search=f?`?${f}`:""}}return(!e||e===".")&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Mt([n,o.pathname])),ra(o)}function ey(e,{relative:t}={}){let n=u.useContext(xf);ve(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=zf("useViewTransitionState"),a=ua(e,{relative:t});if(!n.isTransitioning)return!1;let o=Gt(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Gt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return gs(a.pathname,i)!=null||gs(a.pathname,o)!=null}class Pf extends Error{constructor(n){super("different_account");Fs(this,"summary");this.name="DifferentAccountError",this.summary=n}}class ty{constructor(){Fs(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 o=await r.json().catch(()=>({}));if(o!=null&&o.wouldWipe)throw new Pf(o.summary??{credentialCount:0,serviceCount:0,credentialIds:[]})}if(!r.ok){const o=await r.json().catch(()=>({error:"Invalid API key"}));throw new Error(o.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(o=>{var i,l;return{authorization_id:o.authorization_id,profile_id:o.profileId,path:o.path,title:o.title??null,sp_status:o.status??null,frame:o.bounds??o.frame??{},required_domains:o.requiredDomains??[],attested_domains:o.attestedDomains??[],missing_domains:(o.requiredDomains??[]).filter(c=>!(o.attestedDomains??[]).includes(c)),deferred_commitment_domains:o.deferredCommitmentDomains??[],approvers_frozen:o.approversFrozen??[],above_cap:o.aboveCap??!1,created_at:o.createdAt?new Date(o.createdAt*1e3).toISOString():"",earliest_expiry:(i=o.attestations)!=null&&i.length?new Date(Math.min(...o.attestations.map(c=>c.expiresAt))*1e3).toISOString():null,remaining_seconds:(l=o.attestations)!=null&&l.length?Math.max(0,Math.min(...o.attestations.map(c=>c.expiresAt))-Math.floor(Date.now()/1e3)):null}})}async getDenials(t){const n=new URLSearchParams;t!=null&&t.since&&n.set("since",String(t.since)),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString()?`?${n.toString()}`:"",a=await this.fetch(`/denials${r}`);if(!a.ok)throw new Error(`Failed to fetch denials: ${a.status}`);return a.json()}async getMyReceipts(t){const n=new URLSearchParams;t!=null&&t.date&&n.set("date",t.date),t!=null&&t.profile&&n.set("profile",t.profile),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString(),a=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!a.ok)throw new Error(`Failed to fetch receipts: ${a.status}`);return(await a.json()).receipts??[]}async revokeAttestation(t,n){const r=await this.fetch(`/api/authorizations/${encodeURIComponent(t)}/revoke`,{method:"POST",body:JSON.stringify({reason:n??"Revoked by user"})});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed to revoke"}));throw new Error(a.error||`Revoke failed: ${r.status}`)}}async getAttestations(t){const n=await this.fetch(`/api/attestations?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 o=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(o.error||`Create group failed: ${n.status}`)}const r=await n.json(),a=r.group||r;return{id:a.id,name:a.name,myDomains:a.myDomains||[],isAdmin:!0}}async joinGroup(t){const n=await this.fetch("/api/groups/join",{method:"POST",body:JSON.stringify({inviteCode:t})});if(!n.ok){const o=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(o.error||`Join group failed: ${n.status}`)}const r=await n.json(),a=r.group||r;return{id:a.id,name:a.name,myDomains:a.myDomains||[],isAdmin:a.isAdmin||!1}}async inviteToGroup(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/invite`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(r.error||`Invite failed: ${n.status}`)}return n.json()}async getMyTeam(){const t=await this.fetch("/api/groups/me");if(!t.ok)return null;const n=await t.json();return n.group?{group:n.group,membership:n.membership}:null}async listUsers(){const t=await this.fetch("/api/users");return t.ok?(await t.json()).users??[]:[]}async setPubkey(t){const n=await this.fetch("/api/users/me/pubkey",{method:"PUT",body:JSON.stringify({pubkey:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to set pubkey"}));throw new Error(r.error||`setPubkey failed: ${n.status}`)}}async getPubkey(t){const n=await this.fetch(`/api/users/${encodeURIComponent(t)}/pubkey`);return n.status===404||!n.ok?null:(await n.json()).pubkey??null}async leaveTeam(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/leave`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to leave team"}));throw new Error(r.error||`Leave failed: ${n.status}`)}}async getVaultStatus(){const t=await this.fetch("/vault/status");if(!t.ok)throw new Error(`Failed to fetch vault status: ${t.status}`);return t.json()}async getCredential(t){const n=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to check credential: ${n.status}`);return n.json()}async setCredential(t,n){const r=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to save credential: ${r.status}`)}async testCredential(t){const n=await this.fetch(`/vault/test/${encodeURIComponent(t)}`,{method:"POST"});if(!n.ok)throw new Error(`Test failed: ${n.status}`);return n.json()}async aiAssist(t){const n=await this.fetch("/ai/assist",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI request failed"}))).error,disclaimer:"AI surfaces reality. You supply intent."}}async 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 aiModels(t){const n=await this.fetch("/ai/models",{method:"POST",body:JSON.stringify(t??{})});if(!n.ok)throw new Error(`Model list failed: ${n.status}`);return n.json()}async getMcpHealth(){const t=await this.fetch("/mcp/health");if(!t.ok)throw new Error(`MCP server unreachable: ${t.status}`);return t.json()}async getMcpIntegrations(){const t=await this.fetch("/mcp/integrations");if(!t.ok)throw new Error(`Failed to fetch integrations: ${t.status}`);return t.json()}async getOAuthHealth(t){try{const n=await this.fetch(`/auth/oauth/${encodeURIComponent(t)}/health`);return n.ok?await n.json():{status:"unverified"}}catch{return{status:"unverified"}}}async getIntegrationManifests(){const t=await this.fetch("/mcp/integrations/manifests");if(!t.ok)throw new Error(`Failed to fetch manifests: ${t.status}`);return t.json()}async discoverScopeField(t,n){const r=await this.fetch(`/integrations/${encodeURIComponent(t)}/discover/${encodeURIComponent(n)}`);if(!r.ok){const a=await r.json().catch(()=>({error:`Discovery failed: ${r.status}`}));throw new Error(a.error)}return r.json()}async activateIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}/activate`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`Failed: ${n.status}`)}return n.json()}async removeMcpIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to remove integration: ${n.status}`)}async setReadPolicy(t,n){const r=await this.fetch(`/integrations/${encodeURIComponent(t)}/read-policy`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({readAgeDays:n})});if(!r.ok){const a=await r.json().catch(()=>({error:`HTTP ${r.status}`}));throw new Error(a.error)}}async getTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`);if(r.status===404||!r.ok)return null;const a=await r.json();return(a==null?void 0:a.config)??null}async setTeamProfileConfig(t,n,r){const a=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(r)});if(!a.ok){const o=await a.json().catch(()=>({error:"Failed to set profile config"}));throw new Error(o.error||`setTeamProfileConfig failed: ${a.status}`)}}async encryptIntent(t,n){const r=await this.fetch("/api/encrypt-intent",{method:"POST",body:JSON.stringify({intent:t,recipients:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Encryption failed"}));throw new Error(a.error||`encryptIntent failed: ${r.status}`)}return r.json()}async getApproversPubkeys(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}/approvers/pubkeys`);return r.ok?(await r.json()).approvers??[]:[]}async deleteTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"DELETE"});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed to delete profile config"}));throw new Error(a.error||`deleteTeamProfileConfig failed: ${r.status}`)}}async getProposals(t){const n=await this.fetch(`/api/proposals?domain=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch proposals: ${n.status}`);return(await n.json()).proposals??[]}async resolveProposal(t,n,r){const a=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/resolve`,{method:"POST",body:JSON.stringify({action:n,domain:r})});if(!a.ok){const o=await a.json().catch(()=>({error:"Failed"}));throw new Error(o.error||`Failed: ${a.status}`)}return a.json()}async getProposalsForApprover(){const t=await this.fetch("/api/proposals?approver=me");if(!t.ok)throw new Error(`Failed to fetch approver proposals: ${t.status}`);return(await t.json()).proposals??[]}async approveProposal(t){const n=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/approve`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`approveProposal failed: ${n.status}`)}return n.json()}async rejectProposal(t,n){const r=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/reject`,{method:"POST",body:JSON.stringify({reason:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed"}));throw new Error(a.error||`rejectProposal failed: ${r.status}`)}return r.json()}async getAttestationIntent(t){const n=await this.fetch(`/api/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 a=await n.json().catch(()=>({error:"Decryption failed"}));throw new Error(a.error||`decryptIntent failed: ${n.status}`)}return(await n.json()).intent}async storeApprovedIntent(t,n){const r=await this.fetch("/api/approved-intents",{method:"POST",body:JSON.stringify({authorityId:t,intent:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed"}));throw new Error(a.error||`storeApprovedIntent failed: ${r.status}`)}}async listTeamAuthorizations(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/attestations`);if(!n.ok)throw new Error(`Failed to fetch team authorizations: ${n.status}`);return((await n.json()).items??[]).map(a=>{var l,c;const o=a.owner??{userId:""};return{authorization_id:a.authorization_id??a.authorizationId,profile_id:a.profileId??a.profile_id,path:a.path??"",title:a.title??null,sp_status:a.status??a.sp_status??null,frame:a.bounds??a.frame??{},required_domains:a.requiredDomains??a.required_domains??[],attested_domains:a.attestedDomains??a.attested_domains??[],missing_domains:(a.requiredDomains??a.required_domains??[]).filter(d=>!(a.attestedDomains??a.attested_domains??[]).includes(d)),deferred_commitment_domains:a.deferredCommitmentDomains??a.deferred_commitment_domains??[],approvers_frozen:a.approversFrozen??a.approvers_frozen??[],above_cap:a.aboveCap??a.above_cap??!1,created_at:a.createdAt?new Date(a.createdAt*1e3).toISOString():a.created_at??"",earliest_expiry:(l=a.attestations)!=null&&l.length?new Date(Math.min(...a.attestations.map(d=>d.expiresAt))*1e3).toISOString():null,remaining_seconds:(c=a.attestations)!=null&&c.length?Math.max(0,Math.min(...a.attestations.map(d=>d.expiresAt))-Math.floor(Date.now()/1e3)):null,owner:o}})}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(),a=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!a.ok)throw new Error(`Failed to fetch receipts: ${a.status}`);const o=await a.json();return{receipts:o.receipts??[],nextBefore:o.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 a=r.toString(),o=await this.fetch(`/api/groups/${encodeURIComponent(t)}/receipts${a?"?"+a:""}`);if(!o.ok)throw new Error(`Failed to fetch team receipts: ${o.status}`);const i=await o.json();return{receipts:i.receipts??[],nextBefore:i.nextBefore??null}}async getThread(t){const n=t.sinceDays??7,r=t.status??"pending",a=t.domain||"owner",o=await this.getProposals(a);let i=[];if(r==="all"){const l=[],c=new Date;for(let f=0;f<n;f++){const g=new Date(c);g.setUTCDate(c.getUTCDate()-f),l.push(g.toISOString().slice(0,10))}i=(await Promise.all(l.map(f=>this.getMyReceipts({date:f,profile:t.profile})))).flat()}return{proposals:o,receipts:i}}async getAutostart(){const t=await this.fetch("/autostart");if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async setAutostart(t){const n=await this.fetch("/autostart",{method:t?"POST":"DELETE"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.message||`HTTP ${n.status}`)}}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 resyncGates(){const t=await this.fetch("/resync-gates",{method:"POST"});if(!t.ok)throw new Error(`Failed to resync gates: ${t.status}`)}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 a=await r.json().catch(()=>({error:"Save failed"}));throw new Error(a.error||`Save failed: ${r.status}`)}}}const A=new ty,Rf=u.createContext(null);function ny({children:e}){const[t,n]=u.useState(null),[r,a]=u.useState("personal"),[o,i]=u.useState(null),[l,c]=u.useState(""),[d,f]=u.useState(null),[g,p]=u.useState(null),[x,w]=u.useState(!1),[v,j]=u.useState(""),h=u.useRef(!1),m=u.useRef(null),y=u.useCallback(async()=>{if(h.current)try{const P=await A.getMyTeam();if(P){const{group:k,membership:z}=P;f(k),p(z),a("team"),i(k);const O=m.current??z.domains[0]??"owner";c(O)}else f(null),p(null),a("personal")}catch{}},[]);u.useEffect(()=>{const P=()=>{document.visibilityState==="visible"&&y()};return document.addEventListener("visibilitychange",P),()=>document.removeEventListener("visibilitychange",P)},[y]);const S=u.useCallback(async(P,k={})=>{w(!0),j("");try{A.setApiKey(P),h.current=!0;const z=await A.login(P,k);n(z),m.current=z.id;const O=await A.getGroups(),K=O.find(V=>V.isPersonal)??O[0]??null;i(K),c("owner"),await y()}catch(z){throw A.clearApiKey(),h.current=!1,j(z instanceof Error?z.message:"Login failed"),z}finally{w(!1)}},[y]),b=u.useCallback(async()=>{await A.logout(),A.clearApiKey(),h.current=!1,m.current=null,n(null),i(null),c(""),f(null),p(null),a("personal"),j("")},[]),T=u.useCallback(()=>j(""),[]),E=u.useCallback((P,k)=>{i(P),c(k)},[]);return s.jsx(Rf.Provider,{value:{user:t,mode:r,group:o,domain:l,groupId:(o==null?void 0:o.id)??null,activeTeam:d,activeMembership:g,isLoading:x,error:v,login:S,logout:b,clearError:T,activeGroup:o,activeDomain:l,groups:o?[o]:[],setActiveContext:E,refreshGroups:y},children:e})}function $e(){const e=u.useContext(Rf);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const _f=u.createContext(null);function ry({children:e}){const{user:t}=$e(),n=u.useRef(null),[r,a]=u.useState(!1),o=u.useRef(new Map),i=u.useCallback((l,c)=>{const d=o.current;return d.has(l)||d.set(l,new Set),d.get(l).add(c),()=>{var f;(f=d.get(l))==null||f.delete(c)}},[]);return u.useEffect(()=>{if(!t){n.current&&(n.current.close(),n.current=null,a(!1));return}if(n.current)return;const l=A.getApiKey();if(!l)return;const c=new EventSource(`/events?key=${encodeURIComponent(l)}`);n.current=c,c.onopen=()=>a(!0),c.onerror=()=>a(!1);const d=["integration-changed","attestation-changed","proposal-added","proposal-resolved","team-membership-changed","action-approval-needed","action-resolved","proposal-approved","proposal-rejected"];for(const f of d)c.addEventListener(f,g=>{let p;try{p=JSON.parse(g.data)}catch{p=null}const x=o.current.get(f);if(x)for(const w of x)try{w(p)}catch(v){console.error(`[EventSource] handler for "${f}" threw:`,v)}});return()=>{c.close(),n.current=null,a(!1)}},[t]),s.jsx(_f.Provider,{value:{connected:r,addListener:i},children:e})}function xe(e,t){const n=u.useContext(_f);if(!n)return;const{addListener:r}=n;u.useEffect(()=>r(e,t),[e,t,r])}const Or="suveren-theme",Dc="hap-theme";function za(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}(function(){const t=localStorage.getItem(Dc);t!==null&&localStorage.getItem(Or)===null&&localStorage.setItem(Or,t),t!==null&&localStorage.removeItem(Dc)})();function Af(){const[e,t]=u.useState(()=>{const o=localStorage.getItem(Or);return o==="light"||o==="dark"?o:"system"}),[n,r]=u.useState(()=>za(e));u.useEffect(()=>{const o=document.documentElement,i=za(e);o.setAttribute("data-theme",i),e==="system"?localStorage.removeItem(Or):localStorage.setItem(Or,e),r(za(e))},[e]),u.useEffect(()=>{if(e!=="system")return;const o=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>r(za("system"));return o.addEventListener("change",i),()=>o.removeEventListener("change",i)},[e]);const a=u.useCallback(()=>{t(o=>o==="system"?"light":o==="light"?"dark":"system")},[]);return{theme:e,effectiveTheme:n,toggle:a}}const ay=5*60*1e3,sy=2e3;function jl(){const[e,t]=u.useState(!1),[n,r]=u.useState("docker"),[a,o]=u.useState(""),[i,l]=u.useState(null),[c,d]=u.useState(!1),[f,g]=u.useState(!1),[p,x]=u.useState(!1),w=u.useRef(null);return u.useEffect(()=>{let v=!1;const j=(y=!1)=>{fetch(y?"/health?refresh=1":"/health").then(S=>S.json()).then(S=>{v||(S.installMethod&&r(S.installMethod),typeof S.latestVersion<"u"&&l(S.latestVersion),S.updateAvailable&&t(!0),S.version&&(o(S.version),w.current===null?w.current=S.version:S.version!==w.current&&S.version!=="dev"&&d(!0)))}).catch(()=>{})};j(!0);const h=setInterval(()=>j(!1),p?sy:ay),m=()=>{document.visibilityState==="visible"&&j(!1)};return document.addEventListener("visibilitychange",m),window.addEventListener("focus",m),()=>{v=!0,clearInterval(h),document.removeEventListener("visibilitychange",m),window.removeEventListener("focus",m)}},[p]),{updateAvailable:e&&!f,installMethod:n,version:a,latestVersion:i,serverRestarted:c,startFastPolling:()=>x(!0),dismiss:()=>g(!0)}}function oy(e){return e?e==="dev"?"dev":/^[0-9a-f]{40}$/i.test(e)?e.slice(0,7):e:""}const Uc={system:"◑",light:"☀",dark:"☾"};function iy(){const{mode:e,group:t,domain:n}=$e();return e==="personal"?s.jsx("span",{children:"personal"}):t?s.jsxs("span",{children:[t.name," / ",n]}):s.jsx("span",{children:n})}function kl({onMenuToggle:e}){const{user:t,logout:n}=$e(),{theme:r,toggle:a}=Af(),{version:o}=jl(),i=oy(o);return s.jsx("nav",{className:"top-nav",children:s.jsxs("div",{className:"top-nav-inner",children:[s.jsxs("div",{className:"logo-group",children:[s.jsx("span",{className:"logo",children:"Suveren"}),s.jsx("span",{className:"version-badge",children:"Local Gateway"})]}),s.jsx("div",{className:"nav-spacer"}),s.jsx("div",{className:"nav-actions nav-actions-desktop",children:t?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"user-chip",children:[s.jsx("strong",{children:t.name}),s.jsx("span",{className:"dot"}),s.jsx(iy,{})]}),s.jsx("button",{className:"theme-toggle",onClick:a,title:`Theme: ${r}`,children:Uc[r]}),s.jsx("button",{className:"nav-logout",onClick:n,children:"Logout"})]}):s.jsxs(s.Fragment,{children:[i&&s.jsxs("span",{title:"Running gateway version",style:{fontSize:"0.8rem",color:"var(--text-tertiary)",fontVariantNumeric:"tabular-nums"},children:["v",i]}),s.jsx("button",{className:"theme-toggle",onClick:a,title:`Theme: ${r}`,children:Uc[r]})]})}),t&&e&&s.jsx("button",{className:"mobile-menu-btn",onClick:e,"aria-label":"Menu",children:"☰"})]})})}function Rt(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 $f(e,t){const n={active:[],pending:[],expired:[],revoked:[]};for(const r of e)n[Rt(r,t)].push(r);return n}function At(e,t,n){const r=u.useRef(e);r.current=e,u.useEffect(()=>{let a=null;const o=()=>typeof document>"u"?!0:document.visibilityState==="visible",i=()=>{o()&&r.current()},l=()=>{a===null&&(a=setInterval(i,t))},c=()=>{a!==null&&(clearInterval(a),a=null)},d=()=>{o()?(r.current(),l()):c()};return o()&&(r.current(),l()),document.addEventListener("visibilitychange",d),()=>{c(),document.removeEventListener("visibilitychange",d)}},[t,n])}const Lf=u.createContext(null),ly=3e4,cy=5e3,uy=3e5;function dy(e,t,n){return t===0?"loading":e!=null&&e.running?"running":e!=null&&e.error?"error":e&&n?"starting":"not-running"}function fy({children:e}){const[t,n]=u.useState({manifests:[],integrations:[],activeSessions:0,mcpServerUp:null,manifestsError:!1,fetchCount:0,authHealth:{}}),r=u.useRef(null),a=u.useCallback(async()=>{let d=!1;const[f,g]=await Promise.all([A.getIntegrationManifests().catch(()=>(d=!0,{manifests:[]})),A.getMcpHealth().catch(()=>null)]);n(x=>({...x,manifests:f.manifests,integrations:(g==null?void 0:g.integrations)??x.integrations,activeSessions:(g==null?void 0:g.activeSessions)??x.activeSessions,mcpServerUp:!!g,manifestsError:d,fetchCount:x.fetchCount+1}));const p=f.manifests.filter(x=>x.oauth);if(p.length>0){const x=await Promise.all(p.map(async w=>[w.id,await A.getOAuthHealth(w.id)]));n(w=>({...w,authHealth:Object.fromEntries(x)}))}},[]),o=t.fetchCount>0&&t.manifests.some(d=>{const f=t.integrations.find(g=>g.id===d.id);return f&&!f.running});xe("integration-changed",a),At(a,o?cy:uy);const i=u.useMemo(()=>{const d=new Map(t.integrations.map(p=>[p.id,p])),f=Date.now();o&&r.current===null?r.current=f:o||(r.current=null);const g=r.current!==null&&f-r.current<ly;return t.manifests.map(p=>{const x=d.get(p.id),w=dy(x,t.fetchCount,g),v=t.authHealth[p.id];return{id:p.id,manifest:p,integration:x,state:w,authStatus:v==null?void 0:v.status,authAccount:v==null?void 0:v.account,authError:v==null?void 0:v.error}})},[t,o]),l=u.useMemo(()=>i.filter(d=>d.state==="not-running"||d.state==="error"||d.authStatus==="failed").length,[i]),c={loading:t.fetchCount===0,mcpServerUp:t.mcpServerUp,manifestsError:t.manifestsError,entries:i,attentionCount:l,activeSessions:t.activeSessions,refresh:a};return s.jsx(Lf.Provider,{value:c,children:e})}function bl(){const e=u.useContext(Lf);if(!e)throw new Error("useIntegrationStatus must be used inside IntegrationStatusProvider");return e}const my=[{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 py(){const{activeDomain:e}=$e(),[t,n]=u.useState({}),r=u.useCallback(async()=>{try{const[a,o,i,l,c]=await Promise.all([A.getCredential("ai-config").catch(()=>null),A.getMyAttestations().catch(()=>null),A.getProposals(e||"owner").catch(()=>null),A.getProposalsForApprover().catch(()=>null),A.getAgentContext().catch(()=>"")]),d={};if(a&&!a.configured&&(d.assistant=1),o){const x=$f(o).expired.length;x>0&&(d.authorizations=x)}const f=(i==null?void 0:i.length)??0,g=(l==null?void 0:l.length)??0,p=f+g;p>0&&(d.proposals=p),(!c||!c.trim())&&(d.brief=1),n(d)}catch{}},[e]);return xe("attestation-changed",r),xe("proposal-added",r),xe("proposal-resolved",r),xe("proposal-approved",r),xe("proposal-rejected",r),xe("team-membership-changed",r),At(r,3e5,e),t}const hy={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},gy={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 yy(){const{mode:e,group:t,domain:n,activeTeam:r}=$e(),a=py(),{attentionCount:o}=bl(),i={...a};o>0&&(i.integrations=o);const l=my.filter(p=>!p.teamOnly||e==="team"),c=u.useRef(null),[d,f]=u.useState(null),g=St();return u.useEffect(()=>{if(c.current===null){c.current=e;return}c.current!==e&&(e==="team"&&r?f(`You are now acting in team context — ${r.name}`):e==="personal"&&f("You have left the team — back to personal context"),c.current=e)},[e,r]),u.useEffect(()=>{f(null)},[g.pathname]),s.jsxs("div",{className:"sidebar",children:[s.jsx("ul",{className:"sidebar-nav",children:l.map(p=>{const x=p.statusKey?i[p.statusKey]:0;return s.jsx("li",{children:s.jsxs(Sl,{to:p.to,end:p.to==="/",className:({isActive:w})=>`sidebar-item${w?" active":""}`,children:[s.jsx("span",{className:"icon",children:p.icon}),p.label,x?s.jsx("span",{style:hy,children:x}):null]})},p.to)})}),s.jsxs("div",{className:"sidebar-context",children:[s.jsx("div",{className:"ctx-label",children:"Active context"}),s.jsx("div",{className:"ctx-value",children:e==="personal"?"personal":t?`${t.name} / ${n}`:n})]}),d&&s.jsx("div",{style:gy,role:"status","aria-live":"polite",children:d})]})}const ho="suveren:updatedTo";function vy(e){return e==="npm"?"npm install -g @suveren/gateway@latest && suveren-gateway restart":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 xy(){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 Mf(){const{updateAvailable:e,installMethod:t,version:n,latestVersion:r,serverRestarted:a,startFastPolling:o,dismiss:i}=jl(),[l,c]=u.useState(!1),[d,f]=u.useState(!1),[g,p]=u.useState(()=>{try{const y=sessionStorage.getItem(ho);if(y)return sessionStorage.removeItem(ho),y}catch{}return null}),x=vy(t),w=u.useRef(null),v=y=>{try{sessionStorage.setItem(ho,y||r||"✓")}catch{}window.location.reload()};u.useEffect(()=>{if(!g)return;const y=setTimeout(()=>p(null),6e3);return()=>clearTimeout(y)},[g]),u.useEffect(()=>{if(!l||!a)return;const y=()=>xy()?!1:(v(n),!0);if(y())return;const S=setInterval(y,1500);return()=>clearInterval(S)},[l,a,n]),u.useEffect(()=>(document.body.classList.toggle("is-updating",l),()=>document.body.classList.remove("is-updating")),[l]);const j=e&&!l&&!g||!!g&&!l;u.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 y=()=>{var T;const b=((T=w.current)==null?void 0:T.offsetHeight)??0;document.documentElement.style.setProperty("--update-banner-h",`${b}px`)};y();const S=new ResizeObserver(y);return w.current&&S.observe(w.current),()=>{S.disconnect(),document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner")}},[j]);const h=()=>{c(!0),o()},m=async()=>{try{await navigator.clipboard.writeText(x),f(!0),setTimeout(()=>f(!1),1800)}catch{}};return s.jsxs(s.Fragment,{children:[g&&!l&&s.jsx("div",{ref:w,className:"update-banner is-live",role:"status","aria-live":"polite",children:s.jsxs("div",{className:"update-banner-row",children:[s.jsxs("span",{className:"update-banner-text",children:["✓"," You","’","re on the latest version",g&&g!=="✓"?` — ${g} is live`:" — now live","."]}),s.jsx("button",{className:"update-banner-x",onClick:()=>p(null),"aria-label":"Dismiss",children:"×"})]})}),e&&!l&&!g&&s.jsx("div",{ref:w,className:"update-banner",role:"status","aria-live":"polite",children:s.jsxs("div",{className:"update-banner-row",children:[s.jsx("span",{className:"update-banner-text",children:"Update available."}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[s.jsx("button",{className:"btn btn-sm btn-secondary",onClick:h,children:"Update"}),s.jsx("button",{className:"update-banner-x",onClick:i,"aria-label":"Dismiss",children:"×"})]})]})}),l&&s.jsx("div",{className:"update-overlay",children:s.jsxs("div",{className:"update-overlay-card",role:"dialog","aria-modal":"true","aria-label":"Finishing the update",children:[s.jsx("div",{className:"update-spinner"}),s.jsxs("h2",{children:["Finishing the update","…"]}),s.jsxs("p",{children:["Copy this command and run it in your terminal. The gateway will restart, and"," ",s.jsx("strong",{children:"this page updates automatically"})," when it comes back ","—"," no need to refresh."]}),s.jsxs("div",{className:"update-cmd-row",children:[s.jsx("code",{className:"update-cmd",children:x}),s.jsx("button",{className:"btn btn-sm btn-primary",onClick:m,children:d?"Copied":"Copy"})]}),s.jsxs("div",{className:"update-status",children:[s.jsx("span",{className:"update-pulse"})," Waiting for the gateway to restart","…"]}),s.jsxs("div",{className:"update-overlay-actions",children:[s.jsx("button",{className:"btn btn-primary",onClick:()=>v(n),children:"Reload now"}),s.jsx("button",{className:"btn btn-secondary",onClick:()=>c(!1),children:"Cancel"})]})]})})]})}const wy={system:"◑",light:"☀",dark:"☾"},Sy=[{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 jy({open:e,onClose:t}){const{user:n,activeGroup:r,activeDomain:a,logout:o}=$e(),{theme:i,toggle:l}=Af(),c=St();return u.useEffect(()=>{t()},[c.pathname]),e?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mobile-menu-backdrop",onClick:t}),s.jsxs("div",{className:"mobile-menu-panel",children:[n&&s.jsxs("div",{className:"mobile-menu-header",children:[s.jsx("strong",{children:n.name}),s.jsx("span",{style:{fontSize:"0.8rem",color:"var(--text-secondary)"},children:r?`${r.name} / ${a}`:a||"personal"})]}),s.jsx("nav",{className:"mobile-menu-nav",children:Sy.map(d=>s.jsxs(Sl,{to:d.to,end:d.to==="/",className:({isActive:f})=>`mobile-menu-item${f?" active":""}`,onClick:t,children:[s.jsx("span",{className:"icon",children:d.icon}),d.label]},d.to))}),s.jsxs("div",{className:"mobile-menu-footer",children:[s.jsxs("button",{className:"mobile-menu-action",onClick:()=>{l()},children:[s.jsx("span",{className:"icon",children:wy[i]}),"Theme: ",i]}),s.jsx("button",{className:"mobile-menu-action",onClick:()=>{o(),t()},children:"Logout"})]})]})]}):null}function ky(){const[e,t]=u.useState(!1);return s.jsxs(fy,{children:[s.jsx(kl,{onMenuToggle:()=>t(!e)}),s.jsx(Mf,{}),s.jsx(yy,{}),s.jsx(jy,{open:e,onClose:()=>t(!1)}),s.jsx("div",{className:"main-content",children:s.jsx("div",{className:"page-inner",children:s.jsx(xg,{})})})]})}function by(){const[e,t]=u.useState(""),{login:n,isLoading:r,error:a,clearError:o}=$e(),[i,l]=u.useState(null),c=async()=>{if(e.trim()){o();try{await n(e)}catch(g){if(g instanceof Pf){l(g.summary);return}}}},d=async()=>{l(null),o();try{await n(e,{confirmWipe:!0})}catch{}},f=()=>{l(null)};return s.jsxs(s.Fragment,{children:[s.jsx(kl,{}),s.jsx(Mf,{}),s.jsxs("div",{className:"login-split",children:[s.jsx("div",{className:"login-split-left",children:s.jsxs("div",{style:{maxWidth:"28rem"},children:[s.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."}),s.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."})]})}),s.jsx("div",{className:"login-split-right",children:s.jsxs("div",{style:{width:"100%",maxWidth:"24rem"},children:[s.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[s.jsx("div",{style:{fontSize:"1.75rem",fontWeight:700,marginBottom:"0.5rem"},children:"Sign In"}),s.jsx("div",{style:{fontSize:"0.95rem",color:"var(--text-secondary)",lineHeight:1.5},children:"Enter your API key to manage authorizations."})]}),a&&s.jsx("div",{className:"error-message",children:a}),s.jsxs("div",{className:"form-group",style:{marginBottom:"1.5rem"},children:[s.jsx("label",{className:"form-label",children:"API Key"}),s.jsx("input",{className:"form-input",type:"password",placeholder:"hap_sk_...",value:e,onChange:g=>t(g.target.value),onKeyDown:g=>g.key==="Enter"&&c(),disabled:r,style:{padding:"0.75rem"}}),s.jsx("div",{className:"form-hint",children:"From your Suveren account."})]}),s.jsx("button",{className:"btn btn-primary btn-full btn-lg",onClick:c,disabled:r,style:{marginBottom:"2rem"},children:r?"Signing in...":"Sign In"}),s.jsx("div",{className:"login-divider",children:"New here?"}),s.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[s.jsxs("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary)",marginBottom:"1rem",lineHeight:1.5},children:["Create an account on Suveren,",s.jsx("br",{}),"then come back to sign in."]}),s.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"})]}),s.jsxs("div",{style:{paddingTop:"1.75rem",borderTop:"1px solid var(--border)"},children:[s.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",marginBottom:"0.875rem"},children:"Getting started"}),s.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.8},children:[s.jsxs(s.Fragment,{children:["Create an account at ",s.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((g,p)=>s.jsxs("div",{style:{display:"flex",gap:"0.625rem",alignItems:"baseline",marginBottom:p<2?"0.5rem":0},children:[s.jsxs("span",{style:{color:"var(--accent)",fontWeight:700,fontSize:"0.95rem"},children:[p+1,"."]}),g]},p))})]})]})})]}),i&&s.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:f,children:s.jsxs("div",{className:"card",onClick:g=>g.stopPropagation(),style:{maxWidth:520,width:"100%",margin:0},children:[s.jsx("h3",{id:"wipe-warning-title",className:"card-title",style:{marginBottom:"0.5rem"},children:"Sign in with a different account?"}),s.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 ",s.jsx("strong",{children:"permanently wipe"})," the following local data:"]}),s.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[s.jsxs("li",{children:[i.credentialCount," stored service credential",i.credentialCount===1?"":"s",i.credentialIds.length>0&&s.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`:"",")"]})]}),s.jsxs("li",{children:[i.serviceCount," configured integration",i.serviceCount===1?"":"s"]}),s.jsx("li",{children:"The local E2EE keypair (a new one will be generated for this account)"}),s.jsx("li",{children:"Any unsynchronised gate content stored locally"})]}),s.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."}),s.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."}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end"},children:[s.jsx("button",{className:"btn btn-ghost",onClick:f,disabled:r,children:"Cancel"}),s.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:d,disabled:r,children:r?"Signing in...":"Wipe local data and sign in"})]})]})})]})}function Cy(){const{setActiveContext:e}=$e(),t=Qt(),[n,r]=u.useState(""),[a,o]=u.useState(""),[i,l]=u.useState(""),[c,d]=u.useState(!1),f=async()=>{if(n.trim()){d(!0),l("");try{const p=await A.joinGroup(n.trim());e(p,p.myDomains[0]||""),t("/")}catch(p){l(p instanceof Error?p.message:"Failed to join group")}finally{d(!1)}}},g=async()=>{if(a.trim()){d(!0),l("");try{const p=await A.createGroup(a.trim());e(p,p.myDomains[0]||""),t("/")}catch(p){l(p instanceof Error?p.message:"Failed to create group")}finally{d(!1)}}};return s.jsxs(s.Fragment,{children:[s.jsx(kl,{}),s.jsx("div",{className:"main-content no-sidebar",style:{marginTop:"var(--nav-height)"},children:s.jsxs("div",{style:{maxWidth:"30rem",margin:"3rem auto",padding:"0 1rem"},children:[s.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[s.jsx("h2",{style:{fontSize:"1.5rem",marginBottom:"0.5rem"},children:"Join Your Team"}),s.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&&s.jsx("div",{className:"error-message",children:i}),s.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[s.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Join an existing group"}),s.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Ask your team admin for an invite code."}),s.jsxs("div",{className:"invite-input-row",children:[s.jsx("input",{className:"form-input",placeholder:"Paste invite code...",value:n,onChange:p=>r(p.target.value),onKeyDown:p=>p.key==="Enter"&&f(),style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem"},disabled:c}),s.jsx("button",{className:"btn btn-primary",onClick:f,disabled:c,children:"Join"})]})]}),s.jsxs("div",{className:"card",children:[s.jsx("h4",{style:{fontSize:"0.95rem",marginBottom:"0.25rem"},children:"Create a new group"}),s.jsx("p",{style:{fontSize:"0.825rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:"Start a new team and invite members. Assign domains after creation."}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("input",{className:"form-input",placeholder:"Group name (e.g., Acme Corp)",value:a,onChange:p=>o(p.target.value),onKeyDown:p=>p.key==="Enter"&&g(),style:{flex:1},disabled:c}),s.jsx("button",{className:"btn btn-secondary",onClick:g,disabled:c,children:"Create"})]})]})]})})]})}const hi="suveren-setup-ai-skipped",gi="suveren-setup-agent-done",yi="suveren-setup-dismissed",Ny={"hap-setup-ai-skipped":hi,"hap-setup-agent-done":gi,"hap-setup-dismissed":yi};function Ey(){for(const[e,t]of Object.entries(Ny)){const n=localStorage.getItem(e);n!==null&&localStorage.getItem(t)===null&&localStorage.setItem(t,n),n!==null&&localStorage.removeItem(e)}}Ey();const go={"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
|
-
|
|
53
|
-
${JSON.stringify({mcpServers:{"suveren-gateway":{url:`${e}/sse`}}},null,2)}`},other:{label:"Other",snippet:e=>`Streamable HTTP: POST ${e}/mcp
|
|
54
|
-
SSE transport: GET ${e}/sse
|
|
55
|
-
Health check: GET ${e}/health`}};function Ty({aiConfigured:e,hasRunningIntegration:t,hasActiveAuth:n,hasAgentConnected:r,mcpEndpoint:a}){const[o,i]=u.useState(()=>localStorage.getItem(hi)==="true"),[l,c]=u.useState(()=>localStorage.getItem(gi)==="true"),[d,f]=u.useState(()=>localStorage.getItem(yi)==="true"),[g,p]=u.useState(null),[x,w]=u.useState("claude-code"),[v,j]=u.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":o?"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(k=>k.status==="done"||k.status==="skipped").length,y=m===h.length,S=u.useCallback(()=>{localStorage.setItem(hi,"true"),i(!0)},[]),b=u.useCallback(()=>{localStorage.setItem(gi,"true"),c(!0),p(null)},[]),T=u.useCallback(()=>{localStorage.setItem(yi,"true"),f(!0)},[]),E=u.useCallback(async k=>{try{await navigator.clipboard.writeText(k),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},[]);if(d||y)return null;const P=h.findIndex(k=>k.status==="pending");return s.jsxs("div",{style:{border:"2px solid var(--accent)",borderRadius:"0.75rem",padding:"1.5rem",marginBottom:"1.5rem",background:"var(--bg-elevated)"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"1.25rem"},children:[s.jsx("h2",{style:{fontSize:"1.1rem",fontWeight:700,margin:0},children:"Get Started"}),s.jsx("button",{onClick:T,style:{background:"none",border:"none",color:"var(--text-tertiary)",cursor:"pointer",fontSize:"1.1rem",padding:"0 0.25rem",lineHeight:1},title:"Hide setup guide",children:"×"})]}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:h.map((k,z)=>{const O=z===P,K=k.status==="done"||k.status==="skipped"?"●":"○",V=k.status==="done"?"var(--success)":k.status==="skipped"?"var(--text-tertiary)":O?"var(--accent)":"var(--text-tertiary)";return s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:O?"0.75rem":"0.25rem 0",borderRadius:O?"0.5rem":void 0,background:O?"var(--accent-subtle)":void 0},children:[s.jsx("span",{style:{color:V,fontSize:"0.75rem",marginTop:"0.2rem",flexShrink:0},children:K}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[k.to&&k.status==="pending"?s.jsx(Ge,{to:k.to,style:{fontSize:"0.9rem",fontWeight:O?600:500,color:O?"var(--accent)":"var(--text-primary)",textDecoration:"none"},children:k.label}):k.status==="pending"&&z===3?s.jsx("button",{onClick:()=>p(g===3?null:3),style:{background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"0.9rem",fontWeight:O?600:500,color:O?"var(--accent)":"var(--text-primary)"},children:k.label}):s.jsx("span",{style:{fontSize:"0.9rem",fontWeight:500,color:k.status==="done"?"var(--text-secondary)":"var(--text-tertiary)"},children:k.label}),k.optional&&k.status==="pending"&&s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontStyle:"italic"},children:"optional"}),k.status==="skipped"&&s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:"skipped"})]}),k.detail&&k.status==="pending"&&O&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.25rem",lineHeight:1.5},children:k.detail})]}),k.optional&&k.status==="pending"&&s.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"}),k.to&&k.status==="pending"&&s.jsx(Ge,{to:k.to,style:{color:"var(--text-tertiary)",textDecoration:"none",fontSize:"0.8rem",flexShrink:0},children:"›"})]}),z===3&&g===3&&s.jsxs("div",{style:{marginTop:"0.75rem",marginLeft:"1.5rem",padding:"1rem",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:"0.5rem"},children:[s.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,marginBottom:"0.75rem",color:"var(--text-primary)"},children:"MCP Endpoint"}),s.jsx("div",{style:{fontFamily:"monospace",fontSize:"0.85rem",padding:"0.5rem 0.75rem",background:"var(--bg-elevated)",border:"1px solid var(--border)",borderRadius:"0.375rem",marginBottom:"1rem",wordBreak:"break-all"},children:a}),s.jsx("div",{style:{display:"flex",gap:"0.25rem",marginBottom:"0.75rem"},children:Object.entries(go).map(([U,N])=>s.jsx("button",{onClick:()=>w(U),style:{padding:"0.375rem 0.75rem",fontSize:"0.75rem",fontWeight:x===U?600:400,background:x===U?"var(--accent-subtle)":"transparent",color:x===U?"var(--accent)":"var(--text-secondary)",border:`1px solid ${x===U?"var(--accent)":"var(--border)"}`,borderRadius:"0.375rem",cursor:"pointer"},children:N.label},U))}),s.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:go[x].snippet(a)}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>E(go[x].snippet(a)),children:v?"Copied":"Copy"}),s.jsx("button",{className:"btn btn-primary btn-sm",onClick:b,children:"Done"})]})]})]},z)})}),s.jsxs("div",{style:{marginTop:"1.25rem"},children:[s.jsx("div",{style:{height:"4px",background:"var(--border)",borderRadius:"2px",overflow:"hidden"},children:s.jsx("div",{style:{height:"100%",width:`${m/h.length*100}%`,background:"var(--accent)",borderRadius:"2px",transition:"width 0.3s ease"}})}),s.jsxs("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.375rem"},children:[m," of ",h.length," complete"]})]})]})}function En({variant:e="base",style:t,className:n,...r}){const a=e==="title"?"skeleton skeleton-title":e==="line"?"skeleton skeleton-line":e==="line-sm"?"skeleton skeleton-line-sm":"skeleton";return s.jsx("span",{className:`${a}${n?` ${n}`:""}`,style:t,role:"status","aria-busy":"true","aria-label":r["aria-label"]??"Loading"})}function yo(){return s.jsxs("div",{className:"skeleton-card",role:"status","aria-busy":"true","aria-label":"Loading",children:[s.jsx(En,{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",flexShrink:0}}),s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"0.35rem"},children:[s.jsx(En,{variant:"line",style:{width:"35%"}}),s.jsx(En,{variant:"line-sm",style:{width:"65%"}})]})]})}const zy={gmail:"Gmail",calendar:"Google Calendar",crm:"CRM",linkedin:"LinkedIn",records:"Records",mollie:"Mollie"},Ff=e=>zy[e]??e,Iy={resource:{chip:"Restricted",sev:"warn"},spam:{chip:"Spam / Trash",sev:"info"},age:{chip:"Too old",sev:"warn"},unset_age:{chip:"Needs setup",sev:"act",fixTo:"/integrations"},read_gate:{chip:"Not granted",sev:"act",fixTo:"/authorizations"},ungoverned:{chip:"Unconfigured",sev:"act"},query_unsafe:{chip:"Unsafe search",sev:"info"}};function Py(e){return Iy[e]??{chip:"Blocked",sev:"info"}}function Ry(e){const t=Ff(e.integrationId);switch(e.reason){case"resource":return e.integrationId==="calendar"?s.jsxs(s.Fragment,{children:["Tried to read your ",s.jsx("b",{children:e.target??"restricted"})," calendar"]}):s.jsxs(s.Fragment,{children:["Tried to read a restricted location in ",t]});case"spam":return s.jsxs(s.Fragment,{children:["Tried to open a message in ",s.jsx("b",{children:"spam or trash"})]});case"age":return s.jsxs(s.Fragment,{children:["Tried to read ",t," older than your read window"]});case"unset_age":return s.jsxs(s.Fragment,{children:["Your ",t," has ",s.jsx("b",{children:"no read window set"}),", so reads are blocked"]});case"read_gate":return s.jsxs(s.Fragment,{children:["Read access isn't granted on your ",t," authorization"]});case"ungoverned":return s.jsxs(s.Fragment,{children:["A ",t," tool isn't configured for safe reading"]});case"query_unsafe":return s.jsx(s.Fragment,{children:"A search couldn't be safely limited and was refused"});default:return s.jsx(s.Fragment,{children:e.detail})}}function _y(e,t){const n=Math.max(0,(t-e)/1e3);if(n<60)return"Just now";if(n<3600)return`${Math.floor(n/60)} min ago`;if(n<86400)return`${Math.floor(n/3600)} hr ago`;const r=Math.floor(n/86400);return r===1?"Yesterday":`${r} days ago`}const Ay=5;function $y(){const[e,t]=u.useState(null),[n,r]=u.useState(0),[a,o]=u.useState(!1),[i,l]=u.useState(!1),c=u.useCallback(()=>{A.getDenials({limit:a?200:Ay}).then(({count:f,records:g})=>{r(f),t(g),l(!1)}).catch(()=>l(!0))},[a]);if(u.useEffect(()=>{c()},[c]),At(c,12e4),i||e===null)return null;const d=(f,g)=>{const p=Py(f.reason);return s.jsxs("div",{className:"rb-row",children:[s.jsx("span",{className:`rb-dot ${p.sev==="act"?"act":p.sev==="info"?"info":""}`,"aria-hidden":"true"}),s.jsxs("div",{className:"rb-body",children:[s.jsx("div",{className:"rb-line",children:Ry(f)}),s.jsxs("div",{className:"rb-meta",children:[s.jsx("span",{className:`rb-chip ${p.sev==="act"?"act":p.sev==="warn"?"warn":""}`,children:p.chip}),s.jsx("span",{className:"rb-via",children:Ff(f.integrationId)})]}),p.fixTo&&s.jsx(Ge,{className:"rb-fix",to:p.fixTo,children:"Set a read window →"})]}),s.jsx("div",{className:"rb-when",children:_y(f.ts,Date.now())})]},`${f.ts}-${g}`)};return s.jsxs("section",{className:"card recent-blocks","aria-label":"Recent blocks",style:{marginTop:"1.5rem"},children:[s.jsxs("div",{className:"card-header",children:[s.jsx("h2",{className:"card-title",children:"Recent blocks"}),n>0&&s.jsx("span",{className:"rb-count",children:n})]}),e.length===0?s.jsxs("div",{className:"rb-empty",children:[s.jsx("span",{className:"rb-mark","aria-hidden":"true",children:s.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"M20 6 9 17l-5-5"})})}),s.jsx("h3",{children:"Nothing blocked"}),s.jsx("p",{children:"Your agent has stayed within every limit you set."})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"rb-sub",children:"Limits you set that stopped your agent. Seeing them here means the gateway is doing its job."}),s.jsx("div",{className:"rb-rows",children:e.map(d)}),!a&&n>e.length&&s.jsx("div",{className:"rb-foot",children:s.jsxs("button",{className:"rb-viewall",type:"button",onClick:()=>o(!0),children:["View all ",n," blocks"]})})]})]})}const Ly=30*60;function vo(e){return e.replace(/@.*$/,"").split("/").pop()??e}function My(){var U;const{domain:e}=$e(),[t,n]=u.useState([]),[r,a]=u.useState([]),[o,i]=u.useState([]),[l,c]=u.useState(!0),[d,f]=u.useState(!1),[g,p]=u.useState(!1),[x,w]=u.useState(!1),{entries:v,activeSessions:j,loading:h}=bl(),m=!h,y=u.useCallback(()=>{A.getMyAttestations().then(N=>{n(N),f(!0)}).catch(()=>f(!0)),A.getProposals(e||"owner").then(N=>{a(N),p(!0)}).catch(()=>p(!0)),A.getProposalsForApprover().then(N=>i(N)).catch(()=>i([])),A.getCredential("ai-config").then(N=>{c(N.configured),w(!0)}).catch(()=>w(!0))},[e]);xe("attestation-changed",y),xe("proposal-added",y),xe("proposal-resolved",y),xe("proposal-approved",y),xe("proposal-rejected",y),At(y,3e5,e);const S=d&&g&&x&&m,b=$f(t),T=b.active,E=b.expired,P=T.filter(N=>N.remaining_seconds!==null&&N.remaining_seconds<=Ly),k=r.filter(N=>N.status==="pending"),z=v.filter(N=>N.state==="running"),O=v.filter(N=>N.state==="starting"),K=v.filter(N=>N.state==="not-running"||N.state==="error"),V=[];for(const N of o)V.push({label:"Approval needed",detail:`${N.tool} — above-cap action under ${vo(N.profileId)}`,to:"/proposals",color:"var(--warning)"});for(const N of k)V.push({label:"Approval pending",detail:`${N.tool} awaiting your approval`,to:"/proposals",color:"var(--warning)"});for(const N of P){const X=Math.ceil((N.remaining_seconds??0)/60);V.push({label:"Expiring soon",detail:`${N.title??vo(N.profile_id)} — ${X} min remaining`,to:"/authorizations",color:"var(--warning)"})}for(const N of E)V.push({label:"Expired",detail:N.title??vo(N.profile_id),to:"/authorizations",color:"var(--danger)"});for(const N of K)V.push({label:N.state==="error"?"Integration error":"Integration stopped",detail:N.state==="error"&&((U=N.integration)!=null&&U.error)?`${N.manifest.name}: ${N.integration.error}`:`${N.manifest.name} is not running`,to:"/integrations",color:"var(--danger)"});for(const N of O)V.push({label:"Integration starting",detail:`${N.manifest.name} is coming up…`,to:"/integrations",color:"var(--warning)"});for(const N of v)N.authStatus==="failed"&&N.state!=="not-running"&&N.state!=="error"&&V.push({label:"Reconnect needed",detail:`${N.manifest.name}: authorization expired — reconnect to restore access`,to:"/integrations",color:"var(--danger)"});return l||V.push({label:"AI Assistant",detail:"Not configured — needed for gate advisory",to:"/settings",color:"var(--text-tertiary)"}),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"page-header",children:s.jsx("h1",{className:"page-title",children:"Dashboard"})}),S&&s.jsx(Ty,{aiConfigured:l,hasRunningIntegration:z.length>0,hasActiveAuth:T.length>0,hasAgentConnected:j>0,mcpEndpoint:`http://localhost:${window.location.port==="3400"?"3430":"7430"}`}),s.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(8rem, 1fr))",gap:"0.75rem",marginBottom:"1.5rem"},children:[s.jsx(Ge,{to:"/authorizations",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[d?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:T.length>0?"var(--success)":"var(--text-tertiary)"},children:T.length}):s.jsx(En,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Active"})]})}),s.jsx(Ge,{to:"/proposals",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[g?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:k.length>0?"var(--warning)":"var(--text-tertiary)"},children:k.length}):s.jsx(En,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pending Approvals"})]})}),s.jsx(Ge,{to:"/authorizations",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[d?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:E.length>0?"var(--danger)":"var(--text-tertiary)"},children:E.length}):s.jsx(En,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Expired"})]})}),s.jsx(Ge,{to:"/integrations",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[m?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:z.length>0?"var(--success)":"var(--text-tertiary)"},children:z.length}):s.jsx(En,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Integrations Running"})]})})]}),V.length>0?s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:V.map((N,X)=>s.jsx(Ge,{to:N.to,style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"0.75rem 1rem",display:"flex",alignItems:"center",gap:"0.75rem"},children:[s.jsx("span",{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",background:N.color,flexShrink:0}}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsx("div",{style:{fontSize:"0.8rem",fontWeight:600,color:"var(--text-primary)"},children:N.label}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:N.detail})]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"›"})]})},X))}):S?s.jsx("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:s.jsx("div",{style:{fontSize:"0.9rem",color:"var(--text-secondary)"},children:"All clear. Nothing needs your attention."})}):s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:[s.jsx(yo,{}),s.jsx(yo,{}),s.jsx(yo,{})]}),s.jsx($y,{})]})}const Fy=["Scope & Limits","Intent","Authorize"];function Of({currentStep:e,onStepClick:t}){const n=Qt();return s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",marginBottom:"2.5rem"},children:[s.jsx("div",{style:{display:"flex",alignItems:"center",flex:1,overflow:"hidden"},children:Fy.map((r,a)=>{const o=a+2,i=o<e,l=o===e;return s.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[a>0&&s.jsx("div",{style:{width:"1.5rem",height:"2px",background:i?"var(--accent)":"var(--border)",flexShrink:1}}),s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",flexShrink:0},children:[s.jsx("div",{className:`step-circle${i?" completed":""}${l?" current":""}`,onClick:i&&t?()=>t(o):void 0,style:i&&t?{cursor:"pointer"}:void 0,children:i?"✓":a+1}),s.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})]})]},o)})}),s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>n("/agent/new"),style:{flexShrink:0,fontSize:"0.8rem",marginTop:"0.15rem"},children:"Cancel"})]})}const Oy=40;function Fe(e,t){const n=e.lastIndexOf("/"),r=n>=0?e.slice(n+1):e,a=r.indexOf("@"),o=a>=0?r.slice(0,a):r;return(o.charAt(0).toUpperCase()+o.slice(1)).slice(0,Oy)}function By({profileId:e,bounds:t,groupName:n,domain:r,onSwitch:a}){return s.jsxs("div",{className:"context-strip",children:[n&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"context-strip-label",children:"Team:"}),s.jsxs("span",{children:[s.jsx("strong",{children:n}),r?` / ${r}`:""]})]}),e&&s.jsxs("span",{children:[s.jsx("strong",{children:"Profile:"})," ",Fe(e)]}),t&&s.jsxs("span",{children:[s.jsx("strong",{children:"Bounds:"})," ",t]}),a&&s.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginLeft:"auto",padding:"0.2rem 0.5rem",fontSize:"0.7rem"},onClick:a,children:"Switch"})]})}function Dy({integrationId:e,field:t,value:n,onChange:r,disabled:a,onLabels:o}){const[i,l]=u.useState(null),[c,d]=u.useState(null),[f,g]=u.useState(!0);u.useEffect(()=>{let w=!1;return A.discoverScopeField(e,t).then(v=>{var j;w||(l(v.options),g(!1),(j=v.options)!=null&&j.length&&(o==null||o(Object.fromEntries(v.options.map(h=>[h.value,h.label])))))}).catch(v=>{w||(d(v instanceof Error?v.message:String(v)),g(!1))}),()=>{w=!0}},[e,t]);const p=new Set(n.split(",").map(w=>w.trim()).filter(Boolean)),x=w=>{const v=new Set(p);v.has(w)?v.delete(w):v.add(w),r(Array.from(v).join(","))};return f?s.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["Loading options from ",e,"…"]}):c||!i?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--warning)",marginBottom:"0.5rem"},children:["Couldn't fetch options (",c??"no response","). Enter values manually, separated by commas."]}),s.jsx("input",{className:"form-input",type:"text",value:n,onChange:w=>r(w.target.value),disabled:a})]}):i.length===0?s.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["No options available from ",e," for this field."]}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:i.map(w=>{const v=w.extras??{},j=typeof v.access=="string"?v.access:void 0,h=j==="reader",m=v.primary===!0;return s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.875rem",color:h?"var(--text-tertiary)":"var(--text-primary)",cursor:a||h?"not-allowed":"pointer"},title:h?"Read-only — you can authorize list/read but not writes":void 0,children:[s.jsx("input",{type:"checkbox",checked:p.has(String(w.value)),onChange:()=>x(String(w.value)),disabled:a||h}),s.jsx("span",{children:w.label||w.value}),m&&s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"primary"}),j&&s.jsxs("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["· ",j]})]},w.value)})})}function Uy(e){return e.replace(/@.*$/,"").split("/").pop()??e}function Wy(e,t){return t.displayName?t.displayName:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function Hy(e){return e.type==="string"&&(e.format==="email"||e.format==="domain")}function Vy(e){var t;return!!(e.enum&&((t=e.constraint)!=null&&t.enforceable.includes("subset")))}function Wc(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 Ky(e){return!e||e==="count"?"":e==="minutes"?"min":e==="hours"?"hr":e==="days"?"days":e==="percent"?"%":e.startsWith("currency:")?e.slice(9):e}function Gy(e){return e?e==="minutes"?15:e==="percent"?5:e.startsWith("currency:")?10:1:1}function Yy(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 Qy(e,t){if(!e||!t)return"";const n=Number(e);if(!Number.isFinite(n)||n<=0)return"";if(t==="minutes"&&n>=60){const r=Math.floor(n/60),a=n%60;return a===0?`${r} hour${r!==1?"s":""}`:`${r}h ${a}m`}if(t==="hours"&&n>=24&&n%24===0){const r=n/24;return`${r} day${r!==1?"s":""}`}if(t==="days"){if(n>=30&&n%30===0)return`${n/30} month${n/30!==1?"s":""}`;if(n>=7&&n%7===0)return`${n/7} week${n/7!==1?"s":""}`}return""}function Jy({id:e,value:t,onChange:n,disabled:r,placeholder:a,unit:o}){const i=Gy(o),l=Yy(o),c=Ky(o),d=Qy(t,o),f=t===""?null:Number(t),g=()=>{const x=t===""?0:Number(t),w=x%i,v=w===0?x+i:x+(i-w);n(String(v))},p=()=>{const x=t===""?0:Number(t);if(x<=0)return;const w=x%i,v=w===0?x-i:x-w;n(String(Math.max(0,v)))};return s.jsxs("div",{className:"bounded-input",children:[s.jsxs("div",{className:"bounded-input-field",children:[s.jsx("button",{type:"button",className:"stepper-btn stepper-decrement",onClick:p,disabled:r||t===""||Number(t)<=0,"aria-label":"Decrease",children:"−"}),s.jsx("input",{id:e,className:"stepper-input",type:"number",min:0,step:i,value:t,placeholder:a??"0",onChange:x=>n(x.target.value),onFocus:x=>x.target.select(),disabled:r}),s.jsx("button",{type:"button",className:"stepper-btn stepper-increment",onClick:g,disabled:r,"aria-label":"Increase",children:"+"}),c&&s.jsx("span",{className:"bounded-input-unit","aria-hidden":"true",children:c})]}),l.length>0&&!r&&s.jsx("div",{className:"bounded-input-presets",role:"group","aria-label":"Quick presets",children:l.map(x=>s.jsx("button",{type:"button",className:`preset-chip${f===x.value?" preset-chip-selected":""}`,onClick:()=>n(String(x.value)),children:x.label},x.value))}),d&&s.jsxs("div",{className:"bounded-input-echo",children:["≈ ",d]})]})}function Hc({htmlFor:e,label:t,description:n}){const[r,a]=u.useState(!1);return s.jsxs("div",{className:"field-label-with-tip",children:[s.jsx("label",{className:"form-label",htmlFor:e,children:t}),n&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"field-tip-trigger","aria-label":`What does "${t}" mean?`,"aria-expanded":r,onClick:()=>a(o=>!o),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onBlur:()=>a(!1),children:"i"}),r&&s.jsx("div",{className:"field-tip-bubble",role:"tooltip",children:n})]})]})}function Xy({id:e,value:t,onChange:n,disabled:r,format:a,placeholder:o}){const[i,l]=u.useState(""),[c,d]=u.useState(!1),f=u.useRef(null),g=t?t.split(",").map(h=>h.trim()).filter(Boolean):[],p=h=>{const m=h.trim();if(!m)return;if(!Wc(m,a)){d(!0);return}d(!1);const y=g.includes(m)?g:[...g,m];n(y.join(",")),l("")},x=h=>{const m=g.filter((y,S)=>S!==h);n(m.join(","))},w=h=>{h.key==="Enter"||h.key===","||h.key==="Tab"?i.trim()&&(h.preventDefault(),p(i)):h.key==="Backspace"&&!i&&g.length>0&&x(g.length-1)},v=h=>{const m=h.clipboardData.getData("text");if(m.includes(",")){h.preventDefault();const S=m.split(",").map(T=>T.trim()).filter(Boolean).filter(T=>Wc(T,a)),b=[...new Set([...g,...S])];n(b.join(",")),l(""),d(!1)}},j=a==="email"?"Type email and press Enter...":"Type domain and press Enter...";return s.jsxs("div",{className:`tag-input${c?" tag-input-invalid":""}`,onClick:()=>{var h;return(h=f.current)==null?void 0:h.focus()},children:[g.map((h,m)=>s.jsxs("span",{className:"tag-pill",children:[h,!r&&s.jsx("button",{type:"button",className:"tag-remove",onClick:y=>{y.stopPropagation(),x(m)},"aria-label":`Remove ${h}`,children:"×"})]},h)),!r&&s.jsx("input",{ref:f,id:e,className:"tag-input-field",type:"text",value:i,onChange:h=>{l(h.target.value),d(!1)},onKeyDown:w,onPaste:v,onBlur:()=>{i.trim()&&p(i)},placeholder:g.length===0?o??j:""})]})}function qy({id:e,options:t,value:n,onChange:r,disabled:a}){const o=n?n.split(",").map(l=>l.trim()).filter(Boolean):[],i=l=>{const c=o.includes(l)?o.filter(d=>d!==l):[...o,l];r(c.join(","))};return s.jsx("div",{className:"checkbox-group",id:e,children:t.map(l=>s.jsxs("label",{className:`checkbox-pill${o.includes(l)?" checkbox-pill-selected":""}`,children:[s.jsx("input",{type:"checkbox",checked:o.includes(l),onChange:()=>i(l),disabled:a}),s.jsx("span",{children:l})]},l))})}function Vc({fieldKey:e,fieldDef:t,value:n,onChange:r,prefix:a,readOnly:o,twoColumn:i,discoveryIntegrationId:l,onLabels:c}){const d=Wy(e,t),f=`${a}-field-${e}`,g=s.jsx(s.Fragment,{children:Vy(t)?s.jsx(qy,{id:f,options:t.enum,value:n,onChange:p=>r(e,p),disabled:o}):(()=>{const p=t.boundType;return(p==null?void 0:p.kind)==="enum"&&Array.isArray(p.values)})()?s.jsxs("select",{id:f,className:"form-select",value:n,onChange:p=>r(e,p.target.value),disabled:o,children:[s.jsx("option",{value:"",children:"Select..."}),t.boundType.values.map(p=>s.jsx("option",{value:p,children:p},p))]}):"enum"in t&&t.enum?s.jsxs("select",{id:f,className:"form-select",value:n,onChange:p=>r(e,p.target.value),disabled:o,children:[s.jsx("option",{value:"",children:"Select..."}),t.enum.map(p=>s.jsx("option",{value:p,children:p},p))]}):t.type==="number"?s.jsx(Jy,{id:f,value:n,onChange:p=>r(e,p),disabled:o,unit:t.unit}):Hy(t)?s.jsx(Xy,{id:f,value:n,onChange:p=>r(e,p),disabled:o,format:t.format}):l?s.jsx(Dy,{integrationId:l,field:e,value:n,onChange:p=>r(e,p),disabled:o,onLabels:p=>c==null?void 0:c(e,p)}):s.jsx("input",{id:f,className:"form-input",type:"text",value:n,onChange:p=>r(e,p.target.value),disabled:o})});return i?s.jsxs("div",{className:"bounds-field-row",children:[s.jsx("div",{className:"bounds-field-label",children:s.jsx(Hc,{htmlFor:f,label:d,description:t.description})}),s.jsx("div",{className:"bounds-field-input",children:g})]},`${a}-${e}`):s.jsxs("div",{className:"form-group",children:[s.jsx(Hc,{htmlFor:f,label:d,description:t.description}),g]},`${a}-${e}`)}function Zy(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 o=!1;for(const[i,l]of Object.entries(n)){const c=e[i];if(c===""||c===void 0)continue;const d=Number(c);if(!isNaN(d)&&d>l){o=!0;break}}return o?r?"above-approvers":"hard-ceiling":"within-cap"}function ev(e,t){const n=new Set;if(!t)return n;for(const[r,a]of Object.entries(t)){const o=e[r];if(o===""||o===void 0)continue;const i=Number(o);!isNaN(i)&&i>a&&n.add(r)}return n}function tv({profile:e,onConfirm:t,onCancel:n,readOnly:r,initialBounds:a,initialContext:o,initialFrame:i,profileConfig:l,approverNames:c,adminName:d}){const f=e.boundsSchema??e.frameSchema,g=e.contextSchema,p=f?Object.entries(f.fields).filter(([C,_])=>!(C==="profile"||C==="path"||_.enforced===!1||_.enforcedBy==="gatekeeper")):[],x=f?Object.entries(f.fields).filter(([,C])=>C.enforcedBy==="gatekeeper").filter(([,C])=>C.enforced!==!1).map(([C,_])=>_.displayName??C):[],w=g&&g.keyOrder.length>0?Object.entries(g.fields):[],v=a??i??{},j=o??{},h={};for(const[C]of p)h[C]=v[C]!==void 0?String(v[C]):"";const m={};for(const[C]of w)m[C]=j[C]!==void 0?String(j[C]):"";const[y,S]=u.useState(h),[b,T]=u.useState(m),[E,P]=u.useState({}),[k,z]=u.useState(null);u.useEffect(()=>{const C=Uy(e.id);A.getIntegrationManifests().then(({manifests:_})=>{const H=_.find(B=>B.profile===C&&B.contextDiscovery&&Object.keys(B.contextDiscovery).length>0);z(H??null)}).catch(()=>z(null))},[e.id]);const O=Zy(y,l),K=ev(y,l==null?void 0:l.caps),V=(C,_)=>{S(H=>({...H,[C]:_}))},U=(C,_)=>{T(H=>({...H,[C]:_}))},N=()=>{const C={profile:e.id};for(const[H,B]of p)B.type==="number"?C[H]=y[H]===""?0:Number(y[H]):C[H]=y[H];const _={};for(const[H,B]of w)B.type==="number"?_[H]=b[H]===""?0:Number(b[H]):_[H]=b[H];return[C,_]},X=()=>{const[C,_]=N();t(C,_,E)},re=()=>{const C=(l==null?void 0:l.caps)??{},_={...y};for(const ie of K)C[ie]!==void 0&&(_[ie]=String(C[ie]));S(_);const H={profile:e.id};for(const[ie,I]of p)if(I.type==="number"){const Y=_[ie]??"";H[ie]=Y===""?0:Number(Y)}else H[ie]=_[ie]??"";const B={};for(const[ie,I]of w)I.type==="number"?B[ie]=b[ie]===""?0:Number(b[ie]):B[ie]=b[ie];t(H,B,E)},L=C=>{const _=l==null?void 0:l.caps;if(!_||_[C]===void 0)return null;const H=_[C],B=K.has(C);return O==="hard-ceiling"&&B?s.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--danger)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",H," — exceeds team ceiling"]}):O==="above-approvers"&&B?s.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--warning)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",H," — above cap"]}):s.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--success)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",H," ok"]})},R=()=>{var C;if(O==="no-config")return null;if(O==="approvers-dormant"){const _=c&&c.length>0?c.join(", "):"the configured approvers";return s.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:[s.jsxs("div",{style:{fontWeight:600,color:"var(--accent)",marginBottom:"0.25rem"},children:["Profile approvers: ",_]}),s.jsxs("div",{children:["No caps are set on this profile, so ",_," 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(O==="within-cap")return s.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:s.jsx("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:"Within all team caps — your responsibility."})});if(O==="above-approvers"){const _=c&&c.length>0?c.join(", "):"the required approvers";return s.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:[s.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.25rem"},children:"Above team cap."}),s.jsxs("div",{children:[s.jsx("strong",{children:"Over-cap actions"})," will require approval from you and ",_,". Within-cap actions run per the mode you choose."]})]})}if(O==="hard-ceiling"){const _=Array.from(K)[0],H=_?(C=l==null?void 0:l.caps)==null?void 0:C[_]:void 0,B=d??"the team admin";return s.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:[s.jsx("div",{style:{fontWeight:600,color:"var(--danger)",marginBottom:"0.25rem"},children:"Hard team ceiling."}),s.jsxs("div",{style:{marginBottom:"0.75rem"},children:["Team policy caps this at ",H??"the configured limit",". Lower your bound or ask ",B," to add an approver path above the cap."]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{type:"button",className:"btn btn-secondary btn-sm",onClick:re,children:"Save below cap"}),n&&s.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"})]})]})}return null},D=O==="hard-ceiling";return s.jsxs("div",{children:[w.length>0&&s.jsxs("div",{className:"context-section",children:[s.jsxs("div",{className:"bounds-section-header",children:[s.jsx("span",{className:"bounds-section-icon",children:"🛡"}),s.jsxs("div",{children:[s.jsx("div",{className:"bounds-section-title",children:"Allowed scope"}),s.jsx("div",{className:"bounds-section-subtitle",children:"Encrypted on your device, never sent to the SP"})]})]}),w.map(([C,_])=>{var B;const H=!!((B=k==null?void 0:k.contextDiscovery)!=null&&B[C]);return s.jsx(Vc,{fieldKey:C,fieldDef:_,value:b[C],onChange:U,prefix:"context",readOnly:r,discoveryIntegrationId:H?k.id:void 0,onLabels:(ie,I)=>P(Y=>({...Y,[ie]:I}))},`context-${C}`)})]}),p.length>0&&s.jsxs("div",{className:"bounds-section",children:[s.jsxs("div",{className:"bounds-section-header",children:[s.jsx("span",{className:"bounds-section-icon",children:"🔒"}),s.jsxs("div",{children:[s.jsx("div",{className:"bounds-section-title",children:"Limits"}),s.jsx("div",{className:"bounds-section-subtitle",children:"Enforced by the Service Provider"})]})]}),s.jsx("div",{className:"bounds-fields-grid",children:p.map(([C,_])=>{var H;return s.jsxs("div",{style:{display:"contents"},children:[s.jsx(Vc,{fieldKey:C,fieldDef:_,value:y[C],onChange:V,prefix:"bounds",readOnly:r,twoColumn:!0}),O!=="no-config"&&((H=l==null?void 0:l.caps)==null?void 0:H[C])!==void 0&&s.jsx("div",{style:{gridColumn:"2 / 3",display:"flex",alignItems:"center",paddingBottom:"0.5rem"},children:L(C)})]},`bounds-${C}`)})}),R(),x.length>0&&s.jsxs("div",{className:"bounds-local-note",style:{marginTop:"0.75rem",fontSize:"0.78rem",color:"var(--text-muted)"},children:[x.join(", ")," ",x.length===1?"is":"are"," set on the integration, not here — reads are checked on this device, so the limit applies immediately and can be changed any time under"," ",s.jsx(Ge,{to:"/integrations",children:"Integrations"}),"."]})]}),s.jsx("button",{className:"btn btn-primary",onClick:X,disabled:D,style:{marginTop:"0.5rem"},children:r?"Next: Gates":"Next: Problem Statement"})]})}function nv(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 rv(e){return e.replace(/```(?:markdown|md)?\s*\n[\s\S]*?```/,"").trim()}const av="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 ys({target:e,currentText:t,onApply:n,greeting:r,placeholder:a,title:o}){const[i,l]=u.useState([{role:"assistant",content:r??av}]),[c,d]=u.useState(""),[f,g]=u.useState(!1),[p,x]=u.useState(null),w=u.useRef(null);u.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[i,f]);const v=async()=>{const h=c.trim();if(!h||f)return;const m=[...i,{role:"user",content:h}];l(m),d(""),x(null),g(!0);try{const y=await A.aiChat({target:e,currentText:t,messages:m.filter((S,b)=>!(b===0&&S.role==="assistant"))});y.success&&y.reply?l(S=>[...S,{role:"assistant",content:y.reply}]):x(y.error??"AI returned no reply")}catch(y){x(y instanceof Error?y.message:"Chat failed")}finally{g(!1)}},j=h=>{h.key==="Enter"&&!h.shiftKey&&!h.nativeEvent.isComposing&&(h.preventDefault(),v())};return s.jsxs("div",{className:"intent-chat",children:[s.jsx("h3",{className:"card-title",children:o??"AI Assistant"}),s.jsxs("div",{ref:w,className:"chat-messages",children:[i.map((h,m)=>{const y=h.role==="assistant"?nv(h.content):null,S=y?rv(h.content):h.content;return s.jsx("div",{className:`chat-msg ${h.role}`,children:s.jsxs("div",{className:"chat-msg-body",children:[S&&s.jsx("div",{className:"chat-msg-prose",children:S}),y!==null&&s.jsxs(s.Fragment,{children:[s.jsx("pre",{className:"chat-fenced-block",children:y}),s.jsx("button",{type:"button",className:"btn btn-primary btn-sm chat-apply-btn",onClick:()=>n(y),children:"Apply this draft"})]})]})},m)}),f&&s.jsx("div",{className:"chat-msg assistant",children:s.jsx("div",{className:"chat-msg-body chat-msg-thinking",children:"Thinking…"})})]}),p&&s.jsx("div",{className:"error-message",children:p}),s.jsxs("div",{className:"chat-composer",children:[s.jsxs("div",{className:"chat-composer-pill",children:[s.jsx("textarea",{className:"chat-input",value:c,onChange:h=>d(h.target.value),onKeyDown:j,placeholder:a??"Ask for help articulating the intent…",rows:1,disabled:f}),s.jsx("button",{type:"button",className:"chat-send-btn",onClick:v,disabled:f||!c.trim(),"aria-label":"Send",children:"↑"})]}),s.jsx("div",{className:"chat-composer-hint",children:"Enter to send · Shift+Enter for newline"})]})]})}function Bf({open:e,onClose:t,children:n,ariaLabel:r}){const a=u.useRef(null),o=u.useRef(null);return u.useEffect(()=>{var l;if(!e)return;o.current=document.activeElement,document.body.style.overflow="hidden";const i=c=>{c.key==="Escape"&&t()};return document.addEventListener("keydown",i),(l=a.current)==null||l.focus(),()=>{document.removeEventListener("keydown",i),document.body.style.overflow="",o.current instanceof HTMLElement&&o.current.focus()}},[e,t]),df.createPortal(s.jsxs(s.Fragment,{children:[s.jsx("div",{className:`bottom-sheet-backdrop${e?" is-open":""}`,onClick:t,"aria-hidden":"true"}),s.jsxs("aside",{ref:a,className:`bottom-sheet${e?" is-open":""}`,role:"dialog","aria-modal":"true","aria-label":r,tabIndex:-1,children:[s.jsx("div",{className:"bottom-sheet-handle","aria-hidden":"true"}),s.jsx("button",{type:"button",className:"bottom-sheet-close",onClick:t,"aria-label":"Close",children:"×"}),n]})]}),document.body)}function sv(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ov(e,t,n){if(t.length===0)return[{text:e,label:e,matched:null}];const r=[],a=new Set;for(const c of t)if(!(!c.scope||c.scope==="all (unscoped)"))for(const d of[c.scope,...c.scope.split(",").map(f=>f.trim())]){const f=d.toLowerCase();d&&!a.has(f)&&(a.add(f),r.push(d))}r.sort((c,d)=>d.length-c.length);const o=c=>{const d=c.toLowerCase();return t.filter(f=>{var g,p;return((g=f.scope)==null?void 0:g.toLowerCase())===d||((p=f.scope)==null?void 0:p.split(",").map(x=>x.trim().toLowerCase()).includes(d))})},i=["\\[\\d+\\]",...r.map(sv)],l=new RegExp(`(${i.join("|")})`,"gi");return e.split(l).filter(c=>c!=="").map(c=>{const d=/^\[(\d+)\]$/.exec(c);if(d){const f=t[Number(d[1])-1];if(f){const g=f.scope&&f.scope!=="all (unscoped)"?f.scope:"all recipients",p=n?`${n}: ${g}`:g;return{text:c,label:p,matched:[f]}}}else if(r.some(f=>f.toLowerCase()===c.toLowerCase())){const f=o(c);if(f.length>0)return{text:c,label:c,matched:f}}return{text:c,label:c,matched:null}})}const Kc=`Why — What's the situation? Why does this need to happen?
|
|
56
|
-
|
|
57
|
-
Goal — What should the agent try to achieve?
|
|
58
|
-
|
|
59
|
-
Watch out — What should the agent avoid or be careful about?`;function iv(e,t,n,r){return ov(e,t,r).map((a,o)=>{if(!a.matched)return s.jsx("span",{children:a.text},o);const i=a.matched;return s.jsx("button",{type:"button",onClick:()=>n(i),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--accent)",textDecoration:"underline",font:"inherit"},children:a.label},o)})}function lv(){var ft;const e=Qt(),[t]=If(),n=Number(t.get("step"))||2,[r,a]=u.useState(null),[o,i]=u.useState(null),[l,c]=u.useState(n),[d,f]=u.useState(null),[g,p]=u.useState(null),[x,w]=u.useState({}),[v,j]=u.useState(Kc),[h,m]=u.useState(!1),[y,S]=u.useState(!0),[b,T]=u.useState(null),[E,P]=u.useState([]),[k,z]=u.useState(void 0),[O,K]=u.useState(!1),[V,U]=u.useState(null),[N,X]=u.useState(null),[re,L]=u.useState(null),[R,D]=u.useState([]),[C,_]=u.useState(null);u.useEffect(()=>{var Ee;const $=sessionStorage.getItem("agentAuth");if(!$){e("/agent/new");return}const J=JSON.parse($);a(J);const oe=sessionStorage.getItem("agentGate");if(oe){const ke=JSON.parse(oe);ke.bounds&&f(ke.bounds),ke.context&&p(ke.context),(Ee=ke.gateContent)!=null&&Ee.intent&&j(ke.gateContent.intent)}A.getProfile(J.profileId).then(ke=>i(ke)).catch(()=>e("/agent/new")).finally(()=>S(!1)),J.groupId&&Promise.all([A.getTeamProfileConfig(J.groupId,J.profileId).catch(()=>null),A.getGroupById(J.groupId).catch(()=>null),A.listUsers().catch(()=>[])]).then(([ke,Q,ee])=>{if(T(ke),ke){const fe=new Map;for(const ce of ee){const W=ce.name&&ce.email?`${ce.name} (${ce.email})`:ce.name||ce.email||ce.id;fe.set(ce.id,W)}const ne=(Q==null?void 0:Q.members)??[];for(const ce of ne){const W=ce.userId??ce.id;W&&(ce.name&&ce.email?fe.set(W,`${ce.name} (${ce.email})`):ce.name&&fe.set(W,ce.name))}const pe=(ke.approvers??[]).map(ce=>fe.get(ce)??ce);P(pe);const Xe=ne.find(ce=>ce.role==="admin");if(Xe){const ce=Xe.userId??Xe.id;ce&&z(fe.get(ce)??Xe.name)}}})},[e]);const H=d?Object.entries(d).filter(([$])=>$!=="profile"&&$!=="path").map(([$,J])=>`${$} = ${J}`).join(", "):"",B=($,J,oe)=>{f($),p(J),oe&&w(oe),c(3)},ie=v.trim()!==Kc.trim()&&v.trim()!=="",I=$=>{ie&&!confirm("Replace your current intent with the AI draft?")||j($)},Y=()=>{const $=o==null?void 0:o.ttl,J={intent:v},oe=JSON.parse(sessionStorage.getItem("agentGate")??"{}");sessionStorage.setItem("agentGate",JSON.stringify({...oe,bounds:d,context:g,contextLabels:x,gateContent:J,ttlConfig:$})),e("/agent/review")},q=async()=>{if(r){K(!0),U(null),X(null),L(null),D([]),_(null);try{const $=await A.aiIntentReview({profileId:r.profileId,newIntent:v,context:g??void 0});D($.grants??[]),$.success?$.review?U($.review):X($.note??"No other authorizations on this profile to compare against."):L($.error??"Check failed.")}catch($){L($ instanceof Error?$.message:"Check failed.")}finally{K(!1)}}},Ce=$=>{j($),(V||N||re)&&(U(null),X(null),L(null),D([]),_(null))};return y||!r||!o?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):s.jsxs(s.Fragment,{children:[s.jsx(Of,{currentStep:l,onStepClick:$=>{$>=2&&c($)}}),s.jsx(By,{profileId:r.profileId,bounds:H||void 0,groupName:r.groupName,domain:r.domain}),l===2&&s.jsx("div",{className:"card",children:s.jsx(tv,{profile:o,onConfirm:B,onCancel:()=>e("/agent/new"),initialBounds:d||void 0,initialContext:g||void 0,profileConfig:b,approverNames:E,adminName:k})}),l===3&&s.jsxs("div",{className:"intent-layout",children:[s.jsx("div",{className:"card intent-pane chat tool",children:s.jsx(ys,{target:{kind:"intent",profileId:r.profileId,bounds:H||void 0},currentText:v,onApply:I})}),s.jsxs("div",{className:"card intent-pane document",children:[s.jsx("h3",{className:"card-title",children:"What should your agent know?"}),s.jsxs("div",{className:"field-editable",style:{marginBottom:0},children:[s.jsxs("div",{className:"field-label",children:[s.jsx("span",{className:"pen",children:"✎"})," Intent — your words, signed with the grant"]}),s.jsx("textarea",{className:"intent-textarea",value:v,onChange:$=>Ce($.target.value)}),s.jsxs("div",{className:"char-counter",children:[v.length," / 2000"]})]}),s.jsxs("div",{style:{marginTop:"0.5rem"},children:[s.jsx("button",{type:"button",className:"btn btn-ghost",style:{fontSize:"0.8rem",padding:"0.4rem 0.75rem"},onClick:q,disabled:O||!ie,children:O?"Checking…":"Check against my other grants"}),re&&s.jsxs("div",{className:"hint-box",role:"note",style:{marginTop:"0.5rem",borderLeftColor:"var(--danger)"},children:[s.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"!"}),s.jsx("div",{className:"hint-body",children:re})]}),N&&s.jsxs("div",{className:"hint-box",role:"note",style:{marginTop:"0.5rem"},children:[s.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"i"}),s.jsx("div",{className:"hint-body",children:N})]}),V&&s.jsxs("div",{className:"hint-box",role:"note",style:{marginTop:"0.5rem"},children:[s.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"i"}),s.jsxs("div",{className:"hint-body",children:[s.jsx("div",{className:"hint-head",children:"Intent review (advisory)"}),s.jsx("div",{style:{whiteSpace:"pre-wrap"},children:iv(V,R,_,Fe(r.profileId))}),s.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.4rem"},children:"Checked with your configured assistant. AI surfaces reality — you decide."})]})]})]}),s.jsxs("div",{className:"intent-footer",children:[s.jsx("button",{className:"btn btn-ghost",onClick:()=>c(2),children:"Back"}),s.jsx("button",{className:"btn btn-primary intent-continue-btn",onClick:Y,disabled:!ie,children:"Continue to Review"})]}),(((ft=b==null?void 0:b.approvers)==null?void 0:ft.length)??0)>0&&s.jsxs("div",{className:"hint-box",role:"note",children:[s.jsx("span",{className:"hint-icon","aria-hidden":"true",children:"i"}),s.jsxs("div",{className:"hint-body",children:[s.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."]})]})]}),s.jsx("button",{type:"button",className:"floating-help",onClick:()=>m(!0),"aria-label":"Open intent assistant",children:"Get help with intent"}),s.jsx(Bf,{open:h,onClose:()=>m(!1),ariaLabel:"Intent assistant",children:s.jsx(ys,{target:{kind:"intent",profileId:r.profileId,bounds:H||void 0},currentText:v,onApply:$=>{I($),m(!1)}})}),C&&s.jsx("div",{className:"modal-backdrop",onClick:$=>$.target===$.currentTarget&&_(null),children:s.jsxs("div",{className:"modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h3",{className:"modal-title",children:C.length>1?`Existing authorizations (${C.length})`:"Existing authorization"}),s.jsx("button",{className:"modal-close",onClick:()=>_(null),children:"×"})]}),s.jsx("div",{className:"modal-body",children:C.map(($,J)=>{var oe;return s.jsxs("div",{style:{marginBottom:J<C.length-1?"1rem":0,paddingBottom:J<C.length-1?"1rem":0,borderBottom:J<C.length-1?"1px solid var(--border)":"none"},children:[s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Scope"}),s.jsx("div",{style:{marginBottom:"0.75rem"},children:$.scope}),s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Intent"}),s.jsx("div",{style:{whiteSpace:"pre-wrap",marginBottom:"0.75rem"},children:((oe=$.intent)==null?void 0:oe.trim())||"(no intent recorded)"}),Object.entries($.bounds).filter(([Ee])=>Ee!=="profile"&&Ee!=="path").length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Limits"}),s.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)"},children:Object.entries($.bounds).filter(([Ee])=>Ee!=="profile"&&Ee!=="path").map(([Ee,ke])=>`${Ee}: ${ke}`).join(" · ")})]})]},J)})})]})})]})]})}function cv(e){return e.normalize("NFC").replace(/\r\n?/g,`
|
|
60
|
-
`).split(`
|
|
61
|
-
`).map(a=>a.replace(/[ \t]+$/,"")).join(`
|
|
62
|
-
`).replace(/\n+$/,"")}async function vi(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map(o=>o.toString(16).padStart(2,"0")).join("")}async function Va(e,t){const n=t.boundsSchema??t.frameSchema;if(!n)throw new Error("Profile has no boundsSchema or frameSchema");const a=n.keyOrder.map(i=>`${i}=${String(e[i])}`).join(`
|
|
63
|
-
`);return`sha256:${await vi(a)}`}async function Df(e,t){if(!t.contextSchema||t.contextSchema.keyOrder.length===0)return`sha256:${await vi("")}`;const r=t.contextSchema.keyOrder.map(o=>`${o}=${String(e[o])}`).join(`
|
|
64
|
-
`);return`sha256:${await vi(r)}`}async function vs(e){const t=new TextEncoder().encode(cv(e)),n=await crypto.subtle.digest("SHA-256",t);return`sha256:${Array.from(new Uint8Array(n)).map(o=>o.toString(16).padStart(2,"0")).join("")}`}function Uf(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,...t.contextLabels&&Object.keys(t.contextLabels).length>0?{contextLabels:t.contextLabels}:{},gateContent:t.gateContent,...t.path?{path:t.path}:{}}}function Gc(e){return e==null?new Set:new Set(String(e).split(",").map(t=>t.trim().toLowerCase()).filter(Boolean))}function uv(e,t){for(const n of e)if(t.has(n))return!0;return!1}function dv(e,t,n){for(const r of e){const a=Gc(t[r]),o=Gc(n[r]);if(!(a.size===0||o.size===0)&&!uv(a,o))return!1}return!0}function fv(e){return e.length>24?`${e.slice(0,10)}…`:e}function Wf(e,t,n){const r=n==null?void 0:n[e];return String(t).split(",").map(o=>o.trim()).filter(Boolean).map(o=>{const i=r==null?void 0:r[o];return i?`${i} (${fv(o)})`:o}).join(", ")}function mv(){var Xe,ce,W;const e=Qt(),{user:t,mode:n,domain:r}=$e(),[a,o]=u.useState(null),[i,l]=u.useState(null),[c,d]=u.useState(null),[f,g]=u.useState("per-action"),[p,x]=u.useState(1800),[w,v]=u.useState(86400),[j,h]=u.useState(""),[m,y]=u.useState("hours"),[S,b]=u.useState(""),[T,E]=u.useState(!0),[P,k]=u.useState(!1),[z,O]=u.useState(""),[K,V]=u.useState(null),[U,N]=u.useState([]),[X,re]=u.useState(!1),[L,R]=u.useState([]),[D,C]=u.useState(0);u.useEffect(()=>{var vn;const M=sessionStorage.getItem("agentAuth"),Z=sessionStorage.getItem("agentGate");if(!M||!Z){e("/agent/new");return}const ae=JSON.parse(M),te=JSON.parse(Z),Ve={bounds:te.bounds??{},context:te.context??{},contextLabels:te.contextLabels??void 0,gateContent:te.gateContent};o(ae),l(Ve),te.ttlConfig&&(x(te.ttlConfig.default??1800),v(te.ttlConfig.max??86400)),te.templateMode==="automatic"?g("immediate"):te.templateMode==="review"&&g("per-action");const Mn=((vn=te.ttlConfig)==null?void 0:vn.max)??86400;if(typeof te.templateTtl=="number"&&te.templateTtl>0){const ze=Math.min(te.templateTtl,Mn);x(ze),[3600,86400,604800,2592e3,31536e3].includes(ze)||(ze%86400===0?(h(String(ze/86400)),y("days")):(h(String(Math.max(1,Math.round(ze/3600)))),y("hours")))}A.getProfile(ae.profileId).then(ze=>{var mt;if(d(ze),!S){const at=ze.name??((mt=ae.profileId.split("/").pop())==null?void 0:mt.replace(/@.*$/,""))??"",Be=[];if(Ve.context&&ze.contextSchema)for(const qe of ze.contextSchema.keyOrder){const ue=Ve.context[qe];if(ue!==void 0&&ue!==""){const wn=String(ue).split(",").map(Yf=>Yf.trim()).filter(Boolean);Be.push(wn.join(", "))}}const xn=Be.length>0?`${at}: ${Be.join(" · ")}`:at;b(xn)}}).catch(()=>{}),ae.groupId?Promise.all([A.getTeamProfileConfig(ae.groupId,ae.profileId).catch(()=>null),A.getGroupById(ae.groupId).catch(()=>null),A.listUsers().catch(()=>[])]).then(([ze,mt,at])=>{if(V(ze),ze){const Be=new Map;for(const ue of at){const wn=ue.name&&ue.email?`${ue.name} (${ue.email})`:ue.name||ue.email||ue.id;Be.set(ue.id,wn)}const xn=(mt==null?void 0:mt.members)??[];for(const ue of xn){const wn=ue.userId??ue.id;wn&&(ue.name&&ue.email?Be.set(wn,`${ue.name} (${ue.email})`):ue.name&&Be.set(wn,ue.name))}const qe=(ze.approvers??[]).map(ue=>Be.get(ue)??ue);N(qe)}}).finally(()=>{re(!0)}):re(!0)},[e]),u.useEffect(()=>{if(!(a!=null&&a.profileId))return;const M=a.profileId,Z=sessionStorage.getItem("agentEditReplaces");A.getEnrichedAuthorizations().then(ae=>{const te=ae.filter(Ve=>Ve.profileId===M&&Ve.authorizationId!==Z).map(Ve=>({authorizationId:Ve.authorizationId,bounds:Ve.bounds,context:Ve.context??{},intent:Ve.intent}));R(te)}).catch(()=>R([]))},[a==null?void 0:a.profileId]),u.useEffect(()=>{if(!i||!c||L.length===0){C(0);return}let M=!1;return(async()=>{const Z=await Va(i.bounds,c),ae=await Promise.all(L.map(te=>Va(te.bounds,c).catch(()=>null)));M||C(ae.filter(te=>te===Z).length)})().catch(()=>{M||C(0)}),()=>{M=!0}},[i,c,L]);const _=async()=>{if(!(!a||!i||!c||!t)){if(!a.groupId){O("No active group; cannot create authorization.");return}k(!0),O("");try{const M=r||a.domain||"owner",Z=await Va(i.bounds,c),ae=await Df(i.context,c),[te,Ve]=await Promise.all([vs(i.gateContent.intent),vs(JSON.stringify({profile:a.profileId,domain:M,group:a.groupId}))]);let Mn,vn,ze,mt;if(a.isTeam){const qe=await A.getApproversPubkeys(a.groupId,a.profileId);if(qe.length>0){const ue=await A.encryptIntent(i.gateContent.intent,qe);Mn=ue.intentCiphertext,vn=ue.encryptedKeys,ze=ue.approversFrozen,mt=ue.intentDisclosureHash}}const at=`authz_${crypto.randomUUID()}`,Be=sessionStorage.getItem("agentEditReplaces")||void 0,xn=await A.attest({authorization_id:at,replaces:Be,profile_id:a.profileId,bounds:i.bounds,bounds_hash:Z,context_hash:ae,domain:M,did:t.did,gate_content_hashes:{intent:te},execution_context_hash:Ve,group_id:a.groupId,ttl:p,commitment_mode:f==="per-action"?"review":"automatic",title:S.trim(),intent_ciphertext:Mn,encrypted_keys:vn,approvers_frozen:ze,intent_disclosure_hash:mt,disclose_identity:T});try{await A.pushGateContent(Uf(xn,{boundsHash:Z,contextHash:ae,context:i.context,contextLabels:i.contextLabels,gateContent:i.gateContent}))}catch(qe){try{await A.revokeAttestation(at,"Auto-revoked: gate content push failed")}catch{}throw new Error(`Authorization signed but gate content delivery failed. The attestation was revoked. Please try again. (${qe instanceof Error?qe.message:"Unknown error"})`)}if(Be)try{await A.revokeAttestation(Be,`Replaced by ${at} (edit)`),A.resyncGates().catch(()=>{})}catch{}sessionStorage.removeItem("agentAuth"),sessionStorage.removeItem("agentGate"),sessionStorage.removeItem("agentEditReplaces"),e(`/authorizations?highlight=${encodeURIComponent(at)}`)}catch(M){O(M instanceof Error?M.message:"Attestation failed")}finally{k(!1)}}};if(!a||!i)return s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."});const H=Object.entries(i.bounds).filter(([M])=>M!=="profile"&&M!=="path"),B=Object.entries(i.context),I=((K==null?void 0:K.caps)!=null?Object.keys(K.caps):[]).length!==0,Y=U.length>0?U.join(", "):((K==null?void 0:K.approvers)??[]).join(", "),q=I?`Within-cap actions run per the mode you choose above. Over-cap actions will require approval from you and ${Y}, 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.",Ce=I?`Over-cap actions will be reviewed by you and ${Y}. Within-cap actions run per the mode you chose above.`:`Approvers ${Y} can read your intent but won't gate any action — no caps configured on this profile.`,ft=!!((Xe=K==null?void 0:K.approvers)!=null&&Xe.length),$=p>w,J={flex:1,padding:"0.75rem",border:f==="immediate"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:f==="immediate"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},oe={flex:1,padding:"0.75rem",border:f==="per-action"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:f==="per-action"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},Ee=((ce=c==null?void 0:c.contextSchema)==null?void 0:ce.keyOrder)??[],ke=L.filter(M=>dv(Ee,i.context,M.context)),Q=ke.length>0,ee=Fe(a.profileId),fe=M=>{const Z=Object.values(M).map(ae=>String(ae).trim()).filter(Boolean);return Z.length>0?Z.join(", "):"all (unscoped)"},ne=ke.map(M=>fe(M.context)).join("; "),pe=`This grant's scope overlaps an existing grant on ${ee} (scoped to: ${ne}). The agent may act under either. Per-action limits take the more permissive value, and daily limits add together — two grants of 10/day allow 20/day. Approval is not weakened: if either grant requires review, review still applies. Confirm this is intended before authorizing.`;return s.jsxs(s.Fragment,{children:[s.jsx(Of,{currentStep:4,onStepClick:M=>{M<=3&&e(`/agent/gate?step=${M}`)}}),s.jsxs("div",{className:"card",children:[s.jsx("h3",{className:"card-title",style:{marginBottom:"0.25rem"},children:"Review & Commit"}),s.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"1.5rem"},children:"Review your authorization details before signing."}),z&&s.jsx("div",{className:"error-message",children:z}),s.jsxs("div",{className:"field-editable",children:[s.jsxs("div",{className:"field-label",children:[s.jsx("span",{className:"pen",children:"✎"})," Title"]}),s.jsx("input",{type:"text",className:"form-input",placeholder:`e.g. ${Fe(a.profileId)}: daily operations`,value:S,onChange:M=>b(M.target.value),maxLength:80,style:{fontSize:"0.9rem"}}),s.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"A short name to identify this authorization on your dashboard."})]}),s.jsxs("div",{className:"field-editable",children:[s.jsxs("div",{className:"field-label",children:[s.jsx("span",{className:"pen",children:"✎"})," Commitment"]}),s.jsxs("div",{style:{display:"flex",gap:"0.75rem"},children:[s.jsxs("button",{onClick:()=>g("per-action"),style:oe,children:[s.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Review Each Action"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"You review and approve each action before it executes."})]}),s.jsxs("button",{onClick:()=>g("immediate"),style:J,children:[s.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Automatic"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Agent acts freely within your limits."})]})]})]}),s.jsxs("div",{className:"field-editable",children:[s.jsxs("div",{className:"field-label",children:[s.jsx("span",{className:"pen",children:"✎"})," Duration"]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",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(M=>M.seconds<=w).map(M=>s.jsx("button",{onClick:()=>{x(M.seconds),h("")},style:{padding:"0.5rem 0.85rem",border:p===M.seconds?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"0.375rem",background:p===M.seconds?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"inherit",color:"var(--text-primary)"},children:M.label},M.seconds)),s.jsxs("div",{style:{display:"flex",gap:"0.375rem",alignItems:"center"},children:[s.jsx("input",{type:"number",className:"form-input",style:{width:"5rem",padding:"0.45rem 0.6rem",fontSize:"0.85rem"},placeholder:"Custom",value:j,onChange:M=>{h(M.target.value);const Z=parseInt(M.target.value,10);if(Z>0){const ae=m==="days"?Z*86400:Z*3600;x(Math.min(ae,w))}}}),s.jsxs("select",{className:"form-input",style:{padding:"0.45rem 0.5rem",fontSize:"0.85rem"},value:m,onChange:M=>{y(M.target.value);const Z=parseInt(j,10);if(Z>0){const ae=M.target.value==="days"?Z*86400:Z*3600;x(Math.min(ae,w))}},children:[s.jsx("option",{value:"hours",children:"hours"}),s.jsx("option",{value:"days",children:"days"})]})]}),$&&s.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--danger)"},children:["Maximum: ",w>=86400?`${Math.floor(w/86400)} days`:`${Math.floor(w/3600)} hours`]})]})]}),s.jsx("div",{className:"field-editable",children:s.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"0.5rem",cursor:"pointer"},children:[s.jsx("input",{type:"checkbox",checked:T,onChange:M=>E(M.target.checked),style:{marginTop:"0.15rem"}}),s.jsxs("span",{style:{fontSize:"0.8rem"},children:["Show my verified name on actions under this authority",s.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.'})]})]})}),s.jsx("div",{className:"info-section-label",children:"What you are signing — set in previous steps"}),s.jsxs("div",{className:"info-block",children:[s.jsxs("div",{className:"info-head",children:[s.jsx("span",{className:"info-title",children:"Intent"}),s.jsx("button",{className:"info-edit",onClick:()=>e("/agent/gate?step=3"),children:"edit in step 3"})]}),s.jsx("div",{style:{whiteSpace:"pre-wrap"},children:i.gateContent.intent})]}),(!!H.length||!!B.length)&&s.jsxs("div",{className:"info-block",children:[s.jsxs("div",{className:"info-head",children:[s.jsx("span",{className:"info-title",children:"Scope & Limits"}),s.jsx("button",{className:"info-edit",onClick:()=>e("/agent/gate?step=2"),children:"edit in step 2"})]}),s.jsxs("dl",{className:"info-kv",children:[B.map(([M,Z])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:M}),s.jsx("dd",{children:Wf(M,Z,i.contextLabels)})]},M)),H.map(([M,Z])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:M}),s.jsx("dd",{children:String(Z)})]},M))]})]}),s.jsxs("div",{className:"info-block",children:[s.jsx("div",{className:"info-head",children:s.jsx("span",{className:"info-title",children:"Authority"})}),s.jsxs("dl",{className:"info-kv",children:[s.jsx("dt",{children:"Profile"}),s.jsxs("dd",{children:[Fe(a.profileId),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:a.profileId})]}),a.groupName&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Team"}),s.jsx("dd",{children:a.groupName})]}),a.groupId&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Approvers"}),s.jsx("dd",{children:X?(((W=K==null?void 0:K.approvers)==null?void 0:W.length)??0)===0?s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{color:"var(--text-tertiary)"},children:"None — solo authorization"}),s.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."})]}):s.jsxs(s.Fragment,{children:[Y,s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:q})]}):s.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Loading…"})})]})]})]}),D>0?s.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:[s.jsx("span",{"aria-hidden":"true",style:{color:"var(--warning)",fontWeight:700},children:"⚠"}),s.jsxs("div",{children:[s.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.2rem"},children:"Identical limits to an existing grant"}),s.jsxs("div",{children:[D===1?`An active grant on ${ee} already has exactly these limits.`:`${D} active grants on ${ee} already have exactly these limits.`," ","If you meant to give the existing grant more time, use ",s.jsx("strong",{children:"Extend"})," on the Authorizations page instead — authorizing here creates a separate, independent grant with its own intent and usage counters."]})]})]}):null,Q?s.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:[s.jsx("span",{"aria-hidden":"true",style:{color:"var(--warning)",fontWeight:700},children:"⚠"}),s.jsxs("div",{children:[s.jsx("div",{style:{fontWeight:600,color:"var(--warning)",marginBottom:"0.2rem"},children:"Overlapping scope"}),s.jsx("div",{children:pe})]})]}):null,s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{className:"btn btn-ghost",onClick:()=>e("/agent/gate"),children:"Back"}),s.jsx("button",{className:"btn btn-primary btn-lg",style:{flex:1},onClick:_,disabled:P||!S.trim(),children:P?"Signing...":f==="immediate"?"Authorize":"Authorize (Review Mode)"})]}),s.jsx("div",{style:{marginTop:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)",textAlign:"center",display:ft?"block":"none"},children:Ce})]})]})}const pv={card:"💳",mail:"✉️"};function hv(e){const t=e==null?void 0:e.overrides;return!t||typeof t!="object"?!1:Object.values(t).some(n=>{var r;return typeof((r=n==null?void 0:n.read)==null?void 0:r.ageField)=="string"})}const gv=[0,7,30,90,365,3650];function xo(e){return e===null?"From your authorization":e===0?"Read nothing":e===1?"1 day back":e===365?"1 year back":e%365===0?`${e/365} years back`:`${e} days back`}function yv({manifest:e,integration:t,state:n,onStatusChange:r,onSuccess:a}){var ke;const[o,i]=u.useState({}),[l,c]=u.useState(!1),[d,f]=u.useState(!1),[g,p]=u.useState({}),[x,w]=u.useState(!1),[v,j]=u.useState(null),[h,m]=u.useState(!1),[y,S]=u.useState(!1),[b,T]=u.useState(!1),[E,P]=u.useState(!1),[k,z]=u.useState({}),[O,K]=u.useState(null),[V,U]=u.useState(!1),[N,X]=u.useState(null);u.useEffect(()=>{let Q=!1;return A.getCredential(e.id).then(ee=>{var fe;if(!(Q||!ee.configured)){if(c(!0),f(!0),ee.fields){const ne={};for(const pe of e.credentials.fields)ee.fields[pe.key]!=null&&(ne[pe.key]=ee.fields[pe.key]);p(ne)}if(e.oauth){const ne=((fe=ee.fieldNames)==null?void 0:fe.includes(e.oauth.tokenStorage))??!1;w(ne),ne&&A.getOAuthHealth(e.id).then(pe=>{Q||j(pe)})}}}).catch(()=>{}),()=>{Q=!0}},[e.id,e.oauth]);const re=hv(e.toolGating),L=t?t.readAgeDays??null:void 0,R=V&&O?O.value:L,D=async Q=>{K({value:Q}),U(!0),X(null);try{await A.setReadPolicy(e.id,Q),a(Q===null?`${e.name} read window now follows your authorization`:`${e.name} read window set to ${xo(Q).toLowerCase()}`),r()}catch(ee){X(ee instanceof Error?ee.message:"Could not save")}finally{U(!1),K(null)}},C=!!e.oauth||e.credentials.fields.some(Q=>!Q.optional),_=e.oauth?x:l,H=!C||_,B=n==="starting"?"starting":H?t!=null&&t.running?"running":!l&&e.credentials.fields.length>0?"unconfigured":"ready":e.oauth&&l&&!x?"needs-oauth":"unconfigured",ie=async()=>{if(e.credentials.fields.some(ee=>{var fe;return(fe=o[ee.key])==null?void 0:fe.trim()})){m(!0);try{await A.setCredential(e.id,o),c(!0),i({}),e.oauth?a(`${e.name} credentials saved!`):(a(`${e.name} credentials saved — starting integration...`),await q())}catch{a(`Failed to save ${e.name} credentials`)}finally{m(!1)}}},I=async()=>{if(e.credentials.fields.some(ee=>{var fe;return(fe=o[ee.key])==null?void 0:fe.trim()})){m(!0);try{await A.setCredential(e.id,o),i({}),c(!0),e.oauth?a(`${e.name} credentials saved — now click Connect.`):(P(!1),a(`${e.name} credentials updated — restarting...`),await q())}catch{a(`Failed to update ${e.name} credentials`)}finally{m(!1)}}},Y=()=>{window.open(`/auth/oauth/${e.id}/start`,"_blank","width=600,height=700");const Q=setInterval(async()=>{var ee;try{const fe=await A.getCredential(e.id);fe.configured&&e.oauth&&((ee=fe.fieldNames)!=null&&ee.includes(e.oauth.tokenStorage))&&(w(!0),P(!1),j(null),clearInterval(Q),a(`${e.name} connected — starting integration...`),A.getOAuthHealth(e.id).then(j).catch(()=>{}),await q())}catch{}},2e3);setTimeout(()=>clearInterval(Q),12e4)},q=async()=>{T(!0);try{const Q=await A.activateIntegration(e.id);Q.warning?a(Q.warning):a(`${e.name} integration started with ${Q.tools.length} tools`),r()}catch(Q){a(`Failed to start ${e.name}: ${Q instanceof Error?Q.message:"Unknown error"}`)}finally{T(!1)}},Ce=async()=>{try{await A.removeMcpIntegration(e.id),a(`${e.name} integration removed`),r()}catch{a(`Failed to remove ${e.name}`)}},ft=pv[e.icon]??"🔧",$=B==="running"?{c:"int-chip-ok",t:"Running"}:B==="starting"?{c:"int-chip-idle",t:"Starting"}:t&&!t.running&&t.error?{c:"int-chip-bad",t:"Crashed"}:{c:"int-chip-idle",t:"Stopped"},J=e.oauth&&x&&(v==null?void 0:v.status)==="failed",oe=C?J?{c:"int-chip-bad",t:"Auth failed"}:_?{c:"int-chip-ok",t:"Auth OK"}:{c:"int-chip-idle",t:"Not set up"}:{c:"int-chip-idle",t:"No auth"},Ee=Q=>Q.replace(/https?:\/\/[^\s)]+\/auth\/oauth\/[a-z-]+\/callback/gi,`${window.location.origin}/auth/oauth/${e.id}/callback`);return s.jsxs("div",{className:"card",style:{marginBottom:"1rem"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem"},children:[s.jsx("span",{style:{fontSize:"1.4rem",lineHeight:1.2},children:ft}),s.jsx("h3",{className:"card-title",style:{margin:0,flex:1,alignSelf:"center"},children:e.name}),s.jsxs("div",{style:{display:"flex",gap:"0.4rem",flexWrap:"wrap",justifyContent:"flex-end"},children:[B!=="unconfigured"&&B!=="needs-oauth"&&s.jsxs("span",{className:`int-chip ${$.c}`,children:[s.jsx("span",{className:"int-dot"}),$.t]}),s.jsxs("span",{className:`int-chip ${oe.c}`,children:[s.jsx("span",{className:"int-dot"}),oe.t]})]})]}),e.oauth&&x&&s.jsx("div",{className:"int-account",style:{marginTop:"0.7rem"},children:v!=null&&v.account?s.jsxs(s.Fragment,{children:["Connected as ",s.jsx("b",{children:v.account})]}):s.jsx("span",{className:"int-none",children:"Account not recorded — reconnect to capture which account is used"})}),J&&!E&&s.jsxs("div",{style:{marginTop:"0.7rem"},children:[s.jsxs("div",{className:"status-banner status-banner-error",style:{marginBottom:"0.6rem"},children:[s.jsx("span",{className:"status-banner-icon",children:"!"}),s.jsxs("span",{className:"status-banner-text",children:["Authentication failed",v!=null&&v.error?` — ${v.error}`:"",". Reconnect to restore access."]})]}),s.jsxs("button",{className:"btn btn-primary btn-sm",onClick:Y,children:["Reconnect ",e.name]})]}),s.jsxs("details",{className:"int-details",style:{marginTop:"0.85rem",marginBottom:"1.25rem"},children:[s.jsx("summary",{children:"Details"}),s.jsxs("div",{className:"int-meta",children:[s.jsx("span",{className:"int-k",children:"What"}),s.jsx("span",{children:e.description}),e.profile&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"int-k",children:"Profile"}),s.jsx("span",{children:e.profile})]}),e.oauth&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"int-k",children:"Scopes"}),s.jsx("span",{children:((ke=e.oauth.scopes)==null?void 0:ke.join(", "))||"—"})]}),t&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"int-k",children:"Tools"}),s.jsxs("span",{children:[t.toolCount," gated"]})]})]})]}),e.setupGuide&&e.setupGuide.length>0&&(B!=="running"||J)&&s.jsxs("div",{style:{marginBottom:"0.75rem"},children:[s.jsxs("button",{onClick:()=>S(!y),style:{background:"none",border:"none",padding:0,fontSize:"0.8rem",color:"var(--accent)",cursor:"pointer",display:"flex",alignItems:"center",gap:"0.375rem"},children:[s.jsx("span",{style:{transition:"transform 0.2s",transform:y?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"}),"How to set up ",e.name]}),y&&s.jsx("div",{style:{marginTop:"0.75rem",paddingLeft:"0.25rem"},children:e.setupGuide.map((Q,ee)=>s.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"0.75rem"},children:[s.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:ee+1}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.125rem"},children:Q.title}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",lineHeight:1.5},children:[Ee(Q.description),Q.link&&s.jsxs(s.Fragment,{children:[" ",s.jsxs("a",{href:Q.link,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"0.8rem"},children:["Open ","↗"]})]})]})]})]},ee))})]}),B==="starting"&&s.jsxs("div",{className:"service-status",style:{color:"var(--warning)"},children:[s.jsx("span",{className:"service-status-dot",style:{background:"var(--warning)"}}),"Starting…"]}),E&&s.jsxs("div",{style:{marginTop:"0.7rem",paddingTop:"0.85rem",borderTop:"1px solid var(--border)"},children:[s.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,marginBottom:"0.5rem"},children:"Change credentials"}),d&&s.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(Q=>s.jsxs("div",{className:"form-group",style:{marginBottom:"0.6rem"},children:[s.jsx("label",{className:"form-label",children:Q.label}),Q.type==="password"?s.jsxs("div",{className:"cred-field",children:[s.jsx("input",{className:"form-input",type:k[Q.key]?"text":"password",name:`${e.id}-${Q.key}-credential`,autoComplete:"new-password",placeholder:Q.placeholder,value:o[Q.key]||"",onChange:ee=>i(fe=>({...fe,[Q.key]:ee.target.value}))}),s.jsx("button",{className:"cred-toggle",onClick:()=>z(ee=>({...ee,[Q.key]:!ee[Q.key]})),children:k[Q.key]?"hide":"show"})]}):s.jsx("input",{className:"form-input",type:"text",name:`${e.id}-${Q.key}-credential`,autoComplete:"off",placeholder:Q.placeholder,value:o[Q.key]||"",onChange:ee=>i(fe=>({...fe,[Q.key]:ee.target.value}))})]},Q.key)),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginTop:"0.25rem"},children:[s.jsx("button",{className:"btn btn-primary btn-sm",onClick:I,disabled:h,children:h?"Saving…":"Save"}),e.oauth&&s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:Y,children:["Connect ",e.name]}),s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>{P(!1),i({})},children:"Cancel"})]})]}),!E&&B==="running"&&t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[s.jsx(Ge,{to:"/agent/new",className:"btn btn-primary btn-sm",style:{textDecoration:"none"},children:"Authorize agent"}),(e.credentials.fields.length>0||e.oauth)&&s.jsx("button",{className:"btn btn-sm btn-secondary",onClick:()=>{i({...g}),P(!0)},title:"Re-enter client ID / secret (e.g. a new OAuth client).",children:"Change credentials"}),s.jsx("span",{style:{flex:1}}),s.jsx("button",{className:"btn btn-sm btn-ghost",style:{color:"var(--danger)"},onClick:Ce,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"})]}),re&&R!==void 0&&s.jsxs("div",{style:{marginTop:"0.9rem",paddingTop:"0.85rem",borderTop:"1px solid var(--border)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"0.5rem",marginBottom:"0.35rem"},children:[s.jsx("span",{style:{fontSize:"0.85rem",fontWeight:600},children:"Read policy"}),s.jsx("span",{style:{fontSize:"0.78rem",color:"var(--text-muted)"},children:"How far back your agent may read"})]}),s.jsx("p",{style:{fontSize:"0.78rem",color:"var(--text-tertiary)",margin:"0 0 0.55rem"},children:"Applies immediately — no new authorization needed."}),s.jsxs("div",{style:{display:"flex",gap:"0.4rem",flexWrap:"wrap"},children:[gv.map(Q=>{const ee=R===Q;return s.jsx("button",{className:`btn btn-sm ${ee?"btn-primary":"btn-secondary"}`,"aria-pressed":ee,disabled:V,onClick:()=>D(Q),children:xo(Q)},Q)}),s.jsx("button",{className:`btn btn-sm ${R===null?"btn-primary":"btn-ghost"}`,"aria-pressed":R===null,disabled:V,onClick:()=>D(null),title:"Clear the local setting and use the read window from your signed authorization instead.",children:xo(null)})]}),s.jsx("div",{style:{fontSize:"0.78rem",marginTop:"0.5rem"},children:N?s.jsx("span",{style:{color:"var(--danger)"},children:N}):V?s.jsx("span",{style:{color:"var(--text-muted)"},children:"Saving…"}):R===null?s.jsx("span",{style:{color:"var(--text-muted)"},children:"Using the window from your authorization. If none is set there, reads are blocked."}):R===0?s.jsx("span",{style:{color:"var(--text-muted)"},children:"Your agent cannot read any mail."}):s.jsxs("span",{style:{color:"var(--text-muted)"},children:["Anything older than ",R," days is blocked, whoever it is from."]})})]}),s.jsx("div",{style:{display:"none"},children:s.jsx(Ge,{to:"/agent/new",className:"btn btn-ghost btn-sm",style:{textDecoration:"none",display:"block",textAlign:"center"},children:"Authorize your agent"})})]}),B==="unconfigured"&&(()=>{const Q=e.credentials.fields.every(ne=>ne.optional),ee=e.credentials.fields.some(ne=>!ne.optional),fe=e.credentials.fields.some(ne=>{var pe;return(pe=o[ne.key])==null?void 0:pe.trim()});return s.jsxs(s.Fragment,{children:[d&&s.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:[s.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"," ",s.jsx("button",{onClick:()=>{c(!0),e.oauth&&w(!0)},style:{background:"none",border:"none",padding:0,color:"var(--accent)",cursor:"pointer",textDecoration:"underline"},children:"keep existing"}),"."]}),e.oauth&&!d&&s.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&&!d&&s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:e.setupHint}),e.credentials.fields.map(ne=>s.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[s.jsx("label",{className:"form-label",children:ne.label}),ne.type==="password"?s.jsxs("div",{className:"cred-field",children:[s.jsx("input",{className:"form-input",type:k[ne.key]?"text":"password",name:`${e.id}-${ne.key}-credential`,autoComplete:"new-password",placeholder:ne.placeholder,value:o[ne.key]||"",onChange:pe=>i(Xe=>({...Xe,[ne.key]:pe.target.value}))}),s.jsx("button",{className:"cred-toggle",onClick:()=>z(pe=>({...pe,[ne.key]:!pe[ne.key]})),children:k[ne.key]?"hide":"show"})]}):s.jsx("input",{className:"form-input",type:"text",name:`${e.id}-${ne.key}-credential`,autoComplete:"off",placeholder:ne.placeholder,value:o[ne.key]||"",onChange:pe=>i(Xe=>({...Xe,[ne.key]:pe.target.value}))})]},ne.key)),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[fe&&s.jsx("button",{className:"btn btn-primary",onClick:ie,disabled:h||ee&&!e.credentials.fields.filter(ne=>!ne.optional).every(ne=>{var pe;return(pe=o[ne.key])==null?void 0:pe.trim()}),children:h?"Saving...":"Save & Encrypt"}),Q&&!fe&&s.jsx("button",{className:"btn btn-primary",onClick:q,disabled:b,children:b?"Starting...":`Activate ${e.name}`})]})]})})(),B==="needs-oauth"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.25rem"},children:["✓"," Step 1 done — credentials saved"]}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["Step 2: connect your ",e.name," account to authorize access."]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[s.jsxs("button",{className:"btn btn-primary",onClick:Y,children:["Connect ",e.name," Account"]}),s.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Change Credentials"})]})]}),B==="ready"&&!t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.75rem"},children:["✓"," ",e.oauth?`${e.name} account connected`:"Credentials configured"]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[s.jsx("button",{className:"btn btn-primary",onClick:q,disabled:b,children:b?"Starting...":`Start ${e.name} Integration`}),!e.oauth&&s.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Update Credentials"}),e.oauth&&s.jsx("button",{className:"btn btn-ghost",onClick:()=>{c(!1),w(!1)},children:"Change Credentials"})]})]}),B==="ready"&&t&&!t.running&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"service-status service-status-error",style:{marginBottom:"0.75rem"},children:[s.jsx("span",{className:"service-status-dot"}),"Not running"]}),t.error&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--danger)",marginBottom:"0.75rem"},children:t.error}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{className:"btn btn-primary",onClick:q,disabled:b,children:b?"Starting...":"Start"}),s.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:Ce,children:"Disable"})]})]})]})}function vv(){const{loading:e,mcpServerUp:t,manifestsError:n,entries:r,refresh:a}=bl(),[o,i]=u.useState(""),l=u.useCallback(c=>{i(c),setTimeout(()=>i(""),5e3)},[]);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"page-header",children:[s.jsx("h1",{className:"page-title",children:"Integrations"}),s.jsx("p",{className:"page-subtitle",children:"Connect external services and manage MCP integrations."})]}),o&&s.jsx("div",{className:"alert alert-success",children:o}),e?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading integrations..."}):t===!1?s.jsxs("div",{className:"status-banner status-banner-error",children:[s.jsx("span",{className:"status-banner-icon",children:"!"}),s.jsx("span",{className:"status-banner-text",children:"MCP server is not reachable. Make sure it is running."})]}):s.jsxs(s.Fragment,{children:[r.map(c=>s.jsx(yv,{manifest:c.manifest,integration:c.integration,state:c.state,onStatusChange:a,onSuccess:l},c.id)),r.length===0&&(n?s.jsxs("div",{className:"status-banner status-banner-error",children:[s.jsx("span",{className:"status-banner-icon",children:"!"}),s.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"," ",s.jsx("code",{children:"SUVEREN_MCP_INTERNAL_URL"})," (dev MCP is :3431), then refresh."]})]}):s.jsx("p",{style:{color:"var(--text-tertiary)",textAlign:"center",marginTop:"2rem"},children:"No integrations available yet."}))]})]})}function xv(){var O,K,V;const{activeTeam:e,activeMembership:t,refreshGroups:n,user:r}=$e(),[a,o]=u.useState(null),[i,l]=u.useState(!1),[c,d]=u.useState(""),[f,g]=u.useState(""),[p,x]=u.useState(!1),[w,v]=u.useState(""),[j,h]=u.useState("");u.useEffect(()=>{fetch("/health").then(U=>U.json()).then(U=>{typeof U.spUrl=="string"&&h(U.spUrl)}).catch(()=>{})},[]),u.useEffect(()=>{if(!e){o(null);return}A.getGroupById(e.id).then(U=>{const N=U.group??U,X=U.members??[],re=U.isAdmin??!1,L=X.map(R=>{const D=R.userId||R.id||"",C=R.role||(re&&D===N.createdBy?"admin":"member");return{id:D,name:R.name||D.slice(0,8)||"Member",email:R.email||"",domains:R.domains||[],role:C,isAdmin:C==="admin"||re&&D===N.createdBy}});o({id:N.id,name:N.name,members:L})}).catch(()=>o(null))},[e==null?void 0:e.id]);const m=(a==null?void 0:a.members.filter(U=>U.isAdmin))??[],y=(e==null?void 0:e.isAdmin)===!0&&m.length<=1&&m.some(U=>U.id===(r==null?void 0:r.id)),S=(e==null?void 0:e.name)??"",b=w.trim()===S&&!i,T=()=>{v(""),x(!0)},E=()=>{x(!1),v("")},P=async()=>{if(!(!e||!b)){l(!0),d("");try{await A.leaveTeam(e.id),await n(),g("You have left the team."),o(null),E()}catch(U){d(U instanceof Error?U.message:"Failed to leave team")}finally{l(!1)}}},k=e&&j?`${j}/dashboard/groups/${e.id}`:void 0,z=j?`${j}/dashboard/groups`:void 0;return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"page-header",children:s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Team"}),s.jsx("p",{className:"page-subtitle",children:"Your current team context. Team management lives in your Service Provider dashboard."})]})}),c&&s.jsx("div",{className:"error-message",children:c}),f&&s.jsx("div",{className:"alert alert-success",children:f}),e?s.jsxs("div",{className:"card",style:{marginBottom:"1.5rem"},children:[s.jsxs("div",{className:"card-header",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"card-title",children:e.name}),s.jsxs("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:[((O=a==null?void 0:a.members)==null?void 0:O.length)??0," ",(((K=a==null?void 0:a.members)==null?void 0:K.length)??0)===1?"member":"members",e.isAdmin&&" · You are admin"]})]}),s.jsx("span",{className:"status-badge status-active",children:"Active"})]}),(V=a==null?void 0:a.members)==null?void 0:V.map(U=>s.jsxs("div",{className:"member-row",children:[s.jsx("div",{className:"member-avatar",children:U.name.split(" ").map(N=>N[0]).join("").slice(0,2).toUpperCase()}),s.jsxs("div",{className:"member-info",children:[s.jsx("div",{className:"member-name",children:U.name}),s.jsx("div",{className:"member-email",children:U.email})]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:U.role})]},U.id)),s.jsxs("div",{style:{marginTop:"1.25rem",paddingTop:"1rem",borderTop:"1px solid var(--border)",display:"flex",alignItems:"center",gap:"0.75rem",flexWrap:"wrap"},children:[k&&s.jsx("a",{className:"btn btn-secondary btn-sm",href:k,target:"_blank",rel:"noopener noreferrer",children:"Manage this team in your Service Provider →"}),s.jsx("span",{title:y?"You are the only admin. Transfer admin to another member in your Service Provider dashboard before leaving.":void 0,style:{marginLeft:"auto"},children:s.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--text-tertiary)"},onClick:T,disabled:i||y,children:"Leave team"})})]})]}):s.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem 1.5rem"},children:[s.jsx("h3",{style:{margin:"0 0 0.5rem 0",fontSize:"1rem"},children:"You are working solo."}),s.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."}),z&&s.jsx("a",{className:"btn btn-primary btn-sm",href:z,target:"_blank",rel:"noopener noreferrer",children:"Open Service Provider dashboard →"})]}),p&&e&&s.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:E,children:s.jsxs("div",{className:"card",onClick:U=>U.stopPropagation(),style:{maxWidth:480,width:"100%",margin:0},children:[s.jsxs("h3",{id:"leave-team-title",className:"card-title",style:{marginBottom:"0.5rem"},children:["Leave ",S,"?"]}),s.jsx("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:"Leaving will:"}),s.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[s.jsx("li",{children:"Revoke all authorizations you created in this team's context"}),s.jsx("li",{children:"Reject any pending action proposals you authored"}),s.jsx("li",{children:"Disable your membership — rejoining requires admin reactivation"})]}),s.jsxs("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem"},children:["Your ",s.jsx("strong",{children:"personal"})," authorizations are not affected."]}),s.jsxs("div",{className:"form-group",children:[s.jsxs("label",{htmlFor:"leave-confirm-input",style:{fontSize:"0.825rem",display:"block",marginBottom:"0.375rem"},children:["Type ",s.jsx("code",{children:S})," to confirm:"]}),s.jsx("input",{id:"leave-confirm-input",className:"form-input",type:"text",value:w,onChange:U=>v(U.target.value),placeholder:S,disabled:i,autoFocus:!0})]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"flex-end",marginTop:"1rem"},children:[s.jsx("button",{className:"btn btn-ghost",onClick:E,disabled:i,children:"Cancel"}),s.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:P,disabled:!b,children:i?"Leaving...":"Leave team"})]})]})})]})}function wv({onDismiss:e}){const t=Qt(),{group:n,groupId:r,domain:a}=$e(),[o,i]=u.useState([]),[l,c]=u.useState([]),[d,f]=u.useState([]),[g,p]=u.useState(!0),[x,w]=u.useState({}),[v,j]=u.useState(null);u.useEffect(()=>{Promise.all([A.listProfiles().catch(()=>[]),A.getIntegrationManifests().then(k=>k.manifests??[]).catch(()=>[]),A.getMcpHealth().then(k=>k.integrations??[]).catch(()=>[])]).then(async([k,z,O])=>{if(i(k),c(z),f(O),r){const K=await Promise.all(k.map(U=>A.getTeamProfileConfig(r,U.id).catch(()=>null))),V={};k.forEach((U,N)=>{const X=K[N];X&&(V[U.id]=X)}),w(V)}}).finally(()=>p(!1))},[r]);const h=new Map;for(const k of l)k.profile&&h.set(k.profile,k);const m=k=>k.replace(/@.*$/,"").split("/").pop()??k,y=k=>k.split("@")[1]??"",S=new Map;for(const k of o){const z=m(k.id);if(!h.has(z))continue;const O=S.get(z);(!O||y(k.id).localeCompare(y(O.id),void 0,{numeric:!0})>0)&&S.set(z,k)}const b=l.map(k=>{const z=k.profile?S.get(k.profile):void 0;return z?{manifest:k,profile:z,integration:d.find(O=>O.id===k.id)}:null}).filter(k=>k!==null),T=k=>k in x,E=(k,z)=>{if(!r){console.error("No active group when creating authorization");return}const O=T(k);sessionStorage.setItem("agentAuth",JSON.stringify({profileId:k,groupId:r,groupName:(n==null?void 0:n.name)??null,domain:a,isTeam:O})),z?sessionStorage.setItem("agentGate",JSON.stringify({bounds:z.bounds,context:z.context,gateContent:{intent:z.intent},ttlConfig:{max:z.ttl},templateMode:z.mode,templateTtl:z.ttl})):sessionStorage.removeItem("agentGate"),j(null),e==null||e(),t("/agent/gate")},P=(k,z)=>{r&&(z!=null&&z.templates&&z.templates.length>0?j({profileId:k,manifest:z}):E(k))};if(v){const k=v.manifest.templates??[];return s.jsxs(s.Fragment,{children:[s.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginBottom:"1rem"},onClick:()=>j(null),children:"← Back to profiles"}),s.jsxs("h3",{style:{margin:"0 0 0.25rem 0",fontSize:"1rem"},children:["Set up ",v.manifest.name," authorization"]}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.5rem",marginBottom:"0.75rem",fontWeight:600},children:"Quick start"}),s.jsx("div",{style:{display:"grid",gap:"0.75rem",gridTemplateColumns:`repeat(${Math.min(k.length,3)}, 1fr)`},children:k.map(z=>s.jsxs("button",{className:"template-card",onClick:()=>E(v.profileId,z),children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.375rem"},children:[s.jsx("span",{className:`template-mode template-mode-${z.mode==="automatic"?"auto":"review"}`,children:z.mode==="automatic"?"Auto":"Review"}),s.jsx("span",{className:"template-risk","data-risk":z.risk,children:z.risk})]}),s.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.25rem"},children:z.name}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",lineHeight:1.45,marginBottom:"0.5rem"},children:z.description}),s.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.3rem"},children:z.tags.map(O=>s.jsx("span",{className:"template-tag",children:O},O))})]},z.name))}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1rem",margin:"1.5rem 0"},children:[s.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}}),s.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"or"}),s.jsx("div",{style:{flex:1,height:"1px",background:"var(--border)"}})]}),s.jsx("button",{className:"btn btn-primary",style:{width:"100%",textAlign:"center",padding:"0.75rem"},onClick:()=>E(v.profileId),children:"Custom — define your own limits and scope"})]})}return s.jsxs(s.Fragment,{children:[s.jsx("style",{children:`
|
|
65
|
-
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; align-items: stretch; }
|
|
66
|
-
.profile-grid .card { display: flex; flex-direction: column; height: 100%; margin-top: 0 !important; }
|
|
67
|
-
@media (max-width: 900px) { .profile-grid { grid-template-columns: repeat(2, 1fr); } }
|
|
68
|
-
@media (max-width: 560px) { .profile-grid { grid-template-columns: 1fr; } }
|
|
69
|
-
`}),g?s.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem"},children:"Loading..."}):b.length===0?s.jsxs("div",{className:"card",style:{padding:"2rem",textAlign:"center"},children:[s.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"0.9rem",marginBottom:"1rem"},children:"No integrations set up yet. Connect a service first."}),s.jsx(Ge,{to:"/integrations",className:"btn btn-primary btn-sm",onClick:()=>e==null?void 0:e(),children:"Go to Integrations"})]}):s.jsx("div",{className:"profile-grid",children:b.map(({manifest:k,profile:z,integration:O})=>{const K=T(z.id),V=(O==null?void 0:O.running)===!0;return s.jsxs("div",{className:"card",style:V?void 0:{opacity:.7},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.125rem"},children:[s.jsx("h3",{className:"card-title",style:{margin:0},children:k.name}),K?s.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"}):s.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"})]}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"1rem",flex:1},children:k.description||z.description}),V?s.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>P(z.id,k),children:"Authorize"}):s.jsxs(Ge,{to:`/integrations?setup=${(k==null?void 0:k.id)??""}`,className:"btn btn-secondary btn-sm",style:{textDecoration:"none",textAlign:"center"},onClick:()=>e==null?void 0:e(),children:["Set up ",(k==null?void 0:k.name)??"integration"]})]},k.id)})})]})}const Sv={active:"Active",pending:"Pending",expired:"Expired",revoked:"Revoked"};function jv({status:e,label:t}){return s.jsx("span",{className:`status-badge status-${e}`,children:t||Sv[e]})}function kv({domain:e,attested:t}){const n=t===!0?"domain-attested":t===!1?"domain-missing":"";return s.jsx("span",{className:`domain-badge ${n}`,style:{fontSize:"0.75rem"},children:e})}const kn=86400,zr=3600,Ia=60,bv=30*kn;function Cv(e){if(e<=0)return"Expired";if(e>90*kn){const t=Math.floor(e/bv);return`${t} ${t===1?"month":"months"} remaining`}if(e>7*kn){const t=Math.floor(e/kn);return`${t} ${t===1?"day":"days"} remaining`}if(e>=2*kn){const t=Math.floor(e/kn),n=Math.floor(e%kn/zr);return`${t} ${t===1?"day":"days"} ${n}h remaining`}if(e>=2*zr){const t=Math.floor(e/zr),n=Math.floor(e%zr/Ia);return`${t}h ${String(n).padStart(2,"0")}m remaining`}if(e>=Ia){const t=Math.floor(e/Ia),n=Math.floor(e%Ia);return`${t}m ${String(n).padStart(2,"0")}s remaining`}return`${Math.floor(e)}s remaining`}function Nv({expiresAt:e}){const[t,n]=u.useState(()=>e-Date.now()/1e3),r=t<2*zr;u.useEffect(()=>{const o=setInterval(()=>n(e-Date.now()/1e3),r?1e3:6e4);return()=>clearInterval(o)},[e,r]);const a=t<300;return s.jsx("span",{className:`ttl-badge ${a?"ttl-warn":"ttl-ok"}`,children:Cv(t)})}function Hf({icon:e,title:t,text:n,children:r}){return s.jsxs("div",{className:"empty-state",children:[e&&s.jsx("div",{className:"empty-state-icon",children:e}),s.jsx("div",{className:"empty-state-title",children:t}),n&&s.jsx("div",{className:"empty-state-text",children:n}),r]})}function Ev(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 Tv=[{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 zv({item:e,onClose:t,onSuccess:n}){var h;const{user:r,activeDomain:a,groupId:o}=$e(),i=e.remaining_seconds??0,l=Tv.filter(m=>m.seconds>i),c=((h=l[0])==null?void 0:h.seconds)??2592e3,[d,f]=u.useState(c),[g,p]=u.useState(!1),[x,w]=u.useState(""),v=Object.entries(e.frame).filter(([m])=>m!=="profile"&&m!=="path"),j=async()=>{var m;if(r){p(!0),w("");try{const y=e.authorization_id,S=await A.getGateContent(y);if(!S)throw new Error("Gate content not found locally. The MCP server may have restarted. Please re-authorize through the full wizard instead.");const b=await A.getProfile(e.profile_id),T=e.frame,E=S.context??{},P=e.attested_domains[0]||a||"owner",k=await Va(T,b),z=await Df(E,b),[O,K]=await Promise.all([vs(S.gateContent.intent),vs(JSON.stringify({profile:e.profile_id,path:e.path,domain:P}))]);if(!o)throw new Error("No active group; cannot extend authorization.");const V=(((m=e.deferred_commitment_domains)==null?void 0:m.length)??0)>0?"review":"automatic",U=await A.attest({authorization_id:e.authorization_id,renew:!0,profile_id:e.profile_id,bounds:T,bounds_hash:k,context_hash:z,domain:P,did:r.did,gate_content_hashes:{intent:O},execution_context_hash:K,group_id:o,commitment_mode:V,ttl:d});await A.pushGateContent(Uf(U,{boundsHash:k,contextHash:z,context:E,path:e.path,gateContent:S.gateContent})),n()}catch(y){w(y instanceof Error?y.message:"Extension failed")}finally{p(!1)}}};return s.jsx("div",{className:"modal-backdrop",onClick:m=>m.target===m.currentTarget&&t(),children:s.jsxs("div",{className:"modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h3",{className:"modal-title",children:"Extend Authorization"}),s.jsx("button",{className:"modal-close",onClick:t,children:"×"})]}),s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{style:{marginBottom:"1rem"},children:[s.jsxs("div",{style:{fontWeight:600,marginBottom:"0.25rem"},children:[Fe(e.profile_id)," / ",e.path]}),v.length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:v.map(([m,y])=>`${m}=${y}`).join(" · ")})]}),s.jsxs("div",{style:{marginBottom:"1rem"},children:[s.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&&s.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["Currently valid for ",Ev(i),". Only longer durations are shown."]}),s.jsx("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:l.length===0?s.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=>s.jsx("button",{className:`btn ${d===m.seconds?"btn-primary":"btn-secondary"}`,onClick:()=>f(m.seconds),style:{minWidth:"3.5rem"},children:m.label},m.seconds))})]}),s.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)."}),x&&s.jsx("div",{className:"error-message",children:x})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:t,disabled:g,children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:j,disabled:g,children:g?"Extending...":"Extend"})]})]})})}function Iv(e,t,n){return[...e].sort((r,a)=>{if(n){if(r.authorization_id===n&&a.authorization_id!==n)return-1;if(a.authorization_id===n&&r.authorization_id!==n)return 1}const o=Rt(r,{revokedSet:t}),i=Rt(a,{revokedSet:t}),l={active:0,pending:1,expired:2,revoked:3};return l[o]!==l[i]?l[o]-l[i]:new Date(a.created_at).getTime()-new Date(r.created_at).getTime()})}function Pv({item:e,revokedSet:t,expandedHash:n,gateCache:r,gateLoading:a,copiedHash:o,revokingHash:i,copyingHash:l,profileConfigCache:c,mode:d,ownerLabel:f,isAdmin:g,onExpand:p,onCopyHash:x,onCopy:w,onRevoke:v,onExtend:j,highlightHash:h}){var D;const m=Rt(e,{revokedSet:t}),y=n===e.authorization_id,S=r[e.authorization_id],b=m==="active"||m==="pending"||m==="expired",T=Object.entries(e.frame).filter(([C])=>C!=="profile"&&C!=="path"),E=c.get(e.profile_id)??null,P=(((D=E==null?void 0:E.approvers)==null?void 0:D.length)??0)>0,k=new Map;if(E!=null&&E.caps&&d==="team")for(const[C,_]of T){const H=E.caps[C];H!==void 0&&Number(_)>H&&k.set(C,{authorized:Number(_),cap:H})}const z=k.size>0,O=e.approvers_frozen??[],K=(E==null?void 0:E.approvers)??[],V=d==="team"&&O.length>0&&K.length>0&&(O.length!==K.length||O.some(C=>!K.includes(C))||K.some(C=>!O.includes(C))),U=Array.from(k.entries()).map(([C,_])=>`${C}: ${_.authorized} (cap ${_.cap})`).join(", "),N=Array.from(k.entries()).map(([C,_])=>`${C}: ${_.authorized} → ${_.cap}`).join(", "),X=z?P?k.size===1?`Above team cap: ${U} — actions require approval`:`Above team cap (${k.size}): ${U} — actions require approval`:k.size===1?`Reduced by hard cap: ${N}`:`Reduced by hard cap (${k.size}): ${N}`:"",re=z?P?"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,L=Fe(e.profile_id),R=h!=null&&e.authorization_id===h;return s.jsxs("div",{className:`card${R?" card-highlight":""}`,style:{marginBottom:0},children:[f&&s.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner: ",s.jsx("span",{style:{color:"var(--text-secondary)",fontWeight:500},children:f})]}),s.jsxs("div",{className:"auth-card-header",children:[s.jsx("span",{style:{fontWeight:700,fontSize:"1rem",color:"var(--text-primary)",letterSpacing:"0.01em"},children:L}),e.title&&s.jsx("span",{style:{fontWeight:500,fontSize:"0.85rem",color:"var(--text-secondary)"},children:e.title}),s.jsx(jv,{status:m}),m==="active"&&e.earliest_expiry&&s.jsx(Nv,{expiresAt:new Date(e.earliest_expiry).getTime()/1e3}),m==="expired"&&s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:new Date(e.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.5rem",alignItems:"center"},children:[e.required_domains.map(C=>s.jsx(kv,{domain:C,attested:e.attested_domains.includes(C)},C)),e.deferred_commitment_domains.length>0&&s.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"}),z&&s.jsx("span",{title:re,style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:P?"var(--accent-subtle)":"var(--danger-subtle)",color:P?"var(--accent)":"var(--danger)",fontWeight:600,cursor:"help"},children:X}),V&&s.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:()=>w(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"})]}),T.length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:T.map(([C,_],H)=>{const B=k.get(C);return s.jsxs("span",{children:[H>0&&" · ",B?P?s.jsxs("span",{title:`Team cap on ${C} is ${B.cap}. Actions exceeding the cap require per-action approval. Bound remains authorized at ${B.authorized}.`,children:[s.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[C,"=",String(_)]}),s.jsxs("span",{style:{color:"var(--accent)",marginLeft:"0.25rem",fontWeight:600},children:["↑ approval at ",B.cap]})]}):s.jsxs("span",{title:`Team cap on ${C} is ${B.cap} with no approvers configured (hard cap). Authorized for ${B.authorized}; effective ${B.cap}.`,children:[s.jsxs("span",{style:{textDecoration:"line-through",color:"var(--text-tertiary)"},children:[C,"=",String(_)]}),s.jsxs("span",{style:{color:"var(--danger)",marginLeft:"0.25rem",fontWeight:600},children:["→"," ",B.cap]})]}):s.jsxs("span",{children:[C,"=",String(_)]})]},C)})}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>p(e),children:y?"▲ Hide Details":"▼ Details"})}),y&&s.jsxs("div",{style:{borderTop:"1px solid var(--border)",marginTop:"0.75rem",paddingTop:"0.75rem"},children:[T.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Bounds"}),s.jsx("dl",{className:"review-grid",children:T.map(([C,_])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:C}),s.jsx("dd",{children:String(_)})]},C))})]}),(S==null?void 0:S.context)&&Object.keys(S.context).length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Context"}),s.jsx("dl",{className:"review-grid",children:Object.entries(S.context).map(([C,_])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:C}),s.jsx("dd",{title:String(_),children:Wf(C,_,S.contextLabels)})]},C))})]}),s.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.25rem"},children:"Intent"}),a===e.authorization_id?s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Loading gate content..."}):S?s.jsx("div",{className:"gate-content-block",children:s.jsx("div",{className:"gate-content-item",children:s.jsx("div",{className:"gate-content-text",children:S.gateContent.intent})})}):s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Gate content not available."}),s.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()}`]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginTop:"0.25rem"},children:[s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontFamily:"'SF Mono', Monaco, monospace",wordBreak:"break-all"},children:e.authorization_id}),s.jsx("button",{className:"btn btn-ghost btn-sm",style:{fontSize:"0.7rem",padding:"0.125rem 0.375rem"},onClick:()=>x(e.authorization_id),children:o===e.authorization_id?"copied":"copy"})]}),s.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.75rem"},children:[!f&&s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>w(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"}),!f&&(m==="active"||m==="pending")&&s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>w(e,{asEdit:!0}),disabled:l===e.authorization_id,title:"Adjust intent, bounds, or scope: opens the ceremony pre-filled; signing the new authorization revokes this one",children:"✎ Edit"}),!f&&b&&s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>j(e),children:"↻ Extend"}),f&&g&&m!=="revoked"?s.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>v(e.authorization_id,f,L),disabled:i===e.authorization_id,children:i===e.authorization_id?"Revoking…":"Revoke"}):!f&&(m==="active"||m==="pending")?s.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>v(e.authorization_id),disabled:i===e.authorization_id,children:i===e.authorization_id?"Revoking…":"Revoke"}):null]})]})]},e.authorization_id)}function Rv(){const[e,t]=u.useState([]),[n,r]=u.useState(!0),[a,o]=u.useState([]),[i,l]=u.useState(!1),[c,d]=u.useState("mine"),[f,g]=u.useState("active"),[p,x]=u.useState(null),[w,v]=u.useState(null),[j,h]=If(),[m,y]=u.useState(()=>j.get("new")==="1"),[S,b]=u.useState(()=>j.get("highlight")),[T,E]=u.useState(null),[P,k]=u.useState({}),[z,O]=u.useState(null),[K,V]=u.useState(null),[U,N]=u.useState(null),[X,re]=u.useState(new Set),[L,R]=u.useState(null),[D,C]=u.useState(null),_=Qt(),{group:H,groupId:B,domain:ie,mode:I,activeTeam:Y}=$e(),q=(Y==null?void 0:Y.isAdmin)===!0,[Ce,ft]=u.useState(()=>new Map),$=u.useCallback(()=>{r(!0),A.getMyAttestations().then(t).catch(()=>{}).finally(()=>r(!1))},[]),J=u.useCallback(()=>{B&&(l(!0),A.listTeamAuthorizations(B).then(o).catch(()=>{}).finally(()=>l(!1)))},[B]);xe("attestation-changed",()=>{$(),q&&B&&J()}),u.useEffect(()=>{if(!S)return;j.get("highlight")&&(j.delete("highlight"),h(j,{replace:!0}));const W=window.setTimeout(()=>b(null),3e3);return()=>window.clearTimeout(W)},[]),At($,3e5),u.useEffect(()=>{c==="team"&&q&&B&&a.length===0&&!i&&J()},[c,q,B,a.length,i,J]),u.useEffect(()=>{if(I!=="team"||!B)return;const W=c==="mine"?e:a;if(W.length===0)return;const M=[...new Set(W.map(Z=>Z.profile_id))].filter(Z=>!Ce.has(Z));if(M.length!==0){ft(Z=>{const ae=new Map(Z);for(const te of M)ae.set(te,null);return ae});for(const Z of M)A.getTeamProfileConfig(B,Z).then(ae=>{ft(te=>new Map(te).set(Z,ae))}).catch(()=>{})}},[e,a,c,B,I,Ce]);const oe=async W=>{if(T===W.authorization_id){E(null);return}E(W.authorization_id);const M=W.authorization_id;if(!(M in P)){O(W.authorization_id);try{const Z=await A.getGateContent(M);k(ae=>({...ae,[M]:Z}))}catch{k(Z=>({...Z,[M]:null}))}finally{O(null)}}},Ee=W=>{navigator.clipboard.writeText(W).then(()=>{N(W),setTimeout(()=>N(null),2e3)})},ke=async(W,M)=>{var Z;if(!B){alert("No active group; cannot copy authorization.");return}C(W.authorization_id);try{const ae=W.authorization_id;let te=P[ae]??null;ae in P||(te=await A.getGateContent(ae),k(qe=>({...qe,[ae]:te})));const Ve=Object.fromEntries(Object.entries(W.frame).filter(([qe])=>qe!=="profile"&&qe!=="path")),Mn=(te==null?void 0:te.context)??{},vn=((Z=te==null?void 0:te.gateContent)==null?void 0:Z.intent)??"",ze=W.deferred_commitment_domains.length>0?"review":"automatic",mt=W.attested_domains[0]||ie||"owner",at=Date.parse(W.created_at),Be=W.earliest_expiry?Date.parse(W.earliest_expiry):NaN,xn=Number.isFinite(at)&&Number.isFinite(Be)&&Be>at?Math.round((Be-at)/1e3):void 0;sessionStorage.setItem("agentAuth",JSON.stringify({profileId:W.profile_id,groupId:B,groupName:(H==null?void 0:H.name)??null,domain:mt})),sessionStorage.setItem("agentGate",JSON.stringify({bounds:Ve,context:Mn,gateContent:{intent:vn},templateMode:ze,templateTtl:xn})),M!=null&&M.asEdit?sessionStorage.setItem("agentEditReplaces",W.authorization_id):sessionStorage.removeItem("agentEditReplaces"),_("/agent/gate")}catch(ae){alert(ae instanceof Error?ae.message:"Failed to copy authorization")}finally{C(null)}},Q=async(W,M,Z)=>{const ae=M&&Z?`Revoke ${M}'s ${Z} authorization? This cannot be undone.`:"Revoke this authorization? The agent will no longer be able to execute actions under this attestation.";if(confirm(ae)){R(W);try{await A.revokeAttestation(W),re(te=>new Set(te).add(W)),A.resyncGates().catch(()=>{}),M&&B&&J()}catch(te){alert(te instanceof Error?te.message:"Failed to revoke authorization")}finally{R(null)}}},ee=c==="mine"?e:a,fe=c==="mine"?n:i,ne={active:ee.filter(W=>Rt(W,{revokedSet:X})==="active").length,pending:ee.filter(W=>Rt(W,{revokedSet:X})==="pending").length,expired:ee.filter(W=>Rt(W,{revokedSet:X})==="expired").length,revoked:ee.filter(W=>Rt(W,{revokedSet:X})==="revoked").length},pe=(()=>{const W=new Map;for(const M of ee){if(Rt(M,{revokedSet:X})!==f)continue;const Z=W.get(M.profile_id)??{count:0,review:!1};Z.count+=1,M.deferred_commitment_domains.length>0&&(Z.review=!0),W.set(M.profile_id,Z)}return Array.from(W.entries()).map(([M,Z])=>({profileId:M,...Z})).sort((M,Z)=>Fe(M.profileId).localeCompare(Fe(Z.profileId)))})(),Xe=Iv(ee.filter(W=>{if(Rt(W,{revokedSet:X})!==f||p!==null&&W.profile_id!==p)return!1;if(w!==null){const M=W.deferred_commitment_domains.length>0;if(w==="review"&&!M||w==="auto"&&M)return!1}return!0}),X,S),ce={revokedSet:X,expandedHash:T,gateCache:P,gateLoading:z,copiedHash:U,revokingHash:L,copyingHash:D,profileConfigCache:Ce,mode:I,activeDomain:ie,group:H,groupId:B,onExpand:oe,onCopyHash:Ee,onCopy:ke,onRevoke:Q,onExtend:V,highlightHash:S};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"page-header",style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"1rem",flexWrap:"wrap"},children:[s.jsxs("div",{children:[s.jsx("h1",{className:"page-title",children:"Authorizations"}),s.jsx("p",{className:"page-subtitle",children:"Active, pending, and expired agent authorizations."})]}),s.jsx("button",{className:"btn btn-primary",onClick:()=>y(!0),children:"+ New authorization"})]}),m&&s.jsx("div",{className:"modal-backdrop",onClick:()=>{y(!1),j.get("new")&&(j.delete("new"),h(j,{replace:!0}))},children:s.jsxs("div",{className:"modal",onClick:W=>W.stopPropagation(),style:{maxWidth:"960px",width:"90vw"},children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h2",{className:"modal-title",children:"New authorization"}),s.jsx("button",{className:"modal-close",onClick:()=>{y(!1),j.get("new")&&(j.delete("new"),h(j,{replace:!0}))},children:"×"})]}),s.jsxs("div",{className:"modal-body",children:[s.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."}),s.jsx(wv,{onDismiss:()=>y(!1)})]})]})}),q&&s.jsxs("div",{className:"nav-tabs",style:{marginBottom:"0.5rem"},children:[s.jsx("button",{className:`nav-tab${c==="mine"?" active":""}`,onClick:()=>{d("mine"),g("active"),x(null),v(null),E(null)},children:"Mine"}),s.jsx("button",{className:`nav-tab${c==="team"?" active":""}`,onClick:()=>{d("team"),g("active"),x(null),v(null),E(null)},children:"Team"})]}),s.jsx("div",{className:"nav-tabs",children:["active","pending","expired","revoked"].map(W=>s.jsxs("button",{className:`nav-tab${f===W?" active":""}`,onClick:()=>{g(W),x(null),v(null)},children:[W.charAt(0).toUpperCase()+W.slice(1)," (",ne[W],")"]},W))}),pe.length>0&&s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"center",marginTop:"-0.25rem",marginBottom:"1rem"},children:[pe.map(W=>{const M=p===W.profileId;return s.jsx("button",{className:`btn btn-sm ${M?"btn-primary":"btn-secondary"}`,onClick:()=>x(M?null:W.profileId),children:Fe(W.profileId)},W.profileId)}),s.jsx("span",{"aria-hidden":"true",style:{color:"var(--border)",fontSize:"1.1rem",padding:"0 0.25rem",userSelect:"none"},children:"|"}),["auto","review"].map(W=>{const M=w===W;return s.jsx("button",{className:`btn btn-sm ${M?"btn-primary":"btn-secondary"}`,onClick:()=>v(M?null:W),children:W==="auto"?"Auto":"Review"},W)})]}),fe&&ee.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):Xe.length===0?s.jsx(Hf,{icon:"☰",title:"No authorizations",text:`No ${f} authorizations found.`}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:Xe.map(W=>{const M=c==="team"?W:null,Z=M!=null&&M.owner?M.owner.name??M.owner.email??M.owner.userId:void 0;return s.jsx(Pv,{item:W,ownerLabel:Z,isAdmin:q,...ce},W.authorization_id)})}),K&&s.jsx(zv,{item:K,onClose:()=>V(null),onSuccess:()=>{V(null),$()}})]})}function Vf({profileId:e}){return s.jsx("span",{className:"profile-badge",children:Fe(e)})}function _v(e){return new Date(e*1e3).toLocaleString()}function Av(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 $v(e,t){if(!t)return!0;const n=t.toLowerCase();return e.profileId.toLowerCase().includes(n)||Fe(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 Yc(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,a)=>a.timestamp-r.timestamp)}function Lv(){const{activeTeam:e,groupId:t}=$e(),n=(e==null?void 0:e.isAdmin)===!0,[r,a]=u.useState("mine"),[o,i]=u.useState([]),[l,c]=u.useState(!0),[d,f]=u.useState({}),[g,p]=u.useState(new Set),[x,w]=u.useState(""),[v,j]=u.useState(new Set),[h,m]=u.useState(new Set),[y,S]=u.useState("all"),[b,T]=u.useState(!1),[E,P]=u.useState(null),[k,z]=u.useState(!1),[O,K]=u.useState(!1),V=u.useRef(""),U=u.useCallback(I=>r==="team"&&n&&t?A.listTeamReceiptsPage(t,{before:I,limit:200}):A.getMyReceiptsPage({before:I,limit:200}),[r,n,t]),N=u.useCallback(()=>{const I=r==="team"?`team:${t}`:"mine",Y=V.current!==I;V.current=I,c(!0),K(!1),U().then(q=>{i(Ce=>Y?q.receipts:Yc(Ce,q.receipts)),P(Ce=>Y?q.nextBefore:Ce??q.nextBefore)}).catch(()=>{Y&&i([]),K(!0)}).finally(()=>c(!1))},[U,r,t]),X=u.useCallback(()=>{!E||k||(z(!0),K(!1),U(E).then(I=>{i(Y=>Yc(Y,I.receipts)),P(I.nextBefore)}).catch(()=>K(!0)).finally(()=>z(!1)))},[E,k,U]);At(N,12e4),u.useEffect(()=>{r!=="team"||Object.keys(d).length>0||A.listUsers().then(I=>{const Y={};for(const q of I)Y[q.id]={name:q.name,email:q.email};f(Y)}).catch(()=>{})},[r,d]);const re=u.useMemo(()=>{const I=new Set;for(const Y of o)I.add(Fe(Y.profileId));return[...I].sort()},[o]),L=u.useMemo(()=>{const I=new Set;for(const Y of o)I.add(Y.action);return[...I].sort()},[o]),R=u.useMemo(()=>{if(r!=="team")return[];const I=new Set;for(const Y of o)Y.userId&&I.add(Y.userId);return[...I].map(Y=>{var q;return{id:Y,label:(q=d[Y])!=null&&q.name?`${d[Y].name} (${d[Y].email})`:Y}}).sort((Y,q)=>Y.label.localeCompare(q.label))},[r,o,d]),D=u.useMemo(()=>o.filter(I=>!(!$v(I,x)||v.size>0&&!v.has(Fe(I.profileId))||h.size>0&&!h.has(I.action)||g.size>0&&I.userId&&!g.has(I.userId)||!Av(I,y))),[o,x,v,h,g,y]),C=v.size>0||h.size>0||g.size>0||y!=="all";function _(I){j(Y=>{const q=new Set(Y);return q.has(I)?q.delete(I):q.add(I),q})}function H(I){m(Y=>{const q=new Set(Y);return q.has(I)?q.delete(I):q.add(I),q})}function B(I){p(Y=>{const q=new Set(Y);return q.has(I)?q.delete(I):q.add(I),q})}function ie(){j(new Set),m(new Set),p(new Set),S("all"),w("")}return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"page-header",children:[s.jsx("h1",{className:"page-title",children:"Receipts"}),s.jsx("p",{className:"page-subtitle",children:"Execution history for agent actions."})]}),n&&s.jsx("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem",borderBottom:"1px solid var(--border)"},children:["mine","team"].map(I=>s.jsx("button",{onClick:()=>a(I),className:"btn btn-ghost",style:{borderRadius:0,padding:"0.5rem 0.875rem",borderBottom:r===I?"2px solid var(--accent)":"2px solid transparent",color:r===I?"var(--text-primary)":"var(--text-tertiary)",fontWeight:r===I?600:500},children:I==="mine"?"Mine":"Team"},I))}),s.jsxs("div",{className:"search-filter-bar",children:[s.jsxs("div",{className:"search-input-wrap",children:[s.jsx("span",{className:"search-icon",children:"⌕"}),s.jsx("input",{type:"text",className:"form-input search-input",placeholder:"Search by profile, action, path, or hash\\u2026",value:x,onChange:I=>w(I.target.value)}),x&&s.jsx("button",{className:"search-clear",onClick:()=>w(""),children:"×"})]}),s.jsxs("button",{className:`btn btn-sm btn-secondary${b?" active":""}`,onClick:()=>T(!b),children:["Filters",C?` (${v.size+h.size+(y!=="all"?1:0)})`:""]})]}),b&&s.jsxs("div",{className:"filter-panel",children:[re.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Profile"}),s.jsx("div",{className:"filter-chips",children:re.map(I=>s.jsx("button",{className:`filter-chip${v.has(I)?" selected":""}`,onClick:()=>_(I),children:I},I))})]}),L.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Action"}),s.jsx("div",{className:"filter-chips",children:L.map(I=>s.jsx("button",{className:`filter-chip${h.has(I)?" selected":""}`,onClick:()=>H(I),children:I},I))})]}),r==="team"&&R.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Owner"}),s.jsx("div",{className:"filter-chips",children:R.map(I=>s.jsx("button",{className:`filter-chip${g.has(I.id)?" selected":""}`,onClick:()=>B(I.id),children:I.label},I.id))})]}),s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Time range"}),s.jsx("div",{className:"filter-chips",children:[["1d","Today"],["7d","7 days"],["30d","30 days"],["all","All time"]].map(([I,Y])=>s.jsx("button",{className:`filter-chip${y===I?" selected":""}`,onClick:()=>S(I),children:Y},I))})]})]}),C&&s.jsxs("div",{className:"active-filters",children:[[...v].map(I=>s.jsxs("span",{className:"active-chip",onClick:()=>_(I),children:[I," ",s.jsx("span",{className:"chip-remove",children:"×"})]},I)),[...h].map(I=>s.jsxs("span",{className:"active-chip",onClick:()=>H(I),children:[I," ",s.jsx("span",{className:"chip-remove",children:"×"})]},I)),[...g].map(I=>{const Y=d[I],q=Y?Y.name:I;return s.jsxs("span",{className:"active-chip",onClick:()=>B(I),children:[q," ",s.jsx("span",{className:"chip-remove",children:"×"})]},I)}),y!=="all"&&s.jsxs("span",{className:"active-chip",onClick:()=>S("all"),children:[y==="1d"?"Today":y==="7d"?"7 days":"30 days"," ",s.jsx("span",{className:"chip-remove",children:"×"})]}),s.jsx("button",{className:"clear-filters",onClick:ie,children:"Clear all"})]}),O&&s.jsx("div",{className:"card",style:{borderColor:"var(--danger, #c0392b)",marginBottom:"0.75rem"},children:s.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&&o.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):D.length===0?s.jsx(Hf,{icon:"⌕",title:o.length===0?"No receipts in the last 30 days":"No matching receipts",text:o.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."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:D.length===o.length?`${o.length} receipt${o.length!==1?"s":""}`:`${D.length} of ${o.length} receipts`}),s.jsx("div",{className:"timeline",children:D.map(I=>{var Y;return s.jsx("div",{className:"timeline-event",children:s.jsxs("div",{className:"card",style:{marginBottom:0},children:[s.jsxs("div",{className:"auth-card-header",children:[s.jsx(Vf,{profileId:I.profileId}),s.jsx("span",{className:"auth-card-path",children:I.path}),s.jsx("span",{className:"receipt-action",children:I.action}),s.jsx("span",{className:"auth-card-time",children:_v(I.timestamp)})]}),r==="team"&&I.userId&&s.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:["Owner:"," ",s.jsx("span",{style:{color:"var(--text-secondary)"},children:(Y=d[I.userId])!=null&&Y.name?`${d[I.userId].name} (${d[I.userId].email})`:I.userId})]}),Object.keys(I.executionContext).length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:Object.entries(I.executionContext).map(([q,Ce])=>`${q}=${Ce}`).join(" · ")}),s.jsxs("div",{style:{display:"flex",gap:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:[s.jsxs("span",{children:["Daily: ",I.cumulativeState.daily.count," calls, $",I.cumulativeState.daily.amount]}),s.jsxs("span",{children:["Monthly: ",I.cumulativeState.monthly.count," calls, $",I.cumulativeState.monthly.amount]})]}),s.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontFamily:"'SF Mono', Monaco, monospace",wordBreak:"break-all",marginTop:"0.375rem"},children:I.attestationHash})]})},I.id)})})]}),E&&s.jsx("div",{style:{textAlign:"center",marginTop:"1rem"},children:s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:X,disabled:k,children:k?"Loading…":"Load older"})})]})}const Mv={darwin:"a macOS login item",win32:"a Windows scheduled task",linux:"a systemd user service"};function Fv(){const[e,t]=u.useState(null),[n,r]=u.useState(!1),[a,o]=u.useState(null),i=u.useCallback(async()=>{try{t(await A.getAutostart())}catch(d){o(d instanceof Error?d.message:"Could not read autostart state")}},[]);u.useEffect(()=>{i()},[i]);const l=u.useCallback(async()=>{if(!(!(e!=null&&e.supported)||n)){r(!0),o(null);try{await A.setAutostart(!e.installed)}catch(d){o(d instanceof Error?d.message:"Failed")}finally{try{t(await A.getAutostart()),o(null)}catch(d){o(d instanceof Error?d.message:"Could not re-read state")}r(!1)}}},[e,n,i]);if(!e)return s.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[s.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,margin:0},children:"Keep Suveren running"}),s.jsx("p",{role:a?"alert":void 0,style:{margin:"0.5rem 0 0",fontSize:"0.9rem",color:"var(--text-secondary)"},children:a?`Could not read autostart state: ${a}`:"Checking…"})]});const c=Mv[e.platform]??"a login service";return s.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"1rem"},children:[s.jsxs("div",{children:[s.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,margin:0},children:"Keep Suveren running"}),s.jsx("p",{style:{color:"var(--text-secondary)",margin:"0.5rem 0 0",fontSize:"0.9rem"},children:e.supported?s.jsxs(s.Fragment,{children:["Starts automatically when you log in, and restarts if it crashes. Uses ",c," — no admin rights needed."]}):e.reason})]}),e.supported&&s.jsx("button",{type:"button",onClick:()=>void l(),disabled:n,"aria-pressed":e.installed,className:e.installed?"btn btn-secondary":"btn btn-primary",style:{whiteSpace:"nowrap"},children:n?"Working…":e.installed?"Turn off":"Turn on"})]}),e.supported&&s.jsxs("p",{style:{margin:"1rem 0 0",fontSize:"0.85rem",color:"var(--text-tertiary)"},children:["Status: ",s.jsx("strong",{children:e.installed?"On — starts from your next login":"Off"})]}),e.supported&&s.jsxs("p",{style:{margin:"0.5rem 0 0",fontSize:"0.85rem",color:"var(--text-tertiary)"},children:["Turning this on doesn't interrupt the gateway you're using — it takes effect at your next login. After any restart Suveren comes back ",s.jsx("strong",{children:"locked"}),": you enter your API key once to unlock it, because nothing stored on this machine can unlock it for you."]}),a&&s.jsx("p",{role:"alert",style:{margin:"0.75rem 0 0",fontSize:"0.85rem",color:"var(--danger, #c00)"},children:a})]})}const Ov={npm:"Checking npm for new releases",docker:"Checking the container registry for new images",dev:"Git checkout — comparing against origin/main, not npm releases"};function Bv(){const{version:e,latestVersion:t,updateAvailable:n,installMethod:r}=jl();return e?s.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[s.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,margin:0},children:"Version"}),s.jsxs("p",{style:{margin:"0.5rem 0 0",fontSize:"0.9rem",color:"var(--text-secondary)"},children:["Running ",s.jsx("strong",{children:e}),n&&t?s.jsxs(s.Fragment,{children:[" — ",s.jsx("strong",{children:t})," is available"]}):null]}),s.jsxs("p",{style:{margin:"0.5rem 0 0",fontSize:"0.85rem",color:"var(--text-tertiary)"},children:[Ov[r]??"Update checking is unavailable",r==="dev"&&s.jsx(s.Fragment,{children:" — a development checkout is not told about published releases."})]})]}):null}const Dv={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 Uv(){const[e,t]=u.useState(""),[n,r]=u.useState("openrouter"),[a,o]=u.useState("openai-compatible"),[i,l]=u.useState("https://openrouter.ai/api/v1"),[c,d]=u.useState("google/gemma-4-31b-it"),[f,g]=u.useState(""),[p,x]=u.useState(!1),[w,v]=u.useState(!1),[j,h]=u.useState(!1),[m,y]=u.useState(null),[S,b]=u.useState([]),[T,E]=u.useState(!1),[P,k]=u.useState(null),[z,O]=u.useState(""),K=u.useCallback(R=>{t(R),setTimeout(()=>t(""),3e3)},[]),V=u.useCallback(async(R,D,C)=>{E(!0),k(null);try{const _=await A.aiModels({provider:R,endpoint:D,...C?{apiKey:C}:{}});_.ok&&_.models.length>0?(b(_.models),k(`${_.models.length} models available`)):(b([]),k(_.message||"No models returned — using defaults"))}catch(_){b([]),k(_ instanceof Error?_.message:"Failed to load models")}finally{E(!1)}},[]),U=u.useCallback(async()=>{try{const R=await A.getCredential("ai-config");if(x(R.configured),R.configured&&R.fields){const D=R.fields.provider||"openai-compatible",C=R.fields.endpoint||"";R.fields.provider&&o(D),R.fields.endpoint&&l(C),R.fields.model&&d(R.fields.model),C.includes("openai.com")?r("openai"):C.includes("groq.com")?r("groq"):C.includes("together.xyz")?r("together"):C.includes("openrouter.ai")?r("openrouter"):r("ollama"),C&&V(D,C)}}catch{}},[V]);u.useEffect(()=>{U()},[U]);const N=R=>{r(R),b([]),k(null),O("");const D=Dv[R];D&&(o(D.provider),l(D.endpoint),d(""),V(D.provider,D.endpoint,f||void 0))},X=()=>V(a,i,f||void 0),re=async()=>{v(!0);try{await A.setCredential("ai-config",{provider:a,endpoint:i,model:c,...f?{apiKey:f}:{}}),x(!0),K("AI configuration saved!")}catch{K("Failed to save AI config")}finally{v(!1)}},L=async()=>{h(!0),y(null);try{const R=await A.aiTest({provider:a,endpoint:i,model:c,...f?{apiKey:f}:{}});y(R.ok?`OK: ${R.message}`:`Failed: ${R.message}`)}catch(R){y(`Error: ${R instanceof Error?R.message:"Unknown"}`)}finally{h(!1)}};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"page-header",children:[s.jsx("h1",{className:"page-title",children:"AI Assistant"}),s.jsx("p",{className:"page-subtitle",children:"Advisory AI to help you think through intent when authorizing agents."})]}),e&&s.jsx("div",{className:"alert alert-success",children:e}),s.jsxs("div",{className:"card",children:[s.jsx("h3",{className:"card-title",children:"Configuration"}),s.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."}),p&&s.jsxs("div",{className:"status-banner status-banner-success",style:{marginBottom:"1rem",fontSize:"0.8rem"},children:[s.jsx("span",{className:"status-banner-icon",children:"✓"}),s.jsx("span",{className:"status-banner-text",children:"AI configured"})]}),s.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[s.jsx("label",{className:"form-label",children:"Provider Preset"}),s.jsxs("select",{className:"form-input",value:n,onChange:R=>N(R.target.value),children:[s.jsx("option",{value:"openrouter",children:"OpenRouter (recommended)"}),s.jsx("option",{value:"ollama",children:"Ollama (local)"}),s.jsx("option",{value:"openai",children:"OpenAI"}),s.jsx("option",{value:"groq",children:"Groq"}),s.jsx("option",{value:"together",children:"Together"})]})]}),s.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[s.jsxs("label",{className:"form-label",children:["API Key ",a==="ollama"?"(not needed for Ollama)":"(required to load models)"]}),s.jsx("input",{className:"form-input",type:"password",name:"ai-provider-api-key-credential-top",autoComplete:"new-password",value:f,onChange:R=>g(R.target.value),onBlur:()=>{f.trim()&&V(a,i,f.trim())},placeholder:p?"••••••••••••••••":"sk-... (not needed for Ollama)"}),s.jsx("p",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",margin:"0.375rem 0 0"},children:"Each provider uses its own key — paste it and the model list loads automatically."})]}),s.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsx("label",{className:"form-label",children:"Model"}),s.jsx("button",{type:"button",className:"btn btn-ghost",style:{fontSize:"0.75rem",padding:"0.125rem 0.5rem"},onClick:X,disabled:T,title:"Re-fetch the model list from the provider",children:T?"Loading…":"↻ Refresh"})]}),S.length===0?s.jsx("div",{className:"form-input",style:{display:"flex",alignItems:"center",minHeight:"2.5rem",color:"var(--text-secondary)",fontSize:"0.85rem"},children:T?"Loading models…":a==="ollama"?"Start Ollama locally, then ↻ Refresh to load models.":"Enter a valid API key above to load available models."}):(()=>{const R=S,D=R.includes(c),C=R.length>12,_=z.trim().toLowerCase();let H=_?R.filter(B=>B.toLowerCase().includes(_)):R;return D&&!H.includes(c)&&(H=[c,...H]),s.jsxs(s.Fragment,{children:[C&&s.jsx("input",{className:"form-input",value:z,onChange:B=>O(B.target.value),placeholder:"Filter models… (e.g. kimi)",style:{marginBottom:"0.375rem"}}),s.jsxs("select",{className:"form-input",value:D?c:"__unset__",onChange:B=>d(B.target.value==="__unset__"?"":B.target.value),children:[s.jsx("option",{value:"__unset__",disabled:!0,children:"Select a model…"}),H.map(B=>s.jsx("option",{value:B,children:B},B)),_&&H.length===0&&s.jsxs("option",{value:"__unset__",disabled:!0,children:["No models match “",z,"”"]})]})]})})(),P&&s.jsx("p",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",margin:"0.375rem 0 0"},children:P})]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[s.jsx("button",{className:"btn btn-primary",onClick:re,disabled:w||!c.trim(),title:c.trim()?void 0:"Select a model first",children:w?"Saving...":"Save & Encrypt"}),p&&s.jsx("button",{className:"btn btn-ghost",onClick:L,disabled:j,children:j?"Testing...":"Test Connection"})]}),m&&s.jsx("div",{className:`alert ${m.startsWith("OK")?"alert-success":"alert-error"}`,style:{marginTop:"0.75rem"},children:m})]}),s.jsx(Wv,{}),s.jsx(Fv,{}),s.jsx(Bv,{}),s.jsxs("div",{className:"card",style:{padding:"1.5rem",marginTop:"2rem"},children:[s.jsx("h2",{style:{fontSize:"1rem",fontWeight:700,marginBottom:"1rem"},children:"Security"}),s.jsxs("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.7},children:[s.jsxs("div",{style:{marginBottom:"1rem"},children:[s.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"What the gateway protects"}),s.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[s.jsx("li",{children:"Every tool call verified against your authorization bounds"}),s.jsx("li",{children:"Credentials never exposed to agents through MCP"}),s.jsx("li",{children:"Every action produces a signed receipt"})]})]}),s.jsxs("div",{children:[s.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)",marginBottom:"0.375rem"},children:"Your responsibility"}),s.jsxs("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:[s.jsx("li",{children:"If your AI agent has full access to your computer, it could bypass the gateway"}),s.jsx("li",{children:"For best security, run agents in sandboxed environments"}),s.jsx("li",{children:"The gateway secures what agents do through tools — not what they do on your machine"})]})]})]})]})]})}function Wv(){const[e,t]=u.useState(null),[n,r]=u.useState({intent:"",context:""}),[a,o]=u.useState(null),[i,l]=u.useState(null),[c,d]=u.useState(null),[f,g]=u.useState(!1),p=u.useCallback(async()=>{if(!f)try{const v=await A.getAIPrompts();t(v),r({intent:v.intent.current,context:v.context.current}),g(!0)}catch(v){l(v instanceof Error?v.message:"Failed to load prompts")}},[f]),x=async v=>{if(e){o(v),l(null);try{const j=n[v],h=j.trim()===e[v].default.trim()?"":j;await A.setAIPrompt(v,h);const m=await A.getAIPrompts();t(m),r({intent:m.intent.current,context:m.context.current}),d(v),setTimeout(()=>d(null),2e3)}catch(j){l(j instanceof Error?j.message:"Save failed")}finally{o(null)}}},w=async v=>{if(confirm(`Revert ${v} prompt to the built-in default?`)){o(v),l(null);try{await A.setAIPrompt(v,"");const j=await A.getAIPrompts();t(j),r({intent:j.intent.current,context:j.context.current})}catch(j){l(j instanceof Error?j.message:"Revert failed")}finally{o(null)}}};return s.jsxs("details",{className:"card",style:{padding:"1.5rem",marginTop:"1rem"},onToggle:v=>{v.currentTarget.open&&p()},children:[s.jsx("summary",{style:{fontSize:"1rem",fontWeight:700,cursor:"pointer",listStyle:"revert",userSelect:"none"},children:"Advanced — AI assistant prompts"}),s.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&&s.jsx("div",{className:"alert alert-error",style:{marginBottom:"0.75rem"},children:i}),!f&&!i&&s.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem"},children:"Loading prompts…"}),e&&s.jsxs(s.Fragment,{children:[s.jsx(Qc,{kind:"intent",label:"Intent — per-authorization",description:"Used on the Intent gate when creating a new authorization.",state:e.intent,draft:n.intent,onChange:v=>r(j=>({...j,intent:v})),onSave:()=>x("intent"),onRevert:()=>w("intent"),saving:a==="intent",justSaved:c==="intent"}),s.jsx(Qc,{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:v=>r(j=>({...j,context:v})),onSave:()=>x("context"),onRevert:()=>w("context"),saving:a==="context",justSaved:c==="context"})]})]})}function Qc({kind:e,label:t,description:n,state:r,draft:a,onChange:o,onSave:i,onRevert:l,saving:c,justSaved:d}){const f=a!==r.current;return s.jsxs("section",{style:{marginBottom:"1.5rem"},children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:"0.25rem",gap:"1rem",flexWrap:"wrap"},children:[s.jsxs("div",{children:[s.jsx("div",{style:{fontWeight:600,fontSize:"0.9rem"},children:t}),s.jsx("div",{style:{fontSize:"0.78rem",color:"var(--text-secondary)"},children:n})]}),r.overridden&&s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em"},children:"Custom"})]}),s.jsx("textarea",{className:"form-textarea",value:a,onChange:g=>o(g.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`}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center",marginTop:"0.5rem",flexWrap:"wrap"},children:[s.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:i,disabled:c||!f,children:c?"Saving…":"Save"}),r.overridden&&s.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"}),d&&s.jsx("span",{style:{fontSize:"0.78rem",color:"var(--success)"},children:"Saved"}),f&&!c&&!d&&s.jsx("span",{style:{fontSize:"0.78rem",color:"var(--text-muted)"},children:"Unsaved changes"})]}),s.jsxs("details",{style:{marginTop:"0.5rem"},children:[s.jsx("summary",{style:{fontSize:"0.78rem",color:"var(--text-muted)",cursor:"pointer"},children:"Show built-in default"}),s.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})]}),s.jsx("span",{style:{display:"none"},children:e})]})}function Hv(e){return e.proposalId?"review":"automatic"}function Jc(e,t,n={}){const r=n.status??"pending",a=n.includeAutonomous??!1,o=[];for(const i of e)r==="pending"&&i.status!=="pending"||n.profile&&i.profileId!==n.profile||o.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=Hv(i);!a&&l==="automatic"||n.profile&&i.profileId!==n.profile||o.push({kind:"receipt",id:i.id,sortTimestamp:i.timestamp,commitmentMode:l,profileId:i.profileId,receipt:i})}return o.sort((i,l)=>l.sortTimestamp-i.sortTimestamp),typeof n.limit=="number"&&n.limit>0?o.slice(0,n.limit):o}const Vv=["https://","http://"];function Kf(e,t){return e!=null&&e.length?e.flatMap(n=>{const r=n.template.replace(/\{(\w+)\}/g,(a,o)=>{const i=t[o];return typeof i=="string"||typeof i=="number"?String(i):"\0"});return r.includes("\0")||/\{|\}/.test(r)?[]:Vv.some(a=>r.toLowerCase().startsWith(a))?[{label:n.label,href:r,description:n.description}]:[]}):[]}function Gf(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),a=Math.floor(n%86400/3600),o=Math.floor(n%3600/60);let i;return r>0?i=`expires in ${r}d ${a}h`:a>0?i=`expires in ${a}h ${o}m`:i=`expires in ${Math.max(1,o)}m`,{label:i,urgent:n<2*3600,expired:!1}}const Kv={pending:"Pending",committed:"Approved",executed:"Executed",rejected:"Rejected",expired:"Expired"},Gv={pending:"status-pending",committed:"status-active",executed:"status-active",rejected:"status-revoked",expired:"status-expired"};function Yv(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 Qv(e){return e.split("__").pop()??e}function Jv(e){const t=e.toLowerCase();return t.includes("delete")||t.includes("refund")||t.includes("cancel")||t.includes("revoke")}const Xv=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]),qv=/^(image|img|photo|picture|thumbnail)(_?url)?$/i;function Zv(e,t){return typeof t!="string"?!1:/^data:image\//i.test(t)?!0:qv.test(e)?/^https?:\/\//.test(t):/^https?:\/\/.+\.(jpe?g|png|gif|webp|svg|avif)(\?|$)/i.test(t)}function xi(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=>xi(t)).join(", ");try{return JSON.stringify(e,null,2)}catch{return String(e)}}function Xc({item:e,onApprove:t,onReject:n,resolving:r,proposalLinks:a}){const o=e.kind==="proposal",i=o?e.proposal.status:"executed",l=o?e.proposal.tool:e.receipt.action,c=Qv(l),d=Jv(l),f=o?e.proposal.toolArgs:null,g=o?e.proposal.executionContext:e.receipt.executionContext,p=o?null:e.receipt.cumulativeState,x=o?Kf(a,e.proposal.toolArgs):[],w=f?Object.entries(f).filter(([j])=>!Xv.has(j)):[],v=Object.entries(g??{});return s.jsxs("div",{className:"card",children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.75rem",flexWrap:"wrap"},children:[s.jsx(Vf,{profileId:e.profileId}),s.jsx("code",{style:{fontSize:"0.85rem"},children:c}),e.commitmentMode==="automatic"&&s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"autonomous"}),s.jsxs("span",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"0.5rem"},children:[o&&i==="pending"&&(()=>{const j=Gf(e.proposal.expiresAt,Date.now());return s.jsx("span",{style:{fontSize:"0.72rem",color:j.urgent?"var(--warning)":"var(--text-tertiary)",fontWeight:j.urgent?600:400,whiteSpace:"nowrap"},children:j.label})})(),s.jsx("span",{className:`status-badge ${Gv[i]}`,children:Kv[i]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:Yv(e.sortTimestamp)})]})]}),d&&s.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:[s.jsx("span",{children:"⚠"}),s.jsx("span",{children:"Irreversible action"})]}),o&&typeof(f==null?void 0:f._imagePreview)=="string"&&s.jsxs("div",{style:{marginBottom:"0.75rem"},children:[s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Preview"}),s.jsx("img",{src:f._imagePreview,alt:typeof(f==null?void 0:f.altText)=="string"?f.altText:"local image preview",style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"}})]}),x.length>0&&s.jsx("div",{style:{marginBottom:"0.75rem",display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:x.map(j=>s.jsxs("a",{href:j.href,target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm",style:{textDecoration:"none"},title:j.description??j.href,children:[j.label," ↗"]},j.label))}),o&&w.length>0&&s.jsxs("div",{style:{marginBottom:"0.75rem"},children:[s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Arguments"}),s.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:w.map(([j,h])=>s.jsxs(u.Fragment,{children:[s.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:j}),s.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word",whiteSpace:"pre-wrap"},children:Zv(j,h)?s.jsx("img",{src:h,alt:typeof(f==null?void 0:f.altText)=="string"?f.altText:j,style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"},onError:m=>{const y=m.currentTarget,S=y.parentElement;if(!S)return;y.style.display="none";const b=document.createElement("span");b.textContent=h,b.style.color="var(--text-tertiary)",S.appendChild(b)}}):xi(h)})]},j))})]}),v.length>0&&s.jsx("div",{style:{marginBottom:"0.75rem",fontSize:"0.8rem",color:"var(--text-secondary)"},children:v.map(([j,h])=>`${j}=${xi(h)}`).join(" · ")}),p&&s.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["After this action · today: ",p.daily.count," action",p.daily.count===1?"":"s",p.daily.amount>0?`, ${p.daily.amount}`:""," · ","this month: ",p.monthly.count,p.monthly.amount>0?`, ${p.monthly.amount}`:""]}),o&&i==="pending"&&s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{className:"btn btn-primary",onClick:()=>t==null?void 0:t(e.id),disabled:r,children:r?"Approving…":"Approve"}),s.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:()=>n==null?void 0:n(e.id),disabled:r,children:"Reject"})]}),s.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:[o?"Proposal":"Receipt",": ",e.id]})]})}const ex=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]);function wi(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=>wi(t)).join(", ");try{return JSON.stringify(e,null,2)}catch{return String(e)}}function tx(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 nx({proposal:e,currentUserId:t,onAction:n,onMessage:r,proposalLinks:a}){const[o,i]=u.useState(!1),[l,c]=u.useState(!1),[d,f]=u.useState(null),[g,p]=u.useState(!1),[x,w]=u.useState(null),[v,j]=u.useState(!1),h=e.tool.split("__").pop()??e.tool,m=Object.entries(e.toolArgs).filter(([N])=>!ex.has(N)),y=Object.entries(e.executionContext),S=Kf(a,e.toolArgs),b=e.pendingApprovers??[],T=e.approvedBy??{},E=Object.keys(T).length,P=b.filter(N=>!(N in T)).length,k=t in T,z=async()=>{if(d===null){p(!0),w(null);try{const N=await A.getAttestationIntent(e.authorizationId);if(!N){w("Intent not available or you are not an authorized approver.");return}const X=await A.decryptIntent({intentCiphertext:N.intentCiphertext,encryptedKey:N.encryptedKey,approverId:t});f(X)}catch(N){w(N instanceof Error?N.message:"Failed to decrypt intent")}finally{p(!1)}}},O=async()=>{v?j(!1):(j(!0),await z())},K=async()=>{i(!0),r("");try{await A.approveProposal(e.id);try{if(d===null){const N=await A.getAttestationIntent(e.authorizationId);if(N){const X=await A.decryptIntent({intentCiphertext:N.intentCiphertext,encryptedKey:N.encryptedKey,approverId:t});f(X),await A.storeApprovedIntent(e.authorizationId,X)}}else await A.storeApprovedIntent(e.authorizationId,d)}catch{}r(`Approved. ${P-1>0?`${P-1} more approver(s) still needed.`:"All approvers signed off — action is ready to execute."}`),n()}catch(N){r(N instanceof Error?N.message:"Approval failed")}finally{i(!1)}},V=async()=>{const N=prompt("Rejection reason (optional):");if(N!==null){c(!0),r("");try{await A.rejectProposal(e.id,N||void 0),r("Action rejected."),n()}catch(X){r(X instanceof Error?X.message:"Rejection failed")}finally{c(!1)}}},U=o||l;return s.jsxs("div",{className:"card",children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[s.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:Fe(e.profileId)}),s.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"}),s.jsxs("span",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"0.5rem"},children:[(()=>{const N=Gf(e.expiresAt,Date.now());return s.jsx("span",{style:{fontSize:"0.72rem",color:N.urgent?"var(--warning)":"var(--text-tertiary)",fontWeight:N.urgent?600:400,whiteSpace:"nowrap"},children:N.label})})(),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:tx(e.createdAt)})]})]}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[E," of ",b.length," approver",b.length===1?"":"s"," signed off",b.map(N=>{const X=N in T;return s.jsxs("span",{style:{marginLeft:"0.5rem",color:X?"var(--success, green)":"var(--text-tertiary)"},children:[X?"✓":"○"," ",N===t?"You":N]},N)})]}),s.jsxs("div",{style:{marginBottom:"0.5rem"},children:[s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Proposed action"}),s.jsx("code",{style:{fontSize:"0.85rem"},children:h})]}),S.length>0&&s.jsx("div",{style:{marginBottom:"0.75rem",display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:S.map(N=>s.jsxs("a",{href:N.href,target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-sm",style:{textDecoration:"none"},title:N.description??N.href,children:[N.label," ↗"]},N.label))}),m.length>0&&s.jsxs("div",{style:{marginBottom:"0.75rem"},children:[s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Arguments"}),s.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:m.map(([N,X])=>s.jsxs(u.Fragment,{children:[s.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:N}),s.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word",whiteSpace:"pre-wrap"},children:wi(X)})]},N))})]}),y.length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:y.map(([N,X])=>`${N}=${wi(X)}`).join(" · ")}),s.jsxs("div",{style:{marginBottom:"0.75rem"},children:[s.jsxs("button",{className:"btn btn-ghost btn-sm",style:{padding:"0.2rem 0",fontSize:"0.75rem"},onClick:O,disabled:g,children:[v?"▲ Hide intent":"▼ Show intent",g&&" (decrypting...)"]}),v&&s.jsx("div",{style:{marginTop:"0.5rem",padding:"0.75rem",background:"var(--bg-main)",borderRadius:"0.375rem",border:"1px solid var(--border)"},children:x?s.jsx("p",{style:{color:"var(--danger)",fontSize:"0.8rem",margin:0},children:x}):d!==null?s.jsx("p",{style:{fontSize:"0.85rem",margin:0,whiteSpace:"pre-wrap",color:"var(--text-primary)"},children:d}):s.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.8rem",margin:0},children:"No intent available for this authority."})})]}),!k&&s.jsxs("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.25rem"},children:[s.jsx("button",{className:"btn btn-primary",onClick:K,disabled:U,children:o?"Approving...":"Approve"}),s.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:V,disabled:U,children:l?"Rejecting...":"Reject"})]}),k&&s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"You approved this action. Waiting on other approvers."}),s.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["Proposal: ",e.id]})]})}function rx(){const{domain:e,user:t}=$e(),n=(t==null?void 0:t.id)??"",[r,a]=u.useState("awaiting-me"),[o,i]=u.useState([]),[l,c]=u.useState([]),[d,f]=u.useState(!0),[g,p]=u.useState(""),x=u.useCallback(async()=>{try{const $=await A.getProposalsForApprover();i($)}catch{}finally{f(!1)}},[]);xe("proposal-added",x),xe("proposal-approved",x),xe("proposal-rejected",x),xe("proposal-resolved",x),At(x,3e4);const[w,v]=u.useState([]),j=u.useCallback(async()=>{try{const $=await A.getProposals(e||"owner");v($)}catch{}},[e]);xe("proposal-added",j),xe("proposal-approved",j),xe("proposal-rejected",j),xe("proposal-resolved",j),At(j,3e4,e);const h=u.useMemo(()=>w.filter($=>{var J;return $.status==="pending"&&(((J=$.pendingApprovers)==null?void 0:J.length)??0)===0}),[w]),m=u.useMemo(()=>Jc(h,[],{status:"pending"}),[h]),[y,S]=u.useState([]),b=u.useCallback(async()=>{if(n)try{const J=(await A.getProposals(e||"owner")).filter(oe=>oe.status==="pending"&&oe.pendingApprovers&&oe.pendingApprovers.includes(n)&&oe.approvedBy&&n in oe.approvedBy);S(J)}catch{}},[n,e]);xe("proposal-approved",b),xe("proposal-rejected",b),At(b,3e4,`${n}:${e}`),u.useEffect(()=>{A.getIntegrationManifests().then($=>c($.manifests??[])).catch(()=>{})},[]);const T=$=>{var J;return(J=l.find(oe=>oe.id===$.split("__")[0]))==null?void 0:J.proposalLinks};u.useEffect(()=>{x(),j(),b()},[]);const[E,P]=u.useState([]),[k,z]=u.useState([]),[O,K]=u.useState(!0),[V,U]=u.useState(null),[N,X]=u.useState(""),[re,L]=u.useState("pending"),[R,D]=u.useState(null),[C,_]=u.useState(!1),H=u.useCallback(async()=>{try{const{proposals:$,receipts:J}=await A.getThread({domain:e,status:re,sinceDays:7});P($),z(J)}catch{}finally{K(!1)}},[e,re]);At(H,3e4,`${e}:${re}`);const B=async($,J)=>{U($),X("");try{const oe=e||"owner",Ee=await A.resolveProposal($,J,oe);X(J==="commit"?`Action approved. Status: ${Ee.status}`:"Action rejected."),await Promise.all([H(),j()])}catch(oe){X(oe instanceof Error?oe.message:"Failed")}finally{U(null)}},ie=u.useMemo(()=>{const $=new Set;for(const J of E)$.add(J.profileId);for(const J of k)$.add(J.profileId);return Array.from($).sort()},[E,k]),I=u.useMemo(()=>Jc(E,k,{status:re,profile:R??void 0,includeAutonomous:C}),[E,k,re,R,C]),Y=u.useCallback(()=>{x(),b()},[x,b]),q=u.useMemo(()=>{const $=new Set,J=[];for(const oe of y)$.has(oe.id)||($.add(oe.id),J.push(oe));return J.sort((oe,Ee)=>Ee.createdAt-oe.createdAt)},[y]),Ce=o.length+m.length,ft=q.length;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"page-header",children:[s.jsx("h1",{className:"page-title",children:"Pending Approvals"}),s.jsx("p",{className:"page-subtitle",children:"Actions awaiting approval, plus recent activity from the last 7 days."})]}),s.jsxs("div",{className:"nav-tabs",style:{marginBottom:"1rem"},children:[s.jsxs("button",{className:`nav-tab${r==="awaiting-me"?" active":""}`,onClick:()=>a("awaiting-me"),children:["Awaiting me ",Ce>0&&s.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:Ce})]}),s.jsxs("button",{className:`nav-tab${r==="awaiting-others"?" active":""}`,onClick:()=>a("awaiting-others"),children:["Awaiting others ",ft>0&&s.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:ft})]}),s.jsx("button",{className:`nav-tab${r==="all"?" active":""}`,onClick:()=>{a("all"),H()},children:"All"})]}),r==="awaiting-me"&&s.jsx(s.Fragment,{children:d&&Ce===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):Ce===0?s.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[s.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions awaiting your approval."}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Review-mode actions and above-cap actions you must approve will appear here."})]}):s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(g||N)&&s.jsx("div",{className:"alert alert-success",children:g||N}),m.map($=>s.jsx(Xc,{proposalLinks:$.kind==="proposal"?T($.proposal.tool):void 0,item:$,onApprove:J=>B(J,"commit"),onReject:J=>B(J,"reject"),resolving:V===$.id},$.id)),o.map($=>s.jsx(nx,{proposal:$,currentUserId:n,onAction:Y,onMessage:p,proposalLinks:T($.tool)},$.id))]})}),r==="awaiting-others"&&s.jsx(s.Fragment,{children:q.length===0?s.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[s.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions waiting on others."}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Actions you proposed or approved that are pending other approvers will appear here."})]}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:q.map($=>s.jsx(sx,{proposal:$,currentUserId:n,onCancel:async()=>{try{await A.rejectProposal($.id,"cancelled by creator"),b(),j()}catch(J){alert(J instanceof Error?J.message:"Cancel failed")}}},$.id))})}),r==="all"&&s.jsxs(s.Fragment,{children:[N&&s.jsx("div",{className:"alert alert-success",style:{marginBottom:"1rem"},children:N}),s.jsxs("div",{className:"filter-chips",style:{marginBottom:"1rem"},children:[s.jsx("button",{className:`filter-chip ${re==="pending"?"selected":""}`,onClick:()=>L("pending"),children:"Pending"}),s.jsx("button",{className:`filter-chip ${re==="all"?"selected":""}`,onClick:()=>L("all"),children:"All"}),ie.length>0&&s.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),ie.map($=>s.jsx("button",{className:`filter-chip ${R===$?"selected":""}`,onClick:()=>D(R===$?null:$),children:Fe($)},$)),re==="all"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),s.jsxs("button",{className:`filter-chip ${C?"selected":""}`,onClick:()=>_(!C),title:"Include actions executed without human review (automatic commitment mode)",children:[C?"✓ ":"","Autonomous actions"]})]})]}),O&&I.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):I.length===0?s.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[s.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:re==="pending"?"No actions awaiting your approval.":"Nothing here yet."}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:re==="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."})]}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:I.map($=>s.jsx(Xc,{proposalLinks:$.kind==="proposal"?T($.proposal.tool):void 0,item:$,onApprove:J=>B(J,"commit"),onReject:J=>B(J,"reject"),resolving:V===$.id},$.id))})]})]})}function ax(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 sx({proposal:e,currentUserId:t,onCancel:n}){var d;const[r,a]=u.useState(!1),o=Object.keys(e.approvedBy??{}),i=(e.pendingApprovers??[]).filter(f=>!(f in(e.approvedBy??{}))),l=(((d=e.pendingApprovers)==null?void 0:d.length)??0)>0,c=async()=>{if(confirm("Cancel this action? All approvers will be notified.")){a(!0);try{await n()}finally{a(!1)}}};return s.jsxs("div",{className:"card",children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.5rem",flexWrap:"wrap"},children:[s.jsx("span",{style:{fontWeight:600,fontSize:"0.9rem"},children:Fe(e.profileId)}),l&&s.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"}),s.jsx("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:ax(e.createdAt)})]}),s.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:s.jsx("code",{children:e.tool.split("__").pop()??e.tool})}),l&&s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[o.map(f=>s.jsx("span",{style:{marginRight:"0.75rem",color:"var(--success, green)"},children:f===t?"You approved":`${f} approved`},f)),i.map(f=>s.jsxs("span",{style:{marginRight:"0.75rem",color:"var(--text-tertiary)"},children:["Waiting on ",f===t?"you":f]},f))]}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:s.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--danger)"},onClick:c,disabled:r,children:r?"Cancelling...":"Cancel"})})]})}const ox=`# Agent Brief
|
|
70
|
-
|
|
71
|
-
You act on my behalf through Suveren — the gateway that gates every
|
|
72
|
-
privileged tool call you make. Suveren implements the bounded-authority
|
|
73
|
-
model from the open Human Agency Protocol (HAP): each authorization
|
|
74
|
-
describes an area of authority, a set of numeric limits, and a scope.
|
|
75
|
-
Operate inside those bounds or the Gatekeeper will reject your action.
|
|
76
|
-
|
|
77
|
-
## Before you act in a domain
|
|
78
|
-
|
|
79
|
-
1. Call \`list-authorizations(domain: "<domain>")\` to load the full
|
|
80
|
-
intent, scope, and usage for that area. The session brief shows only
|
|
81
|
-
a one-line summary per authority — the Intent paragraph lives behind
|
|
82
|
-
that call, and often contains soft rules you MUST honor (e.g. "never
|
|
83
|
-
publish on weekends", "only reply in English").
|
|
84
|
-
2. If the action would exceed a bound or fall outside the scope, stop
|
|
85
|
-
and explain what would be blocked instead of trying.
|
|
86
|
-
3. If you're not sure whether an action is covered, ask me first.
|
|
87
|
-
|
|
88
|
-
## How to handle reviews
|
|
89
|
-
|
|
90
|
-
Authorizations in review mode require my approval before the action
|
|
91
|
-
executes. When you propose an action:
|
|
92
|
-
- Include everything I need to judge it (title, recipients, amounts,
|
|
93
|
-
dates, attendees) in the tool arguments.
|
|
94
|
-
- Don't batch unrelated proposals — one proposal per decision.
|
|
95
|
-
|
|
96
|
-
## Standing orders
|
|
97
|
-
|
|
98
|
-
(Add your own here. Examples:)
|
|
99
|
-
|
|
100
|
-
- Every morning, summarize today's calendar and flag conflicts.
|
|
101
|
-
- On Fridays, give me a weekly review: what's done, what slipped, what's
|
|
102
|
-
next.
|
|
103
|
-
- Never email anyone outside the company without asking first.
|
|
104
|
-
- When drafting posts, prefer plain language over marketing copy.
|
|
105
|
-
`;function ix(){const[e,t]=u.useState(""),[n,r]=u.useState(""),[a,o]=u.useState(!0),[i,l]=u.useState(!1),[c,d]=u.useState(null),[f,g]=u.useState(!1),p=e!==n,x=new Blob([e]).size,w=16*1024;u.useEffect(()=>{if(!p)return;const m=S=>{S.preventDefault(),S.returnValue=""},y=S=>{var E,P;if(S.defaultPrevented||S.button!==0||S.metaKey||S.ctrlKey||S.shiftKey||S.altKey)return;const b=(P=(E=S.target)==null?void 0:E.closest)==null?void 0:P.call(E,"a");if(!b||!b.href)return;let T;try{T=new URL(b.href)}catch{return}T.origin===window.location.origin&&T.pathname!==window.location.pathname&&(confirm("You have unsaved changes to your agent brief. Leave anyway?")||(S.preventDefault(),S.stopPropagation()))};return window.addEventListener("beforeunload",m),document.addEventListener("click",y,!0),()=>{window.removeEventListener("beforeunload",m),document.removeEventListener("click",y,!0)}},[p]),u.useEffect(()=>{let m=!1;return A.getAgentContext().then(y=>{m||(t(y),r(y))}).catch(y=>{m||d({kind:"error",text:y instanceof Error?y.message:"Failed to load context"})}).finally(()=>{m||o(!1)}),()=>{m=!0}},[]);const v=async()=>{l(!0),d(null);try{await A.saveAgentContext(e),r(e),d({kind:"ok",text:"Saved. New MCP sessions will pick this up on next connect."})}catch(m){d({kind:"error",text:m instanceof Error?m.message:"Save failed"})}finally{l(!1)}},j=()=>{t(n),d(null)},h=()=>{e.trim()&&!confirm("Replace current context with the starter template?")||t(ox)};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"page-header",children:[s.jsx("h1",{className:"page-title",children:"Agent Brief"}),s.jsx("p",{className:"page-subtitle",children:"Standing orders for agents that connect via MCP. This text prepends every new session — keep it tight."}),!e.trim()&&!a&&s.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&&s.jsx("div",{className:c.kind==="ok"?"alert alert-success":"error-message",style:{marginBottom:"1rem"},children:c.text}),s.jsxs("div",{className:"intent-layout",style:{marginBottom:"1rem"},children:[s.jsx("div",{className:"card intent-pane chat",children:s.jsx(ys,{target:{kind:"context"},currentText:e,onApply:m=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||t(m)},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…"})}),s.jsxs("div",{className:"card intent-pane document",children:[s.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:"0.5rem",flexWrap:"wrap",marginBottom:"0.5rem"},children:[s.jsx("h3",{className:"card-title",style:{marginBottom:0},children:"context.md"}),s.jsxs("span",{style:{fontSize:"0.75rem",color:x>w?"var(--danger)":"var(--text-muted)"},children:[x.toLocaleString()," / ",w.toLocaleString()," bytes"]})]}),s.jsx("textarea",{className:"form-textarea",value:e,onChange:m=>t(m.target.value),placeholder:a?"Loading…":'Type your standing orders here, or click "Insert starter template" below.',disabled:a,rows:18,style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem",lineHeight:1.5,minHeight:"22rem"}}),s.jsxs("div",{className:"intent-footer",style:{marginTop:"0.75rem"},children:[s.jsx("button",{className:"btn btn-ghost",onClick:j,disabled:i||!p,children:"Revert"}),s.jsx("button",{className:"btn btn-primary",style:{flex:1},onClick:v,disabled:i||!p||x>w||a,children:i?"Saving…":"Save"})]})]}),s.jsx("button",{type:"button",className:"floating-help",onClick:()=>g(!0),"aria-label":"Open brief assistant",children:"Get help with brief"}),s.jsx(Bf,{open:f,onClose:()=>g(!1),ariaLabel:"Brief assistant",children:s.jsx(ys,{target:{kind:"context"},currentText:e,onApply:m=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||(t(m),g(!1))},greeting:"Tell me what your agent should know — I'll help shape your standing orders.",placeholder:"Ask for help with your brief…"})})]})]})}function lx({children:e}){const{user:t,mode:n,domain:r}=$e();return t?n==="team"&&!r?s.jsx(Zt,{to:"/onboarding",replace:!0}):s.jsx(s.Fragment,{children:e}):s.jsx(Zt,{to:"/login",replace:!0})}function cx(){const{user:e}=$e();return s.jsxs(Sg,{children:[s.jsx(Re,{path:"/login",element:e?s.jsx(Zt,{to:"/",replace:!0}):s.jsx(by,{})}),s.jsx(Re,{path:"/onboarding",element:e?s.jsx(Cy,{}):s.jsx(Zt,{to:"/login",replace:!0})}),s.jsxs(Re,{element:s.jsx(lx,{children:s.jsx(ky,{})}),children:[s.jsx(Re,{path:"/",element:s.jsx(My,{})}),s.jsx(Re,{path:"/agent/new",element:s.jsx(Zt,{to:"/authorizations?new=1",replace:!0})}),s.jsx(Re,{path:"/agent/gate",element:s.jsx(lv,{})}),s.jsx(Re,{path:"/agent/review",element:s.jsx(mv,{})}),s.jsx(Re,{path:"/integrations",element:s.jsx(vv,{})}),s.jsx(Re,{path:"/groups",element:s.jsx(xv,{})}),s.jsx(Re,{path:"/authorizations",element:s.jsx(Rv,{})}),s.jsx(Re,{path:"/audit",element:s.jsx(Lv,{})}),s.jsx(Re,{path:"/proposals",element:s.jsx(rx,{})}),s.jsx(Re,{path:"/agent-brief",element:s.jsx(ix,{})}),s.jsx(Re,{path:"/settings",element:s.jsx(Uv,{})}),s.jsx(Re,{path:"/settings/services",element:s.jsx(Zt,{to:"/settings",replace:!0})}),s.jsx(Re,{path:"/deploy",element:s.jsx(Zt,{to:"/integrations",replace:!0})})]}),s.jsx(Re,{path:"*",element:s.jsx(Zt,{to:"/",replace:!0})})]})}function ux(){return s.jsx(Kg,{children:s.jsx(ny,{children:s.jsx(ry,{children:s.jsx(cx,{})})})})}ff(document.getElementById("root")).render(s.jsx(u.StrictMode,{children:s.jsx(ux,{})}));
|