@suveren/gateway 0.3.2 → 0.3.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/dist/control-plane/index.mjs +2 -2
- package/dist/mcp-server/http.mjs +73 -68
- package/dist/ui/assets/index-mg8gMTzG.js +105 -0
- package/dist/ui/index.html +1 -1
- package/node_modules/@hap/core/dist/index.d.mts +7 -2
- package/node_modules/@hap/core/dist/index.d.ts +7 -2
- package/node_modules/@hap/core/dist/index.js +2 -2
- package/node_modules/@hap/core/dist/index.mjs +2 -2
- package/node_modules/@hap/core/package.json +1 -1
- package/node_modules/@hap/core/src/identity.ts +9 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/utf32.js +10 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/package.json +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/types/encodings.d.ts +2 -0
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/buffer.d.ts +64 -25
- package/node_modules/@types/node/crypto.d.ts +18 -5
- package/node_modules/@types/node/diagnostics_channel.d.ts +237 -3
- package/node_modules/@types/node/dns.d.ts +1 -1
- package/node_modules/@types/node/ffi.d.ts +486 -0
- package/node_modules/@types/node/fs/promises.d.ts +3 -0
- package/node_modules/@types/node/fs.d.ts +21 -6
- package/node_modules/@types/node/http.d.ts +25 -0
- package/node_modules/@types/node/index.d.ts +1 -0
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/process.d.ts +14 -1
- package/node_modules/@types/node/quic.d.ts +92 -11
- package/node_modules/@types/node/sqlite.d.ts +55 -0
- package/node_modules/@types/node/stream/iter.d.ts +150 -0
- package/node_modules/@types/node/stream.d.ts +32 -0
- package/node_modules/@types/node/test.d.ts +112 -2
- package/node_modules/@types/node/ts5.6/index.d.ts +1 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +1 -0
- package/node_modules/@types/node/util.d.ts +19 -2
- package/node_modules/@types/node/v8.d.ts +84 -2
- package/node_modules/@types/node/worker_threads.d.ts +8 -7
- package/node_modules/raw-body/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
- package/node_modules/raw-body/node_modules/iconv-lite/encodings/utf32.js +10 -3
- package/node_modules/raw-body/node_modules/iconv-lite/package.json +2 -2
- package/node_modules/raw-body/node_modules/iconv-lite/types/encodings.d.ts +2 -0
- package/package.json +2 -2
- package/dist/ui/assets/index-RkZBhIxU.js +0 -105
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
var Df=Object.defineProperty;var Uf=(e,t,n)=>t in e?Df(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _s=(e,t,n)=>Uf(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 Gc={exports:{}},ps={},Yc={exports:{}},Z={};/**
|
|
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 ea=Symbol.for("react.element"),Wf=Symbol.for("react.portal"),Hf=Symbol.for("react.fragment"),Vf=Symbol.for("react.strict_mode"),Kf=Symbol.for("react.profiler"),Gf=Symbol.for("react.provider"),Yf=Symbol.for("react.context"),Qf=Symbol.for("react.forward_ref"),Jf=Symbol.for("react.suspense"),Xf=Symbol.for("react.memo"),qf=Symbol.for("react.lazy"),yl=Symbol.iterator;function Zf(e){return e===null||typeof e!="object"?null:(e=yl&&e[yl]||e["@@iterator"],typeof e=="function"?e:null)}var Qc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Jc=Object.assign,Xc={};function ar(e,t,n){this.props=e,this.context=t,this.refs=Xc,this.updater=n||Qc}ar.prototype.isReactComponent={};ar.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ar.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function qc(){}qc.prototype=ar.prototype;function hi(e,t,n){this.props=e,this.context=t,this.refs=Xc,this.updater=n||Qc}var gi=hi.prototype=new qc;gi.constructor=hi;Jc(gi,ar.prototype);gi.isPureReactComponent=!0;var xl=Array.isArray,Zc=Object.prototype.hasOwnProperty,vi={current:null},eu={key:!0,ref:!0,__self:!0,__source:!0};function tu(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)Zc.call(t,r)&&!eu.hasOwnProperty(r)&&(a[r]=t[r]);var l=arguments.length-2;if(l===1)a.children=n;else if(1<l){for(var c=Array(l),u=0;u<l;u++)c[u]=arguments[u+2];a.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)a[r]===void 0&&(a[r]=l[r]);return{$$typeof:ea,type:e,key:o,ref:i,props:a,_owner:vi.current}}function em(e,t){return{$$typeof:ea,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function yi(e){return typeof e=="object"&&e!==null&&e.$$typeof===ea}function tm(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var wl=/\/+/g;function As(e,t){return typeof e=="object"&&e!==null&&e.key!=null?tm(""+e.key):t.toString(36)}function Ea(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 ea:case Wf:i=!0}}if(i)return i=e,a=a(i),e=r===""?"."+As(i,0):r,xl(a)?(n="",e!=null&&(n=e.replace(wl,"$&/")+"/"),Ea(a,t,n,"",function(u){return u})):a!=null&&(yi(a)&&(a=em(a,n+(!a.key||i&&i.key===a.key?"":(""+a.key).replace(wl,"$&/")+"/")+e)),t.push(a)),1;if(i=0,r=r===""?".":r+":",xl(e))for(var l=0;l<e.length;l++){o=e[l];var c=r+As(o,l);i+=Ea(o,t,n,c,a)}else if(c=Zf(e),typeof c=="function")for(e=c.call(e),l=0;!(o=e.next()).done;)o=o.value,c=r+As(o,l++),i+=Ea(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 ia(e,t,n){if(e==null)return e;var r=[],a=0;return Ea(e,r,"","",function(o){return t.call(n,o,a++)}),r}function nm(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Be={current:null},Pa={transition:null},rm={ReactCurrentDispatcher:Be,ReactCurrentBatchConfig:Pa,ReactCurrentOwner:vi};function nu(){throw Error("act(...) is not supported in production builds of React.")}Z.Children={map:ia,forEach:function(e,t,n){ia(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ia(e,function(){t++}),t},toArray:function(e){return ia(e,function(t){return t})||[]},only:function(e){if(!yi(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Z.Component=ar;Z.Fragment=Hf;Z.Profiler=Kf;Z.PureComponent=hi;Z.StrictMode=Vf;Z.Suspense=Jf;Z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rm;Z.act=nu;Z.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=Jc({},e.props),a=e.key,o=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,i=vi.current),t.key!==void 0&&(a=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)Zc.call(t,c)&&!eu.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:ea,type:e.type,key:a,ref:o,props:r,_owner:i}};Z.createContext=function(e){return e={$$typeof:Yf,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Gf,_context:e},e.Consumer=e};Z.createElement=tu;Z.createFactory=function(e){var t=tu.bind(null,e);return t.type=e,t};Z.createRef=function(){return{current:null}};Z.forwardRef=function(e){return{$$typeof:Qf,render:e}};Z.isValidElement=yi;Z.lazy=function(e){return{$$typeof:qf,_payload:{_status:-1,_result:e},_init:nm}};Z.memo=function(e,t){return{$$typeof:Xf,type:e,compare:t===void 0?null:t}};Z.startTransition=function(e){var t=Pa.transition;Pa.transition={};try{e()}finally{Pa.transition=t}};Z.unstable_act=nu;Z.useCallback=function(e,t){return Be.current.useCallback(e,t)};Z.useContext=function(e){return Be.current.useContext(e)};Z.useDebugValue=function(){};Z.useDeferredValue=function(e){return Be.current.useDeferredValue(e)};Z.useEffect=function(e,t){return Be.current.useEffect(e,t)};Z.useId=function(){return Be.current.useId()};Z.useImperativeHandle=function(e,t,n){return Be.current.useImperativeHandle(e,t,n)};Z.useInsertionEffect=function(e,t){return Be.current.useInsertionEffect(e,t)};Z.useLayoutEffect=function(e,t){return Be.current.useLayoutEffect(e,t)};Z.useMemo=function(e,t){return Be.current.useMemo(e,t)};Z.useReducer=function(e,t,n){return Be.current.useReducer(e,t,n)};Z.useRef=function(e){return Be.current.useRef(e)};Z.useState=function(e){return Be.current.useState(e)};Z.useSyncExternalStore=function(e,t,n){return Be.current.useSyncExternalStore(e,t,n)};Z.useTransition=function(){return Be.current.useTransition()};Z.version="18.3.1";Yc.exports=Z;var d=Yc.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 am=d,sm=Symbol.for("react.element"),om=Symbol.for("react.fragment"),im=Object.prototype.hasOwnProperty,lm=am.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,cm={key:!0,ref:!0,__self:!0,__source:!0};function ru(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)im.call(t,r)&&!cm.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:sm,type:e,key:o,ref:i,props:a,_owner:lm.current}}ps.Fragment=om;ps.jsx=ru;ps.jsxs=ru;Gc.exports=ps;var s=Gc.exports,au={exports:{}},Ze={},su={exports:{}},ou={};/**
|
|
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(P,z){var $=P.length;P.push(z);e:for(;0<$;){var L=$-1>>>1,V=P[L];if(0<a(V,z))P[L]=z,P[$]=V,$=L;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var z=P[0],$=P.pop();if($!==z){P[0]=$;e:for(var L=0,V=P.length,ee=V>>>1;L<ee;){var X=2*(L+1)-1,ge=P[X],b=X+1,W=P[b];if(0>a(ge,$))b<V&&0>a(W,ge)?(P[L]=W,P[b]=$,L=b):(P[L]=ge,P[X]=$,L=X);else if(b<V&&0>a(W,$))P[L]=W,P[b]=$,L=b;else break e}}return z}function a(P,z){var $=P.sortIndex-z.sortIndex;return $!==0?$:P.id-z.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=[],u=[],p=1,f=null,v=3,y=!1,x=!1,w=!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 g(P){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=P)r(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function S(P){if(w=!1,g(P),!x)if(n(c)!==null)x=!0,q(E);else{var z=n(u);z!==null&&se(S,z.startTime-P)}}function E(P,z){x=!1,w&&(w=!1,h(N),N=-1),y=!0;var $=v;try{for(g(z),f=n(c);f!==null&&(!(f.expirationTime>z)||P&&!H());){var L=f.callback;if(typeof L=="function"){f.callback=null,v=f.priorityLevel;var V=L(f.expirationTime<=z);z=e.unstable_now(),typeof V=="function"?f.callback=V:f===n(c)&&r(c),g(z)}else r(c);f=n(c)}if(f!==null)var ee=!0;else{var X=n(u);X!==null&&se(S,X.startTime-z),ee=!1}return ee}finally{f=null,v=$,y=!1}}var T=!1,k=null,N=-1,C=5,I=-1;function H(){return!(e.unstable_now()-I<C)}function U(){if(k!==null){var P=e.unstable_now();I=P;var z=!0;try{z=k(!0,P)}finally{z?D():(T=!1,k=null)}}else T=!1}var D;if(typeof m=="function")D=function(){m(U)};else if(typeof MessageChannel<"u"){var _=new MessageChannel,B=_.port2;_.port1.onmessage=U,D=function(){B.postMessage(null)}}else D=function(){j(U,0)};function q(P){k=P,T||(T=!0,D())}function se(P,z){N=j(function(){P(e.unstable_now())},z)}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(P){P.callback=null},e.unstable_continueExecution=function(){x||y||(x=!0,q(E))},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(P){switch(v){case 1:case 2:case 3:var z=3;break;default:z=v}var $=v;v=z;try{return P()}finally{v=$}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,z){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var $=v;v=P;try{return z()}finally{v=$}},e.unstable_scheduleCallback=function(P,z,$){var L=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?L+$:L):$=L,P){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=$+V,P={id:p++,callback:z,priorityLevel:P,startTime:$,expirationTime:V,sortIndex:-1},$>L?(P.sortIndex=$,t(u,P),n(c)===null&&P===n(u)&&(w?(h(N),N=-1):w=!0,se(S,$-L))):(P.sortIndex=V,t(c,P),x||y||(x=!0,q(E))),P},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(P){var z=v;return function(){var $=v;v=z;try{return P.apply(this,arguments)}finally{v=$}}}})(ou);su.exports=ou;var um=su.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 dm=d,qe=um;function M(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var iu=new Set,Lr={};function In(e,t){Xn(e,t),Xn(e+"Capture",t)}function Xn(e,t){for(Lr[e]=t,e=0;e<t.length;e++)iu.add(t[e])}var Bt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),po=Object.prototype.hasOwnProperty,fm=/^[: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]*$/,Sl={},jl={};function mm(e){return po.call(jl,e)?!0:po.call(Sl,e)?!1:fm.test(e)?jl[e]=!0:(Sl[e]=!0,!1)}function pm(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 hm(e,t,n,r){if(t===null||typeof t>"u"||pm(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function De(e,t,n,r,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 _e={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){_e[e]=new De(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];_e[t]=new De(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){_e[e]=new De(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){_e[e]=new De(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){_e[e]=new De(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){_e[e]=new De(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){_e[e]=new De(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){_e[e]=new De(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){_e[e]=new De(e,5,!1,e.toLowerCase(),null,!1,!1)});var xi=/[\-:]([a-z])/g;function wi(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(xi,wi);_e[t]=new De(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(xi,wi);_e[t]=new De(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(xi,wi);_e[t]=new De(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){_e[e]=new De(e,1,!1,e.toLowerCase(),null,!1,!1)});_e.xlinkHref=new De("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){_e[e]=new De(e,1,!1,e.toLowerCase(),null,!0,!0)});function Si(e,t,n,r){var a=_e.hasOwnProperty(t)?_e[t]:null;(a!==null?a.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(hm(t,n,a,r)&&(n=null),r||a===null?mm(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 Vt=dm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,la=Symbol.for("react.element"),_n=Symbol.for("react.portal"),An=Symbol.for("react.fragment"),ji=Symbol.for("react.strict_mode"),ho=Symbol.for("react.profiler"),lu=Symbol.for("react.provider"),cu=Symbol.for("react.context"),ki=Symbol.for("react.forward_ref"),go=Symbol.for("react.suspense"),vo=Symbol.for("react.suspense_list"),Ci=Symbol.for("react.memo"),Yt=Symbol.for("react.lazy"),uu=Symbol.for("react.offscreen"),kl=Symbol.iterator;function fr(e){return e===null||typeof e!="object"?null:(e=kl&&e[kl]||e["@@iterator"],typeof e=="function"?e:null)}var he=Object.assign,$s;function Sr(e){if($s===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);$s=t&&t[1]||""}return`
|
|
34
|
-
`+$s+e}var Ls=!1;function Ms(e,t){if(!e||Ls)return"";Ls=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var a=u.stack.split(`
|
|
35
|
-
`),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{Ls=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Sr(e):""}function gm(e){switch(e.tag){case 5:return Sr(e.type);case 16:return Sr("Lazy");case 13:return Sr("Suspense");case 19:return Sr("SuspenseList");case 0:case 2:case 15:return e=Ms(e.type,!1),e;case 11:return e=Ms(e.type.render,!1),e;case 1:return e=Ms(e.type,!0),e;default:return""}}function yo(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 An:return"Fragment";case _n:return"Portal";case ho:return"Profiler";case ji:return"StrictMode";case go:return"Suspense";case vo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case cu:return(e.displayName||"Context")+".Consumer";case lu:return(e._context.displayName||"Context")+".Provider";case ki:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ci:return t=e.displayName||null,t!==null?t:yo(e.type)||"Memo";case Yt:t=e._payload,e=e._init;try{return yo(e(t))}catch{}}return null}function vm(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 yo(t);case 8:return t===ji?"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 un(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function du(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ym(e){var t=du(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 ca(e){e._valueTracker||(e._valueTracker=ym(e))}function fu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=du(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Da(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 xo(e,t){var n=t.checked;return he({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Cl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=un(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 mu(e,t){t=t.checked,t!=null&&Si(e,"checked",t,!1)}function wo(e,t){mu(e,t);var n=un(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")?So(e,t.type,n):t.hasOwnProperty("defaultValue")&&So(e,t.type,un(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function bl(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 So(e,t,n){(t!=="number"||Da(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var jr=Array.isArray;function Vn(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=""+un(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 jo(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(M(91));return he({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Nl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(M(92));if(jr(n)){if(1<n.length)throw Error(M(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:un(n)}}function pu(e,t){var n=un(t.value),r=un(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 El(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function hu(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 ko(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?hu(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ua,gu=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(ua=ua||document.createElement("div"),ua.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ua.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Mr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Nr={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},xm=["Webkit","ms","Moz","O"];Object.keys(Nr).forEach(function(e){xm.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Nr[t]=Nr[e]})});function vu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Nr.hasOwnProperty(e)&&Nr[e]?(""+t).trim():t+"px"}function yu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=vu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var wm=he({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Co(e,t){if(t){if(wm[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(M(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(M(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(M(61))}if(t.style!=null&&typeof t.style!="object")throw Error(M(62))}}function bo(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 No=null;function bi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Eo=null,Kn=null,Gn=null;function Pl(e){if(e=ra(e)){if(typeof Eo!="function")throw Error(M(280));var t=e.stateNode;t&&(t=xs(t),Eo(e.stateNode,e.type,t))}}function xu(e){Kn?Gn?Gn.push(e):Gn=[e]:Kn=e}function wu(){if(Kn){var e=Kn,t=Gn;if(Gn=Kn=null,Pl(e),t)for(e=0;e<t.length;e++)Pl(t[e])}}function Su(e,t){return e(t)}function ju(){}var Fs=!1;function ku(e,t,n){if(Fs)return e(t,n);Fs=!0;try{return Su(e,t,n)}finally{Fs=!1,(Kn!==null||Gn!==null)&&(ju(),wu())}}function Fr(e,t){var n=e.stateNode;if(n===null)return null;var r=xs(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(M(231,t,typeof n));return n}var Po=!1;if(Bt)try{var mr={};Object.defineProperty(mr,"passive",{get:function(){Po=!0}}),window.addEventListener("test",mr,mr),window.removeEventListener("test",mr,mr)}catch{Po=!1}function Sm(e,t,n,r,a,o,i,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(p){this.onError(p)}}var Er=!1,Ua=null,Wa=!1,To=null,jm={onError:function(e){Er=!0,Ua=e}};function km(e,t,n,r,a,o,i,l,c){Er=!1,Ua=null,Sm.apply(jm,arguments)}function Cm(e,t,n,r,a,o,i,l,c){if(km.apply(this,arguments),Er){if(Er){var u=Ua;Er=!1,Ua=null}else throw Error(M(198));Wa||(Wa=!0,To=u)}}function Rn(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 Cu(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 Tl(e){if(Rn(e)!==e)throw Error(M(188))}function bm(e){var t=e.alternate;if(!t){if(t=Rn(e),t===null)throw Error(M(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 Tl(a),e;if(o===r)return Tl(a),t;o=o.sibling}throw Error(M(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(M(189))}}if(n.alternate!==r)throw Error(M(190))}if(n.tag!==3)throw Error(M(188));return n.stateNode.current===n?e:t}function bu(e){return e=bm(e),e!==null?Nu(e):null}function Nu(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Nu(e);if(t!==null)return t;e=e.sibling}return null}var Eu=qe.unstable_scheduleCallback,Il=qe.unstable_cancelCallback,Nm=qe.unstable_shouldYield,Em=qe.unstable_requestPaint,xe=qe.unstable_now,Pm=qe.unstable_getCurrentPriorityLevel,Ni=qe.unstable_ImmediatePriority,Pu=qe.unstable_UserBlockingPriority,Ha=qe.unstable_NormalPriority,Tm=qe.unstable_LowPriority,Tu=qe.unstable_IdlePriority,hs=null,Et=null;function Im(e){if(Et&&typeof Et.onCommitFiberRoot=="function")try{Et.onCommitFiberRoot(hs,e,void 0,(e.current.flags&128)===128)}catch{}}var xt=Math.clz32?Math.clz32:_m,Rm=Math.log,zm=Math.LN2;function _m(e){return e>>>=0,e===0?32:31-(Rm(e)/zm|0)|0}var da=64,fa=4194304;function kr(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 Va(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=kr(l):(o&=i,o!==0&&(r=kr(o)))}else i=n&~a,i!==0?r=kr(i):o!==0&&(r=kr(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-xt(t),a=1<<n,r|=e[n],t&=~a;return r}function Am(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 $m(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,o=e.pendingLanes;0<o;){var i=31-xt(o),l=1<<i,c=a[i];c===-1?(!(l&n)||l&r)&&(a[i]=Am(l,t)):c<=t&&(e.expiredLanes|=l),o&=~l}}function Io(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Iu(){var e=da;return da<<=1,!(da&4194240)&&(da=64),e}function Os(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ta(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-xt(t),e[t]=n}function Lm(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-xt(n),o=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~o}}function Ei(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-xt(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var ae=0;function Ru(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var zu,Pi,_u,Au,$u,Ro=!1,ma=[],tn=null,nn=null,rn=null,Or=new Map,Br=new Map,Xt=[],Mm="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 Rl(e,t){switch(e){case"focusin":case"focusout":tn=null;break;case"dragenter":case"dragleave":nn=null;break;case"mouseover":case"mouseout":rn=null;break;case"pointerover":case"pointerout":Or.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Br.delete(t.pointerId)}}function pr(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=ra(t),t!==null&&Pi(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function Fm(e,t,n,r,a){switch(t){case"focusin":return tn=pr(tn,e,t,n,r,a),!0;case"dragenter":return nn=pr(nn,e,t,n,r,a),!0;case"mouseover":return rn=pr(rn,e,t,n,r,a),!0;case"pointerover":var o=a.pointerId;return Or.set(o,pr(Or.get(o)||null,e,t,n,r,a)),!0;case"gotpointercapture":return o=a.pointerId,Br.set(o,pr(Br.get(o)||null,e,t,n,r,a)),!0}return!1}function Lu(e){var t=xn(e.target);if(t!==null){var n=Rn(t);if(n!==null){if(t=n.tag,t===13){if(t=Cu(n),t!==null){e.blockedOn=t,$u(e.priority,function(){_u(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 Ta(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=zo(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);No=r,n.target.dispatchEvent(r),No=null}else return t=ra(n),t!==null&&Pi(t),e.blockedOn=n,!1;t.shift()}return!0}function zl(e,t,n){Ta(e)&&n.delete(t)}function Om(){Ro=!1,tn!==null&&Ta(tn)&&(tn=null),nn!==null&&Ta(nn)&&(nn=null),rn!==null&&Ta(rn)&&(rn=null),Or.forEach(zl),Br.forEach(zl)}function hr(e,t){e.blockedOn===t&&(e.blockedOn=null,Ro||(Ro=!0,qe.unstable_scheduleCallback(qe.unstable_NormalPriority,Om)))}function Dr(e){function t(a){return hr(a,e)}if(0<ma.length){hr(ma[0],e);for(var n=1;n<ma.length;n++){var r=ma[n];r.blockedOn===e&&(r.blockedOn=null)}}for(tn!==null&&hr(tn,e),nn!==null&&hr(nn,e),rn!==null&&hr(rn,e),Or.forEach(t),Br.forEach(t),n=0;n<Xt.length;n++)r=Xt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Xt.length&&(n=Xt[0],n.blockedOn===null);)Lu(n),n.blockedOn===null&&Xt.shift()}var Yn=Vt.ReactCurrentBatchConfig,Ka=!0;function Bm(e,t,n,r){var a=ae,o=Yn.transition;Yn.transition=null;try{ae=1,Ti(e,t,n,r)}finally{ae=a,Yn.transition=o}}function Dm(e,t,n,r){var a=ae,o=Yn.transition;Yn.transition=null;try{ae=4,Ti(e,t,n,r)}finally{ae=a,Yn.transition=o}}function Ti(e,t,n,r){if(Ka){var a=zo(e,t,n,r);if(a===null)Qs(e,t,r,Ga,n),Rl(e,r);else if(Fm(a,e,t,n,r))r.stopPropagation();else if(Rl(e,r),t&4&&-1<Mm.indexOf(e)){for(;a!==null;){var o=ra(a);if(o!==null&&zu(o),o=zo(e,t,n,r),o===null&&Qs(e,t,r,Ga,n),o===a)break;a=o}a!==null&&r.stopPropagation()}else Qs(e,t,r,null,n)}}var Ga=null;function zo(e,t,n,r){if(Ga=null,e=bi(r),e=xn(e),e!==null)if(t=Rn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Cu(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 Ga=e,null}function Mu(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(Pm()){case Ni:return 1;case Pu:return 4;case Ha:case Tm:return 16;case Tu:return 536870912;default:return 16}default:return 16}}var Zt=null,Ii=null,Ia=null;function Fu(){if(Ia)return Ia;var e,t=Ii,n=t.length,r,a="value"in Zt?Zt.value:Zt.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 Ia=a.slice(e,1<r?1-r:void 0)}function Ra(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 pa(){return!0}function _l(){return!1}function et(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)?pa:_l,this.isPropagationStopped=_l,this}return he(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=pa)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=pa)},persist:function(){},isPersistent:pa}),t}var sr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ri=et(sr),na=he({},sr,{view:0,detail:0}),Um=et(na),Bs,Ds,gr,gs=he({},na,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:zi,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!==gr&&(gr&&e.type==="mousemove"?(Bs=e.screenX-gr.screenX,Ds=e.screenY-gr.screenY):Ds=Bs=0,gr=e),Bs)},movementY:function(e){return"movementY"in e?e.movementY:Ds}}),Al=et(gs),Wm=he({},gs,{dataTransfer:0}),Hm=et(Wm),Vm=he({},na,{relatedTarget:0}),Us=et(Vm),Km=he({},sr,{animationName:0,elapsedTime:0,pseudoElement:0}),Gm=et(Km),Ym=he({},sr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Qm=et(Ym),Jm=he({},sr,{data:0}),$l=et(Jm),Xm={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qm={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"},Zm={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ep(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Zm[e])?!!t[e]:!1}function zi(){return ep}var tp=he({},na,{key:function(e){if(e.key){var t=Xm[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ra(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?qm[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:zi,charCode:function(e){return e.type==="keypress"?Ra(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ra(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),np=et(tp),rp=he({},gs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ll=et(rp),ap=he({},na,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:zi}),sp=et(ap),op=he({},sr,{propertyName:0,elapsedTime:0,pseudoElement:0}),ip=et(op),lp=he({},gs,{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}),cp=et(lp),up=[9,13,27,32],_i=Bt&&"CompositionEvent"in window,Pr=null;Bt&&"documentMode"in document&&(Pr=document.documentMode);var dp=Bt&&"TextEvent"in window&&!Pr,Ou=Bt&&(!_i||Pr&&8<Pr&&11>=Pr),Ml=" ",Fl=!1;function Bu(e,t){switch(e){case"keyup":return up.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Du(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $n=!1;function fp(e,t){switch(e){case"compositionend":return Du(t);case"keypress":return t.which!==32?null:(Fl=!0,Ml);case"textInput":return e=t.data,e===Ml&&Fl?null:e;default:return null}}function mp(e,t){if($n)return e==="compositionend"||!_i&&Bu(e,t)?(e=Fu(),Ia=Ii=Zt=null,$n=!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 Ou&&t.locale!=="ko"?null:t.data;default:return null}}var pp={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 Ol(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!pp[e.type]:t==="textarea"}function Uu(e,t,n,r){xu(r),t=Ya(t,"onChange"),0<t.length&&(n=new Ri("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Tr=null,Ur=null;function hp(e){Zu(e,0)}function vs(e){var t=Fn(e);if(fu(t))return e}function gp(e,t){if(e==="change")return t}var Wu=!1;if(Bt){var Ws;if(Bt){var Hs="oninput"in document;if(!Hs){var Bl=document.createElement("div");Bl.setAttribute("oninput","return;"),Hs=typeof Bl.oninput=="function"}Ws=Hs}else Ws=!1;Wu=Ws&&(!document.documentMode||9<document.documentMode)}function Dl(){Tr&&(Tr.detachEvent("onpropertychange",Hu),Ur=Tr=null)}function Hu(e){if(e.propertyName==="value"&&vs(Ur)){var t=[];Uu(t,Ur,e,bi(e)),ku(hp,t)}}function vp(e,t,n){e==="focusin"?(Dl(),Tr=t,Ur=n,Tr.attachEvent("onpropertychange",Hu)):e==="focusout"&&Dl()}function yp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return vs(Ur)}function xp(e,t){if(e==="click")return vs(t)}function wp(e,t){if(e==="input"||e==="change")return vs(t)}function Sp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var St=typeof Object.is=="function"?Object.is:Sp;function Wr(e,t){if(St(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(!po.call(t,a)||!St(e[a],t[a]))return!1}return!0}function Ul(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Wl(e,t){var n=Ul(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=Ul(n)}}function Vu(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vu(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Ku(){for(var e=window,t=Da();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Da(e.document)}return t}function Ai(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 jp(e){var t=Ku(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Vu(n.ownerDocument.documentElement,n)){if(r!==null&&Ai(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=Wl(n,o);var i=Wl(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 kp=Bt&&"documentMode"in document&&11>=document.documentMode,Ln=null,_o=null,Ir=null,Ao=!1;function Hl(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ao||Ln==null||Ln!==Da(r)||(r=Ln,"selectionStart"in r&&Ai(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ir&&Wr(Ir,r)||(Ir=r,r=Ya(_o,"onSelect"),0<r.length&&(t=new Ri("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Ln)))}function ha(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Mn={animationend:ha("Animation","AnimationEnd"),animationiteration:ha("Animation","AnimationIteration"),animationstart:ha("Animation","AnimationStart"),transitionend:ha("Transition","TransitionEnd")},Vs={},Gu={};Bt&&(Gu=document.createElement("div").style,"AnimationEvent"in window||(delete Mn.animationend.animation,delete Mn.animationiteration.animation,delete Mn.animationstart.animation),"TransitionEvent"in window||delete Mn.transitionend.transition);function ys(e){if(Vs[e])return Vs[e];if(!Mn[e])return e;var t=Mn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Gu)return Vs[e]=t[n];return e}var Yu=ys("animationend"),Qu=ys("animationiteration"),Ju=ys("animationstart"),Xu=ys("transitionend"),qu=new Map,Vl="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 fn(e,t){qu.set(e,t),In(t,[e])}for(var Ks=0;Ks<Vl.length;Ks++){var Gs=Vl[Ks],Cp=Gs.toLowerCase(),bp=Gs[0].toUpperCase()+Gs.slice(1);fn(Cp,"on"+bp)}fn(Yu,"onAnimationEnd");fn(Qu,"onAnimationIteration");fn(Ju,"onAnimationStart");fn("dblclick","onDoubleClick");fn("focusin","onFocus");fn("focusout","onBlur");fn(Xu,"onTransitionEnd");Xn("onMouseEnter",["mouseout","mouseover"]);Xn("onMouseLeave",["mouseout","mouseover"]);Xn("onPointerEnter",["pointerout","pointerover"]);Xn("onPointerLeave",["pointerout","pointerover"]);In("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));In("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));In("onBeforeInput",["compositionend","keypress","textInput","paste"]);In("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));In("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));In("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Cr="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(" "),Np=new Set("cancel close invalid load scroll toggle".split(" ").concat(Cr));function Kl(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Cm(r,t,void 0,e),e.currentTarget=null}function Zu(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,u=l.currentTarget;if(l=l.listener,c!==o&&a.isPropagationStopped())break e;Kl(a,l,u),o=c}else for(i=0;i<r.length;i++){if(l=r[i],c=l.instance,u=l.currentTarget,l=l.listener,c!==o&&a.isPropagationStopped())break e;Kl(a,l,u),o=c}}}if(Wa)throw e=To,Wa=!1,To=null,e}function ie(e,t){var n=t[Oo];n===void 0&&(n=t[Oo]=new Set);var r=e+"__bubble";n.has(r)||(ed(t,e,2,!1),n.add(r))}function Ys(e,t,n){var r=0;t&&(r|=4),ed(n,e,r,t)}var ga="_reactListening"+Math.random().toString(36).slice(2);function Hr(e){if(!e[ga]){e[ga]=!0,iu.forEach(function(n){n!=="selectionchange"&&(Np.has(n)||Ys(n,!1,e),Ys(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ga]||(t[ga]=!0,Ys("selectionchange",!1,t))}}function ed(e,t,n,r){switch(Mu(t)){case 1:var a=Bm;break;case 4:a=Dm;break;default:a=Ti}n=a.bind(null,t,n,e),a=void 0,!Po||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 Qs(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=xn(l),i===null)return;if(c=i.tag,c===5||c===6){r=o=i;continue e}l=l.parentNode}}r=r.return}ku(function(){var u=o,p=bi(n),f=[];e:{var v=qu.get(e);if(v!==void 0){var y=Ri,x=e;switch(e){case"keypress":if(Ra(n)===0)break e;case"keydown":case"keyup":y=np;break;case"focusin":x="focus",y=Us;break;case"focusout":x="blur",y=Us;break;case"beforeblur":case"afterblur":y=Us;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":y=Al;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=Hm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=sp;break;case Yu:case Qu:case Ju:y=Gm;break;case Xu:y=ip;break;case"scroll":y=Um;break;case"wheel":y=cp;break;case"copy":case"cut":case"paste":y=Qm;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=Ll}var w=(t&4)!==0,j=!w&&e==="scroll",h=w?v!==null?v+"Capture":null:v;w=[];for(var m=u,g;m!==null;){g=m;var S=g.stateNode;if(g.tag===5&&S!==null&&(g=S,h!==null&&(S=Fr(m,h),S!=null&&w.push(Vr(m,S,g)))),j)break;m=m.return}0<w.length&&(v=new y(v,x,null,n,p),f.push({event:v,listeners:w}))}}if(!(t&7)){e:{if(v=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",v&&n!==No&&(x=n.relatedTarget||n.fromElement)&&(xn(x)||x[Dt]))break e;if((y||v)&&(v=p.window===p?p:(v=p.ownerDocument)?v.defaultView||v.parentWindow:window,y?(x=n.relatedTarget||n.toElement,y=u,x=x?xn(x):null,x!==null&&(j=Rn(x),x!==j||x.tag!==5&&x.tag!==6)&&(x=null)):(y=null,x=u),y!==x)){if(w=Al,S="onMouseLeave",h="onMouseEnter",m="mouse",(e==="pointerout"||e==="pointerover")&&(w=Ll,S="onPointerLeave",h="onPointerEnter",m="pointer"),j=y==null?v:Fn(y),g=x==null?v:Fn(x),v=new w(S,m+"leave",y,n,p),v.target=j,v.relatedTarget=g,S=null,xn(p)===u&&(w=new w(h,m+"enter",x,n,p),w.target=g,w.relatedTarget=j,S=w),j=S,y&&x)t:{for(w=y,h=x,m=0,g=w;g;g=zn(g))m++;for(g=0,S=h;S;S=zn(S))g++;for(;0<m-g;)w=zn(w),m--;for(;0<g-m;)h=zn(h),g--;for(;m--;){if(w===h||h!==null&&w===h.alternate)break t;w=zn(w),h=zn(h)}w=null}else w=null;y!==null&&Gl(f,v,y,w,!1),x!==null&&j!==null&&Gl(f,j,x,w,!0)}}e:{if(v=u?Fn(u):window,y=v.nodeName&&v.nodeName.toLowerCase(),y==="select"||y==="input"&&v.type==="file")var E=gp;else if(Ol(v))if(Wu)E=wp;else{E=yp;var T=vp}else(y=v.nodeName)&&y.toLowerCase()==="input"&&(v.type==="checkbox"||v.type==="radio")&&(E=xp);if(E&&(E=E(e,u))){Uu(f,E,n,p);break e}T&&T(e,v,u),e==="focusout"&&(T=v._wrapperState)&&T.controlled&&v.type==="number"&&So(v,"number",v.value)}switch(T=u?Fn(u):window,e){case"focusin":(Ol(T)||T.contentEditable==="true")&&(Ln=T,_o=u,Ir=null);break;case"focusout":Ir=_o=Ln=null;break;case"mousedown":Ao=!0;break;case"contextmenu":case"mouseup":case"dragend":Ao=!1,Hl(f,n,p);break;case"selectionchange":if(kp)break;case"keydown":case"keyup":Hl(f,n,p)}var k;if(_i)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else $n?Bu(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(Ou&&n.locale!=="ko"&&($n||N!=="onCompositionStart"?N==="onCompositionEnd"&&$n&&(k=Fu()):(Zt=p,Ii="value"in Zt?Zt.value:Zt.textContent,$n=!0)),T=Ya(u,N),0<T.length&&(N=new $l(N,e,null,n,p),f.push({event:N,listeners:T}),k?N.data=k:(k=Du(n),k!==null&&(N.data=k)))),(k=dp?fp(e,n):mp(e,n))&&(u=Ya(u,"onBeforeInput"),0<u.length&&(p=new $l("onBeforeInput","beforeinput",null,n,p),f.push({event:p,listeners:u}),p.data=k))}Zu(f,t)})}function Vr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ya(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,o=a.stateNode;a.tag===5&&o!==null&&(a=o,o=Fr(e,n),o!=null&&r.unshift(Vr(e,o,a)),o=Fr(e,t),o!=null&&r.push(Vr(e,o,a))),e=e.return}return r}function zn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Gl(e,t,n,r,a){for(var o=t._reactName,i=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,a?(c=Fr(n,o),c!=null&&i.unshift(Vr(n,c,l))):a||(c=Fr(n,o),c!=null&&i.push(Vr(n,c,l)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var Ep=/\r\n?/g,Pp=/\u0000|\uFFFD/g;function Yl(e){return(typeof e=="string"?e:""+e).replace(Ep,`
|
|
38
|
-
`).replace(Pp,"")}function va(e,t,n){if(t=Yl(t),Yl(e)!==t&&n)throw Error(M(425))}function Qa(){}var $o=null,Lo=null;function Mo(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 Fo=typeof setTimeout=="function"?setTimeout:void 0,Tp=typeof clearTimeout=="function"?clearTimeout:void 0,Ql=typeof Promise=="function"?Promise:void 0,Ip=typeof queueMicrotask=="function"?queueMicrotask:typeof Ql<"u"?function(e){return Ql.resolve(null).then(e).catch(Rp)}:Fo;function Rp(e){setTimeout(function(){throw e})}function Js(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),Dr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);Dr(t)}function an(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 Jl(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 or=Math.random().toString(36).slice(2),Nt="__reactFiber$"+or,Kr="__reactProps$"+or,Dt="__reactContainer$"+or,Oo="__reactEvents$"+or,zp="__reactListeners$"+or,_p="__reactHandles$"+or;function xn(e){var t=e[Nt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Dt]||n[Nt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Jl(e);e!==null;){if(n=e[Nt])return n;e=Jl(e)}return t}e=n,n=e.parentNode}return null}function ra(e){return e=e[Nt]||e[Dt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Fn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(M(33))}function xs(e){return e[Kr]||null}var Bo=[],On=-1;function mn(e){return{current:e}}function le(e){0>On||(e.current=Bo[On],Bo[On]=null,On--)}function oe(e,t){On++,Bo[On]=e.current,e.current=t}var dn={},Me=mn(dn),He=mn(!1),bn=dn;function qn(e,t){var n=e.type.contextTypes;if(!n)return dn;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 Ve(e){return e=e.childContextTypes,e!=null}function Ja(){le(He),le(Me)}function Xl(e,t,n){if(Me.current!==dn)throw Error(M(168));oe(Me,t),oe(He,n)}function td(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(M(108,vm(e)||"Unknown",a));return he({},n,r)}function Xa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||dn,bn=Me.current,oe(Me,e),oe(He,He.current),!0}function ql(e,t,n){var r=e.stateNode;if(!r)throw Error(M(169));n?(e=td(e,t,bn),r.__reactInternalMemoizedMergedChildContext=e,le(He),le(Me),oe(Me,e)):le(He),oe(He,n)}var $t=null,ws=!1,Xs=!1;function nd(e){$t===null?$t=[e]:$t.push(e)}function Ap(e){ws=!0,nd(e)}function pn(){if(!Xs&&$t!==null){Xs=!0;var e=0,t=ae;try{var n=$t;for(ae=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}$t=null,ws=!1}catch(a){throw $t!==null&&($t=$t.slice(e+1)),Eu(Ni,pn),a}finally{ae=t,Xs=!1}}return null}var Bn=[],Dn=0,qa=null,Za=0,at=[],st=0,Nn=null,Lt=1,Mt="";function gn(e,t){Bn[Dn++]=Za,Bn[Dn++]=qa,qa=e,Za=t}function rd(e,t,n){at[st++]=Lt,at[st++]=Mt,at[st++]=Nn,Nn=e;var r=Lt;e=Mt;var a=32-xt(r)-1;r&=~(1<<a),n+=1;var o=32-xt(t)+a;if(30<o){var i=a-a%5;o=(r&(1<<i)-1).toString(32),r>>=i,a-=i,Lt=1<<32-xt(t)+a|n<<a|r,Mt=o+e}else Lt=1<<o|n<<a|r,Mt=e}function $i(e){e.return!==null&&(gn(e,1),rd(e,1,0))}function Li(e){for(;e===qa;)qa=Bn[--Dn],Bn[Dn]=null,Za=Bn[--Dn],Bn[Dn]=null;for(;e===Nn;)Nn=at[--st],at[st]=null,Mt=at[--st],at[st]=null,Lt=at[--st],at[st]=null}var Xe=null,Je=null,ce=!1,yt=null;function ad(e,t){var n=ot(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 Zl(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,Xe=e,Je=an(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Xe=e,Je=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Nn!==null?{id:Lt,overflow:Mt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ot(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Xe=e,Je=null,!0):!1;default:return!1}}function Do(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Uo(e){if(ce){var t=Je;if(t){var n=t;if(!Zl(e,t)){if(Do(e))throw Error(M(418));t=an(n.nextSibling);var r=Xe;t&&Zl(e,t)?ad(r,n):(e.flags=e.flags&-4097|2,ce=!1,Xe=e)}}else{if(Do(e))throw Error(M(418));e.flags=e.flags&-4097|2,ce=!1,Xe=e}}}function ec(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Xe=e}function ya(e){if(e!==Xe)return!1;if(!ce)return ec(e),ce=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Mo(e.type,e.memoizedProps)),t&&(t=Je)){if(Do(e))throw sd(),Error(M(418));for(;t;)ad(e,t),t=an(t.nextSibling)}if(ec(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(M(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Je=an(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Je=null}}else Je=Xe?an(e.stateNode.nextSibling):null;return!0}function sd(){for(var e=Je;e;)e=an(e.nextSibling)}function Zn(){Je=Xe=null,ce=!1}function Mi(e){yt===null?yt=[e]:yt.push(e)}var $p=Vt.ReactCurrentBatchConfig;function vr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(M(309));var r=n.stateNode}if(!r)throw Error(M(147,e));var 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(M(284));if(!n._owner)throw Error(M(290,e))}return e}function xa(e,t){throw e=Object.prototype.toString.call(t),Error(M(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function tc(e){var t=e._init;return t(e._payload)}function od(e){function t(h,m){if(e){var g=h.deletions;g===null?(h.deletions=[m],h.flags|=16):g.push(m)}}function n(h,m){if(!e)return null;for(;m!==null;)t(h,m),m=m.sibling;return null}function r(h,m){for(h=new Map;m!==null;)m.key!==null?h.set(m.key,m):h.set(m.index,m),m=m.sibling;return h}function a(h,m){return h=cn(h,m),h.index=0,h.sibling=null,h}function o(h,m,g){return h.index=g,e?(g=h.alternate,g!==null?(g=g.index,g<m?(h.flags|=2,m):g):(h.flags|=2,m)):(h.flags|=1048576,m)}function i(h){return e&&h.alternate===null&&(h.flags|=2),h}function l(h,m,g,S){return m===null||m.tag!==6?(m=ao(g,h.mode,S),m.return=h,m):(m=a(m,g),m.return=h,m)}function c(h,m,g,S){var E=g.type;return E===An?p(h,m,g.props.children,S,g.key):m!==null&&(m.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Yt&&tc(E)===m.type)?(S=a(m,g.props),S.ref=vr(h,m,g),S.return=h,S):(S=Fa(g.type,g.key,g.props,null,h.mode,S),S.ref=vr(h,m,g),S.return=h,S)}function u(h,m,g,S){return m===null||m.tag!==4||m.stateNode.containerInfo!==g.containerInfo||m.stateNode.implementation!==g.implementation?(m=so(g,h.mode,S),m.return=h,m):(m=a(m,g.children||[]),m.return=h,m)}function p(h,m,g,S,E){return m===null||m.tag!==7?(m=Cn(g,h.mode,S,E),m.return=h,m):(m=a(m,g),m.return=h,m)}function f(h,m,g){if(typeof m=="string"&&m!==""||typeof m=="number")return m=ao(""+m,h.mode,g),m.return=h,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case la:return g=Fa(m.type,m.key,m.props,null,h.mode,g),g.ref=vr(h,null,m),g.return=h,g;case _n:return m=so(m,h.mode,g),m.return=h,m;case Yt:var S=m._init;return f(h,S(m._payload),g)}if(jr(m)||fr(m))return m=Cn(m,h.mode,g,null),m.return=h,m;xa(h,m)}return null}function v(h,m,g,S){var E=m!==null?m.key:null;if(typeof g=="string"&&g!==""||typeof g=="number")return E!==null?null:l(h,m,""+g,S);if(typeof g=="object"&&g!==null){switch(g.$$typeof){case la:return g.key===E?c(h,m,g,S):null;case _n:return g.key===E?u(h,m,g,S):null;case Yt:return E=g._init,v(h,m,E(g._payload),S)}if(jr(g)||fr(g))return E!==null?null:p(h,m,g,S,null);xa(h,g)}return null}function y(h,m,g,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return h=h.get(g)||null,l(m,h,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case la:return h=h.get(S.key===null?g:S.key)||null,c(m,h,S,E);case _n:return h=h.get(S.key===null?g:S.key)||null,u(m,h,S,E);case Yt:var T=S._init;return y(h,m,g,T(S._payload),E)}if(jr(S)||fr(S))return h=h.get(g)||null,p(m,h,S,E,null);xa(m,S)}return null}function x(h,m,g,S){for(var E=null,T=null,k=m,N=m=0,C=null;k!==null&&N<g.length;N++){k.index>N?(C=k,k=null):C=k.sibling;var I=v(h,k,g[N],S);if(I===null){k===null&&(k=C);break}e&&k&&I.alternate===null&&t(h,k),m=o(I,m,N),T===null?E=I:T.sibling=I,T=I,k=C}if(N===g.length)return n(h,k),ce&&gn(h,N),E;if(k===null){for(;N<g.length;N++)k=f(h,g[N],S),k!==null&&(m=o(k,m,N),T===null?E=k:T.sibling=k,T=k);return ce&&gn(h,N),E}for(k=r(h,k);N<g.length;N++)C=y(k,h,N,g[N],S),C!==null&&(e&&C.alternate!==null&&k.delete(C.key===null?N:C.key),m=o(C,m,N),T===null?E=C:T.sibling=C,T=C);return e&&k.forEach(function(H){return t(h,H)}),ce&&gn(h,N),E}function w(h,m,g,S){var E=fr(g);if(typeof E!="function")throw Error(M(150));if(g=E.call(g),g==null)throw Error(M(151));for(var T=E=null,k=m,N=m=0,C=null,I=g.next();k!==null&&!I.done;N++,I=g.next()){k.index>N?(C=k,k=null):C=k.sibling;var H=v(h,k,I.value,S);if(H===null){k===null&&(k=C);break}e&&k&&H.alternate===null&&t(h,k),m=o(H,m,N),T===null?E=H:T.sibling=H,T=H,k=C}if(I.done)return n(h,k),ce&&gn(h,N),E;if(k===null){for(;!I.done;N++,I=g.next())I=f(h,I.value,S),I!==null&&(m=o(I,m,N),T===null?E=I:T.sibling=I,T=I);return ce&&gn(h,N),E}for(k=r(h,k);!I.done;N++,I=g.next())I=y(k,h,N,I.value,S),I!==null&&(e&&I.alternate!==null&&k.delete(I.key===null?N:I.key),m=o(I,m,N),T===null?E=I:T.sibling=I,T=I);return e&&k.forEach(function(U){return t(h,U)}),ce&&gn(h,N),E}function j(h,m,g,S){if(typeof g=="object"&&g!==null&&g.type===An&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case la:e:{for(var E=g.key,T=m;T!==null;){if(T.key===E){if(E=g.type,E===An){if(T.tag===7){n(h,T.sibling),m=a(T,g.props.children),m.return=h,h=m;break e}}else if(T.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Yt&&tc(E)===T.type){n(h,T.sibling),m=a(T,g.props),m.ref=vr(h,T,g),m.return=h,h=m;break e}n(h,T);break}else t(h,T);T=T.sibling}g.type===An?(m=Cn(g.props.children,h.mode,S,g.key),m.return=h,h=m):(S=Fa(g.type,g.key,g.props,null,h.mode,S),S.ref=vr(h,m,g),S.return=h,h=S)}return i(h);case _n:e:{for(T=g.key;m!==null;){if(m.key===T)if(m.tag===4&&m.stateNode.containerInfo===g.containerInfo&&m.stateNode.implementation===g.implementation){n(h,m.sibling),m=a(m,g.children||[]),m.return=h,h=m;break e}else{n(h,m);break}else t(h,m);m=m.sibling}m=so(g,h.mode,S),m.return=h,h=m}return i(h);case Yt:return T=g._init,j(h,m,T(g._payload),S)}if(jr(g))return x(h,m,g,S);if(fr(g))return w(h,m,g,S);xa(h,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,m!==null&&m.tag===6?(n(h,m.sibling),m=a(m,g),m.return=h,h=m):(n(h,m),m=ao(g,h.mode,S),m.return=h,h=m),i(h)):n(h,m)}return j}var er=od(!0),id=od(!1),es=mn(null),ts=null,Un=null,Fi=null;function Oi(){Fi=Un=ts=null}function Bi(e){var t=es.current;le(es),e._currentValue=t}function Wo(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 Qn(e,t){ts=e,Fi=Un=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(We=!0),e.firstContext=null)}function lt(e){var t=e._currentValue;if(Fi!==e)if(e={context:e,memoizedValue:t,next:null},Un===null){if(ts===null)throw Error(M(308));Un=e,ts.dependencies={lanes:0,firstContext:e}}else Un=Un.next=e;return t}var wn=null;function Di(e){wn===null?wn=[e]:wn.push(e)}function ld(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,Di(t)):(n.next=a.next,a.next=n),t.interleaved=n,Ut(e,r)}function Ut(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 Ui(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function cd(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 Ot(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function sn(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,te&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Ut(e,n)}return a=r.interleaved,a===null?(t.next=t,Di(r)):(t.next=a.next,a.next=t),r.interleaved=t,Ut(e,n)}function za(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,Ei(e,n)}}function nc(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 ns(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,u=c.next;c.next=null,i===null?o=u:i.next=u,i=c;var p=e.alternate;p!==null&&(p=p.updateQueue,l=p.lastBaseUpdate,l!==i&&(l===null?p.firstBaseUpdate=u:l.next=u,p.lastBaseUpdate=c))}if(o!==null){var f=a.baseState;i=0,p=u=c=null,l=o;do{var v=l.lane,y=l.eventTime;if((r&v)===v){p!==null&&(p=p.next={eventTime:y,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,w=l;switch(v=t,y=n,w.tag){case 1:if(x=w.payload,typeof x=="function"){f=x.call(y,f,v);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=w.payload,v=typeof x=="function"?x.call(y,f,v):x,v==null)break e;f=he({},f,v);break e;case 2:Qt=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,v=a.effects,v===null?a.effects=[l]:v.push(l))}else y={eventTime:y,lane:v,tag:l.tag,payload:l.payload,callback:l.callback,next:null},p===null?(u=p=y,c=f):p=p.next=y,i|=v;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;v=l,l=v.next,v.next=null,a.lastBaseUpdate=v,a.shared.pending=null}}while(!0);if(p===null&&(c=f),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=p,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);Pn|=i,e.lanes=i,e.memoizedState=f}}function rc(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(M(191,a));a.call(r)}}}var aa={},Pt=mn(aa),Gr=mn(aa),Yr=mn(aa);function Sn(e){if(e===aa)throw Error(M(174));return e}function Wi(e,t){switch(oe(Yr,t),oe(Gr,e),oe(Pt,aa),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ko(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ko(t,e)}le(Pt),oe(Pt,t)}function tr(){le(Pt),le(Gr),le(Yr)}function ud(e){Sn(Yr.current);var t=Sn(Pt.current),n=ko(t,e.type);t!==n&&(oe(Gr,e),oe(Pt,n))}function Hi(e){Gr.current===e&&(le(Pt),le(Gr))}var me=mn(0);function rs(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 qs=[];function Vi(){for(var e=0;e<qs.length;e++)qs[e]._workInProgressVersionPrimary=null;qs.length=0}var _a=Vt.ReactCurrentDispatcher,Zs=Vt.ReactCurrentBatchConfig,En=0,pe=null,ke=null,Ne=null,as=!1,Rr=!1,Qr=0,Lp=0;function Ae(){throw Error(M(321))}function Ki(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!St(e[n],t[n]))return!1;return!0}function Gi(e,t,n,r,a,o){if(En=o,pe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,_a.current=e===null||e.memoizedState===null?Bp:Dp,e=n(r,a),Rr){o=0;do{if(Rr=!1,Qr=0,25<=o)throw Error(M(301));o+=1,Ne=ke=null,t.updateQueue=null,_a.current=Up,e=n(r,a)}while(Rr)}if(_a.current=ss,t=ke!==null&&ke.next!==null,En=0,Ne=ke=pe=null,as=!1,t)throw Error(M(300));return e}function Yi(){var e=Qr!==0;return Qr=0,e}function Ct(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ne===null?pe.memoizedState=Ne=e:Ne=Ne.next=e,Ne}function ct(){if(ke===null){var e=pe.alternate;e=e!==null?e.memoizedState:null}else e=ke.next;var t=Ne===null?pe.memoizedState:Ne.next;if(t!==null)Ne=t,ke=e;else{if(e===null)throw Error(M(310));ke=e,e={memoizedState:ke.memoizedState,baseState:ke.baseState,baseQueue:ke.baseQueue,queue:ke.queue,next:null},Ne===null?pe.memoizedState=Ne=e:Ne=Ne.next=e}return Ne}function Jr(e,t){return typeof t=="function"?t(e):t}function eo(e){var t=ct(),n=t.queue;if(n===null)throw Error(M(311));n.lastRenderedReducer=e;var r=ke,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,u=o;do{var p=u.lane;if((En&p)===p)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:p,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,i=r):c=c.next=f,pe.lanes|=p,Pn|=p}u=u.next}while(u!==null&&u!==o);c===null?i=r:c.next=l,St(r,t.memoizedState)||(We=!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,pe.lanes|=o,Pn|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function to(e){var t=ct(),n=t.queue;if(n===null)throw Error(M(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);St(o,t.memoizedState)||(We=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function dd(){}function fd(e,t){var n=pe,r=ct(),a=t(),o=!St(r.memoizedState,a);if(o&&(r.memoizedState=a,We=!0),r=r.queue,Qi(hd.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||Ne!==null&&Ne.memoizedState.tag&1){if(n.flags|=2048,Xr(9,pd.bind(null,n,r,a,t),void 0,null),Ee===null)throw Error(M(349));En&30||md(n,t,a)}return a}function md(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=pe.updateQueue,t===null?(t={lastEffect:null,stores:null},pe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function pd(e,t,n,r){t.value=n,t.getSnapshot=r,gd(t)&&vd(e)}function hd(e,t,n){return n(function(){gd(t)&&vd(e)})}function gd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!St(e,n)}catch{return!0}}function vd(e){var t=Ut(e,1);t!==null&&wt(t,e,1,-1)}function ac(e){var t=Ct();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Jr,lastRenderedState:e},t.queue=e,e=e.dispatch=Op.bind(null,pe,e),[t.memoizedState,e]}function Xr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=pe.updateQueue,t===null?(t={lastEffect:null,stores:null},pe.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function yd(){return ct().memoizedState}function Aa(e,t,n,r){var a=Ct();pe.flags|=e,a.memoizedState=Xr(1|t,n,void 0,r===void 0?null:r)}function Ss(e,t,n,r){var a=ct();r=r===void 0?null:r;var o=void 0;if(ke!==null){var i=ke.memoizedState;if(o=i.destroy,r!==null&&Ki(r,i.deps)){a.memoizedState=Xr(t,n,o,r);return}}pe.flags|=e,a.memoizedState=Xr(1|t,n,o,r)}function sc(e,t){return Aa(8390656,8,e,t)}function Qi(e,t){return Ss(2048,8,e,t)}function xd(e,t){return Ss(4,2,e,t)}function wd(e,t){return Ss(4,4,e,t)}function Sd(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 jd(e,t,n){return n=n!=null?n.concat([e]):null,Ss(4,4,Sd.bind(null,t,e),n)}function Ji(){}function kd(e,t){var n=ct();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ki(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Cd(e,t){var n=ct();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ki(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function bd(e,t,n){return En&21?(St(n,t)||(n=Iu(),pe.lanes|=n,Pn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,We=!0),e.memoizedState=n)}function Mp(e,t){var n=ae;ae=n!==0&&4>n?n:4,e(!0);var r=Zs.transition;Zs.transition={};try{e(!1),t()}finally{ae=n,Zs.transition=r}}function Nd(){return ct().memoizedState}function Fp(e,t,n){var r=ln(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ed(e))Pd(t,n);else if(n=ld(e,t,n,r),n!==null){var a=Oe();wt(n,e,r,a),Td(n,t,r)}}function Op(e,t,n){var r=ln(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ed(e))Pd(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,St(l,i)){var c=t.interleaved;c===null?(a.next=a,Di(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=ld(e,t,a,r),n!==null&&(a=Oe(),wt(n,e,r,a),Td(n,t,r))}}function Ed(e){var t=e.alternate;return e===pe||t!==null&&t===pe}function Pd(e,t){Rr=as=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Td(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ei(e,n)}}var ss={readContext:lt,useCallback:Ae,useContext:Ae,useEffect:Ae,useImperativeHandle:Ae,useInsertionEffect:Ae,useLayoutEffect:Ae,useMemo:Ae,useReducer:Ae,useRef:Ae,useState:Ae,useDebugValue:Ae,useDeferredValue:Ae,useTransition:Ae,useMutableSource:Ae,useSyncExternalStore:Ae,useId:Ae,unstable_isNewReconciler:!1},Bp={readContext:lt,useCallback:function(e,t){return Ct().memoizedState=[e,t===void 0?null:t],e},useContext:lt,useEffect:sc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Aa(4194308,4,Sd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Aa(4194308,4,e,t)},useInsertionEffect:function(e,t){return Aa(4,2,e,t)},useMemo:function(e,t){var n=Ct();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ct();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=Fp.bind(null,pe,e),[r.memoizedState,e]},useRef:function(e){var t=Ct();return e={current:e},t.memoizedState=e},useState:ac,useDebugValue:Ji,useDeferredValue:function(e){return Ct().memoizedState=e},useTransition:function(){var e=ac(!1),t=e[0];return e=Mp.bind(null,e[1]),Ct().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=pe,a=Ct();if(ce){if(n===void 0)throw Error(M(407));n=n()}else{if(n=t(),Ee===null)throw Error(M(349));En&30||md(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,sc(hd.bind(null,r,o,e),[e]),r.flags|=2048,Xr(9,pd.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ct(),t=Ee.identifierPrefix;if(ce){var n=Mt,r=Lt;n=(r&~(1<<32-xt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Qr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Lp++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Dp={readContext:lt,useCallback:kd,useContext:lt,useEffect:Qi,useImperativeHandle:jd,useInsertionEffect:xd,useLayoutEffect:wd,useMemo:Cd,useReducer:eo,useRef:yd,useState:function(){return eo(Jr)},useDebugValue:Ji,useDeferredValue:function(e){var t=ct();return bd(t,ke.memoizedState,e)},useTransition:function(){var e=eo(Jr)[0],t=ct().memoizedState;return[e,t]},useMutableSource:dd,useSyncExternalStore:fd,useId:Nd,unstable_isNewReconciler:!1},Up={readContext:lt,useCallback:kd,useContext:lt,useEffect:Qi,useImperativeHandle:jd,useInsertionEffect:xd,useLayoutEffect:wd,useMemo:Cd,useReducer:to,useRef:yd,useState:function(){return to(Jr)},useDebugValue:Ji,useDeferredValue:function(e){var t=ct();return ke===null?t.memoizedState=e:bd(t,ke.memoizedState,e)},useTransition:function(){var e=to(Jr)[0],t=ct().memoizedState;return[e,t]},useMutableSource:dd,useSyncExternalStore:fd,useId:Nd,unstable_isNewReconciler:!1};function gt(e,t){if(e&&e.defaultProps){t=he({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ho(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:he({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var js={isMounted:function(e){return(e=e._reactInternals)?Rn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Oe(),a=ln(e),o=Ot(r,a);o.payload=t,n!=null&&(o.callback=n),t=sn(e,o,a),t!==null&&(wt(t,e,a,r),za(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Oe(),a=ln(e),o=Ot(r,a);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=sn(e,o,a),t!==null&&(wt(t,e,a,r),za(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Oe(),r=ln(e),a=Ot(n,r);a.tag=2,t!=null&&(a.callback=t),t=sn(e,a,r),t!==null&&(wt(t,e,r,n),za(t,e,r))}};function oc(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?!Wr(n,r)||!Wr(a,o):!0}function Id(e,t,n){var r=!1,a=dn,o=t.contextType;return typeof o=="object"&&o!==null?o=lt(o):(a=Ve(t)?bn:Me.current,r=t.contextTypes,o=(r=r!=null)?qn(e,a):dn),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=js,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=o),t}function ic(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&&js.enqueueReplaceState(t,t.state,null)}function Vo(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},Ui(e);var o=t.contextType;typeof o=="object"&&o!==null?a.context=lt(o):(o=Ve(t)?bn:Me.current,a.context=qn(e,o)),a.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Ho(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&&js.enqueueReplaceState(a,a.state,null),ns(e,n,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function nr(e,t){try{var n="",r=t;do n+=gm(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 no(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ko(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Wp=typeof WeakMap=="function"?WeakMap:Map;function Rd(e,t,n){n=Ot(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){is||(is=!0,ni=r),Ko(e,t)},n}function zd(e,t,n){n=Ot(-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(){Ko(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Ko(e,t),typeof r!="function"&&(on===null?on=new Set([this]):on.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function lc(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Wp;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=rh.bind(null,e,t,n),t.then(e,e))}function cc(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 uc(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=Ot(-1,1),t.tag=2,sn(n,t,1))),n.lanes|=1),e)}var Hp=Vt.ReactCurrentOwner,We=!1;function Fe(e,t,n,r){t.child=e===null?id(t,null,n,r):er(t,e.child,n,r)}function dc(e,t,n,r,a){n=n.render;var o=t.ref;return Qn(t,a),r=Gi(e,t,n,r,o,a),n=Yi(),e!==null&&!We?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Wt(e,t,a)):(ce&&n&&$i(t),t.flags|=1,Fe(e,t,r,a),t.child)}function fc(e,t,n,r,a){if(e===null){var o=n.type;return typeof o=="function"&&!al(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,_d(e,t,o,r,a)):(e=Fa(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:Wr,n(i,r)&&e.ref===t.ref)return Wt(e,t,a)}return t.flags|=1,e=cn(o,r),e.ref=t.ref,e.return=t,t.child=e}function _d(e,t,n,r,a){if(e!==null){var o=e.memoizedProps;if(Wr(o,r)&&e.ref===t.ref)if(We=!1,t.pendingProps=r=o,(e.lanes&a)!==0)e.flags&131072&&(We=!0);else return t.lanes=e.lanes,Wt(e,t,a)}return Go(e,t,n,r,a)}function Ad(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},oe(Hn,Ye),Ye|=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,oe(Hn,Ye),Ye|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,oe(Hn,Ye),Ye|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,oe(Hn,Ye),Ye|=r;return Fe(e,t,a,n),t.child}function $d(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Go(e,t,n,r,a){var o=Ve(n)?bn:Me.current;return o=qn(t,o),Qn(t,a),n=Gi(e,t,n,r,o,a),r=Yi(),e!==null&&!We?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Wt(e,t,a)):(ce&&r&&$i(t),t.flags|=1,Fe(e,t,n,a),t.child)}function mc(e,t,n,r,a){if(Ve(n)){var o=!0;Xa(t)}else o=!1;if(Qn(t,a),t.stateNode===null)$a(e,t),Id(t,n,r),Vo(t,n,r,a),r=!0;else if(e===null){var i=t.stateNode,l=t.memoizedProps;i.props=l;var c=i.context,u=n.contextType;typeof u=="object"&&u!==null?u=lt(u):(u=Ve(n)?bn:Me.current,u=qn(t,u));var p=n.getDerivedStateFromProps,f=typeof p=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==r||c!==u)&&ic(t,i,r,u),Qt=!1;var v=t.memoizedState;i.state=v,ns(t,r,i,a),c=t.memoizedState,l!==r||v!==c||He.current||Qt?(typeof p=="function"&&(Ho(t,n,p,r),c=t.memoizedState),(l=Qt||oc(t,n,l,r,v,c,u))?(f||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(t.flags|=4194308)):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),i.props=r,i.state=c,i.context=u,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,cd(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:gt(t.type,l),i.props=u,f=t.pendingProps,v=i.context,c=n.contextType,typeof c=="object"&&c!==null?c=lt(c):(c=Ve(n)?bn:Me.current,c=qn(t,c));var y=n.getDerivedStateFromProps;(p=typeof y=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==f||v!==c)&&ic(t,i,r,c),Qt=!1,v=t.memoizedState,i.state=v,ns(t,r,i,a);var x=t.memoizedState;l!==f||v!==x||He.current||Qt?(typeof y=="function"&&(Ho(t,n,y,r),x=t.memoizedState),(u=Qt||oc(t,n,u,r,v,x,c)||!1)?(p||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,x,c),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,x,c)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&v===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&v===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),i.props=r,i.state=x,i.context=c,r=u):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&v===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&v===e.memoizedState||(t.flags|=1024),r=!1)}return Yo(e,t,n,r,o,a)}function Yo(e,t,n,r,a,o){$d(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return a&&ql(t,n,!1),Wt(e,t,o);r=t.stateNode,Hp.current=t;var l=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=er(t,e.child,null,o),t.child=er(t,null,l,o)):Fe(e,t,l,o),t.memoizedState=r.state,a&&ql(t,n,!0),t.child}function Ld(e){var t=e.stateNode;t.pendingContext?Xl(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Xl(e,t.context,!1),Wi(e,t.containerInfo)}function pc(e,t,n,r,a){return Zn(),Mi(a),t.flags|=256,Fe(e,t,n,r),t.child}var Qo={dehydrated:null,treeContext:null,retryLane:0};function Jo(e){return{baseLanes:e,cachePool:null,transitions:null}}function Md(e,t,n){var r=t.pendingProps,a=me.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),oe(me,a&1),e===null)return Uo(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=bs(i,r,0,null),e=Cn(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Jo(n),t.memoizedState=Qo,e):Xi(t,i));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return Vp(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=cn(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?o=cn(l,o):(o=Cn(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?Jo(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},o.memoizedState=i,o.childLanes=e.childLanes&~n,t.memoizedState=Qo,r}return o=e.child,e=o.sibling,r=cn(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 Xi(e,t){return t=bs({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function wa(e,t,n,r){return r!==null&&Mi(r),er(t,e.child,null,n),e=Xi(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Vp(e,t,n,r,a,o,i){if(n)return t.flags&256?(t.flags&=-257,r=no(Error(M(422))),wa(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,a=t.mode,r=bs({mode:"visible",children:r.children},a,0,null),o=Cn(o,a,i,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&er(t,e.child,null,i),t.child.memoizedState=Jo(i),t.memoizedState=Qo,o);if(!(t.mode&1))return wa(e,t,i,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,o=Error(M(419)),r=no(o,r,void 0),wa(e,t,i,r)}if(l=(i&e.childLanes)!==0,We||l){if(r=Ee,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,Ut(e,a),wt(r,e,a,-1))}return rl(),r=no(Error(M(421))),wa(e,t,i,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=ah.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Je=an(a.nextSibling),Xe=t,ce=!0,yt=null,e!==null&&(at[st++]=Lt,at[st++]=Mt,at[st++]=Nn,Lt=e.id,Mt=e.overflow,Nn=t),t=Xi(t,r.children),t.flags|=4096,t)}function hc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wo(e.return,t,n)}function ro(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 Fd(e,t,n){var r=t.pendingProps,a=r.revealOrder,o=r.tail;if(Fe(e,t,r.children,n),r=me.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&hc(e,n,t);else if(e.tag===19)hc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(oe(me,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&&rs(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),ro(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&&rs(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}ro(t,!0,n,null,o);break;case"together":ro(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function $a(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Wt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Pn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(M(153));if(t.child!==null){for(e=t.child,n=cn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=cn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Kp(e,t,n){switch(t.tag){case 3:Ld(t),Zn();break;case 5:ud(t);break;case 1:Ve(t.type)&&Xa(t);break;case 4:Wi(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;oe(es,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(oe(me,me.current&1),t.flags|=128,null):n&t.child.childLanes?Md(e,t,n):(oe(me,me.current&1),e=Wt(e,t,n),e!==null?e.sibling:null);oe(me,me.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Fd(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),oe(me,me.current),r)break;return null;case 22:case 23:return t.lanes=0,Ad(e,t,n)}return Wt(e,t,n)}var Od,Xo,Bd,Dd;Od=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}};Xo=function(){};Bd=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,Sn(Pt.current);var o=null;switch(n){case"input":a=xo(e,a),r=xo(e,r),o=[];break;case"select":a=he({},a,{value:void 0}),r=he({},r,{value:void 0}),o=[];break;case"textarea":a=jo(e,a),r=jo(e,r),o=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Qa)}Co(n,r);var i;n=null;for(u in a)if(!r.hasOwnProperty(u)&&a.hasOwnProperty(u)&&a[u]!=null)if(u==="style"){var l=a[u];for(i in l)l.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Lr.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in r){var c=r[u];if(l=a!=null?a[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(i in l)!l.hasOwnProperty(i)||c&&c.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in c)c.hasOwnProperty(i)&&l[i]!==c[i]&&(n||(n={}),n[i]=c[i])}else n||(o||(o=[]),o.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(o=o||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Lr.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&ie("scroll",e),o||l===c||(o=[])):(o=o||[]).push(u,c))}n&&(o=o||[]).push("style",n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}};Dd=function(e,t,n,r){n!==r&&(t.flags|=4)};function yr(e,t){if(!ce)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function $e(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var 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 Gp(e,t,n){var r=t.pendingProps;switch(Li(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $e(t),null;case 1:return Ve(t.type)&&Ja(),$e(t),null;case 3:return r=t.stateNode,tr(),le(He),le(Me),Vi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ya(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,yt!==null&&(si(yt),yt=null))),Xo(e,t),$e(t),null;case 5:Hi(t);var a=Sn(Yr.current);if(n=t.type,e!==null&&t.stateNode!=null)Bd(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(M(166));return $e(t),null}if(e=Sn(Pt.current),ya(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Nt]=t,r[Kr]=o,e=(t.mode&1)!==0,n){case"dialog":ie("cancel",r),ie("close",r);break;case"iframe":case"object":case"embed":ie("load",r);break;case"video":case"audio":for(a=0;a<Cr.length;a++)ie(Cr[a],r);break;case"source":ie("error",r);break;case"img":case"image":case"link":ie("error",r),ie("load",r);break;case"details":ie("toggle",r);break;case"input":Cl(r,o),ie("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},ie("invalid",r);break;case"textarea":Nl(r,o),ie("invalid",r)}Co(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&&va(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&va(r.textContent,l,e),a=["children",""+l]):Lr.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&ie("scroll",r)}switch(n){case"input":ca(r),bl(r,o,!0);break;case"textarea":ca(r),El(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=Qa)}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=hu(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[Nt]=t,e[Kr]=r,Od(e,t,!1,!1),t.stateNode=e;e:{switch(i=bo(n,r),n){case"dialog":ie("cancel",e),ie("close",e),a=r;break;case"iframe":case"object":case"embed":ie("load",e),a=r;break;case"video":case"audio":for(a=0;a<Cr.length;a++)ie(Cr[a],e);a=r;break;case"source":ie("error",e),a=r;break;case"img":case"image":case"link":ie("error",e),ie("load",e),a=r;break;case"details":ie("toggle",e),a=r;break;case"input":Cl(e,r),a=xo(e,r),ie("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=he({},r,{value:void 0}),ie("invalid",e);break;case"textarea":Nl(e,r),a=jo(e,r),ie("invalid",e);break;default:a=r}Co(n,a),l=a;for(o in l)if(l.hasOwnProperty(o)){var c=l[o];o==="style"?yu(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&gu(e,c)):o==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Mr(e,c):typeof c=="number"&&Mr(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Lr.hasOwnProperty(o)?c!=null&&o==="onScroll"&&ie("scroll",e):c!=null&&Si(e,o,c,i))}switch(n){case"input":ca(e),bl(e,r,!1);break;case"textarea":ca(e),El(e);break;case"option":r.value!=null&&e.setAttribute("value",""+un(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?Vn(e,!!r.multiple,o,!1):r.defaultValue!=null&&Vn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=Qa)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return $e(t),null;case 6:if(e&&t.stateNode!=null)Dd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(M(166));if(n=Sn(Yr.current),Sn(Pt.current),ya(t)){if(r=t.stateNode,n=t.memoizedProps,r[Nt]=t,(o=r.nodeValue!==n)&&(e=Xe,e!==null))switch(e.tag){case 3:va(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&va(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Nt]=t,t.stateNode=r}return $e(t),null;case 13:if(le(me),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(ce&&Je!==null&&t.mode&1&&!(t.flags&128))sd(),Zn(),t.flags|=98560,o=!1;else if(o=ya(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(M(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(M(317));o[Nt]=t}else Zn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;$e(t),o=!1}else yt!==null&&(si(yt),yt=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||me.current&1?Ce===0&&(Ce=3):rl())),t.updateQueue!==null&&(t.flags|=4),$e(t),null);case 4:return tr(),Xo(e,t),e===null&&Hr(t.stateNode.containerInfo),$e(t),null;case 10:return Bi(t.type._context),$e(t),null;case 17:return Ve(t.type)&&Ja(),$e(t),null;case 19:if(le(me),o=t.memoizedState,o===null)return $e(t),null;if(r=(t.flags&128)!==0,i=o.rendering,i===null)if(r)yr(o,!1);else{if(Ce!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=rs(e),i!==null){for(t.flags|=128,yr(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 oe(me,me.current&1|2),t.child}e=e.sibling}o.tail!==null&&xe()>rr&&(t.flags|=128,r=!0,yr(o,!1),t.lanes=4194304)}else{if(!r)if(e=rs(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),yr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!ce)return $e(t),null}else 2*xe()-o.renderingStartTime>rr&&n!==1073741824&&(t.flags|=128,r=!0,yr(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=xe(),t.sibling=null,n=me.current,oe(me,r?n&1|2:n&1),t):($e(t),null);case 22:case 23:return nl(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ye&1073741824&&($e(t),t.subtreeFlags&6&&(t.flags|=8192)):$e(t),null;case 24:return null;case 25:return null}throw Error(M(156,t.tag))}function Yp(e,t){switch(Li(t),t.tag){case 1:return Ve(t.type)&&Ja(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return tr(),le(He),le(Me),Vi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Hi(t),null;case 13:if(le(me),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(M(340));Zn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(me),null;case 4:return tr(),null;case 10:return Bi(t.type._context),null;case 22:case 23:return nl(),null;case 24:return null;default:return null}}var Sa=!1,Le=!1,Qp=typeof WeakSet=="function"?WeakSet:Set,K=null;function Wn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ye(e,t,r)}else n.current=null}function qo(e,t,n){try{n()}catch(r){ye(e,t,r)}}var gc=!1;function Jp(e,t){if($o=Ka,e=Ku(),Ai(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,u=0,p=0,f=e,v=null;t:for(;;){for(var y;f!==n||a!==0&&f.nodeType!==3||(l=i+a),f!==o||r!==0&&f.nodeType!==3||(c=i+r),f.nodeType===3&&(i+=f.nodeValue.length),(y=f.firstChild)!==null;)v=f,f=y;for(;;){if(f===e)break t;if(v===n&&++u===a&&(l=i),v===o&&++p===r&&(c=i),(y=f.nextSibling)!==null)break;f=v,v=f.parentNode}f=y}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Lo={focusedElem:e,selectionRange:n},Ka=!1,K=t;K!==null;)if(t=K,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var w=x.memoizedProps,j=x.memoizedState,h=t.stateNode,m=h.getSnapshotBeforeUpdate(t.elementType===t.type?w:gt(t.type,w),j);h.__reactInternalSnapshotBeforeUpdate=m}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(M(163))}}catch(S){ye(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return x=gc,gc=!1,x}function zr(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&&qo(t,n,o)}a=a.next}while(a!==r)}}function ks(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 Zo(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 Ud(e){var t=e.alternate;t!==null&&(e.alternate=null,Ud(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Nt],delete t[Kr],delete t[Oo],delete t[zp],delete t[_p])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Wd(e){return e.tag===5||e.tag===3||e.tag===4}function vc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Wd(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 ei(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=Qa));else if(r!==4&&(e=e.child,e!==null))for(ei(e,t,n),e=e.sibling;e!==null;)ei(e,t,n),e=e.sibling}function ti(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(ti(e,t,n),e=e.sibling;e!==null;)ti(e,t,n),e=e.sibling}var Re=null,vt=!1;function Gt(e,t,n){for(n=n.child;n!==null;)Hd(e,t,n),n=n.sibling}function Hd(e,t,n){if(Et&&typeof Et.onCommitFiberUnmount=="function")try{Et.onCommitFiberUnmount(hs,n)}catch{}switch(n.tag){case 5:Le||Wn(n,t);case 6:var r=Re,a=vt;Re=null,Gt(e,t,n),Re=r,vt=a,Re!==null&&(vt?(e=Re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Re.removeChild(n.stateNode));break;case 18:Re!==null&&(vt?(e=Re,n=n.stateNode,e.nodeType===8?Js(e.parentNode,n):e.nodeType===1&&Js(e,n),Dr(e)):Js(Re,n.stateNode));break;case 4:r=Re,a=vt,Re=n.stateNode.containerInfo,vt=!0,Gt(e,t,n),Re=r,vt=a;break;case 0:case 11:case 14:case 15:if(!Le&&(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)&&qo(n,t,i),a=a.next}while(a!==r)}Gt(e,t,n);break;case 1:if(!Le&&(Wn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){ye(n,t,l)}Gt(e,t,n);break;case 21:Gt(e,t,n);break;case 22:n.mode&1?(Le=(r=Le)||n.memoizedState!==null,Gt(e,t,n),Le=r):Gt(e,t,n);break;default:Gt(e,t,n)}}function yc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Qp),t.forEach(function(r){var a=sh.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function ht(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:Re=l.stateNode,vt=!1;break e;case 3:Re=l.stateNode.containerInfo,vt=!0;break e;case 4:Re=l.stateNode.containerInfo,vt=!0;break e}l=l.return}if(Re===null)throw Error(M(160));Hd(o,i,a),Re=null,vt=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(u){ye(a,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Vd(t,e),t=t.sibling}function Vd(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ht(t,e),kt(e),r&4){try{zr(3,e,e.return),ks(3,e)}catch(w){ye(e,e.return,w)}try{zr(5,e,e.return)}catch(w){ye(e,e.return,w)}}break;case 1:ht(t,e),kt(e),r&512&&n!==null&&Wn(n,n.return);break;case 5:if(ht(t,e),kt(e),r&512&&n!==null&&Wn(n,n.return),e.flags&32){var a=e.stateNode;try{Mr(a,"")}catch(w){ye(e,e.return,w)}}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&&mu(a,o),bo(l,i);var u=bo(l,o);for(i=0;i<c.length;i+=2){var p=c[i],f=c[i+1];p==="style"?yu(a,f):p==="dangerouslySetInnerHTML"?gu(a,f):p==="children"?Mr(a,f):Si(a,p,f,u)}switch(l){case"input":wo(a,o);break;case"textarea":pu(a,o);break;case"select":var v=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var y=o.value;y!=null?Vn(a,!!o.multiple,y,!1):v!==!!o.multiple&&(o.defaultValue!=null?Vn(a,!!o.multiple,o.defaultValue,!0):Vn(a,!!o.multiple,o.multiple?[]:"",!1))}a[Kr]=o}catch(w){ye(e,e.return,w)}}break;case 6:if(ht(t,e),kt(e),r&4){if(e.stateNode===null)throw Error(M(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(w){ye(e,e.return,w)}}break;case 3:if(ht(t,e),kt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Dr(t.containerInfo)}catch(w){ye(e,e.return,w)}break;case 4:ht(t,e),kt(e);break;case 13:ht(t,e),kt(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(el=xe())),r&4&&yc(e);break;case 22:if(p=n!==null&&n.memoizedState!==null,e.mode&1?(Le=(u=Le)||p,ht(t,e),Le=u):ht(t,e),kt(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!p&&e.mode&1)for(K=e,p=e.child;p!==null;){for(f=K=p;K!==null;){switch(v=K,y=v.child,v.tag){case 0:case 11:case 14:case 15:zr(4,v,v.return);break;case 1:Wn(v,v.return);var x=v.stateNode;if(typeof x.componentWillUnmount=="function"){r=v,n=v.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(w){ye(r,n,w)}}break;case 5:Wn(v,v.return);break;case 22:if(v.memoizedState!==null){wc(f);continue}}y!==null?(y.return=v,K=y):wc(f)}p=p.sibling}e:for(p=null,f=e;;){if(f.tag===5){if(p===null){p=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=f.stateNode,c=f.memoizedProps.style,i=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=vu("display",i))}catch(w){ye(e,e.return,w)}}}else if(f.tag===6){if(p===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(w){ye(e,e.return,w)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;p===f&&(p=null),f=f.return}p===f&&(p=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:ht(t,e),kt(e),r&4&&yc(e);break;case 21:break;default:ht(t,e),kt(e)}}function kt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Wd(n)){var r=n;break e}n=n.return}throw Error(M(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Mr(a,""),r.flags&=-33);var o=vc(e);ti(e,o,a);break;case 3:case 4:var i=r.stateNode.containerInfo,l=vc(e);ei(e,l,i);break;default:throw Error(M(161))}}catch(c){ye(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Xp(e,t,n){K=e,Kd(e)}function Kd(e,t,n){for(var r=(e.mode&1)!==0;K!==null;){var a=K,o=a.child;if(a.tag===22&&r){var i=a.memoizedState!==null||Sa;if(!i){var l=a.alternate,c=l!==null&&l.memoizedState!==null||Le;l=Sa;var u=Le;if(Sa=i,(Le=c)&&!u)for(K=a;K!==null;)i=K,c=i.child,i.tag===22&&i.memoizedState!==null?Sc(a):c!==null?(c.return=i,K=c):Sc(a);for(;o!==null;)K=o,Kd(o),o=o.sibling;K=a,Sa=l,Le=u}xc(e)}else a.subtreeFlags&8772&&o!==null?(o.return=a,K=o):xc(e)}}function xc(e){for(;K!==null;){var t=K;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Le||ks(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Le)if(n===null)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:gt(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&rc(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}rc(t,i,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var p=u.memoizedState;if(p!==null){var f=p.dehydrated;f!==null&&Dr(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(M(163))}Le||t.flags&512&&Zo(t)}catch(v){ye(t,t.return,v)}}if(t===e){K=null;break}if(n=t.sibling,n!==null){n.return=t.return,K=n;break}K=t.return}}function wc(e){for(;K!==null;){var t=K;if(t===e){K=null;break}var n=t.sibling;if(n!==null){n.return=t.return,K=n;break}K=t.return}}function Sc(e){for(;K!==null;){var t=K;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ks(4,t)}catch(c){ye(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){ye(t,a,c)}}var o=t.return;try{Zo(t)}catch(c){ye(t,o,c)}break;case 5:var i=t.return;try{Zo(t)}catch(c){ye(t,i,c)}}}catch(c){ye(t,t.return,c)}if(t===e){K=null;break}var l=t.sibling;if(l!==null){l.return=t.return,K=l;break}K=t.return}}var qp=Math.ceil,os=Vt.ReactCurrentDispatcher,qi=Vt.ReactCurrentOwner,it=Vt.ReactCurrentBatchConfig,te=0,Ee=null,we=null,ze=0,Ye=0,Hn=mn(0),Ce=0,qr=null,Pn=0,Cs=0,Zi=0,_r=null,Ue=null,el=0,rr=1/0,At=null,is=!1,ni=null,on=null,ja=!1,en=null,ls=0,Ar=0,ri=null,La=-1,Ma=0;function Oe(){return te&6?xe():La!==-1?La:La=xe()}function ln(e){return e.mode&1?te&2&&ze!==0?ze&-ze:$p.transition!==null?(Ma===0&&(Ma=Iu()),Ma):(e=ae,e!==0||(e=window.event,e=e===void 0?16:Mu(e.type)),e):1}function wt(e,t,n,r){if(50<Ar)throw Ar=0,ri=null,Error(M(185));ta(e,n,r),(!(te&2)||e!==Ee)&&(e===Ee&&(!(te&2)&&(Cs|=n),Ce===4&&qt(e,ze)),Ke(e,r),n===1&&te===0&&!(t.mode&1)&&(rr=xe()+500,ws&&pn()))}function Ke(e,t){var n=e.callbackNode;$m(e,t);var r=Va(e,e===Ee?ze:0);if(r===0)n!==null&&Il(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Il(n),t===1)e.tag===0?Ap(jc.bind(null,e)):nd(jc.bind(null,e)),Ip(function(){!(te&6)&&pn()}),n=null;else{switch(Ru(r)){case 1:n=Ni;break;case 4:n=Pu;break;case 16:n=Ha;break;case 536870912:n=Tu;break;default:n=Ha}n=ef(n,Gd.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Gd(e,t){if(La=-1,Ma=0,te&6)throw Error(M(327));var n=e.callbackNode;if(Jn()&&e.callbackNode!==n)return null;var r=Va(e,e===Ee?ze:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=cs(e,r);else{t=r;var a=te;te|=2;var o=Qd();(Ee!==e||ze!==t)&&(At=null,rr=xe()+500,kn(e,t));do try{th();break}catch(l){Yd(e,l)}while(!0);Oi(),os.current=o,te=a,we!==null?t=0:(Ee=null,ze=0,t=Ce)}if(t!==0){if(t===2&&(a=Io(e),a!==0&&(r=a,t=ai(e,a))),t===1)throw n=qr,kn(e,0),qt(e,r),Ke(e,xe()),n;if(t===6)qt(e,r);else{if(a=e.current.alternate,!(r&30)&&!Zp(a)&&(t=cs(e,r),t===2&&(o=Io(e),o!==0&&(r=o,t=ai(e,o))),t===1))throw n=qr,kn(e,0),qt(e,r),Ke(e,xe()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(M(345));case 2:vn(e,Ue,At);break;case 3:if(qt(e,r),(r&130023424)===r&&(t=el+500-xe(),10<t)){if(Va(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){Oe(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Fo(vn.bind(null,e,Ue,At),t);break}vn(e,Ue,At);break;case 4:if(qt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var i=31-xt(r);o=1<<i,i=t[i],i>a&&(a=i),r&=~o}if(r=a,r=xe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*qp(r/1960))-r,10<r){e.timeoutHandle=Fo(vn.bind(null,e,Ue,At),r);break}vn(e,Ue,At);break;case 5:vn(e,Ue,At);break;default:throw Error(M(329))}}}return Ke(e,xe()),e.callbackNode===n?Gd.bind(null,e):null}function ai(e,t){var n=_r;return e.current.memoizedState.isDehydrated&&(kn(e,t).flags|=256),e=cs(e,t),e!==2&&(t=Ue,Ue=n,t!==null&&si(t)),e}function si(e){Ue===null?Ue=e:Ue.push.apply(Ue,e)}function Zp(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(!St(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 qt(e,t){for(t&=~Zi,t&=~Cs,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-xt(t),r=1<<n;e[n]=-1,t&=~r}}function jc(e){if(te&6)throw Error(M(327));Jn();var t=Va(e,0);if(!(t&1))return Ke(e,xe()),null;var n=cs(e,t);if(e.tag!==0&&n===2){var r=Io(e);r!==0&&(t=r,n=ai(e,r))}if(n===1)throw n=qr,kn(e,0),qt(e,t),Ke(e,xe()),n;if(n===6)throw Error(M(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,vn(e,Ue,At),Ke(e,xe()),null}function tl(e,t){var n=te;te|=1;try{return e(t)}finally{te=n,te===0&&(rr=xe()+500,ws&&pn())}}function Tn(e){en!==null&&en.tag===0&&!(te&6)&&Jn();var t=te;te|=1;var n=it.transition,r=ae;try{if(it.transition=null,ae=1,e)return e()}finally{ae=r,it.transition=n,te=t,!(te&6)&&pn()}}function nl(){Ye=Hn.current,le(Hn)}function kn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Tp(n)),we!==null)for(n=we.return;n!==null;){var r=n;switch(Li(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ja();break;case 3:tr(),le(He),le(Me),Vi();break;case 5:Hi(r);break;case 4:tr();break;case 13:le(me);break;case 19:le(me);break;case 10:Bi(r.type._context);break;case 22:case 23:nl()}n=n.return}if(Ee=e,we=e=cn(e.current,null),ze=Ye=t,Ce=0,qr=null,Zi=Cs=Pn=0,Ue=_r=null,wn!==null){for(t=0;t<wn.length;t++)if(n=wn[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}wn=null}return e}function Yd(e,t){do{var n=we;try{if(Oi(),_a.current=ss,as){for(var r=pe.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}as=!1}if(En=0,Ne=ke=pe=null,Rr=!1,Qr=0,qi.current=null,n===null||n.return===null){Ce=1,qr=t,we=null;break}e:{var o=e,i=n.return,l=n,c=t;if(t=ze,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,p=l,f=p.tag;if(!(p.mode&1)&&(f===0||f===11||f===15)){var v=p.alternate;v?(p.updateQueue=v.updateQueue,p.memoizedState=v.memoizedState,p.lanes=v.lanes):(p.updateQueue=null,p.memoizedState=null)}var y=cc(i);if(y!==null){y.flags&=-257,uc(y,i,l,o,t),y.mode&1&&lc(o,u,t),t=y,c=u;var x=t.updateQueue;if(x===null){var w=new Set;w.add(c),t.updateQueue=w}else x.add(c);break e}else{if(!(t&1)){lc(o,u,t),rl();break e}c=Error(M(426))}}else if(ce&&l.mode&1){var j=cc(i);if(j!==null){!(j.flags&65536)&&(j.flags|=256),uc(j,i,l,o,t),Mi(nr(c,l));break e}}o=c=nr(c,l),Ce!==4&&(Ce=2),_r===null?_r=[o]:_r.push(o),o=i;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var h=Rd(o,c,t);nc(o,h);break e;case 1:l=c;var m=o.type,g=o.stateNode;if(!(o.flags&128)&&(typeof m.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(on===null||!on.has(g)))){o.flags|=65536,t&=-t,o.lanes|=t;var S=zd(o,l,t);nc(o,S);break e}}o=o.return}while(o!==null)}Xd(n)}catch(E){t=E,we===n&&n!==null&&(we=n=n.return);continue}break}while(!0)}function Qd(){var e=os.current;return os.current=ss,e===null?ss:e}function rl(){(Ce===0||Ce===3||Ce===2)&&(Ce=4),Ee===null||!(Pn&268435455)&&!(Cs&268435455)||qt(Ee,ze)}function cs(e,t){var n=te;te|=2;var r=Qd();(Ee!==e||ze!==t)&&(At=null,kn(e,t));do try{eh();break}catch(a){Yd(e,a)}while(!0);if(Oi(),te=n,os.current=r,we!==null)throw Error(M(261));return Ee=null,ze=0,Ce}function eh(){for(;we!==null;)Jd(we)}function th(){for(;we!==null&&!Nm();)Jd(we)}function Jd(e){var t=Zd(e.alternate,e,Ye);e.memoizedProps=e.pendingProps,t===null?Xd(e):we=t,qi.current=null}function Xd(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Yp(n,t),n!==null){n.flags&=32767,we=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ce=6,we=null;return}}else if(n=Gp(n,t,Ye),n!==null){we=n;return}if(t=t.sibling,t!==null){we=t;return}we=t=e}while(t!==null);Ce===0&&(Ce=5)}function vn(e,t,n){var r=ae,a=it.transition;try{it.transition=null,ae=1,nh(e,t,n,r)}finally{it.transition=a,ae=r}return null}function nh(e,t,n,r){do Jn();while(en!==null);if(te&6)throw Error(M(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(M(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Lm(e,o),e===Ee&&(we=Ee=null,ze=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ja||(ja=!0,ef(Ha,function(){return Jn(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=it.transition,it.transition=null;var i=ae;ae=1;var l=te;te|=4,qi.current=null,Jp(e,n),Vd(n,e),jp(Lo),Ka=!!$o,Lo=$o=null,e.current=n,Xp(n),Em(),te=l,ae=i,it.transition=o}else e.current=n;if(ja&&(ja=!1,en=e,ls=a),o=e.pendingLanes,o===0&&(on=null),Im(n.stateNode),Ke(e,xe()),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(is)throw is=!1,e=ni,ni=null,e;return ls&1&&e.tag!==0&&Jn(),o=e.pendingLanes,o&1?e===ri?Ar++:(Ar=0,ri=e):Ar=0,pn(),null}function Jn(){if(en!==null){var e=Ru(ls),t=it.transition,n=ae;try{if(it.transition=null,ae=16>e?16:e,en===null)var r=!1;else{if(e=en,en=null,ls=0,te&6)throw Error(M(331));var a=te;for(te|=4,K=e.current;K!==null;){var o=K,i=o.child;if(K.flags&16){var l=o.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(K=u;K!==null;){var p=K;switch(p.tag){case 0:case 11:case 15:zr(8,p,o)}var f=p.child;if(f!==null)f.return=p,K=f;else for(;K!==null;){p=K;var v=p.sibling,y=p.return;if(Ud(p),p===u){K=null;break}if(v!==null){v.return=y,K=v;break}K=y}}}var x=o.alternate;if(x!==null){var w=x.child;if(w!==null){x.child=null;do{var j=w.sibling;w.sibling=null,w=j}while(w!==null)}}K=o}}if(o.subtreeFlags&2064&&i!==null)i.return=o,K=i;else e:for(;K!==null;){if(o=K,o.flags&2048)switch(o.tag){case 0:case 11:case 15:zr(9,o,o.return)}var h=o.sibling;if(h!==null){h.return=o.return,K=h;break e}K=o.return}}var m=e.current;for(K=m;K!==null;){i=K;var g=i.child;if(i.subtreeFlags&2064&&g!==null)g.return=i,K=g;else e:for(i=m;K!==null;){if(l=K,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:ks(9,l)}}catch(E){ye(l,l.return,E)}if(l===i){K=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,K=S;break e}K=l.return}}if(te=a,pn(),Et&&typeof Et.onPostCommitFiberRoot=="function")try{Et.onPostCommitFiberRoot(hs,e)}catch{}r=!0}return r}finally{ae=n,it.transition=t}}return!1}function kc(e,t,n){t=nr(n,t),t=Rd(e,t,1),e=sn(e,t,1),t=Oe(),e!==null&&(ta(e,1,t),Ke(e,t))}function ye(e,t,n){if(e.tag===3)kc(e,e,n);else for(;t!==null;){if(t.tag===3){kc(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(on===null||!on.has(r))){e=nr(n,e),e=zd(t,e,1),t=sn(t,e,1),e=Oe(),t!==null&&(ta(t,1,e),Ke(t,e));break}}t=t.return}}function rh(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Oe(),e.pingedLanes|=e.suspendedLanes&n,Ee===e&&(ze&n)===n&&(Ce===4||Ce===3&&(ze&130023424)===ze&&500>xe()-el?kn(e,0):Zi|=n),Ke(e,t)}function qd(e,t){t===0&&(e.mode&1?(t=fa,fa<<=1,!(fa&130023424)&&(fa=4194304)):t=1);var n=Oe();e=Ut(e,t),e!==null&&(ta(e,t,n),Ke(e,n))}function ah(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),qd(e,n)}function sh(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(M(314))}r!==null&&r.delete(t),qd(e,n)}var Zd;Zd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||He.current)We=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return We=!1,Kp(e,t,n);We=!!(e.flags&131072)}else We=!1,ce&&t.flags&1048576&&rd(t,Za,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;$a(e,t),e=t.pendingProps;var a=qn(t,Me.current);Qn(t,n),a=Gi(null,t,r,e,a,n);var o=Yi();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,Ve(r)?(o=!0,Xa(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Ui(t),a.updater=js,t.stateNode=a,a._reactInternals=t,Vo(t,r,e,n),t=Yo(null,t,r,!0,o,n)):(t.tag=0,ce&&o&&$i(t),Fe(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch($a(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=ih(r),e=gt(r,e),a){case 0:t=Go(null,t,r,e,n);break e;case 1:t=mc(null,t,r,e,n);break e;case 11:t=dc(null,t,r,e,n);break e;case 14:t=fc(null,t,r,gt(r.type,e),n);break e}throw Error(M(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:gt(r,a),Go(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:gt(r,a),mc(e,t,r,a,n);case 3:e:{if(Ld(t),e===null)throw Error(M(387));r=t.pendingProps,o=t.memoizedState,a=o.element,cd(e,t),ns(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=nr(Error(M(423)),t),t=pc(e,t,r,n,a);break e}else if(r!==a){a=nr(Error(M(424)),t),t=pc(e,t,r,n,a);break e}else for(Je=an(t.stateNode.containerInfo.firstChild),Xe=t,ce=!0,yt=null,n=id(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Zn(),r===a){t=Wt(e,t,n);break e}Fe(e,t,r,n)}t=t.child}return t;case 5:return ud(t),e===null&&Uo(t),r=t.type,a=t.pendingProps,o=e!==null?e.memoizedProps:null,i=a.children,Mo(r,a)?i=null:o!==null&&Mo(r,o)&&(t.flags|=32),$d(e,t),Fe(e,t,i,n),t.child;case 6:return e===null&&Uo(t),null;case 13:return Md(e,t,n);case 4:return Wi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=er(t,null,r,n):Fe(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:gt(r,a),dc(e,t,r,a,n);case 7:return Fe(e,t,t.pendingProps,n),t.child;case 8:return Fe(e,t,t.pendingProps.children,n),t.child;case 12:return Fe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,o=t.memoizedProps,i=a.value,oe(es,r._currentValue),r._currentValue=i,o!==null)if(St(o.value,i)){if(o.children===a.children&&!He.current){t=Wt(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=Ot(-1,n&-n),c.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?c.next=c:(c.next=p.next,p.next=c),u.pending=c}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Wo(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(M(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Wo(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}Fe(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,Qn(t,n),a=lt(a),r=r(a),t.flags|=1,Fe(e,t,r,n),t.child;case 14:return r=t.type,a=gt(r,t.pendingProps),a=gt(r.type,a),fc(e,t,r,a,n);case 15:return _d(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:gt(r,a),$a(e,t),t.tag=1,Ve(r)?(e=!0,Xa(t)):e=!1,Qn(t,n),Id(t,r,a),Vo(t,r,a,n),Yo(null,t,r,!0,e,n);case 19:return Fd(e,t,n);case 22:return Ad(e,t,n)}throw Error(M(156,t.tag))};function ef(e,t){return Eu(e,t)}function oh(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 ot(e,t,n,r){return new oh(e,t,n,r)}function al(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ih(e){if(typeof e=="function")return al(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ki)return 11;if(e===Ci)return 14}return 2}function cn(e,t){var n=e.alternate;return n===null?(n=ot(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 Fa(e,t,n,r,a,o){var i=2;if(r=e,typeof e=="function")al(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case An:return Cn(n.children,a,o,t);case ji:i=8,a|=8;break;case ho:return e=ot(12,n,t,a|2),e.elementType=ho,e.lanes=o,e;case go:return e=ot(13,n,t,a),e.elementType=go,e.lanes=o,e;case vo:return e=ot(19,n,t,a),e.elementType=vo,e.lanes=o,e;case uu:return bs(n,a,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case lu:i=10;break e;case cu:i=9;break e;case ki:i=11;break e;case Ci:i=14;break e;case Yt:i=16,r=null;break e}throw Error(M(130,e==null?e:typeof e,""))}return t=ot(i,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Cn(e,t,n,r){return e=ot(7,e,r,t),e.lanes=n,e}function bs(e,t,n,r){return e=ot(22,e,r,t),e.elementType=uu,e.lanes=n,e.stateNode={isHidden:!1},e}function ao(e,t,n){return e=ot(6,e,null,t),e.lanes=n,e}function so(e,t,n){return t=ot(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function lh(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=Os(0),this.expirationTimes=Os(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Os(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function sl(e,t,n,r,a,o,i,l,c){return e=new lh(e,t,n,l,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=ot(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ui(o),e}function ch(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_n,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function tf(e){if(!e)return dn;e=e._reactInternals;e:{if(Rn(e)!==e||e.tag!==1)throw Error(M(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ve(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(M(171))}if(e.tag===1){var n=e.type;if(Ve(n))return td(e,n,t)}return t}function nf(e,t,n,r,a,o,i,l,c){return e=sl(n,r,!0,e,a,o,i,l,c),e.context=tf(null),n=e.current,r=Oe(),a=ln(n),o=Ot(r,a),o.callback=t??null,sn(n,o,a),e.current.lanes=a,ta(e,a,r),Ke(e,r),e}function Ns(e,t,n,r){var a=t.current,o=Oe(),i=ln(a);return n=tf(n),t.context===null?t.context=n:t.pendingContext=n,t=Ot(o,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=sn(a,t,i),e!==null&&(wt(e,a,i,o),za(e,a,i)),i}function us(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 Cc(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ol(e,t){Cc(e,t),(e=e.alternate)&&Cc(e,t)}function uh(){return null}var rf=typeof reportError=="function"?reportError:function(e){console.error(e)};function il(e){this._internalRoot=e}Es.prototype.render=il.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(M(409));Ns(e,t,null,null)};Es.prototype.unmount=il.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Tn(function(){Ns(null,e,null,null)}),t[Dt]=null}};function Es(e){this._internalRoot=e}Es.prototype.unstable_scheduleHydration=function(e){if(e){var t=Au();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Xt.length&&t!==0&&t<Xt[n].priority;n++);Xt.splice(n,0,e),n===0&&Lu(e)}};function ll(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ps(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function bc(){}function dh(e,t,n,r,a){if(a){if(typeof r=="function"){var o=r;r=function(){var u=us(i);o.call(u)}}var i=nf(t,r,e,0,null,!1,!1,"",bc);return e._reactRootContainer=i,e[Dt]=i.current,Hr(e.nodeType===8?e.parentNode:e),Tn(),i}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var u=us(c);l.call(u)}}var c=sl(e,0,!1,null,null,!1,!1,"",bc);return e._reactRootContainer=c,e[Dt]=c.current,Hr(e.nodeType===8?e.parentNode:e),Tn(function(){Ns(t,c,n,r)}),c}function Ts(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=us(i);l.call(c)}}Ns(t,i,e,a)}else i=dh(n,t,e,a,r);return us(i)}zu=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=kr(t.pendingLanes);n!==0&&(Ei(t,n|1),Ke(t,xe()),!(te&6)&&(rr=xe()+500,pn()))}break;case 13:Tn(function(){var r=Ut(e,1);if(r!==null){var a=Oe();wt(r,e,1,a)}}),ol(e,1)}};Pi=function(e){if(e.tag===13){var t=Ut(e,134217728);if(t!==null){var n=Oe();wt(t,e,134217728,n)}ol(e,134217728)}};_u=function(e){if(e.tag===13){var t=ln(e),n=Ut(e,t);if(n!==null){var r=Oe();wt(n,e,t,r)}ol(e,t)}};Au=function(){return ae};$u=function(e,t){var n=ae;try{return ae=e,t()}finally{ae=n}};Eo=function(e,t,n){switch(t){case"input":if(wo(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=xs(r);if(!a)throw Error(M(90));fu(r),wo(r,a)}}}break;case"textarea":pu(e,n);break;case"select":t=n.value,t!=null&&Vn(e,!!n.multiple,t,!1)}};Su=tl;ju=Tn;var fh={usingClientEntryPoint:!1,Events:[ra,Fn,xs,xu,wu,tl]},xr={findFiberByHostInstance:xn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},mh={bundleType:xr.bundleType,version:xr.version,rendererPackageName:xr.rendererPackageName,rendererConfig:xr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Vt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=bu(e),e===null?null:e.stateNode},findFiberByHostInstance:xr.findFiberByHostInstance||uh,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 ka=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ka.isDisabled&&ka.supportsFiber)try{hs=ka.inject(mh),Et=ka}catch{}}Ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=fh;Ze.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ll(t))throw Error(M(200));return ch(e,t,null,n)};Ze.createRoot=function(e,t){if(!ll(e))throw Error(M(299));var n=!1,r="",a=rf;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=sl(e,1,!1,null,null,n,!1,r,a),e[Dt]=t.current,Hr(e.nodeType===8?e.parentNode:e),new il(t)};Ze.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(M(188)):(e=Object.keys(e).join(","),Error(M(268,e)));return e=bu(t),e=e===null?null:e.stateNode,e};Ze.flushSync=function(e){return Tn(e)};Ze.hydrate=function(e,t,n){if(!Ps(t))throw Error(M(200));return Ts(null,e,t,!0,n)};Ze.hydrateRoot=function(e,t,n){if(!ll(e))throw Error(M(405));var r=n!=null&&n.hydratedSources||null,a=!1,o="",i=rf;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=nf(t,null,e,1,n??null,a,!1,o,i),e[Dt]=t.current,Hr(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 Es(t)};Ze.render=function(e,t,n){if(!Ps(t))throw Error(M(200));return Ts(null,e,t,!1,n)};Ze.unmountComponentAtNode=function(e){if(!Ps(e))throw Error(M(40));return e._reactRootContainer?(Tn(function(){Ts(null,null,e,!1,function(){e._reactRootContainer=null,e[Dt]=null})}),!0):!1};Ze.unstable_batchedUpdates=tl;Ze.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ps(n))throw Error(M(200));if(e==null||e._reactInternals===void 0)throw Error(M(38));return Ts(e,t,n,!1,r)};Ze.version="18.3.1-next-f1338f8080-20240426";function af(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(af)}catch(e){console.error(e)}}af(),au.exports=Ze;var sf=au.exports,of,Nc=sf;of=Nc.createRoot,Nc.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 Ec="popstate";function Pc(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ph(e={}){function t(r,a){var u;let o=(u=a.state)==null?void 0:u.masked,{pathname:i,search:l,hash:c}=o||r.location;return oi("",{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:Zr(a)}return gh(t,n,null,e)}function ue(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ut(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function hh(){return Math.random().toString(36).substring(2,10)}function Tc(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 oi(e,t,n=null,r,a){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?ir(t):t,state:n,key:t&&t.key||r||hh(),unstable_mask:a}}function Zr({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 ir(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 gh(e,t,n,r={}){let{window:a=document.defaultView,v5Compat:o=!1}=r,i=a.history,l="POP",c=null,u=p();u==null&&(u=0,i.replaceState({...i.state,idx:u},""));function p(){return(i.state||{idx:null}).idx}function f(){l="POP";let j=p(),h=j==null?null:j-u;u=j,c&&c({action:l,location:w.location,delta:h})}function v(j,h){l="PUSH";let m=Pc(j)?j:oi(w.location,j,h);u=p()+1;let g=Tc(m,u),S=w.createHref(m.unstable_mask||m);try{i.pushState(g,"",S)}catch(E){if(E instanceof DOMException&&E.name==="DataCloneError")throw E;a.location.assign(S)}o&&c&&c({action:l,location:w.location,delta:1})}function y(j,h){l="REPLACE";let m=Pc(j)?j:oi(w.location,j,h);u=p();let g=Tc(m,u),S=w.createHref(m.unstable_mask||m);i.replaceState(g,"",S),o&&c&&c({action:l,location:w.location,delta:0})}function x(j){return vh(j)}let w={get action(){return l},get location(){return e(a,i)},listen(j){if(c)throw new Error("A history only accepts one active listener");return a.addEventListener(Ec,f),c=j,()=>{a.removeEventListener(Ec,f),c=null}},createHref(j){return t(a,j)},createURL:x,encodeLocation(j){let h=x(j);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:v,replace:y,go(j){return i.go(j)}};return w}function vh(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ue(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Zr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function lf(e,t,n="/"){return yh(e,t,n,!1)}function yh(e,t,n,r){let a=typeof t=="string"?ir(t):t,o=Ht(a.pathname||"/",n);if(o==null)return null;let i=cf(e);xh(i);let l=null;for(let c=0;l==null&&c<i.length;++c){let u=Ih(o);l=Ph(i[c],u,r)}return l}function cf(e,t=[],n=[],r="",a=!1){let o=(i,l,c=a,u)=>{let p={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(r)&&c)return;ue(p.relativePath.startsWith(r),`Absolute route path "${p.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(r.length)}let f=Tt([r,p.relativePath]),v=n.concat(p);i.children&&i.children.length>0&&(ue(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),cf(i.children,t,v,f,c)),!(i.path==null&&!i.index)&&t.push({path:f,score:Nh(f,i.index),routesMeta:v})};return e.forEach((i,l)=>{var c;if(i.path===""||!((c=i.path)!=null&&c.includes("?")))o(i,l);else for(let u of uf(i.path))o(i,l,!0,u)}),t}function uf(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=uf(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 xh(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Eh(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var wh=/^:[\w-]+$/,Sh=3,jh=2,kh=1,Ch=10,bh=-2,Ic=e=>e==="*";function Nh(e,t){let n=e.split("/"),r=n.length;return n.some(Ic)&&(r+=bh),t&&(r+=jh),n.filter(a=>!Ic(a)).reduce((a,o)=>a+(wh.test(o)?Sh:o===""?kh:Ch),r)}function Eh(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 Ph(e,t,n=!1){let{routesMeta:r}=e,a={},o="/",i=[];for(let l=0;l<r.length;++l){let c=r[l],u=l===r.length-1,p=o==="/"?t:t.slice(o.length)||"/",f=ds({path:c.relativePath,caseSensitive:c.caseSensitive,end:u},p),v=c.route;if(!f&&u&&n&&!r[r.length-1].route.index&&(f=ds({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},p)),!f)return null;Object.assign(a,f.params),i.push({params:a,pathname:Tt([o,f.pathname]),pathnameBase:Ah(Tt([o,f.pathnameBase])),route:v}),f.pathnameBase!=="/"&&(o=Tt([o,f.pathnameBase]))}return i}function ds(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Th(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((u,{paramName:p,isOptional:f},v)=>{if(p==="*"){let x=l[v]||"";i=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const y=l[v];return f&&!y?u[p]=void 0:u[p]=(y||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:i,pattern:e}}function Th(e,t=!1,n=!0){ut(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,c,u,p)=>{if(r.push({paramName:l,isOptional:c!=null}),c){let f=p.charAt(u+i.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),r]}function Ih(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ut(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ht(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 Rh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function zh(e,t="/"){let{pathname:n,search:r="",hash:a=""}=typeof e=="string"?ir(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=Rc(n.substring(1),"/"):o=Rc(n,t)):o=t,{pathname:o,search:$h(r),hash:Lh(a)}}function Rc(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 oo(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function _h(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function cl(e){let t=_h(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Is(e,t,n,r=!1){let a;typeof e=="string"?a=ir(e):(a={...e},ue(!a.pathname||!a.pathname.includes("?"),oo("?","pathname","search",a)),ue(!a.pathname||!a.pathname.includes("#"),oo("#","pathname","hash",a)),ue(!a.search||!a.search.includes("#"),oo("#","search","hash",a)));let o=e===""||a.pathname==="",i=o?"/":a.pathname,l;if(i==null)l=n;else{let f=t.length-1;if(!r&&i.startsWith("..")){let v=i.split("/");for(;v[0]==="..";)v.shift(),f-=1;a.pathname=v.join("/")}l=f>=0?t[f]:"/"}let c=zh(a,l),u=i&&i!=="/"&&i.endsWith("/"),p=(o||i===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||p)&&(c.pathname+="/"),c}var Tt=e=>e.join("/").replace(/\/\/+/g,"/"),Ah=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),$h=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Lh=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Mh=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 Fh(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Oh(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var df=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ff(e,t){let n=e;if(typeof n!="string"||!Rh.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,a=!1;if(df)try{let o=new URL(window.location.href),i=n.startsWith("//")?new URL(o.protocol+n):new URL(n),l=Ht(i.pathname,t);i.origin===o.origin&&l!=null?n=l+i.search+i.hash:a=!0}catch{ut(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var mf=["POST","PUT","PATCH","DELETE"];new Set(mf);var Bh=["GET",...mf];new Set(Bh);var lr=d.createContext(null);lr.displayName="DataRouter";var Rs=d.createContext(null);Rs.displayName="DataRouterState";var Dh=d.createContext(!1),pf=d.createContext({isTransitioning:!1});pf.displayName="ViewTransition";var Uh=d.createContext(new Map);Uh.displayName="Fetchers";var Wh=d.createContext(null);Wh.displayName="Await";var tt=d.createContext(null);tt.displayName="Navigation";var sa=d.createContext(null);sa.displayName="Location";var jt=d.createContext({outlet:null,matches:[],isDataRoute:!1});jt.displayName="Route";var ul=d.createContext(null);ul.displayName="RouteError";var hf="REACT_ROUTER_ERROR",Hh="REDIRECT",Vh="ROUTE_ERROR_RESPONSE";function Kh(e){if(e.startsWith(`${hf}:${Hh}:{`))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 Gh(e){if(e.startsWith(`${hf}:${Vh}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Mh(t.status,t.statusText,t.data)}catch{}}function Yh(e,{relative:t}={}){ue(cr(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=d.useContext(tt),{hash:a,pathname:o,search:i}=oa(e,{relative:t}),l=o;return n!=="/"&&(l=o==="/"?n:Tt([n,o])),r.createHref({pathname:l,search:i,hash:a})}function cr(){return d.useContext(sa)!=null}function dt(){return ue(cr(),"useLocation() may be used only in the context of a <Router> component."),d.useContext(sa).location}var gf="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function vf(e){d.useContext(tt).static||d.useLayoutEffect(e)}function Kt(){let{isDataRoute:e}=d.useContext(jt);return e?cg():Qh()}function Qh(){ue(cr(),"useNavigate() may be used only in the context of a <Router> component.");let e=d.useContext(lr),{basename:t,navigator:n}=d.useContext(tt),{matches:r}=d.useContext(jt),{pathname:a}=dt(),o=JSON.stringify(cl(r)),i=d.useRef(!1);return vf(()=>{i.current=!0}),d.useCallback((c,u={})=>{if(ut(i.current,gf),!i.current)return;if(typeof c=="number"){n.go(c);return}let p=Is(c,JSON.parse(o),a,u.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Tt([t,p.pathname])),(u.replace?n.replace:n.push)(p,u.state,u)},[t,n,o,a,e])}var Jh=d.createContext(null);function Xh(e){let t=d.useContext(jt).outlet;return d.useMemo(()=>t&&d.createElement(Jh.Provider,{value:e},t),[t,e])}function oa(e,{relative:t}={}){let{matches:n}=d.useContext(jt),{pathname:r}=dt(),a=JSON.stringify(cl(n));return d.useMemo(()=>Is(e,JSON.parse(a),r,t==="path"),[e,a,r,t])}function qh(e,t){return yf(e,t)}function yf(e,t,n){var j;ue(cr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=d.useContext(tt),{matches:a}=d.useContext(jt),o=a[a.length-1],i=o?o.params:{},l=o?o.pathname:"/",c=o?o.pathnameBase:"/",u=o&&o.route;{let h=u&&u.path||"";wf(l,!u||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${h}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
50
|
-
|
|
51
|
-
Please change the parent <Route path="${h}"> to <Route path="${h==="/"?"*":`${h}/*`}">.`)}let p=dt(),f;if(t){let h=typeof t=="string"?ir(t):t;ue(c==="/"||((j=h.pathname)==null?void 0:j.startsWith(c)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${h.pathname}" was given in the \`location\` prop.`),f=h}else f=p;let v=f.pathname||"/",y=v;if(c!=="/"){let h=c.replace(/^\//,"").split("/");y="/"+v.replace(/^\//,"").split("/").slice(h.length).join("/")}let x=lf(e,{pathname:y});ut(u||x!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),ut(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=rg(x&&x.map(h=>Object.assign({},h,{params:Object.assign({},i,h.params),pathname:Tt([c,r.encodeLocation?r.encodeLocation(h.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?c:Tt([c,r.encodeLocation?r.encodeLocation(h.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathnameBase])})),a,n);return t&&w?d.createElement(sa.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...f},navigationType:"POP"}},w):w}function Zh(){let e=lg(),t=Fh(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=d.createElement(d.Fragment,null,d.createElement("p",null,"💿 Hey developer 👋"),d.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",d.createElement("code",{style:o},"ErrorBoundary")," or"," ",d.createElement("code",{style:o},"errorElement")," prop on your route.")),d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},t),n?d.createElement("pre",{style:a},n):null,i)}var eg=d.createElement(Zh,null),xf=class extends d.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Gh(e.digest);n&&(e=n)}let t=e!==void 0?d.createElement(jt.Provider,{value:this.props.routeContext},d.createElement(ul.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?d.createElement(tg,{error:e},t):t}};xf.contextType=Dh;var io=new WeakMap;function tg({children:e,error:t}){let{basename:n}=d.useContext(tt);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Kh(t.digest);if(r){let a=io.get(t);if(a)throw a;let o=ff(r.location,n);if(df&&!io.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 io.set(t,i),i}return d.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function ng({routeContext:e,match:t,children:n}){let r=d.useContext(lr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(jt.Provider,{value:e},n)}function rg(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 p=a.findIndex(f=>f.route.id&&(o==null?void 0:o[f.route.id])!==void 0);ue(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,p+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let p=0;p<a.length;p++){let f=a[p];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=p),f.route.id){let{loaderData:v,errors:y}=r,x=f.route.loader&&!v.hasOwnProperty(f.route.id)&&(!y||y[f.route.id]===void 0);if(f.route.lazy||x){n.isStatic&&(i=!0),l>=0?a=a.slice(0,l+1):a=[a[0]];break}}}}let c=n==null?void 0:n.onError,u=r&&c?(p,f)=>{var v,y;c(p,{location:r.location,params:((y=(v=r.matches)==null?void 0:v[0])==null?void 0:y.params)??{},unstable_pattern:Oh(r.matches),errorInfo:f})}:void 0;return a.reduceRight((p,f,v)=>{let y,x=!1,w=null,j=null;r&&(y=o&&f.route.id?o[f.route.id]:void 0,w=f.route.errorElement||eg,i&&(l<0&&v===0?(wf("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,j=null):l===v&&(x=!0,j=f.route.hydrateFallbackElement||null)));let h=t.concat(a.slice(0,v+1)),m=()=>{let g;return y?g=w:x?g=j:f.route.Component?g=d.createElement(f.route.Component,null):f.route.element?g=f.route.element:g=p,d.createElement(ng,{match:f,routeContext:{outlet:p,matches:h,isDataRoute:r!=null},children:g})};return r&&(f.route.ErrorBoundary||f.route.errorElement||v===0)?d.createElement(xf,{location:r.location,revalidation:r.revalidation,component:w,error:y,children:m(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:u}):m()},null)}function dl(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ag(e){let t=d.useContext(lr);return ue(t,dl(e)),t}function sg(e){let t=d.useContext(Rs);return ue(t,dl(e)),t}function og(e){let t=d.useContext(jt);return ue(t,dl(e)),t}function fl(e){let t=og(e),n=t.matches[t.matches.length-1];return ue(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function ig(){return fl("useRouteId")}function lg(){var r;let e=d.useContext(ul),t=sg("useRouteError"),n=fl("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function cg(){let{router:e}=ag("useNavigate"),t=fl("useNavigate"),n=d.useRef(!1);return vf(()=>{n.current=!0}),d.useCallback(async(a,o={})=>{ut(n.current,gf),n.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...o}))},[e,t])}var zc={};function wf(e,t,n){!t&&!zc[e]&&(zc[e]=!0,ut(!1,n))}d.memo(ug);function ug({routes:e,future:t,state:n,isStatic:r,onError:a}){return yf(e,void 0,{state:n,isStatic:r,onError:a})}function Jt({to:e,replace:t,state:n,relative:r}){ue(cr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=d.useContext(tt);ut(!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}=d.useContext(jt),{pathname:i}=dt(),l=Kt(),c=Is(e,cl(o),i,r==="path"),u=JSON.stringify(c);return d.useEffect(()=>{l(JSON.parse(u),{replace:t,state:n,relative:r})},[l,u,r,t,n]),null}function dg(e){return Xh(e.context)}function be(e){ue(!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 fg({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:a,static:o=!1,unstable_useTransitions:i}){ue(!cr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),c=d.useMemo(()=>({basename:l,navigator:a,static:o,unstable_useTransitions:i,future:{}}),[l,a,o,i]);typeof n=="string"&&(n=ir(n));let{pathname:u="/",search:p="",hash:f="",state:v=null,key:y="default",unstable_mask:x}=n,w=d.useMemo(()=>{let j=Ht(u,l);return j==null?null:{location:{pathname:j,search:p,hash:f,state:v,key:y,unstable_mask:x},navigationType:r}},[l,u,p,f,v,y,r,x]);return ut(w!=null,`<Router basename="${l}"> is not able to match the URL "${u}${p}${f}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:d.createElement(tt.Provider,{value:c},d.createElement(sa.Provider,{children:t,value:w}))}function mg({children:e,location:t}){return qh(ii(e),t)}function ii(e,t=[]){let n=[];return d.Children.forEach(e,(r,a)=>{if(!d.isValidElement(r))return;let o=[...t,a];if(r.type===d.Fragment){n.push.apply(n,ii(r.props.children,o));return}ue(r.type===be,`[${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>`),ue(!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=ii(r.props.children,o)),n.push(i)}),n}var Oa="get",Ba="application/x-www-form-urlencoded";function zs(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function pg(e){return zs(e)&&e.tagName.toLowerCase()==="button"}function hg(e){return zs(e)&&e.tagName.toLowerCase()==="form"}function gg(e){return zs(e)&&e.tagName.toLowerCase()==="input"}function vg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function yg(e,t){return e.button===0&&(!t||t==="_self")&&!vg(e)}function li(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 xg(e,t){let n=li(e);return t&&t.forEach((r,a)=>{n.has(a)||t.getAll(a).forEach(o=>{n.append(a,o)})}),n}var Ca=null;function wg(){if(Ca===null)try{new FormData(document.createElement("form"),0),Ca=!1}catch{Ca=!0}return Ca}var Sg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function lo(e){return e!=null&&!Sg.has(e)?(ut(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ba}"`),null):e}function jg(e,t){let n,r,a,o,i;if(hg(e)){let l=e.getAttribute("action");r=l?Ht(l,t):null,n=e.getAttribute("method")||Oa,a=lo(e.getAttribute("enctype"))||Ba,o=new FormData(e)}else if(pg(e)||gg(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?Ht(c,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Oa,a=lo(e.getAttribute("formenctype"))||lo(l.getAttribute("enctype"))||Ba,o=new FormData(l,e),!wg()){let{name:u,type:p,value:f}=e;if(p==="image"){let v=u?`${u}.`:"";o.append(`${v}x`,"0"),o.append(`${v}y`,"0")}else u&&o.append(u,f)}}else{if(zs(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Oa,r=null,a=Ba,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 ml(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function kg(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&&Ht(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${r}`,a}async function Cg(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 bg(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 Ng(e,t,n){let r=await Promise.all(e.map(async a=>{let o=t.routes[a.route.id];if(o){let i=await Cg(o,n);return i.links?i.links():[]}return[]}));return Ig(r.flat(1).filter(bg).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function _c(e,t,n,r,a,o){let i=(c,u)=>n[u]?c.route.id!==n[u].route.id:!0,l=(c,u)=>{var p;return n[u].pathname!==c.pathname||((p=n[u].route.path)==null?void 0:p.endsWith("*"))&&n[u].params["*"]!==c.params["*"]};return o==="assets"?t.filter((c,u)=>i(c,u)||l(c,u)):o==="data"?t.filter((c,u)=>{var f;let p=r.routes[c.route.id];if(!p||!p.hasLoader)return!1;if(i(c,u)||l(c,u))return!0;if(c.route.shouldRevalidate){let v=c.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:c.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function Eg(e,t,{includeHydrateFallback:n}={}){return Pg(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 Pg(e){return[...new Set(e)]}function Tg(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Ig(e,t){let n=new Set;return new Set(t),e.reduce((r,a)=>{let o=JSON.stringify(Tg(a));return n.has(o)||(n.add(o),r.push({key:o,link:a})),r},[])}function Sf(){let e=d.useContext(lr);return ml(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Rg(){let e=d.useContext(Rs);return ml(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var pl=d.createContext(void 0);pl.displayName="FrameworkContext";function jf(){let e=d.useContext(pl);return ml(e,"You must render this element inside a <HydratedRouter> element"),e}function zg(e,t){let n=d.useContext(pl),[r,a]=d.useState(!1),[o,i]=d.useState(!1),{onFocus:l,onBlur:c,onMouseEnter:u,onMouseLeave:p,onTouchStart:f}=t,v=d.useRef(null);d.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let w=h=>{h.forEach(m=>{i(m.isIntersecting)})},j=new IntersectionObserver(w,{threshold:.5});return v.current&&j.observe(v.current),()=>{j.disconnect()}}},[e]),d.useEffect(()=>{if(r){let w=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(w)}}},[r]);let y=()=>{a(!0)},x=()=>{a(!1),i(!1)};return n?e!=="intent"?[o,v,{}]:[o,v,{onFocus:wr(l,y),onBlur:wr(c,x),onMouseEnter:wr(u,y),onMouseLeave:wr(p,x),onTouchStart:wr(f,y)}]:[!1,v,{}]}function wr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function _g({page:e,...t}){let{router:n}=Sf(),r=d.useMemo(()=>lf(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?d.createElement($g,{page:e,matches:r,...t}):null}function Ag(e){let{manifest:t,routeModules:n}=jf(),[r,a]=d.useState([]);return d.useEffect(()=>{let o=!1;return Ng(e,t,n).then(i=>{o||a(i)}),()=>{o=!0}},[e,t,n]),r}function $g({page:e,matches:t,...n}){let r=dt(),{future:a,manifest:o,routeModules:i}=jf(),{basename:l}=Sf(),{loaderData:c,matches:u}=Rg(),p=d.useMemo(()=>_c(e,t,u,o,r,"data"),[e,t,u,o,r]),f=d.useMemo(()=>_c(e,t,u,o,r,"assets"),[e,t,u,o,r]),v=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,j=!1;if(t.forEach(m=>{var S;let g=o.routes[m.route.id];!g||!g.hasLoader||(!p.some(E=>E.route.id===m.route.id)&&m.route.id in c&&((S=i[m.route.id])!=null&&S.shouldRevalidate)||g.hasClientLoader?j=!0:w.add(m.route.id))}),w.size===0)return[];let h=kg(e,l,a.unstable_trailingSlashAwareDataRequests,"data");return j&&w.size>0&&h.searchParams.set("_routes",t.filter(m=>w.has(m.route.id)).map(m=>m.route.id).join(",")),[h.pathname+h.search]},[l,a.unstable_trailingSlashAwareDataRequests,c,r,o,p,t,e,i]),y=d.useMemo(()=>Eg(f,o),[f,o]),x=Ag(f);return d.createElement(d.Fragment,null,v.map(w=>d.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),y.map(w=>d.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),x.map(({key:w,link:j})=>d.createElement("link",{key:w,nonce:n.nonce,...j,crossOrigin:j.crossOrigin??n.crossOrigin})))}function Lg(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Mg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Mg&&(window.__reactRouterVersion="7.13.1")}catch{}function Fg({basename:e,children:t,unstable_useTransitions:n,window:r}){let a=d.useRef();a.current==null&&(a.current=ph({window:r,v5Compat:!0}));let o=a.current,[i,l]=d.useState({action:o.action,location:o.location}),c=d.useCallback(u=>{n===!1?l(u):d.startTransition(()=>l(u))},[n]);return d.useLayoutEffect(()=>o.listen(c),[o,c]),d.createElement(fg,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:o,unstable_useTransitions:n})}var kf=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Qe=d.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:a,reloadDocument:o,replace:i,unstable_mask:l,state:c,target:u,to:p,preventScrollReset:f,viewTransition:v,unstable_defaultShouldRevalidate:y,...x},w){let{basename:j,navigator:h,unstable_useTransitions:m}=d.useContext(tt),g=typeof p=="string"&&kf.test(p),S=ff(p,j);p=S.to;let E=Yh(p,{relative:a}),T=dt(),k=null;if(l){let B=Is(l,[],T.unstable_mask?T.unstable_mask.pathname:"/",!0);j!=="/"&&(B.pathname=B.pathname==="/"?j:Tt([j,B.pathname])),k=h.createHref(B)}let[N,C,I]=zg(r,x),H=Dg(p,{replace:i,unstable_mask:l,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:v,unstable_defaultShouldRevalidate:y,unstable_useTransitions:m});function U(B){t&&t(B),B.defaultPrevented||H(B)}let D=!(S.isExternal||o),_=d.createElement("a",{...x,...I,href:(D?k:void 0)||S.absoluteURL||E,onClick:D?U:t,ref:Lg(w,C),target:u,"data-discover":!g&&n==="render"?"true":void 0});return N&&!g?d.createElement(d.Fragment,null,_,d.createElement(_g,{page:E})):_});Qe.displayName="Link";var hl=d.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:a=!1,style:o,to:i,viewTransition:l,children:c,...u},p){let f=oa(i,{relative:u.relative}),v=dt(),y=d.useContext(Rs),{navigator:x,basename:w}=d.useContext(tt),j=y!=null&&Kg(f)&&l===!0,h=x.encodeLocation?x.encodeLocation(f).pathname:f.pathname,m=v.pathname,g=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(m=m.toLowerCase(),g=g?g.toLowerCase():null,h=h.toLowerCase()),g&&w&&(g=Ht(g,w)||g);const S=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let E=m===h||!a&&m.startsWith(h)&&m.charAt(S)==="/",T=g!=null&&(g===h||!a&&g.startsWith(h)&&g.charAt(h.length)==="/"),k={isActive:E,isPending:T,isTransitioning:j},N=E?t:void 0,C;typeof r=="function"?C=r(k):C=[r,E?"active":null,T?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let I=typeof o=="function"?o(k):o;return d.createElement(Qe,{...u,"aria-current":N,className:C,ref:p,style:I,to:i,viewTransition:l},typeof c=="function"?c(k):c)});hl.displayName="NavLink";var Og=d.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:a,state:o,method:i=Oa,action:l,onSubmit:c,relative:u,preventScrollReset:p,viewTransition:f,unstable_defaultShouldRevalidate:v,...y},x)=>{let{unstable_useTransitions:w}=d.useContext(tt),j=Hg(),h=Vg(l,{relative:u}),m=i.toLowerCase()==="get"?"get":"post",g=typeof l=="string"&&kf.test(l),S=E=>{if(c&&c(E),E.defaultPrevented)return;E.preventDefault();let T=E.nativeEvent.submitter,k=(T==null?void 0:T.getAttribute("formmethod"))||i,N=()=>j(T||E.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:a,state:o,relative:u,preventScrollReset:p,viewTransition:f,unstable_defaultShouldRevalidate:v});w&&n!==!1?d.startTransition(()=>N()):N()};return d.createElement("form",{ref:x,method:m,action:h,onSubmit:r?c:S,...y,"data-discover":!g&&e==="render"?"true":void 0})});Og.displayName="Form";function Bg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Cf(e){let t=d.useContext(lr);return ue(t,Bg(e)),t}function Dg(e,{target:t,replace:n,unstable_mask:r,state:a,preventScrollReset:o,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c,unstable_useTransitions:u}={}){let p=Kt(),f=dt(),v=oa(e,{relative:i});return d.useCallback(y=>{if(yg(y,t)){y.preventDefault();let x=n!==void 0?n:Zr(f)===Zr(v),w=()=>p(e,{replace:x,unstable_mask:r,state:a,preventScrollReset:o,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:c});u?d.startTransition(()=>w()):w()}},[f,p,v,n,r,a,t,e,o,i,l,c,u])}function bf(e){ut(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=d.useRef(li(e)),n=d.useRef(!1),r=dt(),a=d.useMemo(()=>xg(r.search,n.current?null:t.current),[r.search]),o=Kt(),i=d.useCallback((l,c)=>{const u=li(typeof l=="function"?l(new URLSearchParams(a)):l);n.current=!0,o("?"+u,c)},[o,a]);return[a,i]}var Ug=0,Wg=()=>`__${String(++Ug)}__`;function Hg(){let{router:e}=Cf("useSubmit"),{basename:t}=d.useContext(tt),n=ig(),r=e.fetch,a=e.navigate;return d.useCallback(async(o,i={})=>{let{action:l,method:c,encType:u,formData:p,body:f}=jg(o,t);if(i.navigate===!1){let v=i.fetcherKey||Wg();await r(v,n,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:p,body:f,formMethod:i.method||c,formEncType:i.encType||u,flushSync:i.flushSync})}else await a(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:p,body:f,formMethod:i.method||c,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,a,t,n])}function Vg(e,{relative:t}={}){let{basename:n}=d.useContext(tt),r=d.useContext(jt);ue(r,"useFormAction must be used inside a RouteContext");let[a]=r.matches.slice(-1),o={...oa(e||".",{relative:t})},i=dt();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),c=l.getAll("index");if(c.some(p=>p==="")){l.delete("index"),c.filter(f=>f).forEach(f=>l.append("index",f));let p=l.toString();o.search=p?`?${p}`:""}}return(!e||e===".")&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Tt([n,o.pathname])),Zr(o)}function Kg(e,{relative:t}={}){let n=d.useContext(pf);ue(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Cf("useViewTransitionState"),a=oa(e,{relative:t});if(!n.isTransitioning)return!1;let o=Ht(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Ht(n.nextLocation.pathname,r)||n.nextLocation.pathname;return ds(a.pathname,i)!=null||ds(a.pathname,o)!=null}class Nf extends Error{constructor(n){super("different_account");_s(this,"summary");this.name="DifferentAccountError",this.summary=n}}class Gg{constructor(){_s(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 Nf(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{frame_hash:o.frameHash??o.boundsHash,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 getMyReceipts(t){const n=new URLSearchParams;t!=null&&t.date&&n.set("date",t.date),t!=null&&t.profile&&n.set("profile",t.profile),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString(),a=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!a.ok)throw new Error(`Failed to fetch receipts: ${a.status}`);return(await a.json()).receipts??[]}async revokeAttestation(t,n){const r=await this.fetch(`/api/attestations/${encodeURIComponent(t)}/revoke`,{method:"POST",body:JSON.stringify({reason:n??"Revoked by user"})});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed to revoke"}));throw new Error(a.error||`Revoke failed: ${r.status}`)}}async getAttestations(t){const n=await this.fetch(`/api/attestations?frame_hash=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch attestations: ${n.status}`);return n.json()}async getGroupById(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch group: ${n.status}`);return n.json()}async createGroup(t){const n=await this.fetch("/api/groups",{method:"POST",body:JSON.stringify({name:t})});if(!n.ok){const 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 getMcpHealth(){const t=await this.fetch("/mcp/health");if(!t.ok)throw new Error(`MCP server unreachable: ${t.status}`);return t.json()}async getMcpIntegrations(){const t=await this.fetch("/mcp/integrations");if(!t.ok)throw new Error(`Failed to fetch integrations: ${t.status}`);return t.json()}async getOAuthHealth(t){try{const n=await this.fetch(`/auth/oauth/${encodeURIComponent(t)}/health`);return n.ok?await n.json():{status:"unverified"}}catch{return{status:"unverified"}}}async getIntegrationManifests(){const t=await this.fetch("/mcp/integrations/manifests");if(!t.ok)throw new Error(`Failed to fetch manifests: ${t.status}`);return t.json()}async discoverScopeField(t,n){const r=await this.fetch(`/integrations/${encodeURIComponent(t)}/discover/${encodeURIComponent(n)}`);if(!r.ok){const a=await r.json().catch(()=>({error:`Discovery failed: ${r.status}`}));throw new Error(a.error)}return r.json()}async activateIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}/activate`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`Failed: ${n.status}`)}return n.json()}async removeMcpIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to remove integration: ${n.status}`)}async getTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`);if(r.status===404||!r.ok)return null;const a=await r.json();return(a==null?void 0:a.config)??null}async setTeamProfileConfig(t,n,r){const a=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(r)});if(!a.ok){const 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/attestations/${encodeURIComponent(t)}/intent`);return n.status===404||n.status===403||!n.ok?null:n.json()}async decryptIntent(t){const n=await this.fetch("/api/decrypt-intent",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const a=await n.json().catch(()=>({error:"Decryption failed"}));throw new Error(a.error||`decryptIntent failed: ${n.status}`)}return(await n.json()).intent}async storeApprovedIntent(t,n){const r=await this.fetch("/api/approved-intents",{method:"POST",body:JSON.stringify({authorityId:t,intent:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Failed"}));throw new Error(a.error||`storeApprovedIntent failed: ${r.status}`)}}async listTeamAuthorizations(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/attestations`);if(!n.ok)throw new Error(`Failed to fetch team authorizations: ${n.status}`);return((await n.json()).items??[]).map(a=>{var l,c;const o=a.owner??{userId:""};return{frame_hash:a.boundsHash??a.frameHash??a.frame_hash,profile_id:a.profileId??a.profile_id,path:a.path??"",title:a.title??null,sp_status:a.status??a.sp_status??null,frame:a.bounds??a.frame??{},required_domains:a.requiredDomains??a.required_domains??[],attested_domains:a.attestedDomains??a.attested_domains??[],missing_domains:(a.requiredDomains??a.required_domains??[]).filter(u=>!(a.attestedDomains??a.attested_domains??[]).includes(u)),deferred_commitment_domains:a.deferredCommitmentDomains??a.deferred_commitment_domains??[],approvers_frozen:a.approversFrozen??a.approvers_frozen??[],above_cap:a.aboveCap??a.above_cap??!1,created_at:a.createdAt?new Date(a.createdAt*1e3).toISOString():a.created_at??"",earliest_expiry:(l=a.attestations)!=null&&l.length?new Date(Math.min(...a.attestations.map(u=>u.expiresAt))*1e3).toISOString():null,remaining_seconds:(c=a.attestations)!=null&&c.length?Math.max(0,Math.min(...a.attestations.map(u=>u.expiresAt))-Math.floor(Date.now()/1e3)):null,owner: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 p=0;p<n;p++){const f=new Date(c);f.setUTCDate(c.getUTCDate()-p),l.push(f.toISOString().slice(0,10))}i=(await Promise.all(l.map(p=>this.getMyReceipts({date:p,profile:t.profile})))).flat()}return{proposals:o,receipts:i}}async getGateContent(t){const n=await this.fetch(`/gate-content?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch gate content: ${n.status}`);return(await n.json()).entry??null}async getEnrichedAuthorizations(){const t=await this.fetch("/active-authorizations");if(!t.ok)throw new Error(`Failed to fetch authorizations: ${t.status}`);return(await t.json()).authorizations??[]}async pushGateContent(t){const n=await this.fetch("/gate-content",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to push gate content"}));throw new Error(r.error||`Push gate content failed: ${n.status}`)}}async getAgentContext(){const t=await this.fetch("/agent-brief/context");if(!t.ok)throw new Error(`Failed to fetch agent context: ${t.status}`);return(await t.json()).content}async saveAgentContext(t){const n=await this.fetch("/agent-brief/context",{method:"PUT",body:JSON.stringify({content:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to save agent context"}));throw new Error(r.error||`Save failed: ${n.status}`)}}async aiChat(t){const n=await this.fetch("/ai/chat",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI chat failed"}))).error||`Chat failed: ${n.status}`}}async getAIPrompts(){const t=await this.fetch("/ai-prompts");if(!t.ok)throw new Error(`Failed to load AI prompts: ${t.status}`);return t.json()}async setAIPrompt(t,n){const r=await this.fetch(`/ai-prompts/${t}`,{method:"PUT",body:JSON.stringify({value:n})});if(!r.ok){const a=await r.json().catch(()=>({error:"Save failed"}));throw new Error(a.error||`Save failed: ${r.status}`)}}}const O=new Gg,Ef=d.createContext(null);function Yg({children:e}){const[t,n]=d.useState(null),[r,a]=d.useState("personal"),[o,i]=d.useState(null),[l,c]=d.useState(""),[u,p]=d.useState(null),[f,v]=d.useState(null),[y,x]=d.useState(!1),[w,j]=d.useState(""),h=d.useRef(!1),m=d.useRef(null),g=d.useCallback(async()=>{if(h.current)try{const N=await O.getMyTeam();if(N){const{group:C,membership:I}=N;p(C),v(I),a("team"),i(C);const H=m.current??I.domains[0]??"owner";c(H)}else p(null),v(null),a("personal")}catch{}},[]);d.useEffect(()=>{const N=()=>{document.visibilityState==="visible"&&g()};return document.addEventListener("visibilitychange",N),()=>document.removeEventListener("visibilitychange",N)},[g]);const S=d.useCallback(async(N,C={})=>{x(!0),j("");try{O.setApiKey(N),h.current=!0;const I=await O.login(N,C);n(I),m.current=I.id;const H=await O.getGroups(),U=H.find(D=>D.isPersonal)??H[0]??null;i(U),c("owner"),await g()}catch(I){throw O.clearApiKey(),h.current=!1,j(I instanceof Error?I.message:"Login failed"),I}finally{x(!1)}},[g]),E=d.useCallback(async()=>{await O.logout(),O.clearApiKey(),h.current=!1,m.current=null,n(null),i(null),c(""),p(null),v(null),a("personal"),j("")},[]),T=d.useCallback(()=>j(""),[]),k=d.useCallback((N,C)=>{i(N),c(C)},[]);return s.jsx(Ef.Provider,{value:{user:t,mode:r,group:o,domain:l,groupId:(o==null?void 0:o.id)??null,activeTeam:u,activeMembership:f,isLoading:y,error:w,login:S,logout:E,clearError:T,activeGroup:o,activeDomain:l,groups:o?[o]:[],setActiveContext:k,refreshGroups:g},children:e})}function Te(){const e=d.useContext(Ef);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const Pf=d.createContext(null);function Qg({children:e}){const{user:t}=Te(),n=d.useRef(null),[r,a]=d.useState(!1),o=d.useRef(new Map),i=d.useCallback((l,c)=>{const u=o.current;return u.has(l)||u.set(l,new Set),u.get(l).add(c),()=>{var p;(p=u.get(l))==null||p.delete(c)}},[]);return d.useEffect(()=>{if(!t){n.current&&(n.current.close(),n.current=null,a(!1));return}if(n.current)return;const l=O.getApiKey();if(!l)return;const c=new EventSource(`/events?key=${encodeURIComponent(l)}`);n.current=c,c.onopen=()=>a(!0),c.onerror=()=>a(!1);const u=["integration-changed","attestation-changed","proposal-added","proposal-resolved","team-membership-changed","action-approval-needed","action-resolved","proposal-approved","proposal-rejected"];for(const p of u)c.addEventListener(p,f=>{let v;try{v=JSON.parse(f.data)}catch{v=null}const y=o.current.get(p);if(y)for(const x of y)try{x(v)}catch(w){console.error(`[EventSource] handler for "${p}" threw:`,w)}});return()=>{c.close(),n.current=null,a(!1)}},[t]),s.jsx(Pf.Provider,{value:{connected:r,addListener:i},children:e})}function fe(e,t){const n=d.useContext(Pf);if(!n)return;const{addListener:r}=n;d.useEffect(()=>r(e,t),[e,t,r])}const $r="suveren-theme",Ac="hap-theme";function ba(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}(function(){const t=localStorage.getItem(Ac);t!==null&&localStorage.getItem($r)===null&&localStorage.setItem($r,t),t!==null&&localStorage.removeItem(Ac)})();function Tf(){const[e,t]=d.useState(()=>{const o=localStorage.getItem($r);return o==="light"||o==="dark"?o:"system"}),[n,r]=d.useState(()=>ba(e));d.useEffect(()=>{const o=document.documentElement,i=ba(e);o.setAttribute("data-theme",i),e==="system"?localStorage.removeItem($r):localStorage.setItem($r,e),r(ba(e))},[e]),d.useEffect(()=>{if(e!=="system")return;const o=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>r(ba("system"));return o.addEventListener("change",i),()=>o.removeEventListener("change",i)},[e]);const a=d.useCallback(()=>{t(o=>o==="system"?"light":o==="light"?"dark":"system")},[]);return{theme:e,effectiveTheme:n,toggle:a}}const Jg=5*60*1e3,Xg=2e3;function If(){const[e,t]=d.useState(!1),[n,r]=d.useState("docker"),[a,o]=d.useState(""),[i,l]=d.useState(null),[c,u]=d.useState(!1),[p,f]=d.useState(!1),[v,y]=d.useState(!1),x=d.useRef(null);return d.useEffect(()=>{let w=!1;const j=(g=!1)=>{fetch(g?"/health?refresh=1":"/health").then(S=>S.json()).then(S=>{w||(S.installMethod&&r(S.installMethod),typeof S.latestVersion<"u"&&l(S.latestVersion),S.updateAvailable&&t(!0),S.version&&(o(S.version),x.current===null?x.current=S.version:S.version!==x.current&&S.version!=="dev"&&u(!0)))}).catch(()=>{})};j(!0);const h=setInterval(()=>j(!1),v?Xg:Jg),m=()=>{document.visibilityState==="visible"&&j(!1)};return document.addEventListener("visibilitychange",m),window.addEventListener("focus",m),()=>{w=!0,clearInterval(h),document.removeEventListener("visibilitychange",m),window.removeEventListener("focus",m)}},[v]),{updateAvailable:e&&!p,installMethod:n,version:a,latestVersion:i,serverRestarted:c,startFastPolling:()=>y(!0),dismiss:()=>f(!0)}}function qg(e){return e?e==="dev"?"dev":/^[0-9a-f]{40}$/i.test(e)?e.slice(0,7):e:""}const $c={system:"◑",light:"☀",dark:"☾"};function Zg(){const{mode:e,group:t,domain:n}=Te();return e==="personal"?s.jsx("span",{children:"personal"}):t?s.jsxs("span",{children:[t.name," / ",n]}):s.jsx("span",{children:n})}function gl({onMenuToggle:e}){const{user:t,logout:n}=Te(),{theme:r,toggle:a}=Tf(),{version:o}=If(),i=qg(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(Zg,{})]}),s.jsx("button",{className:"theme-toggle",onClick:a,title:`Theme: ${r}`,children:$c[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:$c[r]})]})}),t&&e&&s.jsx("button",{className:"mobile-menu-btn",onClick:e,"aria-label":"Menu",children:"☰"})]})})}function bt(e,t){var n;return(n=t==null?void 0:t.revokedSet)!=null&&n.has(e.frame_hash)||e.sp_status==="revoked"?"revoked":e.sp_status==="expired"||e.remaining_seconds===null||e.remaining_seconds<=0?"expired":e.missing_domains.length>0?"pending":"active"}function Rf(e,t){const n={active:[],pending:[],expired:[],revoked:[]};for(const r of e)n[bt(r,t)].push(r);return n}function Ft(e,t,n){const r=d.useRef(e);r.current=e,d.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)},u=()=>{o()?(r.current(),l()):c()};return o()&&(r.current(),l()),document.addEventListener("visibilitychange",u),()=>{c(),document.removeEventListener("visibilitychange",u)}},[t,n])}const zf=d.createContext(null),ev=3e4;function tv({children:e}){const[t,n]=d.useState({manifests:[],integrations:[],activeSessions:0,mcpServerUp:null,manifestsError:!1,fetchCount:0}),r=d.useRef(null),a=d.useCallback(async()=>{let c=!1;const[u,p]=await Promise.all([O.getIntegrationManifests().catch(()=>(c=!0,{manifests:[]})),O.getMcpHealth().catch(()=>null)]);n(f=>({manifests:u.manifests,integrations:(p==null?void 0:p.integrations)??f.integrations,activeSessions:(p==null?void 0:p.activeSessions)??f.activeSessions,mcpServerUp:!!p,manifestsError:c,fetchCount:f.fetchCount+1}))},[]);fe("integration-changed",a),Ft(a,3e5);const o=d.useMemo(()=>{const c=new Map(t.integrations.map(v=>[v.id,v])),u=Date.now(),p=t.fetchCount>0&&t.manifests.some(v=>{const y=c.get(v.id);return y&&!y.running});p&&r.current===null?r.current=u:p||(r.current=null);const f=r.current!==null&&u-r.current<ev;return t.manifests.map(v=>{const y=c.get(v.id);let x;return t.fetchCount===0?x="loading":y!=null&&y.running?x="running":y!=null&&y.error?x="error":y&&f?x="starting":x="not-running",{id:v.id,manifest:v,integration:y,state:x}})},[t]),i=d.useMemo(()=>o.filter(c=>c.state==="not-running"||c.state==="error").length,[o]),l={loading:t.fetchCount===0,mcpServerUp:t.mcpServerUp,manifestsError:t.manifestsError,entries:o,attentionCount:i,activeSessions:t.activeSessions,refresh:a};return s.jsx(zf.Provider,{value:l,children:e})}function vl(){const e=d.useContext(zf);if(!e)throw new Error("useIntegrationStatus must be used inside IntegrationStatusProvider");return e}const nv=[{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 rv(){const{activeDomain:e}=Te(),[t,n]=d.useState({}),r=d.useCallback(async()=>{try{const[a,o,i,l,c]=await Promise.all([O.getCredential("ai-config").catch(()=>null),O.getMyAttestations().catch(()=>null),O.getProposals(e||"owner").catch(()=>null),O.getProposalsForApprover().catch(()=>null),O.getAgentContext().catch(()=>"")]),u={};if(a&&!a.configured&&(u.assistant=1),o){const y=Rf(o).expired.length;y>0&&(u.authorizations=y)}const p=(i==null?void 0:i.length)??0,f=(l==null?void 0:l.length)??0,v=p+f;v>0&&(u.proposals=v),(!c||!c.trim())&&(u.brief=1),n(u)}catch{}},[e]);return fe("attestation-changed",r),fe("proposal-added",r),fe("proposal-resolved",r),fe("proposal-approved",r),fe("proposal-rejected",r),fe("team-membership-changed",r),Ft(r,3e5,e),t}const av={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},sv={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 ov(){const{mode:e,group:t,domain:n,activeTeam:r}=Te(),a=rv(),{attentionCount:o}=vl(),i={...a};o>0&&(i.integrations=o);const l=nv.filter(v=>!v.teamOnly||e==="team"),c=d.useRef(null),[u,p]=d.useState(null),f=dt();return d.useEffect(()=>{if(c.current===null){c.current=e;return}c.current!==e&&(e==="team"&&r?p(`You are now acting in team context — ${r.name}`):e==="personal"&&p("You have left the team — back to personal context"),c.current=e)},[e,r]),d.useEffect(()=>{p(null)},[f.pathname]),s.jsxs("div",{className:"sidebar",children:[s.jsx("ul",{className:"sidebar-nav",children:l.map(v=>{const y=v.statusKey?i[v.statusKey]:0;return s.jsx("li",{children:s.jsxs(hl,{to:v.to,end:v.to==="/",className:({isActive:x})=>`sidebar-item${x?" active":""}`,children:[s.jsx("span",{className:"icon",children:v.icon}),v.label,y?s.jsx("span",{style:av,children:y}):null]})},v.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})]}),u&&s.jsx("div",{style:sv,role:"status","aria-live":"polite",children:u})]})}const co="suveren:updatedTo";function iv(e){return e==="npm"?"suveren-gateway stop; npm install -g @suveren/gateway@latest && suveren-gateway start --detach":e==="dev"?"git pull && pnpm install":"docker rm -f suveren-gateway 2>/dev/null; docker ps -q --filter publish=7400 --filter publish=7430 | xargs -r docker rm -f; docker pull ghcr.io/suverenai/suveren-gateway:latest && docker run -d --name suveren-gateway -p 7400:3000 -p 7430:3030 -v $HOME/.suveren:/app/data ghcr.io/suverenai/suveren-gateway"}function lv(){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 cv(){const{updateAvailable:e,installMethod:t,version:n,latestVersion:r,serverRestarted:a,startFastPolling:o,dismiss:i}=If(),[l,c]=d.useState(!1),[u,p]=d.useState(!1),[f,v]=d.useState(()=>{try{const g=sessionStorage.getItem(co);if(g)return sessionStorage.removeItem(co),g}catch{}return null}),y=iv(t),x=d.useRef(null),w=g=>{try{sessionStorage.setItem(co,g||r||"✓")}catch{}window.location.reload()};d.useEffect(()=>{if(!f)return;const g=setTimeout(()=>v(null),6e3);return()=>clearTimeout(g)},[f]),d.useEffect(()=>{if(!l||!a)return;const g=()=>lv()?!1:(w(n),!0);if(g())return;const S=setInterval(g,1500);return()=>clearInterval(S)},[l,a,n]),d.useEffect(()=>(document.body.classList.toggle("is-updating",l),()=>document.body.classList.remove("is-updating")),[l]);const j=e&&!l&&!f||!!f&&!l;d.useEffect(()=>{if(!j){document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner");return}document.body.classList.add("has-update-banner");const g=()=>{var T;const E=((T=x.current)==null?void 0:T.offsetHeight)??0;document.documentElement.style.setProperty("--update-banner-h",`${E}px`)};g();const S=new ResizeObserver(g);return x.current&&S.observe(x.current),()=>{S.disconnect(),document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner")}},[j]);const h=()=>{c(!0),o()},m=async()=>{try{await navigator.clipboard.writeText(y),p(!0),setTimeout(()=>p(!1),1800)}catch{}};return s.jsxs(s.Fragment,{children:[f&&!l&&s.jsx("div",{ref:x,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",f&&f!=="✓"?` — ${f} is live`:" — now live","."]}),s.jsx("button",{className:"update-banner-x",onClick:()=>v(null),"aria-label":"Dismiss",children:"×"})]})}),e&&!l&&!f&&s.jsx("div",{ref:x,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:y}),s.jsx("button",{className:"btn btn-sm btn-primary",onClick:m,children:u?"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:()=>w(n),children:"Reload now"}),s.jsx("button",{className:"btn btn-secondary",onClick:()=>c(!1),children:"Cancel"})]})]})})]})}const uv={system:"◑",light:"☀",dark:"☾"},dv=[{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 fv({open:e,onClose:t}){const{user:n,activeGroup:r,activeDomain:a,logout:o}=Te(),{theme:i,toggle:l}=Tf(),c=dt();return d.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:dv.map(u=>s.jsxs(hl,{to:u.to,end:u.to==="/",className:({isActive:p})=>`mobile-menu-item${p?" active":""}`,onClick:t,children:[s.jsx("span",{className:"icon",children:u.icon}),u.label]},u.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:uv[i]}),"Theme: ",i]}),s.jsx("button",{className:"mobile-menu-action",onClick:()=>{o(),t()},children:"Logout"})]})]})]}):null}function mv(){const[e,t]=d.useState(!1);return s.jsxs(tv,{children:[s.jsx(gl,{onMenuToggle:()=>t(!e)}),s.jsx(cv,{}),s.jsx(ov,{}),s.jsx(fv,{open:e,onClose:()=>t(!1)}),s.jsx("div",{className:"main-content",children:s.jsx("div",{className:"page-inner",children:s.jsx(dg,{})})})]})}function pv(){const[e,t]=d.useState(""),{login:n,isLoading:r,error:a,clearError:o}=Te(),[i,l]=d.useState(null),c=async()=>{if(e.trim()){o();try{await n(e)}catch(f){if(f instanceof Nf){l(f.summary);return}}}},u=async()=>{l(null),o();try{await n(e,{confirmWipe:!0})}catch{}},p=()=>{l(null)};return s.jsxs(s.Fragment,{children:[s.jsx(gl,{}),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:f=>t(f.target.value),onKeyDown:f=>f.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((f,v)=>s.jsxs("div",{style:{display:"flex",gap:"0.625rem",alignItems:"baseline",marginBottom:v<2?"0.5rem":0},children:[s.jsxs("span",{style:{color:"var(--accent)",fontWeight:700,fontSize:"0.95rem"},children:[v+1,"."]}),f]},v))})]})]})})]}),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:p,children:s.jsxs("div",{className:"card",onClick:f=>f.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:p,disabled:r,children:"Cancel"}),s.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:u,disabled:r,children:r?"Signing in...":"Wipe local data and sign in"})]})]})})]})}function hv(){const{setActiveContext:e}=Te(),t=Kt(),[n,r]=d.useState(""),[a,o]=d.useState(""),[i,l]=d.useState(""),[c,u]=d.useState(!1),p=async()=>{if(n.trim()){u(!0),l("");try{const v=await O.joinGroup(n.trim());e(v,v.myDomains[0]||""),t("/")}catch(v){l(v instanceof Error?v.message:"Failed to join group")}finally{u(!1)}}},f=async()=>{if(a.trim()){u(!0),l("");try{const v=await O.createGroup(a.trim());e(v,v.myDomains[0]||""),t("/")}catch(v){l(v instanceof Error?v.message:"Failed to create group")}finally{u(!1)}}};return s.jsxs(s.Fragment,{children:[s.jsx(gl,{}),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:v=>r(v.target.value),onKeyDown:v=>v.key==="Enter"&&p(),style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem"},disabled:c}),s.jsx("button",{className:"btn btn-primary",onClick:p,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:v=>o(v.target.value),onKeyDown:v=>v.key==="Enter"&&f(),style:{flex:1},disabled:c}),s.jsx("button",{className:"btn btn-secondary",onClick:f,disabled:c,children:"Create"})]})]})]})})]})}const ci="suveren-setup-ai-skipped",ui="suveren-setup-agent-done",di="suveren-setup-dismissed",gv={"hap-setup-ai-skipped":ci,"hap-setup-agent-done":ui,"hap-setup-dismissed":di};function vv(){for(const[e,t]of Object.entries(gv)){const n=localStorage.getItem(e);n!==null&&localStorage.getItem(t)===null&&localStorage.setItem(t,n),n!==null&&localStorage.removeItem(e)}}vv();const uo={"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 yv({aiConfigured:e,hasRunningIntegration:t,hasActiveAuth:n,hasAgentConnected:r,mcpEndpoint:a}){const[o,i]=d.useState(()=>localStorage.getItem(ci)==="true"),[l,c]=d.useState(()=>localStorage.getItem(ui)==="true"),[u,p]=d.useState(()=>localStorage.getItem(di)==="true"),[f,v]=d.useState(null),[y,x]=d.useState("claude-code"),[w,j]=d.useState(!1),h=[{label:"AI Assistant",detail:"A trusted AI helps you think through authorizations — surfacing risks and asking the right questions.",to:"/settings",status:e?"done":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(C=>C.status==="done"||C.status==="skipped").length,g=m===h.length,S=d.useCallback(()=>{localStorage.setItem(ci,"true"),i(!0)},[]),E=d.useCallback(()=>{localStorage.setItem(ui,"true"),c(!0),v(null)},[]),T=d.useCallback(()=>{localStorage.setItem(di,"true"),p(!0)},[]),k=d.useCallback(async C=>{try{await navigator.clipboard.writeText(C),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},[]);if(u||g)return null;const N=h.findIndex(C=>C.status==="pending");return 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((C,I)=>{const H=I===N,U=C.status==="done"||C.status==="skipped"?"●":"○",D=C.status==="done"?"var(--success)":C.status==="skipped"?"var(--text-tertiary)":H?"var(--accent)":"var(--text-tertiary)";return s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:H?"0.75rem":"0.25rem 0",borderRadius:H?"0.5rem":void 0,background:H?"var(--accent-subtle)":void 0},children:[s.jsx("span",{style:{color:D,fontSize:"0.75rem",marginTop:"0.2rem",flexShrink:0},children:U}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[C.to&&C.status==="pending"?s.jsx(Qe,{to:C.to,style:{fontSize:"0.9rem",fontWeight:H?600:500,color:H?"var(--accent)":"var(--text-primary)",textDecoration:"none"},children:C.label}):C.status==="pending"&&I===3?s.jsx("button",{onClick:()=>v(f===3?null:3),style:{background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"0.9rem",fontWeight:H?600:500,color:H?"var(--accent)":"var(--text-primary)"},children:C.label}):s.jsx("span",{style:{fontSize:"0.9rem",fontWeight:500,color:C.status==="done"?"var(--text-secondary)":"var(--text-tertiary)"},children:C.label}),C.optional&&C.status==="pending"&&s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",fontStyle:"italic"},children:"optional"}),C.status==="skipped"&&s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:"skipped"})]}),C.detail&&C.status==="pending"&&H&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginTop:"0.25rem",lineHeight:1.5},children:C.detail})]}),C.optional&&C.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"}),C.to&&C.status==="pending"&&s.jsx(Qe,{to:C.to,style:{color:"var(--text-tertiary)",textDecoration:"none",fontSize:"0.8rem",flexShrink:0},children:"›"})]}),I===3&&f===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(uo).map(([_,B])=>s.jsx("button",{onClick:()=>x(_),style:{padding:"0.375rem 0.75rem",fontSize:"0.75rem",fontWeight:y===_?600:400,background:y===_?"var(--accent-subtle)":"transparent",color:y===_?"var(--accent)":"var(--text-secondary)",border:`1px solid ${y===_?"var(--accent)":"var(--border)"}`,borderRadius:"0.375rem",cursor:"pointer"},children:B.label},_))}),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:uo[y].snippet(a)}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>k(uo[y].snippet(a)),children:w?"Copied":"Copy"}),s.jsx("button",{className:"btn btn-primary btn-sm",onClick:E,children:"Done"})]})]})]},I)})}),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 jn({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 fo(){return s.jsxs("div",{className:"skeleton-card",role:"status","aria-busy":"true","aria-label":"Loading",children:[s.jsx(jn,{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(jn,{variant:"line",style:{width:"35%"}}),s.jsx(jn,{variant:"line-sm",style:{width:"65%"}})]})]})}const xv=30*60;function mo(e){return e.replace(/@.*$/,"").split("/").pop()??e}function wv(){var _;const{domain:e}=Te(),[t,n]=d.useState([]),[r,a]=d.useState([]),[o,i]=d.useState([]),[l,c]=d.useState(!0),[u,p]=d.useState(!1),[f,v]=d.useState(!1),[y,x]=d.useState(!1),{entries:w,activeSessions:j,loading:h}=vl(),m=!h,g=d.useCallback(()=>{O.getMyAttestations().then(B=>{n(B),p(!0)}).catch(()=>p(!0)),O.getProposals(e||"owner").then(B=>{a(B),v(!0)}).catch(()=>v(!0)),O.getProposalsForApprover().then(B=>i(B)).catch(()=>i([])),O.getCredential("ai-config").then(B=>{c(B.configured),x(!0)}).catch(()=>x(!0))},[e]);fe("attestation-changed",g),fe("proposal-added",g),fe("proposal-resolved",g),fe("proposal-approved",g),fe("proposal-rejected",g),Ft(g,3e5,e);const S=u&&f&&y&&m,E=Rf(t),T=E.active,k=E.expired,N=T.filter(B=>B.remaining_seconds!==null&&B.remaining_seconds<=xv),C=r.filter(B=>B.status==="pending"),I=w.filter(B=>B.state==="running"),H=w.filter(B=>B.state==="starting"),U=w.filter(B=>B.state==="not-running"||B.state==="error"),D=[];for(const B of o)D.push({label:"Approval needed",detail:`${B.tool} — above-cap action under ${mo(B.profileId)}`,to:"/proposals",color:"var(--warning)"});for(const B of C)D.push({label:"Approval pending",detail:`${B.tool} awaiting your approval`,to:"/proposals",color:"var(--warning)"});for(const B of N){const q=Math.ceil((B.remaining_seconds??0)/60);D.push({label:"Expiring soon",detail:`${B.title??mo(B.profile_id)} — ${q} min remaining`,to:"/authorizations",color:"var(--warning)"})}for(const B of k)D.push({label:"Expired",detail:B.title??mo(B.profile_id),to:"/authorizations",color:"var(--danger)"});for(const B of U)D.push({label:B.state==="error"?"Integration error":"Integration stopped",detail:B.state==="error"&&((_=B.integration)!=null&&_.error)?`${B.manifest.name}: ${B.integration.error}`:`${B.manifest.name} is not running`,to:"/integrations",color:"var(--danger)"});for(const B of H)D.push({label:"Integration starting",detail:`${B.manifest.name} is coming up…`,to:"/integrations",color:"var(--warning)"});return l||D.push({label:"AI Assistant",detail:"Not configured — needed for gate advisory",to:"/settings",color:"var(--text-tertiary)"}),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"page-header",children:s.jsx("h1",{className:"page-title",children:"Dashboard"})}),S&&s.jsx(yv,{aiConfigured:l,hasRunningIntegration:I.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(Qe,{to:"/authorizations",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[u?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:T.length>0?"var(--success)":"var(--text-tertiary)"},children:T.length}):s.jsx(jn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Active"})]})}),s.jsx(Qe,{to:"/proposals",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[f?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:C.length>0?"var(--warning)":"var(--text-tertiary)"},children:C.length}):s.jsx(jn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pending Approvals"})]})}),s.jsx(Qe,{to:"/authorizations",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[u?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:k.length>0?"var(--danger)":"var(--text-tertiary)"},children:k.length}):s.jsx(jn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Expired"})]})}),s.jsx(Qe,{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:I.length>0?"var(--success)":"var(--text-tertiary)"},children:I.length}):s.jsx(jn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Integrations Running"})]})})]}),D.length>0?s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:D.map((B,q)=>s.jsx(Qe,{to:B.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:B.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:B.label}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:B.detail})]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"›"})]})},q))}):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(fo,{}),s.jsx(fo,{}),s.jsx(fo,{})]})]})}const Sv=["Scope & Limits","Intent","Authorize"];function _f({currentStep:e,onStepClick:t}){const n=Kt();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:Sv.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 Lc=40;function Pe(e,t){if(t)return t.slice(0,Lc);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,Lc)}function jv({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:"})," ",Pe(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 kv({integrationId:e,field:t,value:n,onChange:r,disabled:a}){const[o,i]=d.useState(null),[l,c]=d.useState(null),[u,p]=d.useState(!0);d.useEffect(()=>{let y=!1;return O.discoverScopeField(e,t).then(x=>{y||(i(x.options),p(!1))}).catch(x=>{y||(c(x instanceof Error?x.message:String(x)),p(!1))}),()=>{y=!0}},[e,t]);const f=new Set(n.split(",").map(y=>y.trim()).filter(Boolean)),v=y=>{const x=new Set(f);x.has(y)?x.delete(y):x.add(y),r(Array.from(x).join(","))};return u?s.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["Loading options from ",e,"…"]}):l||!o?s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--warning)",marginBottom:"0.5rem"},children:["Couldn't fetch options (",l??"no response","). Enter values manually, separated by commas."]}),s.jsx("input",{className:"form-input",type:"text",value:n,onChange:y=>r(y.target.value),disabled:a})]}):o.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:o.map(y=>{const x=y.extras??{},w=typeof x.access=="string"?x.access:void 0,j=w==="reader",h=x.primary===!0;return s.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.875rem",color:j?"var(--text-tertiary)":"var(--text-primary)",cursor:a||j?"not-allowed":"pointer"},title:j?"Read-only — you can authorize list/read but not writes":void 0,children:[s.jsx("input",{type:"checkbox",checked:f.has(String(y.value)),onChange:()=>v(String(y.value)),disabled:a||j}),s.jsx("span",{children:y.label||y.value}),h&&s.jsx("span",{style:{fontSize:"0.7rem",color:"var(--accent)",textTransform:"uppercase",letterSpacing:"0.04em"},children:"primary"}),w&&s.jsxs("span",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)"},children:["· ",w]})]},y.value)})})}function Cv(e){return e.replace(/@.*$/,"").split("/").pop()??e}function bv(e,t){return t.displayName?t.displayName:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function Nv(e){return e.type==="string"&&(e.format==="email"||e.format==="domain")}function Ev(e){var t;return!!(e.enum&&((t=e.constraint)!=null&&t.enforceable.includes("subset")))}function Mc(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 Pv(e){return!e||e==="count"?"":e==="minutes"?"min":e==="hours"?"hr":e==="days"?"days":e==="percent"?"%":e.startsWith("currency:")?e.slice(9):e}function Tv(e){return e?e==="minutes"?15:e==="percent"?5:e.startsWith("currency:")?10:1:1}function Iv(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 Rv(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 zv({id:e,value:t,onChange:n,disabled:r,placeholder:a,unit:o}){const i=Tv(o),l=Iv(o),c=Pv(o),u=Rv(t,o),p=t===""?null:Number(t),f=()=>{const y=t===""?0:Number(t),x=y%i,w=x===0?y+i:y+(i-x);n(String(w))},v=()=>{const y=t===""?0:Number(t);if(y<=0)return;const x=y%i,w=x===0?y-i:y-x;n(String(Math.max(0,w)))};return 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:v,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:y=>n(y.target.value),onFocus:y=>y.target.select(),disabled:r}),s.jsx("button",{type:"button",className:"stepper-btn stepper-increment",onClick:f,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(y=>s.jsx("button",{type:"button",className:`preset-chip${p===y.value?" preset-chip-selected":""}`,onClick:()=>n(String(y.value)),children:y.label},y.value))}),u&&s.jsxs("div",{className:"bounded-input-echo",children:["≈ ",u]})]})}function Fc({htmlFor:e,label:t,description:n}){const[r,a]=d.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 _v({id:e,value:t,onChange:n,disabled:r,format:a,placeholder:o}){const[i,l]=d.useState(""),[c,u]=d.useState(!1),p=d.useRef(null),f=t?t.split(",").map(h=>h.trim()).filter(Boolean):[],v=h=>{const m=h.trim();if(!m)return;if(!Mc(m,a)){u(!0);return}u(!1);const g=f.includes(m)?f:[...f,m];n(g.join(",")),l("")},y=h=>{const m=f.filter((g,S)=>S!==h);n(m.join(","))},x=h=>{h.key==="Enter"||h.key===","||h.key==="Tab"?i.trim()&&(h.preventDefault(),v(i)):h.key==="Backspace"&&!i&&f.length>0&&y(f.length-1)},w=h=>{const m=h.clipboardData.getData("text");if(m.includes(",")){h.preventDefault();const S=m.split(",").map(T=>T.trim()).filter(Boolean).filter(T=>Mc(T,a)),E=[...new Set([...f,...S])];n(E.join(",")),l(""),u(!1)}},j=a==="email"?"Type email and press Enter...":"Type domain and press Enter...";return s.jsxs("div",{className:`tag-input${c?" tag-input-invalid":""}`,onClick:()=>{var h;return(h=p.current)==null?void 0:h.focus()},children:[f.map((h,m)=>s.jsxs("span",{className:"tag-pill",children:[h,!r&&s.jsx("button",{type:"button",className:"tag-remove",onClick:g=>{g.stopPropagation(),y(m)},"aria-label":`Remove ${h}`,children:"×"})]},h)),!r&&s.jsx("input",{ref:p,id:e,className:"tag-input-field",type:"text",value:i,onChange:h=>{l(h.target.value),u(!1)},onKeyDown:x,onPaste:w,onBlur:()=>{i.trim()&&v(i)},placeholder:f.length===0?o??j:""})]})}function Av({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(u=>u!==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 Oc({fieldKey:e,fieldDef:t,value:n,onChange:r,prefix:a,readOnly:o,twoColumn:i,discoveryIntegrationId:l}){const c=bv(e,t),u=`${a}-field-${e}`,p=s.jsx(s.Fragment,{children:Ev(t)?s.jsx(Av,{id:u,options:t.enum,value:n,onChange:f=>r(e,f),disabled:o}):(()=>{const f=t.boundType;return(f==null?void 0:f.kind)==="enum"&&Array.isArray(f.values)})()?s.jsxs("select",{id:u,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:o,children:[s.jsx("option",{value:"",children:"Select..."}),t.boundType.values.map(f=>s.jsx("option",{value:f,children:f},f))]}):"enum"in t&&t.enum?s.jsxs("select",{id:u,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:o,children:[s.jsx("option",{value:"",children:"Select..."}),t.enum.map(f=>s.jsx("option",{value:f,children:f},f))]}):t.type==="number"?s.jsx(zv,{id:u,value:n,onChange:f=>r(e,f),disabled:o,unit:t.unit}):Nv(t)?s.jsx(_v,{id:u,value:n,onChange:f=>r(e,f),disabled:o,format:t.format}):l?s.jsx(kv,{integrationId:l,field:e,value:n,onChange:f=>r(e,f),disabled:o}):s.jsx("input",{id:u,className:"form-input",type:"text",value:n,onChange:f=>r(e,f.target.value),disabled:o})});return i?s.jsxs("div",{className:"bounds-field-row",children:[s.jsx("div",{className:"bounds-field-label",children:s.jsx(Fc,{htmlFor:u,label:c,description:t.description})}),s.jsx("div",{className:"bounds-field-input",children:p})]},`${a}-${e}`):s.jsxs("div",{className:"form-group",children:[s.jsx(Fc,{htmlFor:u,label:c,description:t.description}),p]},`${a}-${e}`)}function $v(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 u=Number(c);if(!isNaN(u)&&u>l){o=!0;break}}return o?r?"above-approvers":"hard-ceiling":"within-cap"}function Lv(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 Mv({profile:e,onConfirm:t,onCancel:n,readOnly:r,initialBounds:a,initialContext:o,initialFrame:i,profileConfig:l,approverNames:c,adminName:u}){const p=e.boundsSchema??e.frameSchema,f=e.contextSchema,v=p?Object.entries(p.fields).filter(([P])=>!(P==="profile"||P==="path")):[],y=f&&f.keyOrder.length>0?Object.entries(f.fields):[],x=a??i??{},w=o??{},j={};for(const[P]of v)j[P]=x[P]!==void 0?String(x[P]):"";const h={};for(const[P]of y)h[P]=w[P]!==void 0?String(w[P]):"";const[m,g]=d.useState(j),[S,E]=d.useState(h),[T,k]=d.useState(null);d.useEffect(()=>{const P=Cv(e.id);O.getIntegrationManifests().then(({manifests:z})=>{const $=z.find(L=>L.profile===P&&L.contextDiscovery&&Object.keys(L.contextDiscovery).length>0);k($??null)}).catch(()=>k(null))},[e.id]);const N=$v(m,l),C=Lv(m,l==null?void 0:l.caps),I=(P,z)=>{g($=>({...$,[P]:z}))},H=(P,z)=>{E($=>({...$,[P]:z}))},U=()=>{const P={profile:e.id};for(const[$,L]of v)L.type==="number"?P[$]=m[$]===""?0:Number(m[$]):P[$]=m[$];const z={};for(const[$,L]of y)L.type==="number"?z[$]=S[$]===""?0:Number(S[$]):z[$]=S[$];return[P,z]},D=()=>{const[P,z]=U();t(P,z)},_=()=>{const P=(l==null?void 0:l.caps)??{},z={...m};for(const V of C)P[V]!==void 0&&(z[V]=String(P[V]));g(z);const $={profile:e.id};for(const[V,ee]of v)if(ee.type==="number"){const X=z[V]??"";$[V]=X===""?0:Number(X)}else $[V]=z[V]??"";const L={};for(const[V,ee]of y)ee.type==="number"?L[V]=S[V]===""?0:Number(S[V]):L[V]=S[V];t($,L)},B=P=>{const z=l==null?void 0:l.caps;if(!z||z[P]===void 0)return null;const $=z[P],L=C.has(P);return N==="hard-ceiling"&&L?s.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--danger)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",$," — exceeds team ceiling"]}):N==="above-approvers"&&L?s.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--warning)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",$," — above cap"]}):s.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--success)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",$," ok"]})},q=()=>{var P;if(N==="no-config")return null;if(N==="approvers-dormant"){const z=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: ",z]}),s.jsxs("div",{children:["No caps are set on this profile, so ",z," won't gate any action under this authority. Your intent will still be encrypted and shared with them as an accountability record — they can read what you authorised, even though they aren't reviewing individual actions."]})]})}if(N==="within-cap")return 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(N==="above-approvers"){const z=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 ",z,". Within-cap actions run per the mode you choose."]})]})}if(N==="hard-ceiling"){const z=Array.from(C)[0],$=z?(P=l==null?void 0:l.caps)==null?void 0:P[z]:void 0,L=u??"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 ",$??"the configured limit",". Lower your bound or ask ",L," 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:_,children:"Save below cap"}),n&&s.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"})]})]})}return null},se=N==="hard-ceiling";return s.jsxs("div",{children:[y.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"})]})]}),y.map(([P,z])=>{var L;const $=!!((L=T==null?void 0:T.contextDiscovery)!=null&&L[P]);return s.jsx(Oc,{fieldKey:P,fieldDef:z,value:S[P],onChange:H,prefix:"context",readOnly:r,discoveryIntegrationId:$?T.id:void 0},`context-${P}`)})]}),v.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:v.map(([P,z])=>{var $;return s.jsxs("div",{style:{display:"contents"},children:[s.jsx(Oc,{fieldKey:P,fieldDef:z,value:m[P],onChange:I,prefix:"bounds",readOnly:r,twoColumn:!0}),N!=="no-config"&&(($=l==null?void 0:l.caps)==null?void 0:$[P])!==void 0&&s.jsx("div",{style:{gridColumn:"2 / 3",display:"flex",alignItems:"center",paddingBottom:"0.5rem"},children:B(P)})]},`bounds-${P}`)})}),q()]}),s.jsx("button",{className:"btn btn-primary",onClick:D,disabled:se,style:{marginTop:"0.5rem"},children:r?"Next: Gates":"Next: Problem Statement"})]})}function Fv(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 Ov(e){return e.replace(/```(?:markdown|md)?\s*\n[\s\S]*?```/,"").trim()}const Bv="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 fs({target:e,currentText:t,onApply:n,greeting:r,placeholder:a,title:o}){const[i,l]=d.useState([{role:"assistant",content:r??Bv}]),[c,u]=d.useState(""),[p,f]=d.useState(!1),[v,y]=d.useState(null),x=d.useRef(null);d.useEffect(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[i,p]);const w=async()=>{const h=c.trim();if(!h||p)return;const m=[...i,{role:"user",content:h}];l(m),u(""),y(null),f(!0);try{const g=await O.aiChat({target:e,currentText:t,messages:m.filter((S,E)=>!(E===0&&S.role==="assistant"))});g.success&&g.reply?l(S=>[...S,{role:"assistant",content:g.reply}]):y(g.error??"AI returned no reply")}catch(g){y(g instanceof Error?g.message:"Chat failed")}finally{f(!1)}},j=h=>{h.key==="Enter"&&!h.shiftKey&&!h.nativeEvent.isComposing&&(h.preventDefault(),w())};return s.jsxs("div",{className:"intent-chat",children:[s.jsx("h3",{className:"card-title",children:o??"AI Assistant"}),s.jsxs("div",{ref:x,className:"chat-messages",children:[i.map((h,m)=>{const g=h.role==="assistant"?Fv(h.content):null,S=g?Ov(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}),g!==null&&s.jsxs(s.Fragment,{children:[s.jsx("pre",{className:"chat-fenced-block",children:g}),s.jsx("button",{type:"button",className:"btn btn-primary btn-sm chat-apply-btn",onClick:()=>n(g),children:"Apply this draft"})]})]})},m)}),p&&s.jsx("div",{className:"chat-msg assistant",children:s.jsx("div",{className:"chat-msg-body chat-msg-thinking",children:"Thinking…"})})]}),v&&s.jsx("div",{className:"error-message",children:v}),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=>u(h.target.value),onKeyDown:j,placeholder:a??"Ask for help articulating the intent…",rows:1,disabled:p}),s.jsx("button",{type:"button",className:"chat-send-btn",onClick:w,disabled:p||!c.trim(),"aria-label":"Send",children:"↑"})]}),s.jsx("div",{className:"chat-composer-hint",children:"Enter to send · Shift+Enter for newline"})]})]})}function Af({open:e,onClose:t,children:n,ariaLabel:r}){const a=d.useRef(null),o=d.useRef(null);return d.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]),sf.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 Dv(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Uv(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 u of[c.scope,...c.scope.split(",").map(p=>p.trim())]){const p=u.toLowerCase();u&&!a.has(p)&&(a.add(p),r.push(u))}r.sort((c,u)=>u.length-c.length);const o=c=>{const u=c.toLowerCase();return t.filter(p=>{var f,v;return((f=p.scope)==null?void 0:f.toLowerCase())===u||((v=p.scope)==null?void 0:v.split(",").map(y=>y.trim().toLowerCase()).includes(u))})},i=["\\[\\d+\\]",...r.map(Dv)],l=new RegExp(`(${i.join("|")})`,"gi");return e.split(l).filter(c=>c!=="").map(c=>{const u=/^\[(\d+)\]$/.exec(c);if(u){const p=t[Number(u[1])-1];if(p){const f=p.scope&&p.scope!=="all (unscoped)"?p.scope:"all recipients",v=n?`${n}: ${f}`:f;return{text:c,label:v,matched:[p]}}}else if(r.some(p=>p.toLowerCase()===c.toLowerCase())){const p=o(c);if(p.length>0)return{text:c,label:c,matched:p}}return{text:c,label:c,matched:null}})}const Bc=`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 Wv(e,t,n,r){return Uv(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 Hv(){var A;const e=Kt(),[t]=bf(),n=Number(t.get("step"))||2,[r,a]=d.useState(null),[o,i]=d.useState(null),[l,c]=d.useState(n),[u,p]=d.useState(null),[f,v]=d.useState(null),[y,x]=d.useState(Bc),[w,j]=d.useState(!1),[h,m]=d.useState(!0),[g,S]=d.useState(null),[E,T]=d.useState([]),[k,N]=d.useState(void 0),[C,I]=d.useState(!1),[H,U]=d.useState(null),[D,_]=d.useState(null),[B,q]=d.useState(null),[se,P]=d.useState([]),[z,$]=d.useState(null);d.useEffect(()=>{var Ie;const R=sessionStorage.getItem("agentAuth");if(!R){e("/agent/new");return}const Y=JSON.parse(R);a(Y);const Se=sessionStorage.getItem("agentGate");if(Se){const je=JSON.parse(Se);je.bounds&&p(je.bounds),je.context&&v(je.context),(Ie=je.gateContent)!=null&&Ie.intent&&x(je.gateContent.intent)}O.getProfile(Y.profileId).then(je=>i(je)).catch(()=>e("/agent/new")).finally(()=>m(!1)),Y.groupId&&Promise.all([O.getTeamProfileConfig(Y.groupId,Y.profileId).catch(()=>null),O.getGroupById(Y.groupId).catch(()=>null),O.listUsers().catch(()=>[])]).then(([je,hn,ur])=>{if(S(je),je){const It=new Map;for(const ne of ur){const ft=ne.name&&ne.email?`${ne.name} (${ne.email})`:ne.name||ne.email||ne.id;It.set(ne.id,ft)}const nt=(hn==null?void 0:hn.members)??[];for(const ne of nt){const ft=ne.userId??ne.id;ft&&(ne.name&&ne.email?It.set(ft,`${ne.name} (${ne.email})`):ne.name&&It.set(ft,ne.name))}const dr=(je.approvers??[]).map(ne=>It.get(ne)??ne);T(dr);const Rt=nt.find(ne=>ne.role==="admin");if(Rt){const ne=Rt.userId??Rt.id;ne&&N(It.get(ne)??Rt.name)}}})},[e]);const L=u?Object.entries(u).filter(([R])=>R!=="profile"&&R!=="path").map(([R,Y])=>`${R} = ${Y}`).join(", "):"",V=(R,Y)=>{p(R),v(Y),c(3)},ee=y.trim()!==Bc.trim()&&y.trim()!=="",X=R=>{ee&&!confirm("Replace your current intent with the AI draft?")||x(R)},ge=()=>{const R=o==null?void 0:o.ttl,Y={intent:y};sessionStorage.setItem("agentGate",JSON.stringify({bounds:u,context:f,gateContent:Y,ttlConfig:R})),e("/agent/review")},b=async()=>{if(r){I(!0),U(null),_(null),q(null),P([]),$(null);try{const R=await O.aiIntentReview({profileId:r.profileId,newIntent:y,context:f??void 0});P(R.grants??[]),R.success?R.review?U(R.review):_(R.note??"No other authorizations on this profile to compare against."):q(R.error??"Check failed.")}catch(R){q(R instanceof Error?R.message:"Check failed.")}finally{I(!1)}}},W=R=>{x(R),(H||D||B)&&(U(null),_(null),q(null),P([]),$(null))};return h||!r||!o?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):s.jsxs(s.Fragment,{children:[s.jsx(_f,{currentStep:l,onStepClick:R=>{R>=2&&c(R)}}),s.jsx(jv,{profileId:r.profileId,bounds:L||void 0,groupName:r.groupName,domain:r.domain}),l===2&&s.jsx("div",{className:"card",children:s.jsx(Mv,{profile:o,onConfirm:V,onCancel:()=>e("/agent/new"),initialBounds:u||void 0,initialContext:f||void 0,profileConfig:g,approverNames:E,adminName:k})}),l===3&&s.jsxs("div",{className:"intent-layout",children:[s.jsx("div",{className:"card intent-pane chat",children:s.jsx(fs,{target:{kind:"intent",profileId:r.profileId,bounds:L||void 0},currentText:y,onApply:X})}),s.jsxs("div",{className:"card intent-pane document",children:[s.jsx("h3",{className:"card-title",children:"What should your agent know?"}),s.jsx("textarea",{className:"intent-textarea",value:y,onChange:R=>W(R.target.value)}),s.jsxs("div",{className:"char-counter",children:[y.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:b,disabled:C||!ee,children:C?"Checking…":"Check against my other grants"}),B&&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:B})]}),D&&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:D})]}),H&&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:Wv(H,se,$,Pe(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:ge,disabled:!ee,children:"Continue to Review"})]}),(((A=g==null?void 0:g.approvers)==null?void 0:A.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:()=>j(!0),"aria-label":"Open intent assistant",children:"Get help with intent"}),s.jsx(Af,{open:w,onClose:()=>j(!1),ariaLabel:"Intent assistant",children:s.jsx(fs,{target:{kind:"intent",profileId:r.profileId,bounds:L||void 0},currentText:y,onApply:R=>{X(R),j(!1)}})}),z&&s.jsx("div",{className:"modal-backdrop",onClick:R=>R.target===R.currentTarget&&$(null),children:s.jsxs("div",{className:"modal",children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("h3",{className:"modal-title",children:z.length>1?`Existing authorizations (${z.length})`:"Existing authorization"}),s.jsx("button",{className:"modal-close",onClick:()=>$(null),children:"×"})]}),s.jsx("div",{className:"modal-body",children:z.map((R,Y)=>{var Se;return s.jsxs("div",{style:{marginBottom:Y<z.length-1?"1rem":0,paddingBottom:Y<z.length-1?"1rem":0,borderBottom:Y<z.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:R.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:((Se=R.intent)==null?void 0:Se.trim())||"(no intent recorded)"}),Object.entries(R.bounds).filter(([Ie])=>Ie!=="profile"&&Ie!=="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(R.bounds).filter(([Ie])=>Ie!=="profile"&&Ie!=="path").map(([Ie,je])=>`${Ie}: ${je}`).join(" · ")})]})]},Y)})})]})})]})]})}function Vv(e){return e.normalize("NFC").replace(/\r\n?/g,`
|
|
60
|
-
`).split(`
|
|
61
|
-
`).map(a=>a.replace(/[ \t]+$/,"")).join(`
|
|
62
|
-
`).replace(/\n+$/,"")}async function fi(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 $f(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 fi(a)}`}async function Lf(e,t){if(!t.contextSchema||t.contextSchema.keyOrder.length===0)return`sha256:${await fi("")}`;const r=t.contextSchema.keyOrder.map(o=>`${o}=${String(e[o])}`).join(`
|
|
64
|
-
`);return`sha256:${await fi(r)}`}async function ms(e){const t=new TextEncoder().encode(Vv(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 Mf(e,t){return{frameHash:e.frame_hash??e.bounds_hash??t.boundsHash,boundsHash:e.bounds_hash??t.boundsHash,contextHash:t.contextHash,context:t.context,gateContent:t.gateContent,...t.path?{path:t.path}:{}}}function Dc(e){return e==null?new Set:new Set(String(e).split(",").map(t=>t.trim().toLowerCase()).filter(Boolean))}function Kv(e,t){for(const n of e)if(t.has(n))return!0;return!1}function Gv(e,t,n){for(const r of e){const a=Dc(t[r]),o=Dc(n[r]);if(!(a.size===0||o.size===0)&&!Kv(a,o))return!1}return!0}function Yv(){var Rt,ne,ft;const e=Kt(),{user:t,mode:n,domain:r}=Te(),[a,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(null),[p,f]=d.useState("immediate"),[v,y]=d.useState(1800),[x,w]=d.useState(86400),[j,h]=d.useState(""),[m,g]=d.useState("hours"),[S,E]=d.useState(""),[T,k]=d.useState(!1),[N,C]=d.useState(!1),[I,H]=d.useState(""),[U,D]=d.useState(null),[_,B]=d.useState([]),[q,se]=d.useState(!1),[P,z]=d.useState([]);d.useEffect(()=>{const Q=sessionStorage.getItem("agentAuth"),F=sessionStorage.getItem("agentGate");if(!Q||!F){e("/agent/new");return}const G=JSON.parse(Q),J=JSON.parse(F),de={bounds:J.bounds??{},context:J.context??{},gateContent:J.gateContent};o(G),l(de),J.ttlConfig&&(y(J.ttlConfig.default??1800),w(J.ttlConfig.max??86400)),O.getProfile(G.profileId).then(ve=>{var mt;if(u(ve),!S){const zt=ve.name??((mt=G.profileId.split("/").pop())==null?void 0:mt.replace(/@.*$/,""))??"",Ge=[];if(de.context&&ve.contextSchema)for(const pt of ve.contextSchema.keyOrder){const re=de.context[pt];if(re!==void 0&&re!==""){const rt=String(re).split(",").map(Bf=>Bf.trim()).filter(Boolean);Ge.push(rt.join(", "))}}const _t=Ge.length>0?`${zt}: ${Ge.join(" · ")}`:zt;E(_t)}}).catch(()=>{}),G.groupId?Promise.all([O.getTeamProfileConfig(G.groupId,G.profileId).catch(()=>null),O.getGroupById(G.groupId).catch(()=>null),O.listUsers().catch(()=>[])]).then(([ve,mt,zt])=>{if(D(ve),ve){const Ge=new Map;for(const re of zt){const rt=re.name&&re.email?`${re.name} (${re.email})`:re.name||re.email||re.id;Ge.set(re.id,rt)}const _t=(mt==null?void 0:mt.members)??[];for(const re of _t){const rt=re.userId??re.id;rt&&(re.name&&re.email?Ge.set(rt,`${re.name} (${re.email})`):re.name&&Ge.set(rt,re.name))}const pt=(ve.approvers??[]).map(re=>Ge.get(re)??re);B(pt)}}).finally(()=>{se(!0)}):se(!0)},[e]),d.useEffect(()=>{if(!(a!=null&&a.profileId))return;const Q=a.profileId;O.getEnrichedAuthorizations().then(F=>{const G=F.filter(J=>J.profileId===Q).map(J=>({bounds:J.bounds,context:J.context??{},intent:J.intent}));z(G)}).catch(()=>z([]))},[a==null?void 0:a.profileId]);const $=async()=>{if(!(!a||!i||!c||!t)){if(!a.groupId){H("No active group; cannot create authorization.");return}C(!0),H("");try{const Q=r||a.domain||"owner",F=await $f(i.bounds,c),G=await Lf(i.context,c),[J,de]=await Promise.all([ms(i.gateContent.intent),ms(JSON.stringify({profile:a.profileId,domain:Q,group:a.groupId}))]);let ve,mt,zt,Ge;if(a.isTeam){const re=await O.getApproversPubkeys(a.groupId,a.profileId);if(re.length>0){const rt=await O.encryptIntent(i.gateContent.intent,re);ve=rt.intentCiphertext,mt=rt.encryptedKeys,zt=rt.approversFrozen,Ge=rt.intentDisclosureHash}}const _t=await O.attest({profile_id:a.profileId,bounds:i.bounds,bounds_hash:F,context_hash:G,domain:Q,did:t.did,gate_content_hashes:{intent:J},execution_context_hash:de,group_id:a.groupId,ttl:v,commitment_mode:p==="per-action"?"review":"automatic",title:S.trim(),intent_ciphertext:ve,encrypted_keys:mt,approvers_frozen:zt,intent_disclosure_hash:Ge,disclose_identity:T}),pt=_t.frame_hash??_t.bounds_hash??F;try{await O.pushGateContent(Mf(_t,{boundsHash:F,contextHash:G,context:i.context,gateContent:i.gateContent}))}catch(re){try{await O.revokeAttestation(pt,"Auto-revoked: gate content push failed")}catch{}throw new Error(`Authorization signed but gate content delivery failed. The attestation was revoked. Please try again. (${re instanceof Error?re.message:"Unknown error"})`)}sessionStorage.removeItem("agentAuth"),sessionStorage.removeItem("agentGate"),e(`/authorizations?highlight=${encodeURIComponent(pt)}`)}catch(Q){H(Q instanceof Error?Q.message:"Attestation failed")}finally{C(!1)}}};if(!a||!i)return s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."});const L=Object.entries(i.bounds).filter(([Q])=>Q!=="profile"&&Q!=="path"),V=Object.entries(i.context),X=((U==null?void 0:U.caps)!=null?Object.keys(U.caps):[]).length!==0,ge=_.length>0?_.join(", "):((U==null?void 0:U.approvers)??[]).join(", "),b=X?`Within-cap actions run per the mode you choose above. Over-cap actions will require approval from you and ${ge}, 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.",W=X?`Over-cap actions will be reviewed by you and ${ge}. Within-cap actions run per the mode you chose above.`:`Approvers ${ge} can read your intent but won't gate any action — no caps configured on this profile.`,A=!!((Rt=U==null?void 0:U.approvers)!=null&&Rt.length),R=v>x,Y={flex:1,padding:"0.75rem",border:p==="immediate"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:p==="immediate"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},Se={flex:1,padding:"0.75rem",border:p==="per-action"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:p==="per-action"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},Ie=((ne=c==null?void 0:c.contextSchema)==null?void 0:ne.keyOrder)??[],je=P.filter(Q=>Gv(Ie,i.context,Q.context)),hn=je.length>0,ur=Pe(a.profileId),It=Q=>{const F=Object.values(Q).map(G=>String(G).trim()).filter(Boolean);return F.length>0?F.join(", "):"all (unscoped)"},nt=je.map(Q=>It(Q.context)).join("; "),dr=`This grant's scope overlaps an existing grant on ${ur} (scoped to: ${nt}). When two grants cover the same actions, the agent may act under either — the more permissive limits effectively apply. Confirm this is intended before authorizing.`;return s.jsxs(s.Fragment,{children:[s.jsx(_f,{currentStep:4,onStepClick:Q=>{Q<=3&&e(`/agent/gate?step=${Q}`)}}),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."}),I&&s.jsx("div",{className:"error-message",children:I}),s.jsxs("dl",{className:"review-grid",children:[s.jsx("dt",{children:"Profile"}),s.jsxs("dd",{children:[Pe(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:q?(((ft=U==null?void 0:U.approvers)==null?void 0:ft.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:[ge,s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:b})]}):s.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Loading…"})})]}),s.jsx("dt",{children:"TTL"}),s.jsx("dd",{children:"30 minutes"})]}),!!L.length&&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:"Bounds"}),s.jsx("dl",{className:"review-grid",children:L.map(([Q,F])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:Q}),s.jsx("dd",{children:String(F)})]},Q))})]}),!!V.length&&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:V.map(([Q,F])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:Q}),s.jsx("dd",{children:String(F)})]},Q))})]}),s.jsx("div",{className:"gate-content-block",children:s.jsxs("div",{className:"gate-content-item",children:[s.jsx("div",{className:"gate-content-label",children:"Intent"}),s.jsx("div",{className:"gate-content-text",children:i.gateContent.intent})]})}),s.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginTop:"1rem",marginBottom:"0.5rem"},children:"Commitment"}),s.jsxs("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"1.25rem"},children:[s.jsxs("button",{onClick:()=>f("immediate"),style:Y,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("button",{onClick:()=>f("per-action"),style:Se,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."})]})]}),hn?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:dr})]})]}):null,s.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"Duration"}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",marginBottom:"1.25rem",alignItems:"center"},children:[[{label:"1 hour",seconds:3600},{label:"24 hours",seconds:86400},{label:"7 days",seconds:604800},{label:"30 days",seconds:2592e3},{label:"1 year",seconds:31536e3}].filter(Q=>Q.seconds<=x).map(Q=>s.jsx("button",{onClick:()=>{y(Q.seconds),h("")},style:{padding:"0.5rem 0.85rem",border:v===Q.seconds?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"0.375rem",background:v===Q.seconds?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"inherit",color:"var(--text-primary)"},children:Q.label},Q.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:Q=>{h(Q.target.value);const F=parseInt(Q.target.value,10);if(F>0){const G=m==="days"?F*86400:F*3600;y(Math.min(G,x))}}}),s.jsxs("select",{className:"form-input",style:{padding:"0.45rem 0.5rem",fontSize:"0.85rem"},value:m,onChange:Q=>{g(Q.target.value);const F=parseInt(j,10);if(F>0){const G=Q.target.value==="days"?F*86400:F*3600;y(Math.min(G,x))}},children:[s.jsx("option",{value:"hours",children:"hours"}),s.jsx("option",{value:"days",children:"days"})]})]}),R&&s.jsxs("span",{style:{fontSize:"0.75rem",color:"var(--danger)"},children:["Maximum: ",x>=86400?`${Math.floor(x/86400)} days`:`${Math.floor(x/3600)} hours`]})]}),s.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.5rem"},children:"Title"}),s.jsxs("div",{style:{marginBottom:"1.25rem"},children:[s.jsx("input",{type:"text",className:"form-input",placeholder:`e.g. ${Pe(a.profileId)}: daily operations`,value:S,onChange:Q=>E(Q.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.jsx("div",{style:{marginBottom:"1.25rem"},children:s.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"0.5rem",cursor:"pointer"},children:[s.jsx("input",{type:"checkbox",checked:T,onChange:Q=>k(Q.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.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:N||!S.trim(),children:N?"Signing...":p==="immediate"?"Authorize":"Authorize (Review Mode)"})]}),s.jsx("div",{style:{marginTop:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)",textAlign:"center",display:A?"block":"none"},children:W})]})]})}const Qv={card:"💳",mail:"✉️"};function Jv({manifest:e,integration:t,state:n,onStatusChange:r,onSuccess:a}){var ge;const[o,i]=d.useState({}),[l,c]=d.useState(!1),[u,p]=d.useState(!1),[f,v]=d.useState({}),[y,x]=d.useState(!1),[w,j]=d.useState(null),[h,m]=d.useState(!1),[g,S]=d.useState(!1),[E,T]=d.useState(!1),[k,N]=d.useState(!1),[C,I]=d.useState({});d.useEffect(()=>{let b=!1;return O.getCredential(e.id).then(W=>{var A;if(!(b||!W.configured)){if(c(!0),p(!0),W.fields){const R={};for(const Y of e.credentials.fields)W.fields[Y.key]!=null&&(R[Y.key]=W.fields[Y.key]);v(R)}if(e.oauth){const R=((A=W.fieldNames)==null?void 0:A.includes(e.oauth.tokenStorage))??!1;x(R),R&&O.getOAuthHealth(e.id).then(Y=>{b||j(Y)})}}}).catch(()=>{}),()=>{b=!0}},[e.id,e.oauth]);const H=!!e.oauth||e.credentials.fields.some(b=>!b.optional),U=e.oauth?y:l,D=!H||U,_=n==="starting"?"starting":D?t!=null&&t.running?"running":!l&&e.credentials.fields.length>0?"unconfigured":"ready":e.oauth&&l&&!y?"needs-oauth":"unconfigured",B=async()=>{if(e.credentials.fields.some(W=>{var A;return(A=o[W.key])==null?void 0:A.trim()})){m(!0);try{await O.setCredential(e.id,o),c(!0),i({}),e.oauth?a(`${e.name} credentials saved!`):(a(`${e.name} credentials saved — starting integration...`),await P())}catch{a(`Failed to save ${e.name} credentials`)}finally{m(!1)}}},q=async()=>{if(e.credentials.fields.some(W=>{var A;return(A=o[W.key])==null?void 0:A.trim()})){m(!0);try{await O.setCredential(e.id,o),i({}),c(!0),e.oauth?a(`${e.name} credentials saved — now click Connect.`):(N(!1),a(`${e.name} credentials updated — restarting...`),await P())}catch{a(`Failed to update ${e.name} credentials`)}finally{m(!1)}}},se=()=>{window.open(`/auth/oauth/${e.id}/start`,"_blank","width=600,height=700");const b=setInterval(async()=>{var W;try{const A=await O.getCredential(e.id);A.configured&&e.oauth&&((W=A.fieldNames)!=null&&W.includes(e.oauth.tokenStorage))&&(x(!0),N(!1),j(null),clearInterval(b),a(`${e.name} connected — starting integration...`),O.getOAuthHealth(e.id).then(j).catch(()=>{}),await P())}catch{}},2e3);setTimeout(()=>clearInterval(b),12e4)},P=async()=>{T(!0);try{const b=await O.activateIntegration(e.id);b.warning?a(b.warning):a(`${e.name} integration started with ${b.tools.length} tools`),r()}catch(b){a(`Failed to start ${e.name}: ${b instanceof Error?b.message:"Unknown error"}`)}finally{T(!1)}},z=async()=>{try{await O.removeMcpIntegration(e.id),a(`${e.name} integration removed`),r()}catch{a(`Failed to remove ${e.name}`)}},$=Qv[e.icon]??"🔧",L=_==="running"?{c:"int-chip-ok",t:"Running"}:_==="starting"?{c:"int-chip-idle",t:"Starting"}:t&&!t.running&&t.error?{c:"int-chip-bad",t:"Crashed"}:{c:"int-chip-idle",t:"Stopped"},V=e.oauth&&y&&(w==null?void 0:w.status)==="failed",ee=H?V?{c:"int-chip-bad",t:"Auth failed"}:U?{c:"int-chip-ok",t:"Auth OK"}:{c:"int-chip-idle",t:"Not set up"}:{c:"int-chip-idle",t:"No auth"},X=b=>b.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:$}),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:[_!=="unconfigured"&&_!=="needs-oauth"&&s.jsxs("span",{className:`int-chip ${L.c}`,children:[s.jsx("span",{className:"int-dot"}),L.t]}),s.jsxs("span",{className:`int-chip ${ee.c}`,children:[s.jsx("span",{className:"int-dot"}),ee.t]})]})]}),e.oauth&&y&&s.jsx("div",{className:"int-account",style:{marginTop:"0.7rem"},children:w!=null&&w.account?s.jsxs(s.Fragment,{children:["Connected as ",s.jsx("b",{children:w.account})]}):s.jsx("span",{className:"int-none",children:"Account not recorded — reconnect to capture which account is used"})}),V&&!k&&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",w!=null&&w.error?` — ${w.error}`:"",". Reconnect to restore access."]})]}),s.jsxs("button",{className:"btn btn-primary btn-sm",onClick:se,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:((ge=e.oauth.scopes)==null?void 0:ge.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&&(_!=="running"||V)&&s.jsxs("div",{style:{marginBottom:"0.75rem"},children:[s.jsxs("button",{onClick:()=>S(!g),style:{background:"none",border:"none",padding:0,fontSize:"0.8rem",color:"var(--accent)",cursor:"pointer",display:"flex",alignItems:"center",gap:"0.375rem"},children:[s.jsx("span",{style:{transition:"transform 0.2s",transform:g?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"}),"How to set up ",e.name]}),g&&s.jsx("div",{style:{marginTop:"0.75rem",paddingLeft:"0.25rem"},children:e.setupGuide.map((b,W)=>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:W+1}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.125rem"},children:b.title}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",lineHeight:1.5},children:[X(b.description),b.link&&s.jsxs(s.Fragment,{children:[" ",s.jsxs("a",{href:b.link,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"0.8rem"},children:["Open ","↗"]})]})]})]})]},W))})]}),_==="starting"&&s.jsxs("div",{className:"service-status",style:{color:"var(--warning)"},children:[s.jsx("span",{className:"service-status-dot",style:{background:"var(--warning)"}}),"Starting…"]}),k&&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"}),u&&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(b=>s.jsxs("div",{className:"form-group",style:{marginBottom:"0.6rem"},children:[s.jsx("label",{className:"form-label",children:b.label}),b.type==="password"?s.jsxs("div",{className:"cred-field",children:[s.jsx("input",{className:"form-input",type:C[b.key]?"text":"password",placeholder:b.placeholder,value:o[b.key]||"",onChange:W=>i(A=>({...A,[b.key]:W.target.value}))}),s.jsx("button",{className:"cred-toggle",onClick:()=>I(W=>({...W,[b.key]:!W[b.key]})),children:C[b.key]?"hide":"show"})]}):s.jsx("input",{className:"form-input",type:"text",placeholder:b.placeholder,value:o[b.key]||"",onChange:W=>i(A=>({...A,[b.key]:W.target.value}))})]},b.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:q,disabled:h,children:h?"Saving…":"Save"}),e.oauth&&s.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:se,children:["Connect ",e.name]}),s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>{N(!1),i({})},children:"Cancel"})]})]}),!k&&_==="running"&&t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[s.jsx(Qe,{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({...f}),N(!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:z,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"})]}),s.jsx("div",{style:{display:"none"},children:s.jsx(Qe,{to:"/agent/new",className:"btn btn-ghost btn-sm",style:{textDecoration:"none",display:"block",textAlign:"center"},children:"Authorize your agent"})})]}),_==="unconfigured"&&(()=>{const b=e.credentials.fields.every(R=>R.optional),W=e.credentials.fields.some(R=>!R.optional),A=e.credentials.fields.some(R=>{var Y;return(Y=o[R.key])==null?void 0:Y.trim()});return s.jsxs(s.Fragment,{children:[u&&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&&x(!0)},style:{background:"none",border:"none",padding:0,color:"var(--accent)",cursor:"pointer",textDecoration:"underline"},children:"keep existing"}),"."]}),e.oauth&&!u&&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&&!u&&s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:e.setupHint}),e.credentials.fields.map(R=>s.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[s.jsx("label",{className:"form-label",children:R.label}),R.type==="password"?s.jsxs("div",{className:"cred-field",children:[s.jsx("input",{className:"form-input",type:C[R.key]?"text":"password",placeholder:R.placeholder,value:o[R.key]||"",onChange:Y=>i(Se=>({...Se,[R.key]:Y.target.value}))}),s.jsx("button",{className:"cred-toggle",onClick:()=>I(Y=>({...Y,[R.key]:!Y[R.key]})),children:C[R.key]?"hide":"show"})]}):s.jsx("input",{className:"form-input",type:"text",placeholder:R.placeholder,value:o[R.key]||"",onChange:Y=>i(Se=>({...Se,[R.key]:Y.target.value}))})]},R.key)),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[A&&s.jsx("button",{className:"btn btn-primary",onClick:B,disabled:h||W&&!e.credentials.fields.filter(R=>!R.optional).every(R=>{var Y;return(Y=o[R.key])==null?void 0:Y.trim()}),children:h?"Saving...":"Save & Encrypt"}),b&&!A&&s.jsx("button",{className:"btn btn-primary",onClick:P,disabled:E,children:E?"Starting...":`Activate ${e.name}`})]})]})})(),_==="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:se,children:["Connect ",e.name," Account"]}),s.jsx("button",{className:"btn btn-ghost",onClick:()=>c(!1),children:"Change Credentials"})]})]}),_==="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:P,disabled:E,children:E?"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),x(!1)},children:"Change Credentials"})]})]}),_==="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:P,disabled:E,children:E?"Starting...":"Start"}),s.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:z,children:"Disable"})]})]})]})}function Xv(){const{loading:e,mcpServerUp:t,manifestsError:n,entries:r,refresh:a}=vl(),[o,i]=d.useState(""),l=d.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(Jv,{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 qv(){var H,U,D;const{activeTeam:e,activeMembership:t,refreshGroups:n,user:r}=Te(),[a,o]=d.useState(null),[i,l]=d.useState(!1),[c,u]=d.useState(""),[p,f]=d.useState(""),[v,y]=d.useState(!1),[x,w]=d.useState(""),[j,h]=d.useState("");d.useEffect(()=>{fetch("/health").then(_=>_.json()).then(_=>{typeof _.spUrl=="string"&&h(_.spUrl)}).catch(()=>{})},[]),d.useEffect(()=>{if(!e){o(null);return}O.getGroupById(e.id).then(_=>{const B=_.group??_,q=_.members??[],se=_.isAdmin??!1,P=q.map(z=>{const $=z.userId||z.id||"",L=z.role||(se&&$===B.createdBy?"admin":"member");return{id:$,name:z.name||$.slice(0,8)||"Member",email:z.email||"",domains:z.domains||[],role:L,isAdmin:L==="admin"||se&&$===B.createdBy}});o({id:B.id,name:B.name,members:P})}).catch(()=>o(null))},[e==null?void 0:e.id]);const m=(a==null?void 0:a.members.filter(_=>_.isAdmin))??[],g=(e==null?void 0:e.isAdmin)===!0&&m.length<=1&&m.some(_=>_.id===(r==null?void 0:r.id)),S=(e==null?void 0:e.name)??"",E=x.trim()===S&&!i,T=()=>{w(""),y(!0)},k=()=>{y(!1),w("")},N=async()=>{if(!(!e||!E)){l(!0),u("");try{await O.leaveTeam(e.id),await n(),f("You have left the team."),o(null),k()}catch(_){u(_ instanceof Error?_.message:"Failed to leave team")}finally{l(!1)}}},C=e&&j?`${j}/dashboard/groups/${e.id}`:void 0,I=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}),p&&s.jsx("div",{className:"alert alert-success",children:p}),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:[((H=a==null?void 0:a.members)==null?void 0:H.length)??0," ",(((U=a==null?void 0:a.members)==null?void 0:U.length)??0)===1?"member":"members",e.isAdmin&&" · You are admin"]})]}),s.jsx("span",{className:"status-badge status-active",children:"Active"})]}),(D=a==null?void 0:a.members)==null?void 0:D.map(_=>s.jsxs("div",{className:"member-row",children:[s.jsx("div",{className:"member-avatar",children:_.name.split(" ").map(B=>B[0]).join("").slice(0,2).toUpperCase()}),s.jsxs("div",{className:"member-info",children:[s.jsx("div",{className:"member-name",children:_.name}),s.jsx("div",{className:"member-email",children:_.email})]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:_.role})]},_.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:[C&&s.jsx("a",{className:"btn btn-secondary btn-sm",href:C,target:"_blank",rel:"noopener noreferrer",children:"Manage this team in your Service Provider →"}),s.jsx("span",{title:g?"You are the only admin. Transfer admin to another member in your Service Provider dashboard before leaving.":void 0,style:{marginLeft:"auto"},children:s.jsx("button",{className:"btn btn-ghost btn-sm",style:{color:"var(--text-tertiary)"},onClick:T,disabled:i||g,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."}),I&&s.jsx("a",{className:"btn btn-primary btn-sm",href:I,target:"_blank",rel:"noopener noreferrer",children:"Open Service Provider dashboard →"})]}),v&&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:k,children:s.jsxs("div",{className:"card",onClick:_=>_.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:x,onChange:_=>w(_.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:k,disabled:i,children:"Cancel"}),s.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:N,disabled:!E,children:i?"Leaving...":"Leave team"})]})]})})]})}function Zv({onDismiss:e}){const t=Kt(),{group:n,groupId:r,domain:a}=Te(),[o,i]=d.useState([]),[l,c]=d.useState([]),[u,p]=d.useState([]),[f,v]=d.useState(!0),[y,x]=d.useState({}),[w,j]=d.useState(null);d.useEffect(()=>{Promise.all([O.listProfiles().catch(()=>[]),O.getIntegrationManifests().then(k=>k.manifests??[]).catch(()=>[]),O.getMcpHealth().then(k=>k.integrations??[]).catch(()=>[])]).then(async([k,N,C])=>{if(i(k),c(N),p(C),r){const I=await Promise.all(k.map(U=>O.getTeamProfileConfig(r,U.id).catch(()=>null))),H={};k.forEach((U,D)=>{const _=I[D];_&&(H[U.id]=_)}),x(H)}}).finally(()=>v(!1))},[r]);const h=new Map,m=new Map;for(const k of l)k.profile&&h.set(k.profile,k);for(const k of u){const N=l.find(C=>C.id===k.id);N!=null&&N.profile&&m.set(N.profile,k)}const g=o.filter(k=>{const N=k.id.replace(/@.*$/,"").split("/").pop()??k.id;return h.has(N)}),S=k=>k in y,E=(k,N)=>{if(!r){console.error("No active group when creating authorization");return}const C=S(k);sessionStorage.setItem("agentAuth",JSON.stringify({profileId:k,groupId:r,groupName:(n==null?void 0:n.name)??null,domain:a,isTeam:C})),N?sessionStorage.setItem("agentGate",JSON.stringify({bounds:N.bounds,context:N.context,gateContent:{intent:N.intent},ttlConfig:{max:N.ttl},templateMode:N.mode,templateTtl:N.ttl})):sessionStorage.removeItem("agentGate"),j(null),e==null||e(),t("/agent/gate")},T=k=>{if(!r)return;const N=k.replace(/@.*$/,"").split("/").pop()??k,C=h.get(N);C!=null&&C.templates&&C.templates.length>0?j({profileId:k,manifest:C}):E(k)};if(w){const k=w.manifest.templates??[];return 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 ",w.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(N=>s.jsxs("button",{className:"template-card",onClick:()=>E(w.profileId,N),children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",marginBottom:"0.375rem"},children:[s.jsx("span",{className:`template-mode template-mode-${N.mode==="automatic"?"auto":"review"}`,children:N.mode==="automatic"?"Auto":"Review"}),s.jsx("span",{className:"template-risk","data-risk":N.risk,children:N.risk})]}),s.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.25rem"},children:N.name}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",lineHeight:1.45,marginBottom:"0.5rem"},children:N.description}),s.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.3rem"},children:N.tags.map(C=>s.jsx("span",{className:"template-tag",children:C},C))})]},N.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(w.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
|
-
`}),f?s.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem"},children:"Loading..."}):g.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(Qe,{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:g.map(k=>{const N=S(k.id),C=k.id.replace(/@.*$/,"").split("/").pop()??k.id,I=h.get(C),H=m.get(C),U=(H==null?void 0:H.running)===!0;return s.jsxs("div",{className:"card",style:U?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:Pe(k.id,k.name)}),N?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}),U?s.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>T(k.id),children:"Authorize"}):s.jsxs(Qe,{to:`/integrations?setup=${(I==null?void 0:I.id)??""}`,className:"btn btn-secondary btn-sm",style:{textDecoration:"none",textAlign:"center"},onClick:()=>e==null?void 0:e(),children:["Set up ",(I==null?void 0:I.name)??"integration"]})]},k.id)})})]})}const ey={active:"Active",pending:"Pending",expired:"Expired",revoked:"Revoked"};function ty({status:e,label:t}){return s.jsx("span",{className:`status-badge status-${e}`,children:t||ey[e]})}function ny({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 yn=86400,br=3600,Na=60,ry=30*yn;function ay(e){if(e<=0)return"Expired";if(e>90*yn){const t=Math.floor(e/ry);return`${t} ${t===1?"month":"months"} remaining`}if(e>7*yn){const t=Math.floor(e/yn);return`${t} ${t===1?"day":"days"} remaining`}if(e>=2*yn){const t=Math.floor(e/yn),n=Math.floor(e%yn/br);return`${t} ${t===1?"day":"days"} ${n}h remaining`}if(e>=2*br){const t=Math.floor(e/br),n=Math.floor(e%br/Na);return`${t}h ${String(n).padStart(2,"0")}m remaining`}if(e>=Na){const t=Math.floor(e/Na),n=Math.floor(e%Na);return`${t}m ${String(n).padStart(2,"0")}s remaining`}return`${Math.floor(e)}s remaining`}function sy({expiresAt:e}){const[t,n]=d.useState(()=>e-Date.now()/1e3),r=t<2*br;d.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:ay(t)})}function Ff({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 oy(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 iy=[{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 ly({item:e,onClose:t,onSuccess:n}){var h;const{user:r,activeDomain:a,groupId:o}=Te(),i=e.remaining_seconds??0,l=iy.filter(m=>m.seconds>i),c=((h=l[0])==null?void 0:h.seconds)??2592e3,[u,p]=d.useState(c),[f,v]=d.useState(!1),[y,x]=d.useState(""),w=Object.entries(e.frame).filter(([m])=>m!=="profile"&&m!=="path"),j=async()=>{var m;if(r){v(!0),x("");try{const g=e.frame_hash||e.profile_id||e.path,S=await O.getGateContent(g);if(!S)throw new Error("Gate content not found locally. The MCP server may have restarted. Please re-authorize through the full wizard instead.");const E=await O.getProfile(e.profile_id),T=e.frame,k=S.context??{},N=e.attested_domains[0]||a||"owner",C=await $f(T,E),I=await Lf(k,E),[H,U]=await Promise.all([ms(S.gateContent.intent),ms(JSON.stringify({profile:e.profile_id,path:e.path,domain:N}))]);if(!o)throw new Error("No active group; cannot extend authorization.");const D=(((m=e.deferred_commitment_domains)==null?void 0:m.length)??0)>0?"review":"automatic",_=await O.attest({profile_id:e.profile_id,path:e.path,bounds:T,bounds_hash:C,context_hash:I,domain:N,did:r.did,gate_content_hashes:{intent:H},execution_context_hash:U,group_id:o,commitment_mode:D,ttl:u});await O.pushGateContent(Mf(_,{boundsHash:C,contextHash:I,context:k,path:e.path,gateContent:S.gateContent})),n()}catch(g){x(g instanceof Error?g.message:"Extension failed")}finally{v(!1)}}};return 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:[Pe(e.profile_id)," / ",e.path]}),w.length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:w.map(([m,g])=>`${m}=${g}`).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 ",oy(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 ${u===m.seconds?"btn-primary":"btn-secondary"}`,onClick:()=>p(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)."}),y&&s.jsx("div",{className:"error-message",children:y})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{className:"btn btn-secondary",onClick:t,disabled:f,children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:j,disabled:f,children:f?"Extending...":"Extend"})]})]})})}function cy(e,t,n){return[...e].sort((r,a)=>{if(n){if(r.frame_hash===n&&a.frame_hash!==n)return-1;if(a.frame_hash===n&&r.frame_hash!==n)return 1}const o=bt(r,{revokedSet:t}),i=bt(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 uy({item:e,revokedSet:t,expandedHash:n,gateCache:r,gateLoading:a,copiedHash:o,revokingHash:i,copyingHash:l,profileConfigCache:c,mode:u,ownerLabel:p,isAdmin:f,onExpand:v,onCopyHash:y,onCopy:x,onRevoke:w,onExtend:j,highlightHash:h}){var $;const m=bt(e,{revokedSet:t}),g=n===e.frame_hash,S=r[e.frame_hash||e.profile_id||e.path],E=m==="active"||m==="pending"||m==="expired",T=Object.entries(e.frame).filter(([L])=>L!=="profile"&&L!=="path"),k=c.get(e.profile_id)??null,N=((($=k==null?void 0:k.approvers)==null?void 0:$.length)??0)>0,C=new Map;if(k!=null&&k.caps&&u==="team")for(const[L,V]of T){const ee=k.caps[L];ee!==void 0&&Number(V)>ee&&C.set(L,{authorized:Number(V),cap:ee})}const I=C.size>0,H=e.approvers_frozen??[],U=(k==null?void 0:k.approvers)??[],D=u==="team"&&H.length>0&&U.length>0&&(H.length!==U.length||H.some(L=>!U.includes(L))||U.some(L=>!H.includes(L))),_=Array.from(C.entries()).map(([L,V])=>`${L}: ${V.authorized} (cap ${V.cap})`).join(", "),B=Array.from(C.entries()).map(([L,V])=>`${L}: ${V.authorized} → ${V.cap}`).join(", "),q=I?N?C.size===1?`Above team cap: ${_} — actions require approval`:`Above team cap (${C.size}): ${_} — actions require approval`:C.size===1?`Reduced by hard cap: ${B}`:`Reduced by hard cap (${C.size}): ${B}`:"",se=I?N?"Above-cap actions under this authority require per-action approval from the profile's approvers. Bounds remain authorized at their original values.":"No approvers are configured for this profile, so the team cap is a hard ceiling. Bounds above the cap are effectively reduced to the cap. Ask the admin to raise the cap or add approvers, or copy this authorization to reissue within the cap.":void 0,P=Pe(e.profile_id),z=h!=null&&e.frame_hash===h;return s.jsxs("div",{className:`card${z?" card-highlight":""}`,style:{marginBottom:0},children:[p&&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:p})]}),s.jsxs("div",{className:"auth-card-header",children:[s.jsx("span",{style:{fontWeight:700,fontSize:"1rem",color:"var(--text-primary)",letterSpacing:"0.01em"},children:P}),e.title&&s.jsx("span",{style:{fontWeight:500,fontSize:"0.85rem",color:"var(--text-secondary)"},children:e.title}),s.jsx(ty,{status:m}),m==="active"&&e.earliest_expiry&&s.jsx(sy,{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(L=>s.jsx(ny,{domain:L,attested:e.attested_domains.includes(L)},L)),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"}),I&&s.jsx("span",{title:se,style:{fontSize:"0.65rem",padding:"0.15rem 0.4rem",borderRadius:"0.25rem",background:N?"var(--accent-subtle)":"var(--danger-subtle)",color:N?"var(--accent)":"var(--danger)",fontWeight:600,cursor:"help"},children:q}),D&&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:()=>x(e),disabled:l===e.frame_hash,title:"The approver list for this profile has changed since this authority was created. Copy to reissue with the current approvers.",children:l===e.frame_hash?"Copying...":"Approver list updated · Copy with new approvers"})]}),T.length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:T.map(([L,V],ee)=>{const X=C.get(L);return s.jsxs("span",{children:[ee>0&&" · ",X?N?s.jsxs("span",{title:`Team cap on ${L} is ${X.cap}. Actions exceeding the cap require per-action approval. Bound remains authorized at ${X.authorized}.`,children:[s.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[L,"=",String(V)]}),s.jsxs("span",{style:{color:"var(--accent)",marginLeft:"0.25rem",fontWeight:600},children:["↑ approval at ",X.cap]})]}):s.jsxs("span",{title:`Team cap on ${L} is ${X.cap} with no approvers configured (hard cap). Authorized for ${X.authorized}; effective ${X.cap}.`,children:[s.jsxs("span",{style:{textDecoration:"line-through",color:"var(--text-tertiary)"},children:[L,"=",String(V)]}),s.jsxs("span",{style:{color:"var(--danger)",marginLeft:"0.25rem",fontWeight:600},children:["→"," ",X.cap]})]}):s.jsxs("span",{children:[L,"=",String(V)]})]},L)})}),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:()=>v(e),children:g?"▲ Hide Details":"▼ Details"})}),g&&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(([L,V])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:L}),s.jsx("dd",{children:String(V)})]},L))})]}),(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(([L,V])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:L}),s.jsx("dd",{children:String(V)})]},L))})]}),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.frame_hash?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.frame_hash}),s.jsx("button",{className:"btn btn-ghost btn-sm",style:{fontSize:"0.7rem",padding:"0.125rem 0.375rem"},onClick:()=>y(e.frame_hash),children:o===e.frame_hash?"copied":"copy"})]}),s.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.75rem"},children:[!p&&s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>x(e),disabled:l===e.frame_hash,title:"Start a new authorization pre-filled with these bounds, context, and intent",children:l===e.frame_hash?"Copying…":"⧉ Copy"}),!p&&E&&s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>j(e),children:"↻ Extend"}),p&&f&&m!=="revoked"?s.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.frame_hash,p,P),disabled:i===e.frame_hash,children:i===e.frame_hash?"Revoking…":"Revoke"}):!p&&(m==="active"||m==="pending")?s.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.frame_hash),disabled:i===e.frame_hash,children:i===e.frame_hash?"Revoking…":"Revoke"}):null]})]})]},e.frame_hash)}function dy(){const[e,t]=d.useState([]),[n,r]=d.useState(!0),[a,o]=d.useState([]),[i,l]=d.useState(!1),[c,u]=d.useState("mine"),[p,f]=d.useState("active"),[v,y]=d.useState(null),[x,w]=d.useState(null),[j,h]=bf(),[m,g]=d.useState(()=>j.get("new")==="1"),[S,E]=d.useState(()=>j.get("highlight")),[T,k]=d.useState(null),[N,C]=d.useState({}),[I,H]=d.useState(null),[U,D]=d.useState(null),[_,B]=d.useState(null),[q,se]=d.useState(new Set),[P,z]=d.useState(null),[$,L]=d.useState(null),V=Kt(),{group:ee,groupId:X,domain:ge,mode:b,activeTeam:W}=Te(),A=(W==null?void 0:W.isAdmin)===!0,[R,Y]=d.useState(()=>new Map),Se=d.useCallback(()=>{r(!0),O.getMyAttestations().then(t).catch(()=>{}).finally(()=>r(!1))},[]),Ie=d.useCallback(()=>{X&&(l(!0),O.listTeamAuthorizations(X).then(o).catch(()=>{}).finally(()=>l(!1)))},[X]);fe("attestation-changed",()=>{Se(),A&&X&&Ie()}),d.useEffect(()=>{if(!S)return;j.get("highlight")&&(j.delete("highlight"),h(j,{replace:!0}));const F=window.setTimeout(()=>E(null),3e3);return()=>window.clearTimeout(F)},[]),Ft(Se,3e5),d.useEffect(()=>{c==="team"&&A&&X&&a.length===0&&!i&&Ie()},[c,A,X,a.length,i,Ie]),d.useEffect(()=>{if(b!=="team"||!X)return;const F=c==="mine"?e:a;if(F.length===0)return;const G=[...new Set(F.map(J=>J.profile_id))].filter(J=>!R.has(J));if(G.length!==0){Y(J=>{const de=new Map(J);for(const ve of G)de.set(ve,null);return de});for(const J of G)O.getTeamProfileConfig(X,J).then(de=>{Y(ve=>new Map(ve).set(J,de))}).catch(()=>{})}},[e,a,c,X,b,R]);const je=async F=>{if(T===F.frame_hash){k(null);return}k(F.frame_hash);const G=F.frame_hash||F.profile_id||F.path;if(!(G in N)){H(F.frame_hash);try{const J=await O.getGateContent(G);C(de=>({...de,[G]:J}))}catch{C(J=>({...J,[G]:null}))}finally{H(null)}}},hn=F=>{navigator.clipboard.writeText(F).then(()=>{B(F),setTimeout(()=>B(null),2e3)})},ur=async F=>{var G;if(!X){alert("No active group; cannot copy authorization.");return}L(F.frame_hash);try{const J=F.frame_hash||F.profile_id||F.path;let de=N[J]??null;J in N||(de=await O.getGateContent(J),C(pt=>({...pt,[J]:de})));const ve=Object.fromEntries(Object.entries(F.frame).filter(([pt])=>pt!=="profile"&&pt!=="path")),mt=(de==null?void 0:de.context)??{},zt=((G=de==null?void 0:de.gateContent)==null?void 0:G.intent)??"",Ge=F.deferred_commitment_domains.length>0?"review":"automatic",_t=F.attested_domains[0]||ge||"owner";sessionStorage.setItem("agentAuth",JSON.stringify({profileId:F.profile_id,groupId:X,groupName:(ee==null?void 0:ee.name)??null,domain:_t})),sessionStorage.setItem("agentGate",JSON.stringify({bounds:ve,context:mt,gateContent:{intent:zt},templateMode:Ge})),V("/agent/gate")}catch(J){alert(J instanceof Error?J.message:"Failed to copy authorization")}finally{L(null)}},It=async(F,G,J)=>{const de=G&&J?`Revoke ${G}'s ${J} authorization? This cannot be undone.`:"Revoke this authorization? The agent will no longer be able to execute actions under this attestation.";if(confirm(de)){z(F);try{await O.revokeAttestation(F),se(ve=>new Set(ve).add(F)),G&&X&&Ie()}catch(ve){alert(ve instanceof Error?ve.message:"Failed to revoke authorization")}finally{z(null)}}},nt=c==="mine"?e:a,dr=c==="mine"?n:i,Rt={active:nt.filter(F=>bt(F,{revokedSet:q})==="active").length,pending:nt.filter(F=>bt(F,{revokedSet:q})==="pending").length,expired:nt.filter(F=>bt(F,{revokedSet:q})==="expired").length,revoked:nt.filter(F=>bt(F,{revokedSet:q})==="revoked").length},ne=(()=>{const F=new Map;for(const G of nt){if(bt(G,{revokedSet:q})!==p)continue;const J=F.get(G.profile_id)??{count:0,review:!1};J.count+=1,G.deferred_commitment_domains.length>0&&(J.review=!0),F.set(G.profile_id,J)}return Array.from(F.entries()).map(([G,J])=>({profileId:G,...J})).sort((G,J)=>Pe(G.profileId).localeCompare(Pe(J.profileId)))})(),ft=cy(nt.filter(F=>{if(bt(F,{revokedSet:q})!==p||v!==null&&F.profile_id!==v)return!1;if(x!==null){const G=F.deferred_commitment_domains.length>0;if(x==="review"&&!G||x==="auto"&&G)return!1}return!0}),q,S),Q={revokedSet:q,expandedHash:T,gateCache:N,gateLoading:I,copiedHash:_,revokingHash:P,copyingHash:$,profileConfigCache:R,mode:b,activeDomain:ge,group:ee,groupId:X,onExpand:je,onCopyHash:hn,onCopy:ur,onRevoke:It,onExtend:D,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:()=>g(!0),children:"+ New authorization"})]}),m&&s.jsx("div",{className:"modal-backdrop",onClick:()=>{g(!1),j.get("new")&&(j.delete("new"),h(j,{replace:!0}))},children:s.jsxs("div",{className:"modal",onClick:F=>F.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:()=>{g(!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(Zv,{onDismiss:()=>g(!1)})]})]})}),A&&s.jsxs("div",{className:"nav-tabs",style:{marginBottom:"0.5rem"},children:[s.jsx("button",{className:`nav-tab${c==="mine"?" active":""}`,onClick:()=>{u("mine"),f("active"),y(null),w(null),k(null)},children:"Mine"}),s.jsx("button",{className:`nav-tab${c==="team"?" active":""}`,onClick:()=>{u("team"),f("active"),y(null),w(null),k(null)},children:"Team"})]}),s.jsx("div",{className:"nav-tabs",children:["active","pending","expired","revoked"].map(F=>s.jsxs("button",{className:`nav-tab${p===F?" active":""}`,onClick:()=>{f(F),y(null),w(null)},children:[F.charAt(0).toUpperCase()+F.slice(1)," (",Rt[F],")"]},F))}),ne.length>0&&s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"center",marginTop:"-0.25rem",marginBottom:"1rem"},children:[ne.map(F=>{const G=v===F.profileId;return s.jsx("button",{className:`btn btn-sm ${G?"btn-primary":"btn-secondary"}`,onClick:()=>y(G?null:F.profileId),children:Pe(F.profileId)},F.profileId)}),s.jsx("span",{"aria-hidden":"true",style:{color:"var(--border)",fontSize:"1.1rem",padding:"0 0.25rem",userSelect:"none"},children:"|"}),["auto","review"].map(F=>{const G=x===F;return s.jsx("button",{className:`btn btn-sm ${G?"btn-primary":"btn-secondary"}`,onClick:()=>w(G?null:F),children:F==="auto"?"Auto":"Review"},F)})]}),dr&&nt.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):ft.length===0?s.jsx(Ff,{icon:"☰",title:"No authorizations",text:`No ${p} authorizations found.`}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:ft.map(F=>{const G=c==="team"?F:null,J=G!=null&&G.owner?G.owner.name??G.owner.email??G.owner.userId:void 0;return s.jsx(uy,{item:F,ownerLabel:J,isAdmin:A,...Q},F.frame_hash)})}),U&&s.jsx(ly,{item:U,onClose:()=>D(null),onSuccess:()=>{D(null),Se()}})]})}function Of({profileId:e}){return s.jsx("span",{className:"profile-badge",children:Pe(e)})}function fy(e){return new Date(e*1e3).toLocaleString()}function my(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 py(e,t){if(!t)return!0;const n=t.toLowerCase();return e.profileId.toLowerCase().includes(n)||Pe(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 Uc(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 hy(){const{activeTeam:e,groupId:t}=Te(),n=(e==null?void 0:e.isAdmin)===!0,[r,a]=d.useState("mine"),[o,i]=d.useState([]),[l,c]=d.useState(!0),[u,p]=d.useState({}),[f,v]=d.useState(new Set),[y,x]=d.useState(""),[w,j]=d.useState(new Set),[h,m]=d.useState(new Set),[g,S]=d.useState("all"),[E,T]=d.useState(!1),[k,N]=d.useState(null),[C,I]=d.useState(!1),[H,U]=d.useState(!1),D=d.useRef(""),_=d.useCallback(b=>r==="team"&&n&&t?O.listTeamReceiptsPage(t,{before:b,limit:200}):O.getMyReceiptsPage({before:b,limit:200}),[r,n,t]),B=d.useCallback(()=>{const b=r==="team"?`team:${t}`:"mine",W=D.current!==b;D.current=b,c(!0),U(!1),_().then(A=>{i(R=>W?A.receipts:Uc(R,A.receipts)),N(R=>W?A.nextBefore:R??A.nextBefore)}).catch(()=>{W&&i([]),U(!0)}).finally(()=>c(!1))},[_,r,t]),q=d.useCallback(()=>{!k||C||(I(!0),U(!1),_(k).then(b=>{i(W=>Uc(W,b.receipts)),N(b.nextBefore)}).catch(()=>U(!0)).finally(()=>I(!1)))},[k,C,_]);Ft(B,12e4),d.useEffect(()=>{r!=="team"||Object.keys(u).length>0||O.listUsers().then(b=>{const W={};for(const A of b)W[A.id]={name:A.name,email:A.email};p(W)}).catch(()=>{})},[r,u]);const se=d.useMemo(()=>{const b=new Set;for(const W of o)b.add(Pe(W.profileId));return[...b].sort()},[o]),P=d.useMemo(()=>{const b=new Set;for(const W of o)b.add(W.action);return[...b].sort()},[o]),z=d.useMemo(()=>{if(r!=="team")return[];const b=new Set;for(const W of o)W.userId&&b.add(W.userId);return[...b].map(W=>{var A;return{id:W,label:(A=u[W])!=null&&A.name?`${u[W].name} (${u[W].email})`:W}}).sort((W,A)=>W.label.localeCompare(A.label))},[r,o,u]),$=d.useMemo(()=>o.filter(b=>!(!py(b,y)||w.size>0&&!w.has(Pe(b.profileId))||h.size>0&&!h.has(b.action)||f.size>0&&b.userId&&!f.has(b.userId)||!my(b,g))),[o,y,w,h,f,g]),L=w.size>0||h.size>0||f.size>0||g!=="all";function V(b){j(W=>{const A=new Set(W);return A.has(b)?A.delete(b):A.add(b),A})}function ee(b){m(W=>{const A=new Set(W);return A.has(b)?A.delete(b):A.add(b),A})}function X(b){v(W=>{const A=new Set(W);return A.has(b)?A.delete(b):A.add(b),A})}function ge(){j(new Set),m(new Set),v(new Set),S("all"),x("")}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(b=>s.jsx("button",{onClick:()=>a(b),className:"btn btn-ghost",style:{borderRadius:0,padding:"0.5rem 0.875rem",borderBottom:r===b?"2px solid var(--accent)":"2px solid transparent",color:r===b?"var(--text-primary)":"var(--text-tertiary)",fontWeight:r===b?600:500},children:b==="mine"?"Mine":"Team"},b))}),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:y,onChange:b=>x(b.target.value)}),y&&s.jsx("button",{className:"search-clear",onClick:()=>x(""),children:"×"})]}),s.jsxs("button",{className:`btn btn-sm btn-secondary${E?" active":""}`,onClick:()=>T(!E),children:["Filters",L?` (${w.size+h.size+(g!=="all"?1:0)})`:""]})]}),E&&s.jsxs("div",{className:"filter-panel",children:[se.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Profile"}),s.jsx("div",{className:"filter-chips",children:se.map(b=>s.jsx("button",{className:`filter-chip${w.has(b)?" selected":""}`,onClick:()=>V(b),children:b},b))})]}),P.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Action"}),s.jsx("div",{className:"filter-chips",children:P.map(b=>s.jsx("button",{className:`filter-chip${h.has(b)?" selected":""}`,onClick:()=>ee(b),children:b},b))})]}),r==="team"&&z.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Owner"}),s.jsx("div",{className:"filter-chips",children:z.map(b=>s.jsx("button",{className:`filter-chip${f.has(b.id)?" selected":""}`,onClick:()=>X(b.id),children:b.label},b.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(([b,W])=>s.jsx("button",{className:`filter-chip${g===b?" selected":""}`,onClick:()=>S(b),children:W},b))})]})]}),L&&s.jsxs("div",{className:"active-filters",children:[[...w].map(b=>s.jsxs("span",{className:"active-chip",onClick:()=>V(b),children:[b," ",s.jsx("span",{className:"chip-remove",children:"×"})]},b)),[...h].map(b=>s.jsxs("span",{className:"active-chip",onClick:()=>ee(b),children:[b," ",s.jsx("span",{className:"chip-remove",children:"×"})]},b)),[...f].map(b=>{const W=u[b],A=W?W.name:b;return s.jsxs("span",{className:"active-chip",onClick:()=>X(b),children:[A," ",s.jsx("span",{className:"chip-remove",children:"×"})]},b)}),g!=="all"&&s.jsxs("span",{className:"active-chip",onClick:()=>S("all"),children:[g==="1d"?"Today":g==="7d"?"7 days":"30 days"," ",s.jsx("span",{className:"chip-remove",children:"×"})]}),s.jsx("button",{className:"clear-filters",onClick:ge,children:"Clear all"})]}),H&&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..."}):$.length===0?s.jsx(Ff,{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:$.length===o.length?`${o.length} receipt${o.length!==1?"s":""}`:`${$.length} of ${o.length} receipts`}),s.jsx("div",{className:"timeline",children:$.map(b=>{var W;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(Of,{profileId:b.profileId}),s.jsx("span",{className:"auth-card-path",children:b.path}),s.jsx("span",{className:"receipt-action",children:b.action}),s.jsx("span",{className:"auth-card-time",children:fy(b.timestamp)})]}),r==="team"&&b.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:(W=u[b.userId])!=null&&W.name?`${u[b.userId].name} (${u[b.userId].email})`:b.userId})]}),Object.keys(b.executionContext).length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:Object.entries(b.executionContext).map(([A,R])=>`${A}=${R}`).join(" · ")}),s.jsxs("div",{style:{display:"flex",gap:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:[s.jsxs("span",{children:["Daily: ",b.cumulativeState.daily.count," calls, $",b.cumulativeState.daily.amount]}),s.jsxs("span",{children:["Monthly: ",b.cumulativeState.monthly.count," calls, $",b.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:b.attestationHash})]})},b.id)})})]}),k&&s.jsx("div",{style:{textAlign:"center",marginTop:"1rem"},children:s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:q,disabled:C,children:C?"Loading…":"Load older"})})]})}const Wc={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 gy(){const[e,t]=d.useState(""),[n,r]=d.useState("openrouter"),[a,o]=d.useState("openai-compatible"),[i,l]=d.useState("https://openrouter.ai/api/v1"),[c,u]=d.useState("google/gemma-4-31b-it"),[p,f]=d.useState(""),[v,y]=d.useState(!1),[x,w]=d.useState(!1),[j,h]=d.useState(!1),[m,g]=d.useState(null),S=d.useCallback(C=>{t(C),setTimeout(()=>t(""),3e3)},[]),E=d.useCallback(async()=>{try{const C=await O.getCredential("ai-config");if(y(C.configured),C.configured&&C.fields){C.fields.provider&&o(C.fields.provider),C.fields.endpoint&&l(C.fields.endpoint),C.fields.model&&u(C.fields.model);const I=C.fields.endpoint??"";I.includes("openai.com")?r("openai"):I.includes("groq.com")?r("groq"):I.includes("together.xyz")?r("together"):I.includes("openrouter.ai")?r("openrouter"):r("ollama")}}catch{}},[]);d.useEffect(()=>{E()},[E]);const T=C=>{r(C);const I=Wc[C];I&&(o(I.provider),l(I.endpoint),u(I.models[0]))},k=async()=>{w(!0);try{await O.setCredential("ai-config",{provider:a,endpoint:i,model:c,...p?{apiKey:p}:{}}),y(!0),S("AI configuration saved!")}catch{S("Failed to save AI config")}finally{w(!1)}},N=async()=>{h(!0),g(null);try{const C=await O.aiTest(p?{provider:a,endpoint:i,model:c,apiKey:p}:{});g(C.ok?`OK: ${C.message}`:`Failed: ${C.message}`)}catch(C){g(`Error: ${C instanceof Error?C.message:"Unknown"}`)}finally{h(!1)}};return 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."}),v&&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:C=>T(C.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.jsx("label",{className:"form-label",children:"Model"}),(()=>{var H;const C=((H=Wc[n])==null?void 0:H.models)??[],I=C.includes(c);return s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"form-input",value:I?c:"__custom__",onChange:U=>{U.target.value==="__custom__"?u(""):u(U.target.value)},style:{marginBottom:I?void 0:"0.375rem"},children:[C.map(U=>s.jsx("option",{value:U,children:U},U)),s.jsx("option",{value:"__custom__",children:"Custom model..."})]}),!I&&s.jsx("input",{className:"form-input",value:c,onChange:U=>u(U.target.value),placeholder:"Enter model name"})]})})()]}),s.jsxs("div",{className:"form-group",style:{marginBottom:"1rem"},children:[s.jsx("label",{className:"form-label",children:"API Key (if required)"}),s.jsx("input",{className:"form-input",type:"password",value:p,onChange:C=>f(C.target.value),placeholder:v?"••••••••••••••••":"sk-... (not needed for Ollama)"})]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[s.jsx("button",{className:"btn btn-primary",onClick:k,disabled:x,children:x?"Saving...":"Save & Encrypt"}),v&&s.jsx("button",{className:"btn btn-ghost",onClick:N,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(vy,{}),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 vy(){const[e,t]=d.useState(null),[n,r]=d.useState({intent:"",context:""}),[a,o]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(null),[p,f]=d.useState(!1),v=d.useCallback(async()=>{if(!p)try{const w=await O.getAIPrompts();t(w),r({intent:w.intent.current,context:w.context.current}),f(!0)}catch(w){l(w instanceof Error?w.message:"Failed to load prompts")}},[p]),y=async w=>{if(e){o(w),l(null);try{const j=n[w],h=j.trim()===e[w].default.trim()?"":j;await O.setAIPrompt(w,h);const m=await O.getAIPrompts();t(m),r({intent:m.intent.current,context:m.context.current}),u(w),setTimeout(()=>u(null),2e3)}catch(j){l(j instanceof Error?j.message:"Save failed")}finally{o(null)}}},x=async w=>{if(confirm(`Revert ${w} prompt to the built-in default?`)){o(w),l(null);try{await O.setAIPrompt(w,"");const j=await O.getAIPrompts();t(j),r({intent:j.intent.current,context:j.context.current})}catch(j){l(j instanceof Error?j.message:"Revert failed")}finally{o(null)}}};return s.jsxs("details",{className:"card",style:{padding:"1.5rem",marginTop:"1rem"},onToggle:w=>{w.currentTarget.open&&v()},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}),!p&&!i&&s.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem"},children:"Loading prompts…"}),e&&s.jsxs(s.Fragment,{children:[s.jsx(Hc,{kind:"intent",label:"Intent — per-authorization",description:"Used on the Intent gate when creating a new authorization.",state:e.intent,draft:n.intent,onChange:w=>r(j=>({...j,intent:w})),onSave:()=>y("intent"),onRevert:()=>x("intent"),saving:a==="intent",justSaved:c==="intent"}),s.jsx(Hc,{kind:"context",label:"Context — standing-orders brief",description:"Used on the Brief page when refining your context.md.",state:e.context,draft:n.context,onChange:w=>r(j=>({...j,context:w})),onSave:()=>y("context"),onRevert:()=>x("context"),saving:a==="context",justSaved:c==="context"})]})]})}function Hc({kind:e,label:t,description:n,state:r,draft:a,onChange:o,onSave:i,onRevert:l,saving:c,justSaved:u}){const p=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:f=>o(f.target.value),rows:12,spellCheck:!1,style:{width:"100%",fontFamily:"'SF Mono', Monaco, 'Cascadia Code', monospace",fontSize:"0.82rem",lineHeight:1.55,resize:"vertical",minHeight:"14rem",marginTop:"0.5rem"},"aria-label":`${t} system prompt`}),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||!p,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"}),u&&s.jsx("span",{style:{fontSize:"0.78rem",color:"var(--success)"},children:"Saved"}),p&&!c&&!u&&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 yy(e){return e.proposalId?"review":"automatic"}function Vc(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=yy(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 xy={pending:"Pending",committed:"Approved",executed:"Executed",rejected:"Rejected",expired:"Expired"},wy={pending:"status-pending",committed:"status-active",executed:"status-active",rejected:"status-revoked",expired:"status-expired"};function Sy(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 jy(e){return e.split("__").pop()??e}function ky(e){const t=e.toLowerCase();return t.includes("delete")||t.includes("refund")||t.includes("cancel")||t.includes("revoke")}const Cy=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]),by=/^(image|img|photo|picture|thumbnail)(_?url)?$/i;function Ny(e,t){return typeof t!="string"?!1:/^data:image\//i.test(t)?!0:by.test(e)?/^https?:\/\//.test(t):/^https?:\/\/.+\.(jpe?g|png|gif|webp|svg|avif)(\?|$)/i.test(t)}function mi(e){if(e==null)return"—";if(typeof e=="string")return e.length>160?e.slice(0,157)+"…":e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>mi(t)).join(", ");try{const t=JSON.stringify(e);return t.length>160?t.slice(0,157)+"…":t}catch{return String(e)}}function Kc({item:e,onApprove:t,onReject:n,resolving:r}){const a=e.kind==="proposal",o=a?e.proposal.status:"executed",i=a?e.proposal.tool:e.receipt.action,l=jy(i),c=ky(i),u=a?e.proposal.toolArgs:null,p=a?e.proposal.executionContext:e.receipt.executionContext,f=a?null:e.receipt.cumulativeState,v=u?Object.entries(u).filter(([x])=>!Cy.has(x)):[],y=Object.entries(p??{});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(Of,{profileId:e.profileId}),s.jsx("code",{style:{fontSize:"0.85rem"},children:l}),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:[s.jsx("span",{className:`status-badge ${wy[o]}`,children:xy[o]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:Sy(e.sortTimestamp)})]})]}),c&&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"})]}),a&&typeof(u==null?void 0:u._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:u._imagePreview,alt:typeof(u==null?void 0:u.altText)=="string"?u.altText:"local image preview",style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"}})]}),a&&v.length>0&&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:v.map(([x,w])=>s.jsxs(d.Fragment,{children:[s.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:x}),s.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word"},children:Ny(x,w)?s.jsx("img",{src:w,alt:typeof(u==null?void 0:u.altText)=="string"?u.altText:x,style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"},onError:j=>{const h=j.currentTarget,m=h.parentElement;if(!m)return;h.style.display="none";const g=document.createElement("span");g.textContent=w,g.style.color="var(--text-tertiary)",m.appendChild(g)}}):mi(w)})]},x))})]}),y.length>0&&s.jsx("div",{style:{marginBottom:"0.75rem",fontSize:"0.8rem",color:"var(--text-secondary)"},children:y.map(([x,w])=>`${x}=${mi(w)}`).join(" · ")}),f&&s.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["After this action · today: ",f.daily.count," action",f.daily.count===1?"":"s",f.daily.amount>0?`, ${f.daily.amount}`:""," · ","this month: ",f.monthly.count,f.monthly.amount>0?`, ${f.monthly.amount}`:""]}),a&&o==="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:[a?"Proposal":"Receipt",": ",e.id]})]})}const Ey=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]);function pi(e){if(e==null)return"—";if(typeof e=="string")return e.length>200?e.slice(0,197)+"...":e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>pi(t)).join(", ");try{const t=JSON.stringify(e);return t.length>200?t.slice(0,197)+"...":t}catch{return String(e)}}function Py(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 Ty({proposal:e,currentUserId:t,onAction:n,onMessage:r}){const[a,o]=d.useState(!1),[i,l]=d.useState(!1),[c,u]=d.useState(null),[p,f]=d.useState(!1),[v,y]=d.useState(null),[x,w]=d.useState(!1),j=e.tool.split("__").pop()??e.tool,h=Object.entries(e.toolArgs).filter(([D])=>!Ey.has(D)),m=Object.entries(e.executionContext),g=e.pendingApprovers??[],S=e.approvedBy??{},E=Object.keys(S).length,T=g.filter(D=>!(D in S)).length,k=t in S,N=async()=>{if(c===null){f(!0),y(null);try{const D=await O.getAttestationIntent(e.frameHash);if(!D){y("Intent not available or you are not an authorized approver.");return}const _=await O.decryptIntent({intentCiphertext:D.intentCiphertext,encryptedKey:D.encryptedKey,approverId:t});u(_)}catch(D){y(D instanceof Error?D.message:"Failed to decrypt intent")}finally{f(!1)}}},C=async()=>{x?w(!1):(w(!0),await N())},I=async()=>{o(!0),r("");try{await O.approveProposal(e.id);try{if(c===null){const D=await O.getAttestationIntent(e.frameHash);if(D){const _=await O.decryptIntent({intentCiphertext:D.intentCiphertext,encryptedKey:D.encryptedKey,approverId:t});u(_),await O.storeApprovedIntent(e.frameHash,_)}}else await O.storeApprovedIntent(e.frameHash,c)}catch{}r(`Approved. ${T-1>0?`${T-1} more approver(s) still needed.`:"All approvers signed off — action is ready to execute."}`),n()}catch(D){r(D instanceof Error?D.message:"Approval failed")}finally{o(!1)}},H=async()=>{const D=prompt("Rejection reason (optional):");if(D!==null){l(!0),r("");try{await O.rejectProposal(e.id,D||void 0),r("Action rejected."),n()}catch(_){r(_ instanceof Error?_.message:"Rejection failed")}finally{l(!1)}}},U=a||i;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:Pe(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.jsx("span",{style:{marginLeft:"auto",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:Py(e.createdAt)})]}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[E," of ",g.length," approver",g.length===1?"":"s"," signed off",g.map(D=>{const _=D in S;return s.jsxs("span",{style:{marginLeft:"0.5rem",color:_?"var(--success, green)":"var(--text-tertiary)"},children:[_?"✓":"○"," ",D===t?"You":D]},D)})]}),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:j})]}),h.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:h.map(([D,_])=>s.jsxs(d.Fragment,{children:[s.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:D}),s.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word"},children:pi(_)})]},D))})]}),m.length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:m.map(([D,_])=>`${D}=${pi(_)}`).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:C,disabled:p,children:[x?"▲ Hide intent":"▼ Show intent",p&&" (decrypting...)"]}),x&&s.jsx("div",{style:{marginTop:"0.5rem",padding:"0.75rem",background:"var(--bg-main)",borderRadius:"0.375rem",border:"1px solid var(--border)"},children:v?s.jsx("p",{style:{color:"var(--danger)",fontSize:"0.8rem",margin:0},children:v}):c!==null?s.jsx("p",{style:{fontSize:"0.85rem",margin:0,whiteSpace:"pre-wrap",color:"var(--text-primary)"},children:c}):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:I,disabled:U,children:a?"Approving...":"Approve"}),s.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:H,disabled:U,children:i?"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 Iy(){const{domain:e,user:t}=Te(),n=(t==null?void 0:t.id)??"",[r,a]=d.useState("awaiting-me"),[o,i]=d.useState([]),[l,c]=d.useState(!0),[u,p]=d.useState(""),f=d.useCallback(async()=>{try{const A=await O.getProposalsForApprover();i(A)}catch{}finally{c(!1)}},[]);fe("proposal-added",f),fe("proposal-approved",f),fe("proposal-rejected",f),fe("proposal-resolved",f),Ft(f,3e4);const[v,y]=d.useState([]),x=d.useCallback(async()=>{try{const A=await O.getProposals(e||"owner");y(A)}catch{}},[e]);fe("proposal-added",x),fe("proposal-approved",x),fe("proposal-rejected",x),fe("proposal-resolved",x),Ft(x,3e4,e);const w=d.useMemo(()=>v.filter(A=>{var R;return A.status==="pending"&&(((R=A.pendingApprovers)==null?void 0:R.length)??0)===0}),[v]),j=d.useMemo(()=>Vc(w,[],{status:"pending"}),[w]),[h,m]=d.useState([]),g=d.useCallback(async()=>{if(n)try{const R=(await O.getProposals(e||"owner")).filter(Y=>Y.status==="pending"&&Y.pendingApprovers&&Y.pendingApprovers.includes(n)&&Y.approvedBy&&n in Y.approvedBy);m(R)}catch{}},[n,e]);fe("proposal-approved",g),fe("proposal-rejected",g),Ft(g,3e4,`${n}:${e}`),d.useEffect(()=>{f(),x(),g()},[]);const[S,E]=d.useState([]),[T,k]=d.useState([]),[N,C]=d.useState(!0),[I,H]=d.useState(null),[U,D]=d.useState(""),[_,B]=d.useState("pending"),[q,se]=d.useState(null),[P,z]=d.useState(!1),$=d.useCallback(async()=>{try{const{proposals:A,receipts:R}=await O.getThread({domain:e,status:_,sinceDays:7});E(A),k(R)}catch{}finally{C(!1)}},[e,_]);Ft($,3e4,`${e}:${_}`);const L=async(A,R)=>{H(A),D("");try{const Y=e||"owner",Se=await O.resolveProposal(A,R,Y);D(R==="commit"?`Action approved. Status: ${Se.status}`:"Action rejected."),await Promise.all([$(),x()])}catch(Y){D(Y instanceof Error?Y.message:"Failed")}finally{H(null)}},V=d.useMemo(()=>{const A=new Set;for(const R of S)A.add(R.profileId);for(const R of T)A.add(R.profileId);return Array.from(A).sort()},[S,T]),ee=d.useMemo(()=>Vc(S,T,{status:_,profile:q??void 0,includeAutonomous:P}),[S,T,_,q,P]),X=d.useCallback(()=>{f(),g()},[f,g]),ge=d.useMemo(()=>{const A=new Set,R=[];for(const Y of h)A.has(Y.id)||(A.add(Y.id),R.push(Y));return R.sort((Y,Se)=>Se.createdAt-Y.createdAt)},[h]),b=o.length+j.length,W=ge.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 ",b>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:b})]}),s.jsxs("button",{className:`nav-tab${r==="awaiting-others"?" active":""}`,onClick:()=>a("awaiting-others"),children:["Awaiting others ",W>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:W})]}),s.jsx("button",{className:`nav-tab${r==="all"?" active":""}`,onClick:()=>{a("all"),$()},children:"All"})]}),r==="awaiting-me"&&s.jsx(s.Fragment,{children:l&&b===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):b===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:[(u||U)&&s.jsx("div",{className:"alert alert-success",children:u||U}),j.map(A=>s.jsx(Kc,{item:A,onApprove:R=>L(R,"commit"),onReject:R=>L(R,"reject"),resolving:I===A.id},A.id)),o.map(A=>s.jsx(Ty,{proposal:A,currentUserId:n,onAction:X,onMessage:p},A.id))]})}),r==="awaiting-others"&&s.jsx(s.Fragment,{children:ge.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:ge.map(A=>s.jsx(zy,{proposal:A,currentUserId:n,onCancel:async()=>{try{await O.rejectProposal(A.id,"cancelled by creator"),g(),x()}catch(R){alert(R instanceof Error?R.message:"Cancel failed")}}},A.id))})}),r==="all"&&s.jsxs(s.Fragment,{children:[U&&s.jsx("div",{className:"alert alert-success",style:{marginBottom:"1rem"},children:U}),s.jsxs("div",{className:"filter-chips",style:{marginBottom:"1rem"},children:[s.jsx("button",{className:`filter-chip ${_==="pending"?"selected":""}`,onClick:()=>B("pending"),children:"Pending"}),s.jsx("button",{className:`filter-chip ${_==="all"?"selected":""}`,onClick:()=>B("all"),children:"All"}),V.length>0&&s.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),V.map(A=>s.jsx("button",{className:`filter-chip ${q===A?"selected":""}`,onClick:()=>se(q===A?null:A),children:Pe(A)},A)),_==="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 ${P?"selected":""}`,onClick:()=>z(!P),title:"Include actions executed without human review (automatic commitment mode)",children:[P?"✓ ":"","Autonomous actions"]})]})]}),N&&ee.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):ee.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:_==="pending"?"No actions awaiting your approval.":"Nothing here yet."}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:_==="pending"?"Your agents are operating within their authorizations. Switch to All to see recent activity.":"When an agent calls a gated tool, activity will appear here."})]}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:ee.map(A=>s.jsx(Kc,{item:A,onApprove:R=>L(R,"commit"),onReject:R=>L(R,"reject"),resolving:I===A.id},A.id))})]})]})}function Ry(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 zy({proposal:e,currentUserId:t,onCancel:n}){var u;const[r,a]=d.useState(!1),o=Object.keys(e.approvedBy??{}),i=(e.pendingApprovers??[]).filter(p=>!(p in(e.approvedBy??{}))),l=(((u=e.pendingApprovers)==null?void 0:u.length)??0)>0,c=async()=>{if(confirm("Cancel this action? All approvers will be notified.")){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:Pe(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:Ry(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(p=>s.jsx("span",{style:{marginRight:"0.75rem",color:"var(--success, green)"},children:p===t?"You approved":`${p} approved`},p)),i.map(p=>s.jsxs("span",{style:{marginRight:"0.75rem",color:"var(--text-tertiary)"},children:["Waiting on ",p===t?"you":p]},p))]}),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 _y=`# 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 Ay(){const[e,t]=d.useState(""),[n,r]=d.useState(""),[a,o]=d.useState(!0),[i,l]=d.useState(!1),[c,u]=d.useState(null),[p,f]=d.useState(!1),v=e!==n,y=new Blob([e]).size,x=16*1024;d.useEffect(()=>{if(!v)return;const m=S=>{S.preventDefault(),S.returnValue=""},g=S=>{var k,N;if(S.defaultPrevented||S.button!==0||S.metaKey||S.ctrlKey||S.shiftKey||S.altKey)return;const E=(N=(k=S.target)==null?void 0:k.closest)==null?void 0:N.call(k,"a");if(!E||!E.href)return;let T;try{T=new URL(E.href)}catch{return}T.origin===window.location.origin&&T.pathname!==window.location.pathname&&(confirm("You have unsaved changes to your agent brief. Leave anyway?")||(S.preventDefault(),S.stopPropagation()))};return window.addEventListener("beforeunload",m),document.addEventListener("click",g,!0),()=>{window.removeEventListener("beforeunload",m),document.removeEventListener("click",g,!0)}},[v]),d.useEffect(()=>{let m=!1;return O.getAgentContext().then(g=>{m||(t(g),r(g))}).catch(g=>{m||u({kind:"error",text:g instanceof Error?g.message:"Failed to load context"})}).finally(()=>{m||o(!1)}),()=>{m=!0}},[]);const w=async()=>{l(!0),u(null);try{await O.saveAgentContext(e),r(e),u({kind:"ok",text:"Saved. New MCP sessions will pick this up on next connect."})}catch(m){u({kind:"error",text:m instanceof Error?m.message:"Save failed"})}finally{l(!1)}},j=()=>{t(n),u(null)},h=()=>{e.trim()&&!confirm("Replace current context with the starter template?")||t(_y)};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(fs,{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:y>x?"var(--danger)":"var(--text-muted)"},children:[y.toLocaleString()," / ",x.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||!v,children:"Revert"}),s.jsx("button",{className:"btn btn-primary",style:{flex:1},onClick:w,disabled:i||!v||y>x||a,children:i?"Saving…":"Save"})]})]}),s.jsx("button",{type:"button",className:"floating-help",onClick:()=>f(!0),"aria-label":"Open brief assistant",children:"Get help with brief"}),s.jsx(Af,{open:p,onClose:()=>f(!1),ariaLabel:"Brief assistant",children:s.jsx(fs,{target:{kind:"context"},currentText:e,onApply:m=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||(t(m),f(!1))},greeting:"Tell me what your agent should know — I'll help shape your standing orders.",placeholder:"Ask for help with your brief…"})})]})]})}function $y({children:e}){const{user:t,mode:n,domain:r}=Te();return t?n==="team"&&!r?s.jsx(Jt,{to:"/onboarding",replace:!0}):s.jsx(s.Fragment,{children:e}):s.jsx(Jt,{to:"/login",replace:!0})}function Ly(){const{user:e}=Te();return s.jsxs(mg,{children:[s.jsx(be,{path:"/login",element:e?s.jsx(Jt,{to:"/",replace:!0}):s.jsx(pv,{})}),s.jsx(be,{path:"/onboarding",element:e?s.jsx(hv,{}):s.jsx(Jt,{to:"/login",replace:!0})}),s.jsxs(be,{element:s.jsx($y,{children:s.jsx(mv,{})}),children:[s.jsx(be,{path:"/",element:s.jsx(wv,{})}),s.jsx(be,{path:"/agent/new",element:s.jsx(Jt,{to:"/authorizations?new=1",replace:!0})}),s.jsx(be,{path:"/agent/gate",element:s.jsx(Hv,{})}),s.jsx(be,{path:"/agent/review",element:s.jsx(Yv,{})}),s.jsx(be,{path:"/integrations",element:s.jsx(Xv,{})}),s.jsx(be,{path:"/groups",element:s.jsx(qv,{})}),s.jsx(be,{path:"/authorizations",element:s.jsx(dy,{})}),s.jsx(be,{path:"/audit",element:s.jsx(hy,{})}),s.jsx(be,{path:"/proposals",element:s.jsx(Iy,{})}),s.jsx(be,{path:"/agent-brief",element:s.jsx(Ay,{})}),s.jsx(be,{path:"/settings",element:s.jsx(gy,{})}),s.jsx(be,{path:"/settings/services",element:s.jsx(Jt,{to:"/settings",replace:!0})}),s.jsx(be,{path:"/deploy",element:s.jsx(Jt,{to:"/integrations",replace:!0})})]}),s.jsx(be,{path:"*",element:s.jsx(Jt,{to:"/",replace:!0})})]})}function My(){return s.jsx(Fg,{children:s.jsx(Yg,{children:s.jsx(Qg,{children:s.jsx(Ly,{})})})})}of(document.getElementById("root")).render(s.jsx(d.StrictMode,{children:s.jsx(My,{})}));
|