@suveren/gateway 0.2.2 → 0.2.3

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.
Files changed (28) hide show
  1. package/dist/control-plane/index.mjs +2 -2
  2. package/dist/mcp-server/http.mjs +48 -17
  3. package/dist/ui/assets/{index-C0DMnnek.js → index-CIhRJ6MD.js} +23 -22
  4. package/dist/ui/index.html +1 -1
  5. package/dist/ui/mockups/intent-redesign.html +1 -1
  6. package/node_modules/eventsource-parser/README.md +31 -0
  7. package/node_modules/eventsource-parser/dist/index.cjs +21 -10
  8. package/node_modules/eventsource-parser/dist/index.cjs.map +1 -1
  9. package/node_modules/eventsource-parser/dist/index.d.cts +33 -10
  10. package/node_modules/eventsource-parser/dist/index.d.ts +33 -10
  11. package/node_modules/eventsource-parser/dist/index.js +21 -10
  12. package/node_modules/eventsource-parser/dist/index.js.map +1 -1
  13. package/node_modules/eventsource-parser/dist/stream.cjs +4 -3
  14. package/node_modules/eventsource-parser/dist/stream.cjs.map +1 -1
  15. package/node_modules/eventsource-parser/dist/stream.d.cts +16 -3
  16. package/node_modules/eventsource-parser/dist/stream.d.ts +16 -3
  17. package/node_modules/eventsource-parser/dist/stream.js +4 -3
  18. package/node_modules/eventsource-parser/dist/stream.js.map +1 -1
  19. package/node_modules/eventsource-parser/package.json +8 -8
  20. package/node_modules/eventsource-parser/src/errors.ts +1 -1
  21. package/node_modules/eventsource-parser/src/index.ts +6 -1
  22. package/node_modules/eventsource-parser/src/parse.ts +55 -13
  23. package/node_modules/eventsource-parser/src/stream.ts +24 -5
  24. package/node_modules/eventsource-parser/src/types.ts +25 -0
  25. package/node_modules/hasown/CHANGELOG.md +7 -0
  26. package/node_modules/hasown/index.d.ts +0 -1
  27. package/node_modules/hasown/package.json +4 -5
  28. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- var If=Object.defineProperty;var Rf=(e,t,n)=>t in e?If(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pa=(e,t,n)=>Rf(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();var Au={exports:{}},ua={},$u={exports:{}},J={};/**
1
+ var Rf=Object.defineProperty;var zf=(e,t,n)=>t in e?Rf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ta=(e,t,n)=>zf(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const a of o)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(o){const a={};return o.integrity&&(a.integrity=o.integrity),o.referrerPolicy&&(a.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?a.credentials="include":o.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(o){if(o.ep)return;o.ep=!0;const a=n(o);fetch(o.href,a)}})();var Lu={exports:{}},ca={},Mu={exports:{}},J={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@ var If=Object.defineProperty;var Rf=(e,t,n)=>t in e?If(e,t,{enumerable:!0,config
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Kr=Symbol.for("react.element"),_f=Symbol.for("react.portal"),zf=Symbol.for("react.fragment"),Af=Symbol.for("react.strict_mode"),$f=Symbol.for("react.profiler"),Lf=Symbol.for("react.provider"),Mf=Symbol.for("react.context"),Ff=Symbol.for("react.forward_ref"),Of=Symbol.for("react.suspense"),Bf=Symbol.for("react.memo"),Df=Symbol.for("react.lazy"),il=Symbol.iterator;function Uf(e){return e===null||typeof e!="object"?null:(e=il&&e[il]||e["@@iterator"],typeof e=="function"?e:null)}var Lu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Mu=Object.assign,Fu={};function Zn(e,t,n){this.props=e,this.context=t,this.refs=Fu,this.updater=n||Lu}Zn.prototype.isReactComponent={};Zn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Zn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Ou(){}Ou.prototype=Zn.prototype;function oi(e,t,n){this.props=e,this.context=t,this.refs=Fu,this.updater=n||Lu}var ai=oi.prototype=new Ou;ai.constructor=oi;Mu(ai,Zn.prototype);ai.isPureReactComponent=!0;var ll=Array.isArray,Bu=Object.prototype.hasOwnProperty,si={current:null},Du={key:!0,ref:!0,__self:!0,__source:!0};function Uu(e,t,n){var r,o={},a=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(a=""+t.key),t)Bu.call(t,r)&&!Du.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1<l){for(var u=Array(l),c=0;c<l;c++)u[c]=arguments[c+2];o.children=u}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)o[r]===void 0&&(o[r]=l[r]);return{$$typeof:Kr,type:e,key:a,ref:i,props:o,_owner:si.current}}function Wf(e,t){return{$$typeof:Kr,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ii(e){return typeof e=="object"&&e!==null&&e.$$typeof===Kr}function Hf(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var ul=/\/+/g;function Ta(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Hf(""+e.key):t.toString(36)}function So(e,t,n,r,o){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(a){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case Kr:case _f:i=!0}}if(i)return i=e,o=o(i),e=r===""?"."+Ta(i,0):r,ll(o)?(n="",e!=null&&(n=e.replace(ul,"$&/")+"/"),So(o,t,n,"",function(c){return c})):o!=null&&(ii(o)&&(o=Wf(o,n+(!o.key||i&&i.key===o.key?"":(""+o.key).replace(ul,"$&/")+"/")+e)),t.push(o)),1;if(i=0,r=r===""?".":r+":",ll(e))for(var l=0;l<e.length;l++){a=e[l];var u=r+Ta(a,l);i+=So(a,t,n,u,o)}else if(u=Uf(e),typeof u=="function")for(e=u.call(e),l=0;!(a=e.next()).done;)a=a.value,u=r+Ta(a,l++),i+=So(a,t,n,u,o);else if(a==="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 eo(e,t,n){if(e==null)return e;var r=[],o=0;return So(e,r,"","",function(a){return t.call(n,a,o++)}),r}function Vf(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Me={current:null},jo={transition:null},Kf={ReactCurrentDispatcher:Me,ReactCurrentBatchConfig:jo,ReactCurrentOwner:si};function Wu(){throw Error("act(...) is not supported in production builds of React.")}J.Children={map:eo,forEach:function(e,t,n){eo(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return eo(e,function(){t++}),t},toArray:function(e){return eo(e,function(t){return t})||[]},only:function(e){if(!ii(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};J.Component=Zn;J.Fragment=zf;J.Profiler=$f;J.PureComponent=oi;J.StrictMode=Af;J.Suspense=Of;J.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Kf;J.act=Wu;J.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=Mu({},e.props),o=e.key,a=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(a=t.ref,i=si.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(u in t)Bu.call(t,u)&&!Du.hasOwnProperty(u)&&(r[u]=t[u]===void 0&&l!==void 0?l[u]:t[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){l=Array(u);for(var c=0;c<u;c++)l[c]=arguments[c+2];r.children=l}return{$$typeof:Kr,type:e.type,key:o,ref:a,props:r,_owner:i}};J.createContext=function(e){return e={$$typeof:Mf,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Lf,_context:e},e.Consumer=e};J.createElement=Uu;J.createFactory=function(e){var t=Uu.bind(null,e);return t.type=e,t};J.createRef=function(){return{current:null}};J.forwardRef=function(e){return{$$typeof:Ff,render:e}};J.isValidElement=ii;J.lazy=function(e){return{$$typeof:Df,_payload:{_status:-1,_result:e},_init:Vf}};J.memo=function(e,t){return{$$typeof:Bf,type:e,compare:t===void 0?null:t}};J.startTransition=function(e){var t=jo.transition;jo.transition={};try{e()}finally{jo.transition=t}};J.unstable_act=Wu;J.useCallback=function(e,t){return Me.current.useCallback(e,t)};J.useContext=function(e){return Me.current.useContext(e)};J.useDebugValue=function(){};J.useDeferredValue=function(e){return Me.current.useDeferredValue(e)};J.useEffect=function(e,t){return Me.current.useEffect(e,t)};J.useId=function(){return Me.current.useId()};J.useImperativeHandle=function(e,t,n){return Me.current.useImperativeHandle(e,t,n)};J.useInsertionEffect=function(e,t){return Me.current.useInsertionEffect(e,t)};J.useLayoutEffect=function(e,t){return Me.current.useLayoutEffect(e,t)};J.useMemo=function(e,t){return Me.current.useMemo(e,t)};J.useReducer=function(e,t,n){return Me.current.useReducer(e,t,n)};J.useRef=function(e){return Me.current.useRef(e)};J.useState=function(e){return Me.current.useState(e)};J.useSyncExternalStore=function(e,t,n){return Me.current.useSyncExternalStore(e,t,n)};J.useTransition=function(){return Me.current.useTransition()};J.version="18.3.1";$u.exports=J;var d=$u.exports;/**
9
+ */var Gr=Symbol.for("react.element"),Af=Symbol.for("react.portal"),$f=Symbol.for("react.fragment"),Lf=Symbol.for("react.strict_mode"),Mf=Symbol.for("react.profiler"),Ff=Symbol.for("react.provider"),Of=Symbol.for("react.context"),Bf=Symbol.for("react.forward_ref"),Df=Symbol.for("react.suspense"),Uf=Symbol.for("react.memo"),Wf=Symbol.for("react.lazy"),dl=Symbol.iterator;function Hf(e){return e===null||typeof e!="object"?null:(e=dl&&e[dl]||e["@@iterator"],typeof e=="function"?e:null)}var Fu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ou=Object.assign,Bu={};function Zn(e,t,n){this.props=e,this.context=t,this.refs=Bu,this.updater=n||Fu}Zn.prototype.isReactComponent={};Zn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Zn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Du(){}Du.prototype=Zn.prototype;function li(e,t,n){this.props=e,this.context=t,this.refs=Bu,this.updater=n||Fu}var ui=li.prototype=new Du;ui.constructor=li;Ou(ui,Zn.prototype);ui.isPureReactComponent=!0;var fl=Array.isArray,Uu=Object.prototype.hasOwnProperty,ci={current:null},Wu={key:!0,ref:!0,__self:!0,__source:!0};function Hu(e,t,n){var r,o={},a=null,i=null;if(t!=null)for(r in t.ref!==void 0&&(i=t.ref),t.key!==void 0&&(a=""+t.key),t)Uu.call(t,r)&&!Wu.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(l===1)o.children=n;else if(1<l){for(var u=Array(l),c=0;c<l;c++)u[c]=arguments[c+2];o.children=u}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)o[r]===void 0&&(o[r]=l[r]);return{$$typeof:Gr,type:e,key:a,ref:i,props:o,_owner:ci.current}}function Vf(e,t){return{$$typeof:Gr,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function di(e){return typeof e=="object"&&e!==null&&e.$$typeof===Gr}function Kf(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var pl=/\/+/g;function Ia(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Kf(""+e.key):t.toString(36)}function jo(e,t,n,r,o){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var i=!1;if(e===null)i=!0;else switch(a){case"string":case"number":i=!0;break;case"object":switch(e.$$typeof){case Gr:case Af:i=!0}}if(i)return i=e,o=o(i),e=r===""?"."+Ia(i,0):r,fl(o)?(n="",e!=null&&(n=e.replace(pl,"$&/")+"/"),jo(o,t,n,"",function(c){return c})):o!=null&&(di(o)&&(o=Vf(o,n+(!o.key||i&&i.key===o.key?"":(""+o.key).replace(pl,"$&/")+"/")+e)),t.push(o)),1;if(i=0,r=r===""?".":r+":",fl(e))for(var l=0;l<e.length;l++){a=e[l];var u=r+Ia(a,l);i+=jo(a,t,n,u,o)}else if(u=Hf(e),typeof u=="function")for(e=u.call(e),l=0;!(a=e.next()).done;)a=a.value,u=r+Ia(a,l++),i+=jo(a,t,n,u,o);else if(a==="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 to(e,t,n){if(e==null)return e;var r=[],o=0;return jo(e,r,"","",function(a){return t.call(n,a,o++)}),r}function Gf(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Me={current:null},ko={transition:null},Qf={ReactCurrentDispatcher:Me,ReactCurrentBatchConfig:ko,ReactCurrentOwner:ci};function Vu(){throw Error("act(...) is not supported in production builds of React.")}J.Children={map:to,forEach:function(e,t,n){to(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return to(e,function(){t++}),t},toArray:function(e){return to(e,function(t){return t})||[]},only:function(e){if(!di(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};J.Component=Zn;J.Fragment=$f;J.Profiler=Mf;J.PureComponent=li;J.StrictMode=Lf;J.Suspense=Df;J.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Qf;J.act=Vu;J.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=Ou({},e.props),o=e.key,a=e.ref,i=e._owner;if(t!=null){if(t.ref!==void 0&&(a=t.ref,i=ci.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(u in t)Uu.call(t,u)&&!Wu.hasOwnProperty(u)&&(r[u]=t[u]===void 0&&l!==void 0?l[u]:t[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){l=Array(u);for(var c=0;c<u;c++)l[c]=arguments[c+2];r.children=l}return{$$typeof:Gr,type:e.type,key:o,ref:a,props:r,_owner:i}};J.createContext=function(e){return e={$$typeof:Of,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Ff,_context:e},e.Consumer=e};J.createElement=Hu;J.createFactory=function(e){var t=Hu.bind(null,e);return t.type=e,t};J.createRef=function(){return{current:null}};J.forwardRef=function(e){return{$$typeof:Bf,render:e}};J.isValidElement=di;J.lazy=function(e){return{$$typeof:Wf,_payload:{_status:-1,_result:e},_init:Gf}};J.memo=function(e,t){return{$$typeof:Uf,type:e,compare:t===void 0?null:t}};J.startTransition=function(e){var t=ko.transition;ko.transition={};try{e()}finally{ko.transition=t}};J.unstable_act=Vu;J.useCallback=function(e,t){return Me.current.useCallback(e,t)};J.useContext=function(e){return Me.current.useContext(e)};J.useDebugValue=function(){};J.useDeferredValue=function(e){return Me.current.useDeferredValue(e)};J.useEffect=function(e,t){return Me.current.useEffect(e,t)};J.useId=function(){return Me.current.useId()};J.useImperativeHandle=function(e,t,n){return Me.current.useImperativeHandle(e,t,n)};J.useInsertionEffect=function(e,t){return Me.current.useInsertionEffect(e,t)};J.useLayoutEffect=function(e,t){return Me.current.useLayoutEffect(e,t)};J.useMemo=function(e,t){return Me.current.useMemo(e,t)};J.useReducer=function(e,t,n){return Me.current.useReducer(e,t,n)};J.useRef=function(e){return Me.current.useRef(e)};J.useState=function(e){return Me.current.useState(e)};J.useSyncExternalStore=function(e,t,n){return Me.current.useSyncExternalStore(e,t,n)};J.useTransition=function(){return Me.current.useTransition()};J.version="18.3.1";Mu.exports=J;var d=Mu.exports;/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@ var If=Object.defineProperty;var Rf=(e,t,n)=>t in e?If(e,t,{enumerable:!0,config
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Gf=d,Qf=Symbol.for("react.element"),Yf=Symbol.for("react.fragment"),Jf=Object.prototype.hasOwnProperty,Xf=Gf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,qf={key:!0,ref:!0,__self:!0,__source:!0};function Hu(e,t,n){var r,o={},a=null,i=null;n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)Jf.call(t,r)&&!qf.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:Qf,type:e,key:a,ref:i,props:o,_owner:Xf.current}}ua.Fragment=Yf;ua.jsx=Hu;ua.jsxs=Hu;Au.exports=ua;var s=Au.exports,Vu={exports:{}},Je={},Ku={exports:{}},Gu={};/**
17
+ */var Yf=d,Jf=Symbol.for("react.element"),Xf=Symbol.for("react.fragment"),qf=Object.prototype.hasOwnProperty,Zf=Yf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ep={key:!0,ref:!0,__self:!0,__source:!0};function Ku(e,t,n){var r,o={},a=null,i=null;n!==void 0&&(a=""+n),t.key!==void 0&&(a=""+t.key),t.ref!==void 0&&(i=t.ref);for(r in t)qf.call(t,r)&&!ep.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:Jf,type:e,key:a,ref:i,props:o,_owner:Zf.current}}ca.Fragment=Xf;ca.jsx=Ku;ca.jsxs=Ku;Lu.exports=ca;var s=Lu.exports,Gu={exports:{}},Je={},Qu={exports:{}},Yu={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@ var If=Object.defineProperty;var Rf=(e,t,n)=>t in e?If(e,t,{enumerable:!0,config
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(E,P){var $=E.length;E.push(P);e:for(;0<$;){var F=$-1>>>1,W=E[F];if(0<o(W,P))E[F]=P,E[$]=W,$=F;else break e}}function n(E){return E.length===0?null:E[0]}function r(E){if(E.length===0)return null;var P=E[0],$=E.pop();if($!==P){E[0]=$;e:for(var F=0,W=E.length,ne=W>>>1;F<ne;){var Q=2*(F+1)-1,Pe=E[Q],G=Q+1,H=E[G];if(0>o(Pe,$))G<W&&0>o(H,Pe)?(E[F]=H,E[G]=$,F=G):(E[F]=Pe,E[Q]=$,F=Q);else if(G<W&&0>o(H,$))E[F]=H,E[G]=$,F=G;else break e}}return P}function o(E,P){var $=E.sortIndex-P.sortIndex;return $!==0?$:E.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var u=[],c=[],h=1,p=null,g=3,y=!1,x=!1,w=!1,j=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(E){for(var P=n(c);P!==null;){if(P.callback===null)r(c);else if(P.startTime<=E)r(c),P.sortIndex=P.expirationTime,t(u,P);else break;P=n(c)}}function S(E){if(w=!1,v(E),!x)if(n(u)!==null)x=!0,V(b);else{var P=n(c);P!==null&&_(S,P.startTime-E)}}function b(E,P){x=!1,w&&(w=!1,m(N),N=-1),y=!0;var $=g;try{for(v(P),p=n(u);p!==null&&(!(p.expirationTime>P)||E&&!M());){var F=p.callback;if(typeof F=="function"){p.callback=null,g=p.priorityLevel;var W=F(p.expirationTime<=P);P=e.unstable_now(),typeof W=="function"?p.callback=W:p===n(u)&&r(u),v(P)}else r(u);p=n(u)}if(p!==null)var ne=!0;else{var Q=n(c);Q!==null&&_(S,Q.startTime-P),ne=!1}return ne}finally{p=null,g=$,y=!1}}var T=!1,k=null,N=-1,C=5,I=-1;function M(){return!(e.unstable_now()-I<C)}function B(){if(k!==null){var E=e.unstable_now();I=E;var P=!0;try{P=k(!0,E)}finally{P?A():(T=!1,k=null)}}else T=!1}var A;if(typeof f=="function")A=function(){f(B)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,R=z.port2;z.port1.onmessage=B,A=function(){R.postMessage(null)}}else A=function(){j(B,0)};function V(E){k=E,T||(T=!0,A())}function _(E,P){N=j(function(){E(e.unstable_now())},P)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(E){E.callback=null},e.unstable_continueExecution=function(){x||y||(x=!0,V(b))},e.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(E){switch(g){case 1:case 2:case 3:var P=3;break;default:P=g}var $=g;g=P;try{return E()}finally{g=$}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(E,P){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var $=g;g=E;try{return P()}finally{g=$}},e.unstable_scheduleCallback=function(E,P,$){var F=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?F+$:F):$=F,E){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=$+W,E={id:h++,callback:P,priorityLevel:E,startTime:$,expirationTime:W,sortIndex:-1},$>F?(E.sortIndex=$,t(c,E),n(u)===null&&E===n(c)&&(w?(m(N),N=-1):w=!0,_(S,$-F))):(E.sortIndex=W,t(u,E),x||y||(x=!0,V(b))),E},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(E){var P=g;return function(){var $=g;g=P;try{return E.apply(this,arguments)}finally{g=$}}}})(Gu);Ku.exports=Gu;var Zf=Ku.exports;/**
25
+ */(function(e){function t(E,P){var $=E.length;E.push(P);e:for(;0<$;){var F=$-1>>>1,W=E[F];if(0<o(W,P))E[F]=P,E[$]=W,$=F;else break e}}function n(E){return E.length===0?null:E[0]}function r(E){if(E.length===0)return null;var P=E[0],$=E.pop();if($!==P){E[0]=$;e:for(var F=0,W=E.length,ne=W>>>1;F<ne;){var Q=2*(F+1)-1,Pe=E[Q],G=Q+1,H=E[G];if(0>o(Pe,$))G<W&&0>o(H,Pe)?(E[F]=H,E[G]=$,F=G):(E[F]=Pe,E[Q]=$,F=Q);else if(G<W&&0>o(H,$))E[F]=H,E[G]=$,F=G;else break e}}return P}function o(E,P){var $=E.sortIndex-P.sortIndex;return $!==0?$:E.id-P.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var i=Date,l=i.now();e.unstable_now=function(){return i.now()-l}}var u=[],c=[],h=1,f=null,g=3,y=!1,x=!1,w=!1,j=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,p=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(E){for(var P=n(c);P!==null;){if(P.callback===null)r(c);else if(P.startTime<=E)r(c),P.sortIndex=P.expirationTime,t(u,P);else break;P=n(c)}}function S(E){if(w=!1,v(E),!x)if(n(u)!==null)x=!0,V(b);else{var P=n(c);P!==null&&R(S,P.startTime-E)}}function b(E,P){x=!1,w&&(w=!1,m(N),N=-1),y=!0;var $=g;try{for(v(P),f=n(u);f!==null&&(!(f.expirationTime>P)||E&&!M());){var F=f.callback;if(typeof F=="function"){f.callback=null,g=f.priorityLevel;var W=F(f.expirationTime<=P);P=e.unstable_now(),typeof W=="function"?f.callback=W:f===n(u)&&r(u),v(P)}else r(u);f=n(u)}if(f!==null)var ne=!0;else{var Q=n(c);Q!==null&&R(S,Q.startTime-P),ne=!1}return ne}finally{f=null,g=$,y=!1}}var T=!1,k=null,N=-1,C=5,I=-1;function M(){return!(e.unstable_now()-I<C)}function B(){if(k!==null){var E=e.unstable_now();I=E;var P=!0;try{P=k(!0,E)}finally{P?A():(T=!1,k=null)}}else T=!1}var A;if(typeof p=="function")A=function(){p(B)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,_=z.port2;z.port1.onmessage=B,A=function(){_.postMessage(null)}}else A=function(){j(B,0)};function V(E){k=E,T||(T=!0,A())}function R(E,P){N=j(function(){E(e.unstable_now())},P)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(E){E.callback=null},e.unstable_continueExecution=function(){x||y||(x=!0,V(b))},e.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<E?Math.floor(1e3/E):5},e.unstable_getCurrentPriorityLevel=function(){return g},e.unstable_getFirstCallbackNode=function(){return n(u)},e.unstable_next=function(E){switch(g){case 1:case 2:case 3:var P=3;break;default:P=g}var $=g;g=P;try{return E()}finally{g=$}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(E,P){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var $=g;g=E;try{return P()}finally{g=$}},e.unstable_scheduleCallback=function(E,P,$){var F=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?F+$:F):$=F,E){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=$+W,E={id:h++,callback:P,priorityLevel:E,startTime:$,expirationTime:W,sortIndex:-1},$>F?(E.sortIndex=$,t(c,E),n(u)===null&&E===n(c)&&(w?(m(N),N=-1):w=!0,R(S,$-F))):(E.sortIndex=W,t(u,E),x||y||(x=!0,V(b))),E},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(E){var P=g;return function(){var $=g;g=P;try{return E.apply(this,arguments)}finally{g=$}}}})(Yu);Qu.exports=Yu;var tp=Qu.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,14 +30,14 @@ var If=Object.defineProperty;var Rf=(e,t,n)=>t in e?If(e,t,{enumerable:!0,config
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var ep=d,Ye=Zf;function L(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 Qu=new Set,Pr={};function Nn(e,t){Kn(e,t),Kn(e+"Capture",t)}function Kn(e,t){for(Pr[e]=t,e=0;e<t.length;e++)Qu.add(t[e])}var Lt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),is=Object.prototype.hasOwnProperty,tp=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,cl={},dl={};function np(e){return is.call(dl,e)?!0:is.call(cl,e)?!1:tp.test(e)?dl[e]=!0:(cl[e]=!0,!1)}function rp(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 op(e,t,n,r){if(t===null||typeof t>"u"||rp(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Fe(e,t,n,r,o,a,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=i}var be={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){be[e]=new Fe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];be[t]=new Fe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){be[e]=new Fe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){be[e]=new Fe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){be[e]=new Fe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){be[e]=new Fe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){be[e]=new Fe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){be[e]=new Fe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){be[e]=new Fe(e,5,!1,e.toLowerCase(),null,!1,!1)});var li=/[\-:]([a-z])/g;function ui(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(li,ui);be[t]=new Fe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(li,ui);be[t]=new Fe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(li,ui);be[t]=new Fe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){be[e]=new Fe(e,1,!1,e.toLowerCase(),null,!1,!1)});be.xlinkHref=new Fe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){be[e]=new Fe(e,1,!1,e.toLowerCase(),null,!0,!0)});function ci(e,t,n,r){var o=be.hasOwnProperty(t)?be[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(op(t,n,o,r)&&(n=null),r||o===null?np(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Dt=ep.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,to=Symbol.for("react.element"),Pn=Symbol.for("react.portal"),Tn=Symbol.for("react.fragment"),di=Symbol.for("react.strict_mode"),ls=Symbol.for("react.profiler"),Yu=Symbol.for("react.provider"),Ju=Symbol.for("react.context"),fi=Symbol.for("react.forward_ref"),us=Symbol.for("react.suspense"),cs=Symbol.for("react.suspense_list"),pi=Symbol.for("react.memo"),Wt=Symbol.for("react.lazy"),Xu=Symbol.for("react.offscreen"),fl=Symbol.iterator;function ar(e){return e===null||typeof e!="object"?null:(e=fl&&e[fl]||e["@@iterator"],typeof e=="function"?e:null)}var fe=Object.assign,Ia;function mr(e){if(Ia===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ia=t&&t[1]||""}return`
34
- `+Ia+e}var Ra=!1;function _a(e,t){if(!e||Ra)return"";Ra=!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(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var o=c.stack.split(`
33
+ */var np=d,Ye=tp;function L(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 Ju=new Set,Tr={};function Nn(e,t){Kn(e,t),Kn(e+"Capture",t)}function Kn(e,t){for(Tr[e]=t,e=0;e<t.length;e++)Ju.add(t[e])}var $t=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ls=Object.prototype.hasOwnProperty,rp=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ml={},hl={};function op(e){return ls.call(hl,e)?!0:ls.call(ml,e)?!1:rp.test(e)?hl[e]=!0:(ml[e]=!0,!1)}function ap(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 sp(e,t,n,r){if(t===null||typeof t>"u"||ap(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Fe(e,t,n,r,o,a,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=i}var be={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){be[e]=new Fe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];be[t]=new Fe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){be[e]=new Fe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){be[e]=new Fe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){be[e]=new Fe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){be[e]=new Fe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){be[e]=new Fe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){be[e]=new Fe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){be[e]=new Fe(e,5,!1,e.toLowerCase(),null,!1,!1)});var fi=/[\-:]([a-z])/g;function pi(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(fi,pi);be[t]=new Fe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(fi,pi);be[t]=new Fe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(fi,pi);be[t]=new Fe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){be[e]=new Fe(e,1,!1,e.toLowerCase(),null,!1,!1)});be.xlinkHref=new Fe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){be[e]=new Fe(e,1,!1,e.toLowerCase(),null,!0,!0)});function mi(e,t,n,r){var o=be.hasOwnProperty(t)?be[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(sp(t,n,o,r)&&(n=null),r||o===null?op(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Bt=np.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,no=Symbol.for("react.element"),Pn=Symbol.for("react.portal"),Tn=Symbol.for("react.fragment"),hi=Symbol.for("react.strict_mode"),us=Symbol.for("react.profiler"),Xu=Symbol.for("react.provider"),qu=Symbol.for("react.context"),gi=Symbol.for("react.forward_ref"),cs=Symbol.for("react.suspense"),ds=Symbol.for("react.suspense_list"),vi=Symbol.for("react.memo"),Wt=Symbol.for("react.lazy"),Zu=Symbol.for("react.offscreen"),gl=Symbol.iterator;function ar(e){return e===null||typeof e!="object"?null:(e=gl&&e[gl]||e["@@iterator"],typeof e=="function"?e:null)}var fe=Object.assign,_a;function mr(e){if(_a===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);_a=t&&t[1]||""}return`
34
+ `+_a+e}var Ra=!1;function za(e,t){if(!e||Ra)return"";Ra=!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(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var o=c.stack.split(`
35
35
  `),a=r.stack.split(`
36
36
  `),i=o.length-1,l=a.length-1;1<=i&&0<=l&&o[i]!==a[l];)l--;for(;1<=i&&0<=l;i--,l--)if(o[i]!==a[l]){if(i!==1||l!==1)do if(i--,l--,0>l||o[i]!==a[l]){var u=`
37
- `+o[i].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=i&&0<=l);break}}}finally{Ra=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?mr(e):""}function ap(e){switch(e.tag){case 5:return mr(e.type);case 16:return mr("Lazy");case 13:return mr("Suspense");case 19:return mr("SuspenseList");case 0:case 2:case 15:return e=_a(e.type,!1),e;case 11:return e=_a(e.type.render,!1),e;case 1:return e=_a(e.type,!0),e;default:return""}}function ds(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Tn:return"Fragment";case Pn:return"Portal";case ls:return"Profiler";case di:return"StrictMode";case us:return"Suspense";case cs:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ju:return(e.displayName||"Context")+".Consumer";case Yu:return(e._context.displayName||"Context")+".Provider";case fi:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case pi:return t=e.displayName||null,t!==null?t:ds(e.type)||"Memo";case Wt:t=e._payload,e=e._init;try{return ds(e(t))}catch{}}return null}function sp(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 ds(t);case 8:return t===di?"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 on(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ip(e){var t=qu(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(i){r=""+i,a.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 no(e){e._valueTracker||(e._valueTracker=ip(e))}function Zu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=qu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function $o(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 fs(e,t){var n=t.checked;return fe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function pl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=on(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 ec(e,t){t=t.checked,t!=null&&ci(e,"checked",t,!1)}function ps(e,t){ec(e,t);var n=on(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")?ms(e,t.type,n):t.hasOwnProperty("defaultValue")&&ms(e,t.type,on(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ml(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 ms(e,t,n){(t!=="number"||$o(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var hr=Array.isArray;function Bn(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+on(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function hs(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(L(91));return fe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function hl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(L(92));if(hr(n)){if(1<n.length)throw Error(L(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:on(n)}}function tc(e,t){var n=on(t.value),r=on(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 gl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function nc(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 gs(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?nc(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ro,rc=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(ro=ro||document.createElement("div"),ro.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ro.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Tr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},lp=["Webkit","ms","Moz","O"];Object.keys(xr).forEach(function(e){lp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xr[t]=xr[e]})});function oc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||xr.hasOwnProperty(e)&&xr[e]?(""+t).trim():t+"px"}function ac(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=oc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var up=fe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vs(e,t){if(t){if(up[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(L(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(L(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(L(61))}if(t.style!=null&&typeof t.style!="object")throw Error(L(62))}}function ys(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 xs=null;function mi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ws=null,Dn=null,Un=null;function vl(e){if(e=Yr(e)){if(typeof ws!="function")throw Error(L(280));var t=e.stateNode;t&&(t=ma(t),ws(e.stateNode,e.type,t))}}function sc(e){Dn?Un?Un.push(e):Un=[e]:Dn=e}function ic(){if(Dn){var e=Dn,t=Un;if(Un=Dn=null,vl(e),t)for(e=0;e<t.length;e++)vl(t[e])}}function lc(e,t){return e(t)}function uc(){}var za=!1;function cc(e,t,n){if(za)return e(t,n);za=!0;try{return lc(e,t,n)}finally{za=!1,(Dn!==null||Un!==null)&&(uc(),ic())}}function Ir(e,t){var n=e.stateNode;if(n===null)return null;var r=ma(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(L(231,t,typeof n));return n}var Ss=!1;if(Lt)try{var sr={};Object.defineProperty(sr,"passive",{get:function(){Ss=!0}}),window.addEventListener("test",sr,sr),window.removeEventListener("test",sr,sr)}catch{Ss=!1}function cp(e,t,n,r,o,a,i,l,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(h){this.onError(h)}}var wr=!1,Lo=null,Mo=!1,js=null,dp={onError:function(e){wr=!0,Lo=e}};function fp(e,t,n,r,o,a,i,l,u){wr=!1,Lo=null,cp.apply(dp,arguments)}function pp(e,t,n,r,o,a,i,l,u){if(fp.apply(this,arguments),wr){if(wr){var c=Lo;wr=!1,Lo=null}else throw Error(L(198));Mo||(Mo=!0,js=c)}}function En(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function dc(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 yl(e){if(En(e)!==e)throw Error(L(188))}function mp(e){var t=e.alternate;if(!t){if(t=En(e),t===null)throw Error(L(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var a=o.alternate;if(a===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===a.child){for(a=o.child;a;){if(a===n)return yl(o),e;if(a===r)return yl(o),t;a=a.sibling}throw Error(L(188))}if(n.return!==r.return)n=o,r=a;else{for(var i=!1,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){for(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)throw Error(L(189))}}if(n.alternate!==r)throw Error(L(190))}if(n.tag!==3)throw Error(L(188));return n.stateNode.current===n?e:t}function fc(e){return e=mp(e),e!==null?pc(e):null}function pc(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=pc(e);if(t!==null)return t;e=e.sibling}return null}var mc=Ye.unstable_scheduleCallback,xl=Ye.unstable_cancelCallback,hp=Ye.unstable_shouldYield,gp=Ye.unstable_requestPaint,he=Ye.unstable_now,vp=Ye.unstable_getCurrentPriorityLevel,hi=Ye.unstable_ImmediatePriority,hc=Ye.unstable_UserBlockingPriority,Fo=Ye.unstable_NormalPriority,yp=Ye.unstable_LowPriority,gc=Ye.unstable_IdlePriority,ca=null,Ct=null;function xp(e){if(Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(ca,e,void 0,(e.current.flags&128)===128)}catch{}}var mt=Math.clz32?Math.clz32:jp,wp=Math.log,Sp=Math.LN2;function jp(e){return e>>>=0,e===0?32:31-(wp(e)/Sp|0)|0}var oo=64,ao=4194304;function gr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Oo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,a=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~o;l!==0?r=gr(l):(a&=i,a!==0&&(r=gr(a)))}else i=n&~o,i!==0?r=gr(i):a!==0&&(r=gr(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,a=t&-t,o>=a||o===16&&(a&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-mt(t),o=1<<n,r|=e[n],t&=~o;return r}function kp(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 Cp(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,a=e.pendingLanes;0<a;){var i=31-mt(a),l=1<<i,u=o[i];u===-1?(!(l&n)||l&r)&&(o[i]=kp(l,t)):u<=t&&(e.expiredLanes|=l),a&=~l}}function ks(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function vc(){var e=oo;return oo<<=1,!(oo&4194240)&&(oo=64),e}function Aa(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Gr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-mt(t),e[t]=n}function Np(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-mt(n),a=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~a}}function gi(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-mt(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var te=0;function yc(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var xc,vi,wc,Sc,jc,Cs=!1,so=[],Jt=null,Xt=null,qt=null,Rr=new Map,_r=new Map,Kt=[],Ep="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 wl(e,t){switch(e){case"focusin":case"focusout":Jt=null;break;case"dragenter":case"dragleave":Xt=null;break;case"mouseover":case"mouseout":qt=null;break;case"pointerover":case"pointerout":Rr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_r.delete(t.pointerId)}}function ir(e,t,n,r,o,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[o]},t!==null&&(t=Yr(t),t!==null&&vi(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function bp(e,t,n,r,o){switch(t){case"focusin":return Jt=ir(Jt,e,t,n,r,o),!0;case"dragenter":return Xt=ir(Xt,e,t,n,r,o),!0;case"mouseover":return qt=ir(qt,e,t,n,r,o),!0;case"pointerover":var a=o.pointerId;return Rr.set(a,ir(Rr.get(a)||null,e,t,n,r,o)),!0;case"gotpointercapture":return a=o.pointerId,_r.set(a,ir(_r.get(a)||null,e,t,n,r,o)),!0}return!1}function kc(e){var t=mn(e.target);if(t!==null){var n=En(t);if(n!==null){if(t=n.tag,t===13){if(t=dc(n),t!==null){e.blockedOn=t,jc(e.priority,function(){wc(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 ko(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Ns(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);xs=r,n.target.dispatchEvent(r),xs=null}else return t=Yr(n),t!==null&&vi(t),e.blockedOn=n,!1;t.shift()}return!0}function Sl(e,t,n){ko(e)&&n.delete(t)}function Pp(){Cs=!1,Jt!==null&&ko(Jt)&&(Jt=null),Xt!==null&&ko(Xt)&&(Xt=null),qt!==null&&ko(qt)&&(qt=null),Rr.forEach(Sl),_r.forEach(Sl)}function lr(e,t){e.blockedOn===t&&(e.blockedOn=null,Cs||(Cs=!0,Ye.unstable_scheduleCallback(Ye.unstable_NormalPriority,Pp)))}function zr(e){function t(o){return lr(o,e)}if(0<so.length){lr(so[0],e);for(var n=1;n<so.length;n++){var r=so[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Jt!==null&&lr(Jt,e),Xt!==null&&lr(Xt,e),qt!==null&&lr(qt,e),Rr.forEach(t),_r.forEach(t),n=0;n<Kt.length;n++)r=Kt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Kt.length&&(n=Kt[0],n.blockedOn===null);)kc(n),n.blockedOn===null&&Kt.shift()}var Wn=Dt.ReactCurrentBatchConfig,Bo=!0;function Tp(e,t,n,r){var o=te,a=Wn.transition;Wn.transition=null;try{te=1,yi(e,t,n,r)}finally{te=o,Wn.transition=a}}function Ip(e,t,n,r){var o=te,a=Wn.transition;Wn.transition=null;try{te=4,yi(e,t,n,r)}finally{te=o,Wn.transition=a}}function yi(e,t,n,r){if(Bo){var o=Ns(e,t,n,r);if(o===null)Ha(e,t,r,Do,n),wl(e,r);else if(bp(o,e,t,n,r))r.stopPropagation();else if(wl(e,r),t&4&&-1<Ep.indexOf(e)){for(;o!==null;){var a=Yr(o);if(a!==null&&xc(a),a=Ns(e,t,n,r),a===null&&Ha(e,t,r,Do,n),a===o)break;o=a}o!==null&&r.stopPropagation()}else Ha(e,t,r,null,n)}}var Do=null;function Ns(e,t,n,r){if(Do=null,e=mi(r),e=mn(e),e!==null)if(t=En(e),t===null)e=null;else if(n=t.tag,n===13){if(e=dc(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 Do=e,null}function Cc(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(vp()){case hi:return 1;case hc:return 4;case Fo:case yp:return 16;case gc:return 536870912;default:return 16}default:return 16}}var Qt=null,xi=null,Co=null;function Nc(){if(Co)return Co;var e,t=xi,n=t.length,r,o="value"in Qt?Qt.value:Qt.textContent,a=o.length;for(e=0;e<n&&t[e]===o[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===o[a-r];r++);return Co=o.slice(e,1<r?1-r:void 0)}function No(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 io(){return!0}function jl(){return!1}function Xe(e){function t(n,r,o,a,i){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=a,this.target=i,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(a):a[l]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?io:jl,this.isPropagationStopped=jl,this}return fe(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=io)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=io)},persist:function(){},isPersistent:io}),t}var er={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wi=Xe(er),Qr=fe({},er,{view:0,detail:0}),Rp=Xe(Qr),$a,La,ur,da=fe({},Qr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Si,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!==ur&&(ur&&e.type==="mousemove"?($a=e.screenX-ur.screenX,La=e.screenY-ur.screenY):La=$a=0,ur=e),$a)},movementY:function(e){return"movementY"in e?e.movementY:La}}),kl=Xe(da),_p=fe({},da,{dataTransfer:0}),zp=Xe(_p),Ap=fe({},Qr,{relatedTarget:0}),Ma=Xe(Ap),$p=fe({},er,{animationName:0,elapsedTime:0,pseudoElement:0}),Lp=Xe($p),Mp=fe({},er,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Fp=Xe(Mp),Op=fe({},er,{data:0}),Cl=Xe(Op),Bp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Dp={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"},Up={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Wp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Up[e])?!!t[e]:!1}function Si(){return Wp}var Hp=fe({},Qr,{key:function(e){if(e.key){var t=Bp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=No(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Dp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Si,charCode:function(e){return e.type==="keypress"?No(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?No(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Vp=Xe(Hp),Kp=fe({},da,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Nl=Xe(Kp),Gp=fe({},Qr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Si}),Qp=Xe(Gp),Yp=fe({},er,{propertyName:0,elapsedTime:0,pseudoElement:0}),Jp=Xe(Yp),Xp=fe({},da,{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}),qp=Xe(Xp),Zp=[9,13,27,32],ji=Lt&&"CompositionEvent"in window,Sr=null;Lt&&"documentMode"in document&&(Sr=document.documentMode);var em=Lt&&"TextEvent"in window&&!Sr,Ec=Lt&&(!ji||Sr&&8<Sr&&11>=Sr),El=" ",bl=!1;function bc(e,t){switch(e){case"keyup":return Zp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pc(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var In=!1;function tm(e,t){switch(e){case"compositionend":return Pc(t);case"keypress":return t.which!==32?null:(bl=!0,El);case"textInput":return e=t.data,e===El&&bl?null:e;default:return null}}function nm(e,t){if(In)return e==="compositionend"||!ji&&bc(e,t)?(e=Nc(),Co=xi=Qt=null,In=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ec&&t.locale!=="ko"?null:t.data;default:return null}}var rm={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 Pl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!rm[e.type]:t==="textarea"}function Tc(e,t,n,r){sc(r),t=Uo(t,"onChange"),0<t.length&&(n=new wi("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var jr=null,Ar=null;function om(e){Bc(e,0)}function fa(e){var t=zn(e);if(Zu(t))return e}function am(e,t){if(e==="change")return t}var Ic=!1;if(Lt){var Fa;if(Lt){var Oa="oninput"in document;if(!Oa){var Tl=document.createElement("div");Tl.setAttribute("oninput","return;"),Oa=typeof Tl.oninput=="function"}Fa=Oa}else Fa=!1;Ic=Fa&&(!document.documentMode||9<document.documentMode)}function Il(){jr&&(jr.detachEvent("onpropertychange",Rc),Ar=jr=null)}function Rc(e){if(e.propertyName==="value"&&fa(Ar)){var t=[];Tc(t,Ar,e,mi(e)),cc(om,t)}}function sm(e,t,n){e==="focusin"?(Il(),jr=t,Ar=n,jr.attachEvent("onpropertychange",Rc)):e==="focusout"&&Il()}function im(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return fa(Ar)}function lm(e,t){if(e==="click")return fa(t)}function um(e,t){if(e==="input"||e==="change")return fa(t)}function cm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gt=typeof Object.is=="function"?Object.is:cm;function $r(e,t){if(gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!is.call(t,o)||!gt(e[o],t[o]))return!1}return!0}function Rl(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function _l(e,t){var n=Rl(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=Rl(n)}}function _c(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_c(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zc(){for(var e=window,t=$o();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=$o(e.document)}return t}function ki(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 dm(e){var t=zc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&_c(n.ownerDocument.documentElement,n)){if(r!==null&&ki(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,a=Math.min(r.start,o);r=r.end===void 0?a:Math.min(r.end,o),!e.extend&&a>r&&(o=r,r=a,a=o),o=_l(n,a);var i=_l(n,r);o&&i&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),a>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 fm=Lt&&"documentMode"in document&&11>=document.documentMode,Rn=null,Es=null,kr=null,bs=!1;function zl(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;bs||Rn==null||Rn!==$o(r)||(r=Rn,"selectionStart"in r&&ki(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kr&&$r(kr,r)||(kr=r,r=Uo(Es,"onSelect"),0<r.length&&(t=new wi("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Rn)))}function lo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var _n={animationend:lo("Animation","AnimationEnd"),animationiteration:lo("Animation","AnimationIteration"),animationstart:lo("Animation","AnimationStart"),transitionend:lo("Transition","TransitionEnd")},Ba={},Ac={};Lt&&(Ac=document.createElement("div").style,"AnimationEvent"in window||(delete _n.animationend.animation,delete _n.animationiteration.animation,delete _n.animationstart.animation),"TransitionEvent"in window||delete _n.transitionend.transition);function pa(e){if(Ba[e])return Ba[e];if(!_n[e])return e;var t=_n[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ac)return Ba[e]=t[n];return e}var $c=pa("animationend"),Lc=pa("animationiteration"),Mc=pa("animationstart"),Fc=pa("transitionend"),Oc=new Map,Al="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function sn(e,t){Oc.set(e,t),Nn(t,[e])}for(var Da=0;Da<Al.length;Da++){var Ua=Al[Da],pm=Ua.toLowerCase(),mm=Ua[0].toUpperCase()+Ua.slice(1);sn(pm,"on"+mm)}sn($c,"onAnimationEnd");sn(Lc,"onAnimationIteration");sn(Mc,"onAnimationStart");sn("dblclick","onDoubleClick");sn("focusin","onFocus");sn("focusout","onBlur");sn(Fc,"onTransitionEnd");Kn("onMouseEnter",["mouseout","mouseover"]);Kn("onMouseLeave",["mouseout","mouseover"]);Kn("onPointerEnter",["pointerout","pointerover"]);Kn("onPointerLeave",["pointerout","pointerover"]);Nn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Nn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Nn("onBeforeInput",["compositionend","keypress","textInput","paste"]);Nn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Nn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Nn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),hm=new Set("cancel close invalid load scroll toggle".split(" ").concat(vr));function $l(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,pp(r,t,void 0,e),e.currentTarget=null}function Bc(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var a=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],u=l.instance,c=l.currentTarget;if(l=l.listener,u!==a&&o.isPropagationStopped())break e;$l(o,l,c),a=u}else for(i=0;i<r.length;i++){if(l=r[i],u=l.instance,c=l.currentTarget,l=l.listener,u!==a&&o.isPropagationStopped())break e;$l(o,l,c),a=u}}}if(Mo)throw e=js,Mo=!1,js=null,e}function oe(e,t){var n=t[_s];n===void 0&&(n=t[_s]=new Set);var r=e+"__bubble";n.has(r)||(Dc(t,e,2,!1),n.add(r))}function Wa(e,t,n){var r=0;t&&(r|=4),Dc(n,e,r,t)}var uo="_reactListening"+Math.random().toString(36).slice(2);function Lr(e){if(!e[uo]){e[uo]=!0,Qu.forEach(function(n){n!=="selectionchange"&&(hm.has(n)||Wa(n,!1,e),Wa(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[uo]||(t[uo]=!0,Wa("selectionchange",!1,t))}}function Dc(e,t,n,r){switch(Cc(t)){case 1:var o=Tp;break;case 4:o=Ip;break;default:o=yi}n=o.bind(null,t,n,e),o=void 0,!Ss||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Ha(e,t,n,r,o){var a=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var l=r.stateNode.containerInfo;if(l===o||l.nodeType===8&&l.parentNode===o)break;if(i===4)for(i=r.return;i!==null;){var u=i.tag;if((u===3||u===4)&&(u=i.stateNode.containerInfo,u===o||u.nodeType===8&&u.parentNode===o))return;i=i.return}for(;l!==null;){if(i=mn(l),i===null)return;if(u=i.tag,u===5||u===6){r=a=i;continue e}l=l.parentNode}}r=r.return}cc(function(){var c=a,h=mi(n),p=[];e:{var g=Oc.get(e);if(g!==void 0){var y=wi,x=e;switch(e){case"keypress":if(No(n)===0)break e;case"keydown":case"keyup":y=Vp;break;case"focusin":x="focus",y=Ma;break;case"focusout":x="blur",y=Ma;break;case"beforeblur":case"afterblur":y=Ma;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=kl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=zp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=Qp;break;case $c:case Lc:case Mc:y=Lp;break;case Fc:y=Jp;break;case"scroll":y=Rp;break;case"wheel":y=qp;break;case"copy":case"cut":case"paste":y=Fp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=Nl}var w=(t&4)!==0,j=!w&&e==="scroll",m=w?g!==null?g+"Capture":null:g;w=[];for(var f=c,v;f!==null;){v=f;var S=v.stateNode;if(v.tag===5&&S!==null&&(v=S,m!==null&&(S=Ir(f,m),S!=null&&w.push(Mr(f,S,v)))),j)break;f=f.return}0<w.length&&(g=new y(g,x,null,n,h),p.push({event:g,listeners:w}))}}if(!(t&7)){e:{if(g=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",g&&n!==xs&&(x=n.relatedTarget||n.fromElement)&&(mn(x)||x[Mt]))break e;if((y||g)&&(g=h.window===h?h:(g=h.ownerDocument)?g.defaultView||g.parentWindow:window,y?(x=n.relatedTarget||n.toElement,y=c,x=x?mn(x):null,x!==null&&(j=En(x),x!==j||x.tag!==5&&x.tag!==6)&&(x=null)):(y=null,x=c),y!==x)){if(w=kl,S="onMouseLeave",m="onMouseEnter",f="mouse",(e==="pointerout"||e==="pointerover")&&(w=Nl,S="onPointerLeave",m="onPointerEnter",f="pointer"),j=y==null?g:zn(y),v=x==null?g:zn(x),g=new w(S,f+"leave",y,n,h),g.target=j,g.relatedTarget=v,S=null,mn(h)===c&&(w=new w(m,f+"enter",x,n,h),w.target=v,w.relatedTarget=j,S=w),j=S,y&&x)t:{for(w=y,m=x,f=0,v=w;v;v=bn(v))f++;for(v=0,S=m;S;S=bn(S))v++;for(;0<f-v;)w=bn(w),f--;for(;0<v-f;)m=bn(m),v--;for(;f--;){if(w===m||m!==null&&w===m.alternate)break t;w=bn(w),m=bn(m)}w=null}else w=null;y!==null&&Ll(p,g,y,w,!1),x!==null&&j!==null&&Ll(p,j,x,w,!0)}}e:{if(g=c?zn(c):window,y=g.nodeName&&g.nodeName.toLowerCase(),y==="select"||y==="input"&&g.type==="file")var b=am;else if(Pl(g))if(Ic)b=um;else{b=im;var T=sm}else(y=g.nodeName)&&y.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(b=lm);if(b&&(b=b(e,c))){Tc(p,b,n,h);break e}T&&T(e,g,c),e==="focusout"&&(T=g._wrapperState)&&T.controlled&&g.type==="number"&&ms(g,"number",g.value)}switch(T=c?zn(c):window,e){case"focusin":(Pl(T)||T.contentEditable==="true")&&(Rn=T,Es=c,kr=null);break;case"focusout":kr=Es=Rn=null;break;case"mousedown":bs=!0;break;case"contextmenu":case"mouseup":case"dragend":bs=!1,zl(p,n,h);break;case"selectionchange":if(fm)break;case"keydown":case"keyup":zl(p,n,h)}var k;if(ji)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 In?bc(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(Ec&&n.locale!=="ko"&&(In||N!=="onCompositionStart"?N==="onCompositionEnd"&&In&&(k=Nc()):(Qt=h,xi="value"in Qt?Qt.value:Qt.textContent,In=!0)),T=Uo(c,N),0<T.length&&(N=new Cl(N,e,null,n,h),p.push({event:N,listeners:T}),k?N.data=k:(k=Pc(n),k!==null&&(N.data=k)))),(k=em?tm(e,n):nm(e,n))&&(c=Uo(c,"onBeforeInput"),0<c.length&&(h=new Cl("onBeforeInput","beforeinput",null,n,h),p.push({event:h,listeners:c}),h.data=k))}Bc(p,t)})}function Mr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Uo(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,a=o.stateNode;o.tag===5&&a!==null&&(o=a,a=Ir(e,n),a!=null&&r.unshift(Mr(e,a,o)),a=Ir(e,t),a!=null&&r.push(Mr(e,a,o))),e=e.return}return r}function bn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Ll(e,t,n,r,o){for(var a=t._reactName,i=[];n!==null&&n!==r;){var l=n,u=l.alternate,c=l.stateNode;if(u!==null&&u===r)break;l.tag===5&&c!==null&&(l=c,o?(u=Ir(n,a),u!=null&&i.unshift(Mr(n,u,l))):o||(u=Ir(n,a),u!=null&&i.push(Mr(n,u,l)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var gm=/\r\n?/g,vm=/\u0000|\uFFFD/g;function Ml(e){return(typeof e=="string"?e:""+e).replace(gm,`
38
- `).replace(vm,"")}function co(e,t,n){if(t=Ml(t),Ml(e)!==t&&n)throw Error(L(425))}function Wo(){}var Ps=null,Ts=null;function Is(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Rs=typeof setTimeout=="function"?setTimeout:void 0,ym=typeof clearTimeout=="function"?clearTimeout:void 0,Fl=typeof Promise=="function"?Promise:void 0,xm=typeof queueMicrotask=="function"?queueMicrotask:typeof Fl<"u"?function(e){return Fl.resolve(null).then(e).catch(wm)}:Rs;function wm(e){setTimeout(function(){throw e})}function Va(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),zr(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);zr(t)}function Zt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Ol(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var tr=Math.random().toString(36).slice(2),kt="__reactFiber$"+tr,Fr="__reactProps$"+tr,Mt="__reactContainer$"+tr,_s="__reactEvents$"+tr,Sm="__reactListeners$"+tr,jm="__reactHandles$"+tr;function mn(e){var t=e[kt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Mt]||n[kt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Ol(e);e!==null;){if(n=e[kt])return n;e=Ol(e)}return t}e=n,n=e.parentNode}return null}function Yr(e){return e=e[kt]||e[Mt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function zn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(L(33))}function ma(e){return e[Fr]||null}var zs=[],An=-1;function ln(e){return{current:e}}function ae(e){0>An||(e.current=zs[An],zs[An]=null,An--)}function re(e,t){An++,zs[An]=e.current,e.current=t}var an={},ze=ln(an),De=ln(!1),wn=an;function Gn(e,t){var n=e.type.contextTypes;if(!n)return an;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},a;for(a in n)o[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ue(e){return e=e.childContextTypes,e!=null}function Ho(){ae(De),ae(ze)}function Bl(e,t,n){if(ze.current!==an)throw Error(L(168));re(ze,t),re(De,n)}function Uc(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(L(108,sp(e)||"Unknown",o));return fe({},n,r)}function Vo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||an,wn=ze.current,re(ze,e),re(De,De.current),!0}function Dl(e,t,n){var r=e.stateNode;if(!r)throw Error(L(169));n?(e=Uc(e,t,wn),r.__reactInternalMemoizedMergedChildContext=e,ae(De),ae(ze),re(ze,e)):ae(De),re(De,n)}var Rt=null,ha=!1,Ka=!1;function Wc(e){Rt===null?Rt=[e]:Rt.push(e)}function km(e){ha=!0,Wc(e)}function un(){if(!Ka&&Rt!==null){Ka=!0;var e=0,t=te;try{var n=Rt;for(te=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Rt=null,ha=!1}catch(o){throw Rt!==null&&(Rt=Rt.slice(e+1)),mc(hi,un),o}finally{te=t,Ka=!1}}return null}var $n=[],Ln=0,Ko=null,Go=0,et=[],tt=0,Sn=null,_t=1,zt="";function dn(e,t){$n[Ln++]=Go,$n[Ln++]=Ko,Ko=e,Go=t}function Hc(e,t,n){et[tt++]=_t,et[tt++]=zt,et[tt++]=Sn,Sn=e;var r=_t;e=zt;var o=32-mt(r)-1;r&=~(1<<o),n+=1;var a=32-mt(t)+o;if(30<a){var i=o-o%5;a=(r&(1<<i)-1).toString(32),r>>=i,o-=i,_t=1<<32-mt(t)+o|n<<o|r,zt=a+e}else _t=1<<a|n<<o|r,zt=e}function Ci(e){e.return!==null&&(dn(e,1),Hc(e,1,0))}function Ni(e){for(;e===Ko;)Ko=$n[--Ln],$n[Ln]=null,Go=$n[--Ln],$n[Ln]=null;for(;e===Sn;)Sn=et[--tt],et[tt]=null,zt=et[--tt],et[tt]=null,_t=et[--tt],et[tt]=null}var Qe=null,Ge=null,se=!1,pt=null;function Vc(e,t){var n=rt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Ul(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Qe=e,Ge=Zt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Qe=e,Ge=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Sn!==null?{id:_t,overflow:zt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Qe=e,Ge=null,!0):!1;default:return!1}}function As(e){return(e.mode&1)!==0&&(e.flags&128)===0}function $s(e){if(se){var t=Ge;if(t){var n=t;if(!Ul(e,t)){if(As(e))throw Error(L(418));t=Zt(n.nextSibling);var r=Qe;t&&Ul(e,t)?Vc(r,n):(e.flags=e.flags&-4097|2,se=!1,Qe=e)}}else{if(As(e))throw Error(L(418));e.flags=e.flags&-4097|2,se=!1,Qe=e}}}function Wl(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Qe=e}function fo(e){if(e!==Qe)return!1;if(!se)return Wl(e),se=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Is(e.type,e.memoizedProps)),t&&(t=Ge)){if(As(e))throw Kc(),Error(L(418));for(;t;)Vc(e,t),t=Zt(t.nextSibling)}if(Wl(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ge=Zt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ge=null}}else Ge=Qe?Zt(e.stateNode.nextSibling):null;return!0}function Kc(){for(var e=Ge;e;)e=Zt(e.nextSibling)}function Qn(){Ge=Qe=null,se=!1}function Ei(e){pt===null?pt=[e]:pt.push(e)}var Cm=Dt.ReactCurrentBatchConfig;function cr(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(L(309));var r=n.stateNode}if(!r)throw Error(L(147,e));var o=r,a=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===a?t.ref:(t=function(i){var l=o.refs;i===null?delete l[a]:l[a]=i},t._stringRef=a,t)}if(typeof e!="string")throw Error(L(284));if(!n._owner)throw Error(L(290,e))}return e}function po(e,t){throw e=Object.prototype.toString.call(t),Error(L(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Hl(e){var t=e._init;return t(e._payload)}function Gc(e){function t(m,f){if(e){var v=m.deletions;v===null?(m.deletions=[f],m.flags|=16):v.push(f)}}function n(m,f){if(!e)return null;for(;f!==null;)t(m,f),f=f.sibling;return null}function r(m,f){for(m=new Map;f!==null;)f.key!==null?m.set(f.key,f):m.set(f.index,f),f=f.sibling;return m}function o(m,f){return m=rn(m,f),m.index=0,m.sibling=null,m}function a(m,f,v){return m.index=v,e?(v=m.alternate,v!==null?(v=v.index,v<f?(m.flags|=2,f):v):(m.flags|=2,f)):(m.flags|=1048576,f)}function i(m){return e&&m.alternate===null&&(m.flags|=2),m}function l(m,f,v,S){return f===null||f.tag!==6?(f=Za(v,m.mode,S),f.return=m,f):(f=o(f,v),f.return=m,f)}function u(m,f,v,S){var b=v.type;return b===Tn?h(m,f,v.props.children,S,v.key):f!==null&&(f.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Wt&&Hl(b)===f.type)?(S=o(f,v.props),S.ref=cr(m,f,v),S.return=m,S):(S=_o(v.type,v.key,v.props,null,m.mode,S),S.ref=cr(m,f,v),S.return=m,S)}function c(m,f,v,S){return f===null||f.tag!==4||f.stateNode.containerInfo!==v.containerInfo||f.stateNode.implementation!==v.implementation?(f=es(v,m.mode,S),f.return=m,f):(f=o(f,v.children||[]),f.return=m,f)}function h(m,f,v,S,b){return f===null||f.tag!==7?(f=xn(v,m.mode,S,b),f.return=m,f):(f=o(f,v),f.return=m,f)}function p(m,f,v){if(typeof f=="string"&&f!==""||typeof f=="number")return f=Za(""+f,m.mode,v),f.return=m,f;if(typeof f=="object"&&f!==null){switch(f.$$typeof){case to:return v=_o(f.type,f.key,f.props,null,m.mode,v),v.ref=cr(m,null,f),v.return=m,v;case Pn:return f=es(f,m.mode,v),f.return=m,f;case Wt:var S=f._init;return p(m,S(f._payload),v)}if(hr(f)||ar(f))return f=xn(f,m.mode,v,null),f.return=m,f;po(m,f)}return null}function g(m,f,v,S){var b=f!==null?f.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return b!==null?null:l(m,f,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case to:return v.key===b?u(m,f,v,S):null;case Pn:return v.key===b?c(m,f,v,S):null;case Wt:return b=v._init,g(m,f,b(v._payload),S)}if(hr(v)||ar(v))return b!==null?null:h(m,f,v,S,null);po(m,v)}return null}function y(m,f,v,S,b){if(typeof S=="string"&&S!==""||typeof S=="number")return m=m.get(v)||null,l(f,m,""+S,b);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case to:return m=m.get(S.key===null?v:S.key)||null,u(f,m,S,b);case Pn:return m=m.get(S.key===null?v:S.key)||null,c(f,m,S,b);case Wt:var T=S._init;return y(m,f,v,T(S._payload),b)}if(hr(S)||ar(S))return m=m.get(v)||null,h(f,m,S,b,null);po(f,S)}return null}function x(m,f,v,S){for(var b=null,T=null,k=f,N=f=0,C=null;k!==null&&N<v.length;N++){k.index>N?(C=k,k=null):C=k.sibling;var I=g(m,k,v[N],S);if(I===null){k===null&&(k=C);break}e&&k&&I.alternate===null&&t(m,k),f=a(I,f,N),T===null?b=I:T.sibling=I,T=I,k=C}if(N===v.length)return n(m,k),se&&dn(m,N),b;if(k===null){for(;N<v.length;N++)k=p(m,v[N],S),k!==null&&(f=a(k,f,N),T===null?b=k:T.sibling=k,T=k);return se&&dn(m,N),b}for(k=r(m,k);N<v.length;N++)C=y(k,m,N,v[N],S),C!==null&&(e&&C.alternate!==null&&k.delete(C.key===null?N:C.key),f=a(C,f,N),T===null?b=C:T.sibling=C,T=C);return e&&k.forEach(function(M){return t(m,M)}),se&&dn(m,N),b}function w(m,f,v,S){var b=ar(v);if(typeof b!="function")throw Error(L(150));if(v=b.call(v),v==null)throw Error(L(151));for(var T=b=null,k=f,N=f=0,C=null,I=v.next();k!==null&&!I.done;N++,I=v.next()){k.index>N?(C=k,k=null):C=k.sibling;var M=g(m,k,I.value,S);if(M===null){k===null&&(k=C);break}e&&k&&M.alternate===null&&t(m,k),f=a(M,f,N),T===null?b=M:T.sibling=M,T=M,k=C}if(I.done)return n(m,k),se&&dn(m,N),b;if(k===null){for(;!I.done;N++,I=v.next())I=p(m,I.value,S),I!==null&&(f=a(I,f,N),T===null?b=I:T.sibling=I,T=I);return se&&dn(m,N),b}for(k=r(m,k);!I.done;N++,I=v.next())I=y(k,m,N,I.value,S),I!==null&&(e&&I.alternate!==null&&k.delete(I.key===null?N:I.key),f=a(I,f,N),T===null?b=I:T.sibling=I,T=I);return e&&k.forEach(function(B){return t(m,B)}),se&&dn(m,N),b}function j(m,f,v,S){if(typeof v=="object"&&v!==null&&v.type===Tn&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case to:e:{for(var b=v.key,T=f;T!==null;){if(T.key===b){if(b=v.type,b===Tn){if(T.tag===7){n(m,T.sibling),f=o(T,v.props.children),f.return=m,m=f;break e}}else if(T.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Wt&&Hl(b)===T.type){n(m,T.sibling),f=o(T,v.props),f.ref=cr(m,T,v),f.return=m,m=f;break e}n(m,T);break}else t(m,T);T=T.sibling}v.type===Tn?(f=xn(v.props.children,m.mode,S,v.key),f.return=m,m=f):(S=_o(v.type,v.key,v.props,null,m.mode,S),S.ref=cr(m,f,v),S.return=m,m=S)}return i(m);case Pn:e:{for(T=v.key;f!==null;){if(f.key===T)if(f.tag===4&&f.stateNode.containerInfo===v.containerInfo&&f.stateNode.implementation===v.implementation){n(m,f.sibling),f=o(f,v.children||[]),f.return=m,m=f;break e}else{n(m,f);break}else t(m,f);f=f.sibling}f=es(v,m.mode,S),f.return=m,m=f}return i(m);case Wt:return T=v._init,j(m,f,T(v._payload),S)}if(hr(v))return x(m,f,v,S);if(ar(v))return w(m,f,v,S);po(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,f!==null&&f.tag===6?(n(m,f.sibling),f=o(f,v),f.return=m,m=f):(n(m,f),f=Za(v,m.mode,S),f.return=m,m=f),i(m)):n(m,f)}return j}var Yn=Gc(!0),Qc=Gc(!1),Qo=ln(null),Yo=null,Mn=null,bi=null;function Pi(){bi=Mn=Yo=null}function Ti(e){var t=Qo.current;ae(Qo),e._currentValue=t}function Ls(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Hn(e,t){Yo=e,bi=Mn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Be=!0),e.firstContext=null)}function at(e){var t=e._currentValue;if(bi!==e)if(e={context:e,memoizedValue:t,next:null},Mn===null){if(Yo===null)throw Error(L(308));Mn=e,Yo.dependencies={lanes:0,firstContext:e}}else Mn=Mn.next=e;return t}var hn=null;function Ii(e){hn===null?hn=[e]:hn.push(e)}function Yc(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Ii(t)):(n.next=o.next,o.next=n),t.interleaved=n,Ft(e,r)}function Ft(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ht=!1;function Ri(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Jc(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 $t(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function en(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Z&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Ft(e,n)}return o=r.interleaved,o===null?(t.next=t,Ii(r)):(t.next=o.next,o.next=t),r.interleaved=t,Ft(e,n)}function Eo(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,gi(e,n)}}function Vl(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,a=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};a===null?o=a=i:a=a.next=i,n=n.next}while(n!==null);a===null?o=a=t:a=a.next=t}else o=a=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:a,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 Jo(e,t,n,r){var o=e.updateQueue;Ht=!1;var a=o.firstBaseUpdate,i=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var u=l,c=u.next;u.next=null,i===null?a=c:i.next=c,i=u;var h=e.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==i&&(l===null?h.firstBaseUpdate=c:l.next=c,h.lastBaseUpdate=u))}if(a!==null){var p=o.baseState;i=0,h=c=u=null,l=a;do{var g=l.lane,y=l.eventTime;if((r&g)===g){h!==null&&(h=h.next={eventTime:y,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,w=l;switch(g=t,y=n,w.tag){case 1:if(x=w.payload,typeof x=="function"){p=x.call(y,p,g);break e}p=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=w.payload,g=typeof x=="function"?x.call(y,p,g):x,g==null)break e;p=fe({},p,g);break e;case 2:Ht=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,g=o.effects,g===null?o.effects=[l]:g.push(l))}else y={eventTime:y,lane:g,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(c=h=y,u=p):h=h.next=y,i|=g;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;g=l,l=g.next,g.next=null,o.lastBaseUpdate=g,o.shared.pending=null}}while(!0);if(h===null&&(u=p),o.baseState=u,o.firstBaseUpdate=c,o.lastBaseUpdate=h,t=o.shared.interleaved,t!==null){o=t;do i|=o.lane,o=o.next;while(o!==t)}else a===null&&(o.shared.lanes=0);kn|=i,e.lanes=i,e.memoizedState=p}}function Kl(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(L(191,o));o.call(r)}}}var Jr={},Nt=ln(Jr),Or=ln(Jr),Br=ln(Jr);function gn(e){if(e===Jr)throw Error(L(174));return e}function _i(e,t){switch(re(Br,t),re(Or,e),re(Nt,Jr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:gs(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=gs(t,e)}ae(Nt),re(Nt,t)}function Jn(){ae(Nt),ae(Or),ae(Br)}function Xc(e){gn(Br.current);var t=gn(Nt.current),n=gs(t,e.type);t!==n&&(re(Or,e),re(Nt,n))}function zi(e){Or.current===e&&(ae(Nt),ae(Or))}var ce=ln(0);function Xo(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 Ga=[];function Ai(){for(var e=0;e<Ga.length;e++)Ga[e]._workInProgressVersionPrimary=null;Ga.length=0}var bo=Dt.ReactCurrentDispatcher,Qa=Dt.ReactCurrentBatchConfig,jn=0,de=null,ye=null,Se=null,qo=!1,Cr=!1,Dr=0,Nm=0;function Te(){throw Error(L(321))}function $i(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gt(e[n],t[n]))return!1;return!0}function Li(e,t,n,r,o,a){if(jn=a,de=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,bo.current=e===null||e.memoizedState===null?Tm:Im,e=n(r,o),Cr){a=0;do{if(Cr=!1,Dr=0,25<=a)throw Error(L(301));a+=1,Se=ye=null,t.updateQueue=null,bo.current=Rm,e=n(r,o)}while(Cr)}if(bo.current=Zo,t=ye!==null&&ye.next!==null,jn=0,Se=ye=de=null,qo=!1,t)throw Error(L(300));return e}function Mi(){var e=Dr!==0;return Dr=0,e}function St(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Se===null?de.memoizedState=Se=e:Se=Se.next=e,Se}function st(){if(ye===null){var e=de.alternate;e=e!==null?e.memoizedState:null}else e=ye.next;var t=Se===null?de.memoizedState:Se.next;if(t!==null)Se=t,ye=e;else{if(e===null)throw Error(L(310));ye=e,e={memoizedState:ye.memoizedState,baseState:ye.baseState,baseQueue:ye.baseQueue,queue:ye.queue,next:null},Se===null?de.memoizedState=Se=e:Se=Se.next=e}return Se}function Ur(e,t){return typeof t=="function"?t(e):t}function Ya(e){var t=st(),n=t.queue;if(n===null)throw Error(L(311));n.lastRenderedReducer=e;var r=ye,o=r.baseQueue,a=n.pending;if(a!==null){if(o!==null){var i=o.next;o.next=a.next,a.next=i}r.baseQueue=o=a,n.pending=null}if(o!==null){a=o.next,r=r.baseState;var l=i=null,u=null,c=a;do{var h=c.lane;if((jn&h)===h)u!==null&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var p={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};u===null?(l=u=p,i=r):u=u.next=p,de.lanes|=h,kn|=h}c=c.next}while(c!==null&&c!==a);u===null?i=r:u.next=l,gt(r,t.memoizedState)||(Be=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=u,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do a=o.lane,de.lanes|=a,kn|=a,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ja(e){var t=st(),n=t.queue;if(n===null)throw Error(L(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,a=t.memoizedState;if(o!==null){n.pending=null;var i=o=o.next;do a=e(a,i.action),i=i.next;while(i!==o);gt(a,t.memoizedState)||(Be=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function qc(){}function Zc(e,t){var n=de,r=st(),o=t(),a=!gt(r.memoizedState,o);if(a&&(r.memoizedState=o,Be=!0),r=r.queue,Fi(nd.bind(null,n,r,e),[e]),r.getSnapshot!==t||a||Se!==null&&Se.memoizedState.tag&1){if(n.flags|=2048,Wr(9,td.bind(null,n,r,o,t),void 0,null),je===null)throw Error(L(349));jn&30||ed(n,t,o)}return o}function ed(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=de.updateQueue,t===null?(t={lastEffect:null,stores:null},de.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function td(e,t,n,r){t.value=n,t.getSnapshot=r,rd(t)&&od(e)}function nd(e,t,n){return n(function(){rd(t)&&od(e)})}function rd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gt(e,n)}catch{return!0}}function od(e){var t=Ft(e,1);t!==null&&ht(t,e,1,-1)}function Gl(e){var t=St();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ur,lastRenderedState:e},t.queue=e,e=e.dispatch=Pm.bind(null,de,e),[t.memoizedState,e]}function Wr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=de.updateQueue,t===null?(t={lastEffect:null,stores:null},de.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 ad(){return st().memoizedState}function Po(e,t,n,r){var o=St();de.flags|=e,o.memoizedState=Wr(1|t,n,void 0,r===void 0?null:r)}function ga(e,t,n,r){var o=st();r=r===void 0?null:r;var a=void 0;if(ye!==null){var i=ye.memoizedState;if(a=i.destroy,r!==null&&$i(r,i.deps)){o.memoizedState=Wr(t,n,a,r);return}}de.flags|=e,o.memoizedState=Wr(1|t,n,a,r)}function Ql(e,t){return Po(8390656,8,e,t)}function Fi(e,t){return ga(2048,8,e,t)}function sd(e,t){return ga(4,2,e,t)}function id(e,t){return ga(4,4,e,t)}function ld(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 ud(e,t,n){return n=n!=null?n.concat([e]):null,ga(4,4,ld.bind(null,t,e),n)}function Oi(){}function cd(e,t){var n=st();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&$i(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function dd(e,t){var n=st();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&$i(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function fd(e,t,n){return jn&21?(gt(n,t)||(n=vc(),de.lanes|=n,kn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Be=!0),e.memoizedState=n)}function Em(e,t){var n=te;te=n!==0&&4>n?n:4,e(!0);var r=Qa.transition;Qa.transition={};try{e(!1),t()}finally{te=n,Qa.transition=r}}function pd(){return st().memoizedState}function bm(e,t,n){var r=nn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},md(e))hd(t,n);else if(n=Yc(e,t,n,r),n!==null){var o=Le();ht(n,e,r,o),gd(n,t,r)}}function Pm(e,t,n){var r=nn(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(md(e))hd(t,o);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var i=t.lastRenderedState,l=a(i,n);if(o.hasEagerState=!0,o.eagerState=l,gt(l,i)){var u=t.interleaved;u===null?(o.next=o,Ii(t)):(o.next=u.next,u.next=o),t.interleaved=o;return}}catch{}finally{}n=Yc(e,t,o,r),n!==null&&(o=Le(),ht(n,e,r,o),gd(n,t,r))}}function md(e){var t=e.alternate;return e===de||t!==null&&t===de}function hd(e,t){Cr=qo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,gi(e,n)}}var Zo={readContext:at,useCallback:Te,useContext:Te,useEffect:Te,useImperativeHandle:Te,useInsertionEffect:Te,useLayoutEffect:Te,useMemo:Te,useReducer:Te,useRef:Te,useState:Te,useDebugValue:Te,useDeferredValue:Te,useTransition:Te,useMutableSource:Te,useSyncExternalStore:Te,useId:Te,unstable_isNewReconciler:!1},Tm={readContext:at,useCallback:function(e,t){return St().memoizedState=[e,t===void 0?null:t],e},useContext:at,useEffect:Ql,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Po(4194308,4,ld.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Po(4194308,4,e,t)},useInsertionEffect:function(e,t){return Po(4,2,e,t)},useMemo:function(e,t){var n=St();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=St();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=bm.bind(null,de,e),[r.memoizedState,e]},useRef:function(e){var t=St();return e={current:e},t.memoizedState=e},useState:Gl,useDebugValue:Oi,useDeferredValue:function(e){return St().memoizedState=e},useTransition:function(){var e=Gl(!1),t=e[0];return e=Em.bind(null,e[1]),St().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=de,o=St();if(se){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),je===null)throw Error(L(349));jn&30||ed(r,t,n)}o.memoizedState=n;var a={value:n,getSnapshot:t};return o.queue=a,Ql(nd.bind(null,r,a,e),[e]),r.flags|=2048,Wr(9,td.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=St(),t=je.identifierPrefix;if(se){var n=zt,r=_t;n=(r&~(1<<32-mt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Dr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Nm++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Im={readContext:at,useCallback:cd,useContext:at,useEffect:Fi,useImperativeHandle:ud,useInsertionEffect:sd,useLayoutEffect:id,useMemo:dd,useReducer:Ya,useRef:ad,useState:function(){return Ya(Ur)},useDebugValue:Oi,useDeferredValue:function(e){var t=st();return fd(t,ye.memoizedState,e)},useTransition:function(){var e=Ya(Ur)[0],t=st().memoizedState;return[e,t]},useMutableSource:qc,useSyncExternalStore:Zc,useId:pd,unstable_isNewReconciler:!1},Rm={readContext:at,useCallback:cd,useContext:at,useEffect:Fi,useImperativeHandle:ud,useInsertionEffect:sd,useLayoutEffect:id,useMemo:dd,useReducer:Ja,useRef:ad,useState:function(){return Ja(Ur)},useDebugValue:Oi,useDeferredValue:function(e){var t=st();return ye===null?t.memoizedState=e:fd(t,ye.memoizedState,e)},useTransition:function(){var e=Ja(Ur)[0],t=st().memoizedState;return[e,t]},useMutableSource:qc,useSyncExternalStore:Zc,useId:pd,unstable_isNewReconciler:!1};function dt(e,t){if(e&&e.defaultProps){t=fe({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ms(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:fe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var va={isMounted:function(e){return(e=e._reactInternals)?En(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Le(),o=nn(e),a=$t(r,o);a.payload=t,n!=null&&(a.callback=n),t=en(e,a,o),t!==null&&(ht(t,e,o,r),Eo(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Le(),o=nn(e),a=$t(r,o);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=en(e,a,o),t!==null&&(ht(t,e,o,r),Eo(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Le(),r=nn(e),o=$t(n,r);o.tag=2,t!=null&&(o.callback=t),t=en(e,o,r),t!==null&&(ht(t,e,r,n),Eo(t,e,r))}};function Yl(e,t,n,r,o,a,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,a,i):t.prototype&&t.prototype.isPureReactComponent?!$r(n,r)||!$r(o,a):!0}function vd(e,t,n){var r=!1,o=an,a=t.contextType;return typeof a=="object"&&a!==null?a=at(a):(o=Ue(t)?wn:ze.current,r=t.contextTypes,a=(r=r!=null)?Gn(e,o):an),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=va,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=a),t}function Jl(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&&va.enqueueReplaceState(t,t.state,null)}function Fs(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},Ri(e);var a=t.contextType;typeof a=="object"&&a!==null?o.context=at(a):(a=Ue(t)?wn:ze.current,o.context=Gn(e,a)),o.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a=="function"&&(Ms(e,t,a,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&va.enqueueReplaceState(o,o.state,null),Jo(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Xn(e,t){try{var n="",r=t;do n+=ap(r),r=r.return;while(r);var o=n}catch(a){o=`
37
+ `+o[i].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),u}while(1<=i&&0<=l);break}}}finally{Ra=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?mr(e):""}function ip(e){switch(e.tag){case 5:return mr(e.type);case 16:return mr("Lazy");case 13:return mr("Suspense");case 19:return mr("SuspenseList");case 0:case 2:case 15:return e=za(e.type,!1),e;case 11:return e=za(e.type.render,!1),e;case 1:return e=za(e.type,!0),e;default:return""}}function fs(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Tn:return"Fragment";case Pn:return"Portal";case us:return"Profiler";case hi:return"StrictMode";case cs:return"Suspense";case ds:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case qu:return(e.displayName||"Context")+".Consumer";case Xu:return(e._context.displayName||"Context")+".Provider";case gi:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case vi:return t=e.displayName||null,t!==null?t:fs(e.type)||"Memo";case Wt:t=e._payload,e=e._init;try{return fs(e(t))}catch{}}return null}function lp(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fs(t);case 8:return t===hi?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function on(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ec(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function up(e){var t=ec(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(i){r=""+i,a.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 ro(e){e._valueTracker||(e._valueTracker=up(e))}function tc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ec(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Lo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ps(e,t){var n=t.checked;return fe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function vl(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=on(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 nc(e,t){t=t.checked,t!=null&&mi(e,"checked",t,!1)}function ms(e,t){nc(e,t);var n=on(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?hs(e,t.type,n):t.hasOwnProperty("defaultValue")&&hs(e,t.type,on(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function yl(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function hs(e,t,n){(t!=="number"||Lo(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var hr=Array.isArray;function Bn(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+on(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function gs(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(L(91));return fe({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function xl(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(L(92));if(hr(n)){if(1<n.length)throw Error(L(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:on(n)}}function rc(e,t){var n=on(t.value),r=on(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function wl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function oc(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 vs(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?oc(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var oo,ac=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(oo=oo||document.createElement("div"),oo.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=oo.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ir(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xr={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},cp=["Webkit","ms","Moz","O"];Object.keys(xr).forEach(function(e){cp.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xr[t]=xr[e]})});function sc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||xr.hasOwnProperty(e)&&xr[e]?(""+t).trim():t+"px"}function ic(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=sc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var dp=fe({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 ys(e,t){if(t){if(dp[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(L(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(L(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(L(61))}if(t.style!=null&&typeof t.style!="object")throw Error(L(62))}}function xs(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ws=null;function yi(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ss=null,Dn=null,Un=null;function Sl(e){if(e=Jr(e)){if(typeof Ss!="function")throw Error(L(280));var t=e.stateNode;t&&(t=ha(t),Ss(e.stateNode,e.type,t))}}function lc(e){Dn?Un?Un.push(e):Un=[e]:Dn=e}function uc(){if(Dn){var e=Dn,t=Un;if(Un=Dn=null,Sl(e),t)for(e=0;e<t.length;e++)Sl(t[e])}}function cc(e,t){return e(t)}function dc(){}var Aa=!1;function fc(e,t,n){if(Aa)return e(t,n);Aa=!0;try{return cc(e,t,n)}finally{Aa=!1,(Dn!==null||Un!==null)&&(dc(),uc())}}function _r(e,t){var n=e.stateNode;if(n===null)return null;var r=ha(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(L(231,t,typeof n));return n}var js=!1;if($t)try{var sr={};Object.defineProperty(sr,"passive",{get:function(){js=!0}}),window.addEventListener("test",sr,sr),window.removeEventListener("test",sr,sr)}catch{js=!1}function fp(e,t,n,r,o,a,i,l,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(h){this.onError(h)}}var wr=!1,Mo=null,Fo=!1,ks=null,pp={onError:function(e){wr=!0,Mo=e}};function mp(e,t,n,r,o,a,i,l,u){wr=!1,Mo=null,fp.apply(pp,arguments)}function hp(e,t,n,r,o,a,i,l,u){if(mp.apply(this,arguments),wr){if(wr){var c=Mo;wr=!1,Mo=null}else throw Error(L(198));Fo||(Fo=!0,ks=c)}}function En(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function pc(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function jl(e){if(En(e)!==e)throw Error(L(188))}function gp(e){var t=e.alternate;if(!t){if(t=En(e),t===null)throw Error(L(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var a=o.alternate;if(a===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===a.child){for(a=o.child;a;){if(a===n)return jl(o),e;if(a===r)return jl(o),t;a=a.sibling}throw Error(L(188))}if(n.return!==r.return)n=o,r=a;else{for(var i=!1,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){for(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)throw Error(L(189))}}if(n.alternate!==r)throw Error(L(190))}if(n.tag!==3)throw Error(L(188));return n.stateNode.current===n?e:t}function mc(e){return e=gp(e),e!==null?hc(e):null}function hc(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=hc(e);if(t!==null)return t;e=e.sibling}return null}var gc=Ye.unstable_scheduleCallback,kl=Ye.unstable_cancelCallback,vp=Ye.unstable_shouldYield,yp=Ye.unstable_requestPaint,he=Ye.unstable_now,xp=Ye.unstable_getCurrentPriorityLevel,xi=Ye.unstable_ImmediatePriority,vc=Ye.unstable_UserBlockingPriority,Oo=Ye.unstable_NormalPriority,wp=Ye.unstable_LowPriority,yc=Ye.unstable_IdlePriority,da=null,Ct=null;function Sp(e){if(Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(da,e,void 0,(e.current.flags&128)===128)}catch{}}var mt=Math.clz32?Math.clz32:Cp,jp=Math.log,kp=Math.LN2;function Cp(e){return e>>>=0,e===0?32:31-(jp(e)/kp|0)|0}var ao=64,so=4194304;function gr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Bo(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,a=e.pingedLanes,i=n&268435455;if(i!==0){var l=i&~o;l!==0?r=gr(l):(a&=i,a!==0&&(r=gr(a)))}else i=n&~o,i!==0?r=gr(i):a!==0&&(r=gr(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,a=t&-t,o>=a||o===16&&(a&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-mt(t),o=1<<n,r|=e[n],t&=~o;return r}function Np(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 Ep(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,a=e.pendingLanes;0<a;){var i=31-mt(a),l=1<<i,u=o[i];u===-1?(!(l&n)||l&r)&&(o[i]=Np(l,t)):u<=t&&(e.expiredLanes|=l),a&=~l}}function Cs(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function xc(){var e=ao;return ao<<=1,!(ao&4194240)&&(ao=64),e}function $a(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Qr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-mt(t),e[t]=n}function bp(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-mt(n),a=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~a}}function wi(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-mt(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var te=0;function wc(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Sc,Si,jc,kc,Cc,Ns=!1,io=[],Jt=null,Xt=null,qt=null,Rr=new Map,zr=new Map,Kt=[],Pp="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Cl(e,t){switch(e){case"focusin":case"focusout":Jt=null;break;case"dragenter":case"dragleave":Xt=null;break;case"mouseover":case"mouseout":qt=null;break;case"pointerover":case"pointerout":Rr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":zr.delete(t.pointerId)}}function ir(e,t,n,r,o,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[o]},t!==null&&(t=Jr(t),t!==null&&Si(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Tp(e,t,n,r,o){switch(t){case"focusin":return Jt=ir(Jt,e,t,n,r,o),!0;case"dragenter":return Xt=ir(Xt,e,t,n,r,o),!0;case"mouseover":return qt=ir(qt,e,t,n,r,o),!0;case"pointerover":var a=o.pointerId;return Rr.set(a,ir(Rr.get(a)||null,e,t,n,r,o)),!0;case"gotpointercapture":return a=o.pointerId,zr.set(a,ir(zr.get(a)||null,e,t,n,r,o)),!0}return!1}function Nc(e){var t=mn(e.target);if(t!==null){var n=En(t);if(n!==null){if(t=n.tag,t===13){if(t=pc(n),t!==null){e.blockedOn=t,Cc(e.priority,function(){jc(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 Co(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Es(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ws=r,n.target.dispatchEvent(r),ws=null}else return t=Jr(n),t!==null&&Si(t),e.blockedOn=n,!1;t.shift()}return!0}function Nl(e,t,n){Co(e)&&n.delete(t)}function Ip(){Ns=!1,Jt!==null&&Co(Jt)&&(Jt=null),Xt!==null&&Co(Xt)&&(Xt=null),qt!==null&&Co(qt)&&(qt=null),Rr.forEach(Nl),zr.forEach(Nl)}function lr(e,t){e.blockedOn===t&&(e.blockedOn=null,Ns||(Ns=!0,Ye.unstable_scheduleCallback(Ye.unstable_NormalPriority,Ip)))}function Ar(e){function t(o){return lr(o,e)}if(0<io.length){lr(io[0],e);for(var n=1;n<io.length;n++){var r=io[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Jt!==null&&lr(Jt,e),Xt!==null&&lr(Xt,e),qt!==null&&lr(qt,e),Rr.forEach(t),zr.forEach(t),n=0;n<Kt.length;n++)r=Kt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Kt.length&&(n=Kt[0],n.blockedOn===null);)Nc(n),n.blockedOn===null&&Kt.shift()}var Wn=Bt.ReactCurrentBatchConfig,Do=!0;function _p(e,t,n,r){var o=te,a=Wn.transition;Wn.transition=null;try{te=1,ji(e,t,n,r)}finally{te=o,Wn.transition=a}}function Rp(e,t,n,r){var o=te,a=Wn.transition;Wn.transition=null;try{te=4,ji(e,t,n,r)}finally{te=o,Wn.transition=a}}function ji(e,t,n,r){if(Do){var o=Es(e,t,n,r);if(o===null)Va(e,t,r,Uo,n),Cl(e,r);else if(Tp(o,e,t,n,r))r.stopPropagation();else if(Cl(e,r),t&4&&-1<Pp.indexOf(e)){for(;o!==null;){var a=Jr(o);if(a!==null&&Sc(a),a=Es(e,t,n,r),a===null&&Va(e,t,r,Uo,n),a===o)break;o=a}o!==null&&r.stopPropagation()}else Va(e,t,r,null,n)}}var Uo=null;function Es(e,t,n,r){if(Uo=null,e=yi(r),e=mn(e),e!==null)if(t=En(e),t===null)e=null;else if(n=t.tag,n===13){if(e=pc(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 Uo=e,null}function Ec(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(xp()){case xi:return 1;case vc:return 4;case Oo:case wp:return 16;case yc:return 536870912;default:return 16}default:return 16}}var Qt=null,ki=null,No=null;function bc(){if(No)return No;var e,t=ki,n=t.length,r,o="value"in Qt?Qt.value:Qt.textContent,a=o.length;for(e=0;e<n&&t[e]===o[e];e++);var i=n-e;for(r=1;r<=i&&t[n-r]===o[a-r];r++);return No=o.slice(e,1<r?1-r:void 0)}function Eo(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 lo(){return!0}function El(){return!1}function Xe(e){function t(n,r,o,a,i){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=a,this.target=i,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(a):a[l]);return this.isDefaultPrevented=(a.defaultPrevented!=null?a.defaultPrevented:a.returnValue===!1)?lo:El,this.isPropagationStopped=El,this}return fe(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=lo)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=lo)},persist:function(){},isPersistent:lo}),t}var er={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ci=Xe(er),Yr=fe({},er,{view:0,detail:0}),zp=Xe(Yr),La,Ma,ur,fa=fe({},Yr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ni,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ur&&(ur&&e.type==="mousemove"?(La=e.screenX-ur.screenX,Ma=e.screenY-ur.screenY):Ma=La=0,ur=e),La)},movementY:function(e){return"movementY"in e?e.movementY:Ma}}),bl=Xe(fa),Ap=fe({},fa,{dataTransfer:0}),$p=Xe(Ap),Lp=fe({},Yr,{relatedTarget:0}),Fa=Xe(Lp),Mp=fe({},er,{animationName:0,elapsedTime:0,pseudoElement:0}),Fp=Xe(Mp),Op=fe({},er,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Bp=Xe(Op),Dp=fe({},er,{data:0}),Pl=Xe(Dp),Up={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Wp={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"},Hp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Hp[e])?!!t[e]:!1}function Ni(){return Vp}var Kp=fe({},Yr,{key:function(e){if(e.key){var t=Up[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Eo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Wp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ni,charCode:function(e){return e.type==="keypress"?Eo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Eo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Gp=Xe(Kp),Qp=fe({},fa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Tl=Xe(Qp),Yp=fe({},Yr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ni}),Jp=Xe(Yp),Xp=fe({},er,{propertyName:0,elapsedTime:0,pseudoElement:0}),qp=Xe(Xp),Zp=fe({},fa,{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}),em=Xe(Zp),tm=[9,13,27,32],Ei=$t&&"CompositionEvent"in window,Sr=null;$t&&"documentMode"in document&&(Sr=document.documentMode);var nm=$t&&"TextEvent"in window&&!Sr,Pc=$t&&(!Ei||Sr&&8<Sr&&11>=Sr),Il=" ",_l=!1;function Tc(e,t){switch(e){case"keyup":return tm.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ic(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var In=!1;function rm(e,t){switch(e){case"compositionend":return Ic(t);case"keypress":return t.which!==32?null:(_l=!0,Il);case"textInput":return e=t.data,e===Il&&_l?null:e;default:return null}}function om(e,t){if(In)return e==="compositionend"||!Ei&&Tc(e,t)?(e=bc(),No=ki=Qt=null,In=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Pc&&t.locale!=="ko"?null:t.data;default:return null}}var am={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Rl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!am[e.type]:t==="textarea"}function _c(e,t,n,r){lc(r),t=Wo(t,"onChange"),0<t.length&&(n=new Ci("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var jr=null,$r=null;function sm(e){Uc(e,0)}function pa(e){var t=zn(e);if(tc(t))return e}function im(e,t){if(e==="change")return t}var Rc=!1;if($t){var Oa;if($t){var Ba="oninput"in document;if(!Ba){var zl=document.createElement("div");zl.setAttribute("oninput","return;"),Ba=typeof zl.oninput=="function"}Oa=Ba}else Oa=!1;Rc=Oa&&(!document.documentMode||9<document.documentMode)}function Al(){jr&&(jr.detachEvent("onpropertychange",zc),$r=jr=null)}function zc(e){if(e.propertyName==="value"&&pa($r)){var t=[];_c(t,$r,e,yi(e)),fc(sm,t)}}function lm(e,t,n){e==="focusin"?(Al(),jr=t,$r=n,jr.attachEvent("onpropertychange",zc)):e==="focusout"&&Al()}function um(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return pa($r)}function cm(e,t){if(e==="click")return pa(t)}function dm(e,t){if(e==="input"||e==="change")return pa(t)}function fm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var gt=typeof Object.is=="function"?Object.is:fm;function Lr(e,t){if(gt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!ls.call(t,o)||!gt(e[o],t[o]))return!1}return!0}function $l(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ll(e,t){var n=$l(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=$l(n)}}function Ac(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ac(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $c(){for(var e=window,t=Lo();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Lo(e.document)}return t}function bi(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function pm(e){var t=$c(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ac(n.ownerDocument.documentElement,n)){if(r!==null&&bi(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,a=Math.min(r.start,o);r=r.end===void 0?a:Math.min(r.end,o),!e.extend&&a>r&&(o=r,r=a,a=o),o=Ll(n,a);var i=Ll(n,r);o&&i&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),a>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 mm=$t&&"documentMode"in document&&11>=document.documentMode,_n=null,bs=null,kr=null,Ps=!1;function Ml(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ps||_n==null||_n!==Lo(r)||(r=_n,"selectionStart"in r&&bi(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kr&&Lr(kr,r)||(kr=r,r=Wo(bs,"onSelect"),0<r.length&&(t=new Ci("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=_n)))}function uo(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Rn={animationend:uo("Animation","AnimationEnd"),animationiteration:uo("Animation","AnimationIteration"),animationstart:uo("Animation","AnimationStart"),transitionend:uo("Transition","TransitionEnd")},Da={},Lc={};$t&&(Lc=document.createElement("div").style,"AnimationEvent"in window||(delete Rn.animationend.animation,delete Rn.animationiteration.animation,delete Rn.animationstart.animation),"TransitionEvent"in window||delete Rn.transitionend.transition);function ma(e){if(Da[e])return Da[e];if(!Rn[e])return e;var t=Rn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Lc)return Da[e]=t[n];return e}var Mc=ma("animationend"),Fc=ma("animationiteration"),Oc=ma("animationstart"),Bc=ma("transitionend"),Dc=new Map,Fl="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function sn(e,t){Dc.set(e,t),Nn(t,[e])}for(var Ua=0;Ua<Fl.length;Ua++){var Wa=Fl[Ua],hm=Wa.toLowerCase(),gm=Wa[0].toUpperCase()+Wa.slice(1);sn(hm,"on"+gm)}sn(Mc,"onAnimationEnd");sn(Fc,"onAnimationIteration");sn(Oc,"onAnimationStart");sn("dblclick","onDoubleClick");sn("focusin","onFocus");sn("focusout","onBlur");sn(Bc,"onTransitionEnd");Kn("onMouseEnter",["mouseout","mouseover"]);Kn("onMouseLeave",["mouseout","mouseover"]);Kn("onPointerEnter",["pointerout","pointerover"]);Kn("onPointerLeave",["pointerout","pointerover"]);Nn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Nn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Nn("onBeforeInput",["compositionend","keypress","textInput","paste"]);Nn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Nn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Nn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var vr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),vm=new Set("cancel close invalid load scroll toggle".split(" ").concat(vr));function Ol(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,hp(r,t,void 0,e),e.currentTarget=null}function Uc(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var a=void 0;if(t)for(var i=r.length-1;0<=i;i--){var l=r[i],u=l.instance,c=l.currentTarget;if(l=l.listener,u!==a&&o.isPropagationStopped())break e;Ol(o,l,c),a=u}else for(i=0;i<r.length;i++){if(l=r[i],u=l.instance,c=l.currentTarget,l=l.listener,u!==a&&o.isPropagationStopped())break e;Ol(o,l,c),a=u}}}if(Fo)throw e=ks,Fo=!1,ks=null,e}function oe(e,t){var n=t[zs];n===void 0&&(n=t[zs]=new Set);var r=e+"__bubble";n.has(r)||(Wc(t,e,2,!1),n.add(r))}function Ha(e,t,n){var r=0;t&&(r|=4),Wc(n,e,r,t)}var co="_reactListening"+Math.random().toString(36).slice(2);function Mr(e){if(!e[co]){e[co]=!0,Ju.forEach(function(n){n!=="selectionchange"&&(vm.has(n)||Ha(n,!1,e),Ha(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[co]||(t[co]=!0,Ha("selectionchange",!1,t))}}function Wc(e,t,n,r){switch(Ec(t)){case 1:var o=_p;break;case 4:o=Rp;break;default:o=ji}n=o.bind(null,t,n,e),o=void 0,!js||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Va(e,t,n,r,o){var a=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var i=r.tag;if(i===3||i===4){var l=r.stateNode.containerInfo;if(l===o||l.nodeType===8&&l.parentNode===o)break;if(i===4)for(i=r.return;i!==null;){var u=i.tag;if((u===3||u===4)&&(u=i.stateNode.containerInfo,u===o||u.nodeType===8&&u.parentNode===o))return;i=i.return}for(;l!==null;){if(i=mn(l),i===null)return;if(u=i.tag,u===5||u===6){r=a=i;continue e}l=l.parentNode}}r=r.return}fc(function(){var c=a,h=yi(n),f=[];e:{var g=Dc.get(e);if(g!==void 0){var y=Ci,x=e;switch(e){case"keypress":if(Eo(n)===0)break e;case"keydown":case"keyup":y=Gp;break;case"focusin":x="focus",y=Fa;break;case"focusout":x="blur",y=Fa;break;case"beforeblur":case"afterblur":y=Fa;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=bl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=$p;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=Jp;break;case Mc:case Fc:case Oc:y=Fp;break;case Bc:y=qp;break;case"scroll":y=zp;break;case"wheel":y=em;break;case"copy":case"cut":case"paste":y=Bp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=Tl}var w=(t&4)!==0,j=!w&&e==="scroll",m=w?g!==null?g+"Capture":null:g;w=[];for(var p=c,v;p!==null;){v=p;var S=v.stateNode;if(v.tag===5&&S!==null&&(v=S,m!==null&&(S=_r(p,m),S!=null&&w.push(Fr(p,S,v)))),j)break;p=p.return}0<w.length&&(g=new y(g,x,null,n,h),f.push({event:g,listeners:w}))}}if(!(t&7)){e:{if(g=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",g&&n!==ws&&(x=n.relatedTarget||n.fromElement)&&(mn(x)||x[Lt]))break e;if((y||g)&&(g=h.window===h?h:(g=h.ownerDocument)?g.defaultView||g.parentWindow:window,y?(x=n.relatedTarget||n.toElement,y=c,x=x?mn(x):null,x!==null&&(j=En(x),x!==j||x.tag!==5&&x.tag!==6)&&(x=null)):(y=null,x=c),y!==x)){if(w=bl,S="onMouseLeave",m="onMouseEnter",p="mouse",(e==="pointerout"||e==="pointerover")&&(w=Tl,S="onPointerLeave",m="onPointerEnter",p="pointer"),j=y==null?g:zn(y),v=x==null?g:zn(x),g=new w(S,p+"leave",y,n,h),g.target=j,g.relatedTarget=v,S=null,mn(h)===c&&(w=new w(m,p+"enter",x,n,h),w.target=v,w.relatedTarget=j,S=w),j=S,y&&x)t:{for(w=y,m=x,p=0,v=w;v;v=bn(v))p++;for(v=0,S=m;S;S=bn(S))v++;for(;0<p-v;)w=bn(w),p--;for(;0<v-p;)m=bn(m),v--;for(;p--;){if(w===m||m!==null&&w===m.alternate)break t;w=bn(w),m=bn(m)}w=null}else w=null;y!==null&&Bl(f,g,y,w,!1),x!==null&&j!==null&&Bl(f,j,x,w,!0)}}e:{if(g=c?zn(c):window,y=g.nodeName&&g.nodeName.toLowerCase(),y==="select"||y==="input"&&g.type==="file")var b=im;else if(Rl(g))if(Rc)b=dm;else{b=um;var T=lm}else(y=g.nodeName)&&y.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(b=cm);if(b&&(b=b(e,c))){_c(f,b,n,h);break e}T&&T(e,g,c),e==="focusout"&&(T=g._wrapperState)&&T.controlled&&g.type==="number"&&hs(g,"number",g.value)}switch(T=c?zn(c):window,e){case"focusin":(Rl(T)||T.contentEditable==="true")&&(_n=T,bs=c,kr=null);break;case"focusout":kr=bs=_n=null;break;case"mousedown":Ps=!0;break;case"contextmenu":case"mouseup":case"dragend":Ps=!1,Ml(f,n,h);break;case"selectionchange":if(mm)break;case"keydown":case"keyup":Ml(f,n,h)}var k;if(Ei)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 In?Tc(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(Pc&&n.locale!=="ko"&&(In||N!=="onCompositionStart"?N==="onCompositionEnd"&&In&&(k=bc()):(Qt=h,ki="value"in Qt?Qt.value:Qt.textContent,In=!0)),T=Wo(c,N),0<T.length&&(N=new Pl(N,e,null,n,h),f.push({event:N,listeners:T}),k?N.data=k:(k=Ic(n),k!==null&&(N.data=k)))),(k=nm?rm(e,n):om(e,n))&&(c=Wo(c,"onBeforeInput"),0<c.length&&(h=new Pl("onBeforeInput","beforeinput",null,n,h),f.push({event:h,listeners:c}),h.data=k))}Uc(f,t)})}function Fr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Wo(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,a=o.stateNode;o.tag===5&&a!==null&&(o=a,a=_r(e,n),a!=null&&r.unshift(Fr(e,a,o)),a=_r(e,t),a!=null&&r.push(Fr(e,a,o))),e=e.return}return r}function bn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Bl(e,t,n,r,o){for(var a=t._reactName,i=[];n!==null&&n!==r;){var l=n,u=l.alternate,c=l.stateNode;if(u!==null&&u===r)break;l.tag===5&&c!==null&&(l=c,o?(u=_r(n,a),u!=null&&i.unshift(Fr(n,u,l))):o||(u=_r(n,a),u!=null&&i.push(Fr(n,u,l)))),n=n.return}i.length!==0&&e.push({event:t,listeners:i})}var ym=/\r\n?/g,xm=/\u0000|\uFFFD/g;function Dl(e){return(typeof e=="string"?e:""+e).replace(ym,`
38
+ `).replace(xm,"")}function fo(e,t,n){if(t=Dl(t),Dl(e)!==t&&n)throw Error(L(425))}function Ho(){}var Ts=null,Is=null;function _s(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Rs=typeof setTimeout=="function"?setTimeout:void 0,wm=typeof clearTimeout=="function"?clearTimeout:void 0,Ul=typeof Promise=="function"?Promise:void 0,Sm=typeof queueMicrotask=="function"?queueMicrotask:typeof Ul<"u"?function(e){return Ul.resolve(null).then(e).catch(jm)}:Rs;function jm(e){setTimeout(function(){throw e})}function Ka(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),Ar(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Ar(t)}function Zt(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Wl(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var tr=Math.random().toString(36).slice(2),kt="__reactFiber$"+tr,Or="__reactProps$"+tr,Lt="__reactContainer$"+tr,zs="__reactEvents$"+tr,km="__reactListeners$"+tr,Cm="__reactHandles$"+tr;function mn(e){var t=e[kt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Lt]||n[kt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Wl(e);e!==null;){if(n=e[kt])return n;e=Wl(e)}return t}e=n,n=e.parentNode}return null}function Jr(e){return e=e[kt]||e[Lt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function zn(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(L(33))}function ha(e){return e[Or]||null}var As=[],An=-1;function ln(e){return{current:e}}function ae(e){0>An||(e.current=As[An],As[An]=null,An--)}function re(e,t){An++,As[An]=e.current,e.current=t}var an={},ze=ln(an),De=ln(!1),wn=an;function Gn(e,t){var n=e.type.contextTypes;if(!n)return an;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},a;for(a in n)o[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ue(e){return e=e.childContextTypes,e!=null}function Vo(){ae(De),ae(ze)}function Hl(e,t,n){if(ze.current!==an)throw Error(L(168));re(ze,t),re(De,n)}function Hc(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(L(108,lp(e)||"Unknown",o));return fe({},n,r)}function Ko(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||an,wn=ze.current,re(ze,e),re(De,De.current),!0}function Vl(e,t,n){var r=e.stateNode;if(!r)throw Error(L(169));n?(e=Hc(e,t,wn),r.__reactInternalMemoizedMergedChildContext=e,ae(De),ae(ze),re(ze,e)):ae(De),re(De,n)}var It=null,ga=!1,Ga=!1;function Vc(e){It===null?It=[e]:It.push(e)}function Nm(e){ga=!0,Vc(e)}function un(){if(!Ga&&It!==null){Ga=!0;var e=0,t=te;try{var n=It;for(te=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}It=null,ga=!1}catch(o){throw It!==null&&(It=It.slice(e+1)),gc(xi,un),o}finally{te=t,Ga=!1}}return null}var $n=[],Ln=0,Go=null,Qo=0,et=[],tt=0,Sn=null,_t=1,Rt="";function dn(e,t){$n[Ln++]=Qo,$n[Ln++]=Go,Go=e,Qo=t}function Kc(e,t,n){et[tt++]=_t,et[tt++]=Rt,et[tt++]=Sn,Sn=e;var r=_t;e=Rt;var o=32-mt(r)-1;r&=~(1<<o),n+=1;var a=32-mt(t)+o;if(30<a){var i=o-o%5;a=(r&(1<<i)-1).toString(32),r>>=i,o-=i,_t=1<<32-mt(t)+o|n<<o|r,Rt=a+e}else _t=1<<a|n<<o|r,Rt=e}function Pi(e){e.return!==null&&(dn(e,1),Kc(e,1,0))}function Ti(e){for(;e===Go;)Go=$n[--Ln],$n[Ln]=null,Qo=$n[--Ln],$n[Ln]=null;for(;e===Sn;)Sn=et[--tt],et[tt]=null,Rt=et[--tt],et[tt]=null,_t=et[--tt],et[tt]=null}var Qe=null,Ge=null,se=!1,pt=null;function Gc(e,t){var n=rt(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Kl(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Qe=e,Ge=Zt(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Qe=e,Ge=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Sn!==null?{id:_t,overflow:Rt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=rt(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Qe=e,Ge=null,!0):!1;default:return!1}}function $s(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ls(e){if(se){var t=Ge;if(t){var n=t;if(!Kl(e,t)){if($s(e))throw Error(L(418));t=Zt(n.nextSibling);var r=Qe;t&&Kl(e,t)?Gc(r,n):(e.flags=e.flags&-4097|2,se=!1,Qe=e)}}else{if($s(e))throw Error(L(418));e.flags=e.flags&-4097|2,se=!1,Qe=e}}}function Gl(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Qe=e}function po(e){if(e!==Qe)return!1;if(!se)return Gl(e),se=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!_s(e.type,e.memoizedProps)),t&&(t=Ge)){if($s(e))throw Qc(),Error(L(418));for(;t;)Gc(e,t),t=Zt(t.nextSibling)}if(Gl(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(L(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Ge=Zt(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Ge=null}}else Ge=Qe?Zt(e.stateNode.nextSibling):null;return!0}function Qc(){for(var e=Ge;e;)e=Zt(e.nextSibling)}function Qn(){Ge=Qe=null,se=!1}function Ii(e){pt===null?pt=[e]:pt.push(e)}var Em=Bt.ReactCurrentBatchConfig;function cr(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(L(309));var r=n.stateNode}if(!r)throw Error(L(147,e));var o=r,a=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===a?t.ref:(t=function(i){var l=o.refs;i===null?delete l[a]:l[a]=i},t._stringRef=a,t)}if(typeof e!="string")throw Error(L(284));if(!n._owner)throw Error(L(290,e))}return e}function mo(e,t){throw e=Object.prototype.toString.call(t),Error(L(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Ql(e){var t=e._init;return t(e._payload)}function Yc(e){function t(m,p){if(e){var v=m.deletions;v===null?(m.deletions=[p],m.flags|=16):v.push(p)}}function n(m,p){if(!e)return null;for(;p!==null;)t(m,p),p=p.sibling;return null}function r(m,p){for(m=new Map;p!==null;)p.key!==null?m.set(p.key,p):m.set(p.index,p),p=p.sibling;return m}function o(m,p){return m=rn(m,p),m.index=0,m.sibling=null,m}function a(m,p,v){return m.index=v,e?(v=m.alternate,v!==null?(v=v.index,v<p?(m.flags|=2,p):v):(m.flags|=2,p)):(m.flags|=1048576,p)}function i(m){return e&&m.alternate===null&&(m.flags|=2),m}function l(m,p,v,S){return p===null||p.tag!==6?(p=es(v,m.mode,S),p.return=m,p):(p=o(p,v),p.return=m,p)}function u(m,p,v,S){var b=v.type;return b===Tn?h(m,p,v.props.children,S,v.key):p!==null&&(p.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Wt&&Ql(b)===p.type)?(S=o(p,v.props),S.ref=cr(m,p,v),S.return=m,S):(S=zo(v.type,v.key,v.props,null,m.mode,S),S.ref=cr(m,p,v),S.return=m,S)}function c(m,p,v,S){return p===null||p.tag!==4||p.stateNode.containerInfo!==v.containerInfo||p.stateNode.implementation!==v.implementation?(p=ts(v,m.mode,S),p.return=m,p):(p=o(p,v.children||[]),p.return=m,p)}function h(m,p,v,S,b){return p===null||p.tag!==7?(p=xn(v,m.mode,S,b),p.return=m,p):(p=o(p,v),p.return=m,p)}function f(m,p,v){if(typeof p=="string"&&p!==""||typeof p=="number")return p=es(""+p,m.mode,v),p.return=m,p;if(typeof p=="object"&&p!==null){switch(p.$$typeof){case no:return v=zo(p.type,p.key,p.props,null,m.mode,v),v.ref=cr(m,null,p),v.return=m,v;case Pn:return p=ts(p,m.mode,v),p.return=m,p;case Wt:var S=p._init;return f(m,S(p._payload),v)}if(hr(p)||ar(p))return p=xn(p,m.mode,v,null),p.return=m,p;mo(m,p)}return null}function g(m,p,v,S){var b=p!==null?p.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return b!==null?null:l(m,p,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case no:return v.key===b?u(m,p,v,S):null;case Pn:return v.key===b?c(m,p,v,S):null;case Wt:return b=v._init,g(m,p,b(v._payload),S)}if(hr(v)||ar(v))return b!==null?null:h(m,p,v,S,null);mo(m,v)}return null}function y(m,p,v,S,b){if(typeof S=="string"&&S!==""||typeof S=="number")return m=m.get(v)||null,l(p,m,""+S,b);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case no:return m=m.get(S.key===null?v:S.key)||null,u(p,m,S,b);case Pn:return m=m.get(S.key===null?v:S.key)||null,c(p,m,S,b);case Wt:var T=S._init;return y(m,p,v,T(S._payload),b)}if(hr(S)||ar(S))return m=m.get(v)||null,h(p,m,S,b,null);mo(p,S)}return null}function x(m,p,v,S){for(var b=null,T=null,k=p,N=p=0,C=null;k!==null&&N<v.length;N++){k.index>N?(C=k,k=null):C=k.sibling;var I=g(m,k,v[N],S);if(I===null){k===null&&(k=C);break}e&&k&&I.alternate===null&&t(m,k),p=a(I,p,N),T===null?b=I:T.sibling=I,T=I,k=C}if(N===v.length)return n(m,k),se&&dn(m,N),b;if(k===null){for(;N<v.length;N++)k=f(m,v[N],S),k!==null&&(p=a(k,p,N),T===null?b=k:T.sibling=k,T=k);return se&&dn(m,N),b}for(k=r(m,k);N<v.length;N++)C=y(k,m,N,v[N],S),C!==null&&(e&&C.alternate!==null&&k.delete(C.key===null?N:C.key),p=a(C,p,N),T===null?b=C:T.sibling=C,T=C);return e&&k.forEach(function(M){return t(m,M)}),se&&dn(m,N),b}function w(m,p,v,S){var b=ar(v);if(typeof b!="function")throw Error(L(150));if(v=b.call(v),v==null)throw Error(L(151));for(var T=b=null,k=p,N=p=0,C=null,I=v.next();k!==null&&!I.done;N++,I=v.next()){k.index>N?(C=k,k=null):C=k.sibling;var M=g(m,k,I.value,S);if(M===null){k===null&&(k=C);break}e&&k&&M.alternate===null&&t(m,k),p=a(M,p,N),T===null?b=M:T.sibling=M,T=M,k=C}if(I.done)return n(m,k),se&&dn(m,N),b;if(k===null){for(;!I.done;N++,I=v.next())I=f(m,I.value,S),I!==null&&(p=a(I,p,N),T===null?b=I:T.sibling=I,T=I);return se&&dn(m,N),b}for(k=r(m,k);!I.done;N++,I=v.next())I=y(k,m,N,I.value,S),I!==null&&(e&&I.alternate!==null&&k.delete(I.key===null?N:I.key),p=a(I,p,N),T===null?b=I:T.sibling=I,T=I);return e&&k.forEach(function(B){return t(m,B)}),se&&dn(m,N),b}function j(m,p,v,S){if(typeof v=="object"&&v!==null&&v.type===Tn&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case no:e:{for(var b=v.key,T=p;T!==null;){if(T.key===b){if(b=v.type,b===Tn){if(T.tag===7){n(m,T.sibling),p=o(T,v.props.children),p.return=m,m=p;break e}}else if(T.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Wt&&Ql(b)===T.type){n(m,T.sibling),p=o(T,v.props),p.ref=cr(m,T,v),p.return=m,m=p;break e}n(m,T);break}else t(m,T);T=T.sibling}v.type===Tn?(p=xn(v.props.children,m.mode,S,v.key),p.return=m,m=p):(S=zo(v.type,v.key,v.props,null,m.mode,S),S.ref=cr(m,p,v),S.return=m,m=S)}return i(m);case Pn:e:{for(T=v.key;p!==null;){if(p.key===T)if(p.tag===4&&p.stateNode.containerInfo===v.containerInfo&&p.stateNode.implementation===v.implementation){n(m,p.sibling),p=o(p,v.children||[]),p.return=m,m=p;break e}else{n(m,p);break}else t(m,p);p=p.sibling}p=ts(v,m.mode,S),p.return=m,m=p}return i(m);case Wt:return T=v._init,j(m,p,T(v._payload),S)}if(hr(v))return x(m,p,v,S);if(ar(v))return w(m,p,v,S);mo(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,p!==null&&p.tag===6?(n(m,p.sibling),p=o(p,v),p.return=m,m=p):(n(m,p),p=es(v,m.mode,S),p.return=m,m=p),i(m)):n(m,p)}return j}var Yn=Yc(!0),Jc=Yc(!1),Yo=ln(null),Jo=null,Mn=null,_i=null;function Ri(){_i=Mn=Jo=null}function zi(e){var t=Yo.current;ae(Yo),e._currentValue=t}function Ms(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Hn(e,t){Jo=e,_i=Mn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Be=!0),e.firstContext=null)}function at(e){var t=e._currentValue;if(_i!==e)if(e={context:e,memoizedValue:t,next:null},Mn===null){if(Jo===null)throw Error(L(308));Mn=e,Jo.dependencies={lanes:0,firstContext:e}}else Mn=Mn.next=e;return t}var hn=null;function Ai(e){hn===null?hn=[e]:hn.push(e)}function Xc(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Ai(t)):(n.next=o.next,o.next=n),t.interleaved=n,Mt(e,r)}function Mt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ht=!1;function $i(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function qc(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 At(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function en(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Z&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Mt(e,n)}return o=r.interleaved,o===null?(t.next=t,Ai(r)):(t.next=o.next,o.next=t),r.interleaved=t,Mt(e,n)}function bo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,wi(e,n)}}function Yl(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,a=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};a===null?o=a=i:a=a.next=i,n=n.next}while(n!==null);a===null?o=a=t:a=a.next=t}else o=a=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:a,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 Xo(e,t,n,r){var o=e.updateQueue;Ht=!1;var a=o.firstBaseUpdate,i=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var u=l,c=u.next;u.next=null,i===null?a=c:i.next=c,i=u;var h=e.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==i&&(l===null?h.firstBaseUpdate=c:l.next=c,h.lastBaseUpdate=u))}if(a!==null){var f=o.baseState;i=0,h=c=u=null,l=a;do{var g=l.lane,y=l.eventTime;if((r&g)===g){h!==null&&(h=h.next={eventTime:y,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=e,w=l;switch(g=t,y=n,w.tag){case 1:if(x=w.payload,typeof x=="function"){f=x.call(y,f,g);break e}f=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=w.payload,g=typeof x=="function"?x.call(y,f,g):x,g==null)break e;f=fe({},f,g);break e;case 2:Ht=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,g=o.effects,g===null?o.effects=[l]:g.push(l))}else y={eventTime:y,lane:g,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(c=h=y,u=f):h=h.next=y,i|=g;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;g=l,l=g.next,g.next=null,o.lastBaseUpdate=g,o.shared.pending=null}}while(!0);if(h===null&&(u=f),o.baseState=u,o.firstBaseUpdate=c,o.lastBaseUpdate=h,t=o.shared.interleaved,t!==null){o=t;do i|=o.lane,o=o.next;while(o!==t)}else a===null&&(o.shared.lanes=0);kn|=i,e.lanes=i,e.memoizedState=f}}function Jl(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(L(191,o));o.call(r)}}}var Xr={},Nt=ln(Xr),Br=ln(Xr),Dr=ln(Xr);function gn(e){if(e===Xr)throw Error(L(174));return e}function Li(e,t){switch(re(Dr,t),re(Br,e),re(Nt,Xr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:vs(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=vs(t,e)}ae(Nt),re(Nt,t)}function Jn(){ae(Nt),ae(Br),ae(Dr)}function Zc(e){gn(Dr.current);var t=gn(Nt.current),n=vs(t,e.type);t!==n&&(re(Br,e),re(Nt,n))}function Mi(e){Br.current===e&&(ae(Nt),ae(Br))}var ce=ln(0);function qo(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 Qa=[];function Fi(){for(var e=0;e<Qa.length;e++)Qa[e]._workInProgressVersionPrimary=null;Qa.length=0}var Po=Bt.ReactCurrentDispatcher,Ya=Bt.ReactCurrentBatchConfig,jn=0,de=null,ye=null,Se=null,Zo=!1,Cr=!1,Ur=0,bm=0;function Te(){throw Error(L(321))}function Oi(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!gt(e[n],t[n]))return!1;return!0}function Bi(e,t,n,r,o,a){if(jn=a,de=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Po.current=e===null||e.memoizedState===null?_m:Rm,e=n(r,o),Cr){a=0;do{if(Cr=!1,Ur=0,25<=a)throw Error(L(301));a+=1,Se=ye=null,t.updateQueue=null,Po.current=zm,e=n(r,o)}while(Cr)}if(Po.current=ea,t=ye!==null&&ye.next!==null,jn=0,Se=ye=de=null,Zo=!1,t)throw Error(L(300));return e}function Di(){var e=Ur!==0;return Ur=0,e}function St(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Se===null?de.memoizedState=Se=e:Se=Se.next=e,Se}function st(){if(ye===null){var e=de.alternate;e=e!==null?e.memoizedState:null}else e=ye.next;var t=Se===null?de.memoizedState:Se.next;if(t!==null)Se=t,ye=e;else{if(e===null)throw Error(L(310));ye=e,e={memoizedState:ye.memoizedState,baseState:ye.baseState,baseQueue:ye.baseQueue,queue:ye.queue,next:null},Se===null?de.memoizedState=Se=e:Se=Se.next=e}return Se}function Wr(e,t){return typeof t=="function"?t(e):t}function Ja(e){var t=st(),n=t.queue;if(n===null)throw Error(L(311));n.lastRenderedReducer=e;var r=ye,o=r.baseQueue,a=n.pending;if(a!==null){if(o!==null){var i=o.next;o.next=a.next,a.next=i}r.baseQueue=o=a,n.pending=null}if(o!==null){a=o.next,r=r.baseState;var l=i=null,u=null,c=a;do{var h=c.lane;if((jn&h)===h)u!==null&&(u=u.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var f={lane:h,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};u===null?(l=u=f,i=r):u=u.next=f,de.lanes|=h,kn|=h}c=c.next}while(c!==null&&c!==a);u===null?i=r:u.next=l,gt(r,t.memoizedState)||(Be=!0),t.memoizedState=r,t.baseState=i,t.baseQueue=u,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do a=o.lane,de.lanes|=a,kn|=a,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Xa(e){var t=st(),n=t.queue;if(n===null)throw Error(L(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,a=t.memoizedState;if(o!==null){n.pending=null;var i=o=o.next;do a=e(a,i.action),i=i.next;while(i!==o);gt(a,t.memoizedState)||(Be=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function ed(){}function td(e,t){var n=de,r=st(),o=t(),a=!gt(r.memoizedState,o);if(a&&(r.memoizedState=o,Be=!0),r=r.queue,Ui(od.bind(null,n,r,e),[e]),r.getSnapshot!==t||a||Se!==null&&Se.memoizedState.tag&1){if(n.flags|=2048,Hr(9,rd.bind(null,n,r,o,t),void 0,null),je===null)throw Error(L(349));jn&30||nd(n,t,o)}return o}function nd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=de.updateQueue,t===null?(t={lastEffect:null,stores:null},de.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function rd(e,t,n,r){t.value=n,t.getSnapshot=r,ad(t)&&sd(e)}function od(e,t,n){return n(function(){ad(t)&&sd(e)})}function ad(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!gt(e,n)}catch{return!0}}function sd(e){var t=Mt(e,1);t!==null&&ht(t,e,1,-1)}function Xl(e){var t=St();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Wr,lastRenderedState:e},t.queue=e,e=e.dispatch=Im.bind(null,de,e),[t.memoizedState,e]}function Hr(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=de.updateQueue,t===null?(t={lastEffect:null,stores:null},de.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function id(){return st().memoizedState}function To(e,t,n,r){var o=St();de.flags|=e,o.memoizedState=Hr(1|t,n,void 0,r===void 0?null:r)}function va(e,t,n,r){var o=st();r=r===void 0?null:r;var a=void 0;if(ye!==null){var i=ye.memoizedState;if(a=i.destroy,r!==null&&Oi(r,i.deps)){o.memoizedState=Hr(t,n,a,r);return}}de.flags|=e,o.memoizedState=Hr(1|t,n,a,r)}function ql(e,t){return To(8390656,8,e,t)}function Ui(e,t){return va(2048,8,e,t)}function ld(e,t){return va(4,2,e,t)}function ud(e,t){return va(4,4,e,t)}function cd(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function dd(e,t,n){return n=n!=null?n.concat([e]):null,va(4,4,cd.bind(null,t,e),n)}function Wi(){}function fd(e,t){var n=st();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oi(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function pd(e,t){var n=st();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Oi(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function md(e,t,n){return jn&21?(gt(n,t)||(n=xc(),de.lanes|=n,kn|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Be=!0),e.memoizedState=n)}function Pm(e,t){var n=te;te=n!==0&&4>n?n:4,e(!0);var r=Ya.transition;Ya.transition={};try{e(!1),t()}finally{te=n,Ya.transition=r}}function hd(){return st().memoizedState}function Tm(e,t,n){var r=nn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},gd(e))vd(t,n);else if(n=Xc(e,t,n,r),n!==null){var o=Le();ht(n,e,r,o),yd(n,t,r)}}function Im(e,t,n){var r=nn(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(gd(e))vd(t,o);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var i=t.lastRenderedState,l=a(i,n);if(o.hasEagerState=!0,o.eagerState=l,gt(l,i)){var u=t.interleaved;u===null?(o.next=o,Ai(t)):(o.next=u.next,u.next=o),t.interleaved=o;return}}catch{}finally{}n=Xc(e,t,o,r),n!==null&&(o=Le(),ht(n,e,r,o),yd(n,t,r))}}function gd(e){var t=e.alternate;return e===de||t!==null&&t===de}function vd(e,t){Cr=Zo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function yd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,wi(e,n)}}var ea={readContext:at,useCallback:Te,useContext:Te,useEffect:Te,useImperativeHandle:Te,useInsertionEffect:Te,useLayoutEffect:Te,useMemo:Te,useReducer:Te,useRef:Te,useState:Te,useDebugValue:Te,useDeferredValue:Te,useTransition:Te,useMutableSource:Te,useSyncExternalStore:Te,useId:Te,unstable_isNewReconciler:!1},_m={readContext:at,useCallback:function(e,t){return St().memoizedState=[e,t===void 0?null:t],e},useContext:at,useEffect:ql,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,To(4194308,4,cd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return To(4194308,4,e,t)},useInsertionEffect:function(e,t){return To(4,2,e,t)},useMemo:function(e,t){var n=St();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=St();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Tm.bind(null,de,e),[r.memoizedState,e]},useRef:function(e){var t=St();return e={current:e},t.memoizedState=e},useState:Xl,useDebugValue:Wi,useDeferredValue:function(e){return St().memoizedState=e},useTransition:function(){var e=Xl(!1),t=e[0];return e=Pm.bind(null,e[1]),St().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=de,o=St();if(se){if(n===void 0)throw Error(L(407));n=n()}else{if(n=t(),je===null)throw Error(L(349));jn&30||nd(r,t,n)}o.memoizedState=n;var a={value:n,getSnapshot:t};return o.queue=a,ql(od.bind(null,r,a,e),[e]),r.flags|=2048,Hr(9,rd.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=St(),t=je.identifierPrefix;if(se){var n=Rt,r=_t;n=(r&~(1<<32-mt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ur++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=bm++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Rm={readContext:at,useCallback:fd,useContext:at,useEffect:Ui,useImperativeHandle:dd,useInsertionEffect:ld,useLayoutEffect:ud,useMemo:pd,useReducer:Ja,useRef:id,useState:function(){return Ja(Wr)},useDebugValue:Wi,useDeferredValue:function(e){var t=st();return md(t,ye.memoizedState,e)},useTransition:function(){var e=Ja(Wr)[0],t=st().memoizedState;return[e,t]},useMutableSource:ed,useSyncExternalStore:td,useId:hd,unstable_isNewReconciler:!1},zm={readContext:at,useCallback:fd,useContext:at,useEffect:Ui,useImperativeHandle:dd,useInsertionEffect:ld,useLayoutEffect:ud,useMemo:pd,useReducer:Xa,useRef:id,useState:function(){return Xa(Wr)},useDebugValue:Wi,useDeferredValue:function(e){var t=st();return ye===null?t.memoizedState=e:md(t,ye.memoizedState,e)},useTransition:function(){var e=Xa(Wr)[0],t=st().memoizedState;return[e,t]},useMutableSource:ed,useSyncExternalStore:td,useId:hd,unstable_isNewReconciler:!1};function dt(e,t){if(e&&e.defaultProps){t=fe({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Fs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:fe({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ya={isMounted:function(e){return(e=e._reactInternals)?En(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Le(),o=nn(e),a=At(r,o);a.payload=t,n!=null&&(a.callback=n),t=en(e,a,o),t!==null&&(ht(t,e,o,r),bo(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Le(),o=nn(e),a=At(r,o);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=en(e,a,o),t!==null&&(ht(t,e,o,r),bo(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Le(),r=nn(e),o=At(n,r);o.tag=2,t!=null&&(o.callback=t),t=en(e,o,r),t!==null&&(ht(t,e,r,n),bo(t,e,r))}};function Zl(e,t,n,r,o,a,i){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,a,i):t.prototype&&t.prototype.isPureReactComponent?!Lr(n,r)||!Lr(o,a):!0}function xd(e,t,n){var r=!1,o=an,a=t.contextType;return typeof a=="object"&&a!==null?a=at(a):(o=Ue(t)?wn:ze.current,r=t.contextTypes,a=(r=r!=null)?Gn(e,o):an),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ya,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=a),t}function eu(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&&ya.enqueueReplaceState(t,t.state,null)}function Os(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},$i(e);var a=t.contextType;typeof a=="object"&&a!==null?o.context=at(a):(a=Ue(t)?wn:ze.current,o.context=Gn(e,a)),o.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a=="function"&&(Fs(e,t,a,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&ya.enqueueReplaceState(o,o.state,null),Xo(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Xn(e,t){try{var n="",r=t;do n+=ip(r),r=r.return;while(r);var o=n}catch(a){o=`
39
39
  Error generating stack: `+a.message+`
40
- `+a.stack}return{value:e,source:t,stack:o,digest:null}}function Xa(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Os(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var _m=typeof WeakMap=="function"?WeakMap:Map;function yd(e,t,n){n=$t(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){ta||(ta=!0,Ys=r),Os(e,t)},n}function xd(e,t,n){n=$t(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Os(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(n.callback=function(){Os(e,t),typeof r!="function"&&(tn===null?tn=new Set([this]):tn.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function Xl(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new _m;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=Km.bind(null,e,t,n),t.then(e,e))}function ql(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 Zl(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=$t(-1,1),t.tag=2,en(n,t,1))),n.lanes|=1),e)}var zm=Dt.ReactCurrentOwner,Be=!1;function $e(e,t,n,r){t.child=e===null?Qc(t,null,n,r):Yn(t,e.child,n,r)}function eu(e,t,n,r,o){n=n.render;var a=t.ref;return Hn(t,o),r=Li(e,t,n,r,a,o),n=Mi(),e!==null&&!Be?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ot(e,t,o)):(se&&n&&Ci(t),t.flags|=1,$e(e,t,r,o),t.child)}function tu(e,t,n,r,o){if(e===null){var a=n.type;return typeof a=="function"&&!Gi(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,wd(e,t,a,r,o)):(e=_o(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!(e.lanes&o)){var i=a.memoizedProps;if(n=n.compare,n=n!==null?n:$r,n(i,r)&&e.ref===t.ref)return Ot(e,t,o)}return t.flags|=1,e=rn(a,r),e.ref=t.ref,e.return=t,t.child=e}function wd(e,t,n,r,o){if(e!==null){var a=e.memoizedProps;if($r(a,r)&&e.ref===t.ref)if(Be=!1,t.pendingProps=r=a,(e.lanes&o)!==0)e.flags&131072&&(Be=!0);else return t.lanes=e.lanes,Ot(e,t,o)}return Bs(e,t,n,r,o)}function Sd(e,t,n){var r=t.pendingProps,o=r.children,a=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},re(On,Ke),Ke|=n;else{if(!(n&1073741824))return e=a!==null?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,re(On,Ke),Ke|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a!==null?a.baseLanes:n,re(On,Ke),Ke|=r}else a!==null?(r=a.baseLanes|n,t.memoizedState=null):r=n,re(On,Ke),Ke|=r;return $e(e,t,o,n),t.child}function jd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Bs(e,t,n,r,o){var a=Ue(n)?wn:ze.current;return a=Gn(t,a),Hn(t,o),n=Li(e,t,n,r,a,o),r=Mi(),e!==null&&!Be?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ot(e,t,o)):(se&&r&&Ci(t),t.flags|=1,$e(e,t,n,o),t.child)}function nu(e,t,n,r,o){if(Ue(n)){var a=!0;Vo(t)}else a=!1;if(Hn(t,o),t.stateNode===null)To(e,t),vd(t,n,r),Fs(t,n,r,o),r=!0;else if(e===null){var i=t.stateNode,l=t.memoizedProps;i.props=l;var u=i.context,c=n.contextType;typeof c=="object"&&c!==null?c=at(c):(c=Ue(n)?wn:ze.current,c=Gn(t,c));var h=n.getDerivedStateFromProps,p=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function";p||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==r||u!==c)&&Jl(t,i,r,c),Ht=!1;var g=t.memoizedState;i.state=g,Jo(t,r,i,o),u=t.memoizedState,l!==r||g!==u||De.current||Ht?(typeof h=="function"&&(Ms(t,n,h,r),u=t.memoizedState),(l=Ht||Yl(t,n,l,r,g,u,c))?(p||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=u),i.props=r,i.state=u,i.context=c,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Jc(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:dt(t.type,l),i.props=c,p=t.pendingProps,g=i.context,u=n.contextType,typeof u=="object"&&u!==null?u=at(u):(u=Ue(n)?wn:ze.current,u=Gn(t,u));var y=n.getDerivedStateFromProps;(h=typeof y=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==p||g!==u)&&Jl(t,i,r,u),Ht=!1,g=t.memoizedState,i.state=g,Jo(t,r,i,o);var x=t.memoizedState;l!==p||g!==x||De.current||Ht?(typeof y=="function"&&(Ms(t,n,y,r),x=t.memoizedState),(c=Ht||Yl(t,n,c,r,g,x,u)||!1)?(h||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,x,u),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,x,u)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),i.props=r,i.state=x,i.context=u,r=c):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),r=!1)}return Ds(e,t,n,r,a,o)}function Ds(e,t,n,r,o,a){jd(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return o&&Dl(t,n,!1),Ot(e,t,a);r=t.stateNode,zm.current=t;var l=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=Yn(t,e.child,null,a),t.child=Yn(t,null,l,a)):$e(e,t,l,a),t.memoizedState=r.state,o&&Dl(t,n,!0),t.child}function kd(e){var t=e.stateNode;t.pendingContext?Bl(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Bl(e,t.context,!1),_i(e,t.containerInfo)}function ru(e,t,n,r,o){return Qn(),Ei(o),t.flags|=256,$e(e,t,n,r),t.child}var Us={dehydrated:null,treeContext:null,retryLane:0};function Ws(e){return{baseLanes:e,cachePool:null,transitions:null}}function Cd(e,t,n){var r=t.pendingProps,o=ce.current,a=!1,i=(t.flags&128)!==0,l;if((l=i)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),re(ce,o&1),e===null)return $s(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,a?(r=t.mode,a=t.child,i={mode:"hidden",children:i},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=i):a=wa(i,r,0,null),e=xn(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Ws(n),t.memoizedState=Us,e):Bi(t,i));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return Am(e,t,i,r,l,o,n);if(a){a=r.fallback,i=t.mode,o=e.child,l=o.sibling;var u={mode:"hidden",children:r.children};return!(i&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=rn(o,u),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?a=rn(l,a):(a=xn(a,i,n,null),a.flags|=2),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,i=e.child.memoizedState,i=i===null?Ws(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},a.memoizedState=i,a.childLanes=e.childLanes&~n,t.memoizedState=Us,r}return a=e.child,e=a.sibling,r=rn(a,{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 Bi(e,t){return t=wa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function mo(e,t,n,r){return r!==null&&Ei(r),Yn(t,e.child,null,n),e=Bi(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Am(e,t,n,r,o,a,i){if(n)return t.flags&256?(t.flags&=-257,r=Xa(Error(L(422))),mo(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=r.fallback,o=t.mode,r=wa({mode:"visible",children:r.children},o,0,null),a=xn(a,o,i,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,t.mode&1&&Yn(t,e.child,null,i),t.child.memoizedState=Ws(i),t.memoizedState=Us,a);if(!(t.mode&1))return mo(e,t,i,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,a=Error(L(419)),r=Xa(a,r,void 0),mo(e,t,i,r)}if(l=(i&e.childLanes)!==0,Be||l){if(r=je,r!==null){switch(i&-i){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|i)?0:o,o!==0&&o!==a.retryLane&&(a.retryLane=o,Ft(e,o),ht(r,e,o,-1))}return Ki(),r=Xa(Error(L(421))),mo(e,t,i,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=Gm.bind(null,e),o._reactRetry=t,null):(e=a.treeContext,Ge=Zt(o.nextSibling),Qe=t,se=!0,pt=null,e!==null&&(et[tt++]=_t,et[tt++]=zt,et[tt++]=Sn,_t=e.id,zt=e.overflow,Sn=t),t=Bi(t,r.children),t.flags|=4096,t)}function ou(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ls(e.return,t,n)}function qa(e,t,n,r,o){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=o)}function Nd(e,t,n){var r=t.pendingProps,o=r.revealOrder,a=r.tail;if($e(e,t,r.children,n),r=ce.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&&ou(e,n,t);else if(e.tag===19)ou(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(re(ce,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Xo(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),qa(t,!1,o,n,a);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Xo(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}qa(t,!0,n,null,a);break;case"together":qa(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function To(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ot(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),kn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(L(153));if(t.child!==null){for(e=t.child,n=rn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=rn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function $m(e,t,n){switch(t.tag){case 3:kd(t),Qn();break;case 5:Xc(t);break;case 1:Ue(t.type)&&Vo(t);break;case 4:_i(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;re(Qo,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(re(ce,ce.current&1),t.flags|=128,null):n&t.child.childLanes?Cd(e,t,n):(re(ce,ce.current&1),e=Ot(e,t,n),e!==null?e.sibling:null);re(ce,ce.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Nd(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),re(ce,ce.current),r)break;return null;case 22:case 23:return t.lanes=0,Sd(e,t,n)}return Ot(e,t,n)}var Ed,Hs,bd,Pd;Ed=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}};Hs=function(){};bd=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,gn(Nt.current);var a=null;switch(n){case"input":o=fs(e,o),r=fs(e,r),a=[];break;case"select":o=fe({},o,{value:void 0}),r=fe({},r,{value:void 0}),a=[];break;case"textarea":o=hs(e,o),r=hs(e,r),a=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Wo)}vs(n,r);var i;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var l=o[c];for(i in l)l.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Pr.hasOwnProperty(c)?a||(a=[]):(a=a||[]).push(c,null));for(c in r){var u=r[c];if(l=o!=null?o[c]:void 0,r.hasOwnProperty(c)&&u!==l&&(u!=null||l!=null))if(c==="style")if(l){for(i in l)!l.hasOwnProperty(i)||u&&u.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in u)u.hasOwnProperty(i)&&l[i]!==u[i]&&(n||(n={}),n[i]=u[i])}else n||(a||(a=[]),a.push(c,n)),n=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,l=l?l.__html:void 0,u!=null&&l!==u&&(a=a||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(a=a||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Pr.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&oe("scroll",e),a||l===u||(a=[])):(a=a||[]).push(c,u))}n&&(a=a||[]).push("style",n);var c=a;(t.updateQueue=c)&&(t.flags|=4)}};Pd=function(e,t,n,r){n!==r&&(t.flags|=4)};function dr(e,t){if(!se)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ie(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Lm(e,t,n){var r=t.pendingProps;switch(Ni(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return Ue(t.type)&&Ho(),Ie(t),null;case 3:return r=t.stateNode,Jn(),ae(De),ae(ze),Ai(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(fo(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pt!==null&&(qs(pt),pt=null))),Hs(e,t),Ie(t),null;case 5:zi(t);var o=gn(Br.current);if(n=t.type,e!==null&&t.stateNode!=null)bd(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(L(166));return Ie(t),null}if(e=gn(Nt.current),fo(t)){r=t.stateNode,n=t.type;var a=t.memoizedProps;switch(r[kt]=t,r[Fr]=a,e=(t.mode&1)!==0,n){case"dialog":oe("cancel",r),oe("close",r);break;case"iframe":case"object":case"embed":oe("load",r);break;case"video":case"audio":for(o=0;o<vr.length;o++)oe(vr[o],r);break;case"source":oe("error",r);break;case"img":case"image":case"link":oe("error",r),oe("load",r);break;case"details":oe("toggle",r);break;case"input":pl(r,a),oe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!a.multiple},oe("invalid",r);break;case"textarea":hl(r,a),oe("invalid",r)}vs(n,a),o=null;for(var i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="children"?typeof l=="string"?r.textContent!==l&&(a.suppressHydrationWarning!==!0&&co(r.textContent,l,e),o=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(a.suppressHydrationWarning!==!0&&co(r.textContent,l,e),o=["children",""+l]):Pr.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&oe("scroll",r)}switch(n){case"input":no(r),ml(r,a,!0);break;case"textarea":no(r),gl(r);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(r.onclick=Wo)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=nc(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[kt]=t,e[Fr]=r,Ed(e,t,!1,!1),t.stateNode=e;e:{switch(i=ys(n,r),n){case"dialog":oe("cancel",e),oe("close",e),o=r;break;case"iframe":case"object":case"embed":oe("load",e),o=r;break;case"video":case"audio":for(o=0;o<vr.length;o++)oe(vr[o],e);o=r;break;case"source":oe("error",e),o=r;break;case"img":case"image":case"link":oe("error",e),oe("load",e),o=r;break;case"details":oe("toggle",e),o=r;break;case"input":pl(e,r),o=fs(e,r),oe("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=fe({},r,{value:void 0}),oe("invalid",e);break;case"textarea":hl(e,r),o=hs(e,r),oe("invalid",e);break;default:o=r}vs(n,o),l=o;for(a in l)if(l.hasOwnProperty(a)){var u=l[a];a==="style"?ac(e,u):a==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&rc(e,u)):a==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Tr(e,u):typeof u=="number"&&Tr(e,""+u):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Pr.hasOwnProperty(a)?u!=null&&a==="onScroll"&&oe("scroll",e):u!=null&&ci(e,a,u,i))}switch(n){case"input":no(e),ml(e,r,!1);break;case"textarea":no(e),gl(e);break;case"option":r.value!=null&&e.setAttribute("value",""+on(r.value));break;case"select":e.multiple=!!r.multiple,a=r.value,a!=null?Bn(e,!!r.multiple,a,!1):r.defaultValue!=null&&Bn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Wo)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ie(t),null;case 6:if(e&&t.stateNode!=null)Pd(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(L(166));if(n=gn(Br.current),gn(Nt.current),fo(t)){if(r=t.stateNode,n=t.memoizedProps,r[kt]=t,(a=r.nodeValue!==n)&&(e=Qe,e!==null))switch(e.tag){case 3:co(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&co(r.nodeValue,n,(e.mode&1)!==0)}a&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[kt]=t,t.stateNode=r}return Ie(t),null;case 13:if(ae(ce),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(se&&Ge!==null&&t.mode&1&&!(t.flags&128))Kc(),Qn(),t.flags|=98560,a=!1;else if(a=fo(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(L(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(L(317));a[kt]=t}else Qn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ie(t),a=!1}else pt!==null&&(qs(pt),pt=null),a=!0;if(!a)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||ce.current&1?xe===0&&(xe=3):Ki())),t.updateQueue!==null&&(t.flags|=4),Ie(t),null);case 4:return Jn(),Hs(e,t),e===null&&Lr(t.stateNode.containerInfo),Ie(t),null;case 10:return Ti(t.type._context),Ie(t),null;case 17:return Ue(t.type)&&Ho(),Ie(t),null;case 19:if(ae(ce),a=t.memoizedState,a===null)return Ie(t),null;if(r=(t.flags&128)!==0,i=a.rendering,i===null)if(r)dr(a,!1);else{if(xe!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=Xo(e),i!==null){for(t.flags|=128,dr(a,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)a=n,e=r,a.flags&=14680066,i=a.alternate,i===null?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,a.type=i.type,e=i.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return re(ce,ce.current&1|2),t.child}e=e.sibling}a.tail!==null&&he()>qn&&(t.flags|=128,r=!0,dr(a,!1),t.lanes=4194304)}else{if(!r)if(e=Xo(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dr(a,!0),a.tail===null&&a.tailMode==="hidden"&&!i.alternate&&!se)return Ie(t),null}else 2*he()-a.renderingStartTime>qn&&n!==1073741824&&(t.flags|=128,r=!0,dr(a,!1),t.lanes=4194304);a.isBackwards?(i.sibling=t.child,t.child=i):(n=a.last,n!==null?n.sibling=i:t.child=i,a.last=i)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=he(),t.sibling=null,n=ce.current,re(ce,r?n&1|2:n&1),t):(Ie(t),null);case 22:case 23:return Vi(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ke&1073741824&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),null;case 24:return null;case 25:return null}throw Error(L(156,t.tag))}function Mm(e,t){switch(Ni(t),t.tag){case 1:return Ue(t.type)&&Ho(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Jn(),ae(De),ae(ze),Ai(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return zi(t),null;case 13:if(ae(ce),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));Qn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ae(ce),null;case 4:return Jn(),null;case 10:return Ti(t.type._context),null;case 22:case 23:return Vi(),null;case 24:return null;default:return null}}var ho=!1,Re=!1,Fm=typeof WeakSet=="function"?WeakSet:Set,U=null;function Fn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){me(e,t,r)}else n.current=null}function Vs(e,t,n){try{n()}catch(r){me(e,t,r)}}var au=!1;function Om(e,t){if(Ps=Bo,e=zc(),ki(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var i=0,l=-1,u=-1,c=0,h=0,p=e,g=null;t:for(;;){for(var y;p!==n||o!==0&&p.nodeType!==3||(l=i+o),p!==a||r!==0&&p.nodeType!==3||(u=i+r),p.nodeType===3&&(i+=p.nodeValue.length),(y=p.firstChild)!==null;)g=p,p=y;for(;;){if(p===e)break t;if(g===n&&++c===o&&(l=i),g===a&&++h===r&&(u=i),(y=p.nextSibling)!==null)break;p=g,g=p.parentNode}p=y}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ts={focusedElem:e,selectionRange:n},Bo=!1,U=t;U!==null;)if(t=U,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,U=e;else for(;U!==null;){t=U;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var w=x.memoizedProps,j=x.memoizedState,m=t.stateNode,f=m.getSnapshotBeforeUpdate(t.elementType===t.type?w:dt(t.type,w),j);m.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(L(163))}}catch(S){me(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,U=e;break}U=t.return}return x=au,au=!1,x}function Nr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var a=o.destroy;o.destroy=void 0,a!==void 0&&Vs(t,n,a)}o=o.next}while(o!==r)}}function ya(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 Ks(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 Td(e){var t=e.alternate;t!==null&&(e.alternate=null,Td(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[kt],delete t[Fr],delete t[_s],delete t[Sm],delete t[jm])),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 Id(e){return e.tag===5||e.tag===3||e.tag===4}function su(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Id(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 Gs(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=Wo));else if(r!==4&&(e=e.child,e!==null))for(Gs(e,t,n),e=e.sibling;e!==null;)Gs(e,t,n),e=e.sibling}function Qs(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(Qs(e,t,n),e=e.sibling;e!==null;)Qs(e,t,n),e=e.sibling}var Ne=null,ft=!1;function Ut(e,t,n){for(n=n.child;n!==null;)Rd(e,t,n),n=n.sibling}function Rd(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(ca,n)}catch{}switch(n.tag){case 5:Re||Fn(n,t);case 6:var r=Ne,o=ft;Ne=null,Ut(e,t,n),Ne=r,ft=o,Ne!==null&&(ft?(e=Ne,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ne.removeChild(n.stateNode));break;case 18:Ne!==null&&(ft?(e=Ne,n=n.stateNode,e.nodeType===8?Va(e.parentNode,n):e.nodeType===1&&Va(e,n),zr(e)):Va(Ne,n.stateNode));break;case 4:r=Ne,o=ft,Ne=n.stateNode.containerInfo,ft=!0,Ut(e,t,n),Ne=r,ft=o;break;case 0:case 11:case 14:case 15:if(!Re&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var a=o,i=a.destroy;a=a.tag,i!==void 0&&(a&2||a&4)&&Vs(n,t,i),o=o.next}while(o!==r)}Ut(e,t,n);break;case 1:if(!Re&&(Fn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){me(n,t,l)}Ut(e,t,n);break;case 21:Ut(e,t,n);break;case 22:n.mode&1?(Re=(r=Re)||n.memoizedState!==null,Ut(e,t,n),Re=r):Ut(e,t,n);break;default:Ut(e,t,n)}}function iu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Fm),t.forEach(function(r){var o=Qm.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function ct(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var a=e,i=t,l=i;e:for(;l!==null;){switch(l.tag){case 5:Ne=l.stateNode,ft=!1;break e;case 3:Ne=l.stateNode.containerInfo,ft=!0;break e;case 4:Ne=l.stateNode.containerInfo,ft=!0;break e}l=l.return}if(Ne===null)throw Error(L(160));Rd(a,i,o),Ne=null,ft=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(c){me(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)_d(t,e),t=t.sibling}function _d(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ct(t,e),wt(e),r&4){try{Nr(3,e,e.return),ya(3,e)}catch(w){me(e,e.return,w)}try{Nr(5,e,e.return)}catch(w){me(e,e.return,w)}}break;case 1:ct(t,e),wt(e),r&512&&n!==null&&Fn(n,n.return);break;case 5:if(ct(t,e),wt(e),r&512&&n!==null&&Fn(n,n.return),e.flags&32){var o=e.stateNode;try{Tr(o,"")}catch(w){me(e,e.return,w)}}if(r&4&&(o=e.stateNode,o!=null)){var a=e.memoizedProps,i=n!==null?n.memoizedProps:a,l=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{l==="input"&&a.type==="radio"&&a.name!=null&&ec(o,a),ys(l,i);var c=ys(l,a);for(i=0;i<u.length;i+=2){var h=u[i],p=u[i+1];h==="style"?ac(o,p):h==="dangerouslySetInnerHTML"?rc(o,p):h==="children"?Tr(o,p):ci(o,h,p,c)}switch(l){case"input":ps(o,a);break;case"textarea":tc(o,a);break;case"select":var g=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!a.multiple;var y=a.value;y!=null?Bn(o,!!a.multiple,y,!1):g!==!!a.multiple&&(a.defaultValue!=null?Bn(o,!!a.multiple,a.defaultValue,!0):Bn(o,!!a.multiple,a.multiple?[]:"",!1))}o[Fr]=a}catch(w){me(e,e.return,w)}}break;case 6:if(ct(t,e),wt(e),r&4){if(e.stateNode===null)throw Error(L(162));o=e.stateNode,a=e.memoizedProps;try{o.nodeValue=a}catch(w){me(e,e.return,w)}}break;case 3:if(ct(t,e),wt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{zr(t.containerInfo)}catch(w){me(e,e.return,w)}break;case 4:ct(t,e),wt(e);break;case 13:ct(t,e),wt(e),o=e.child,o.flags&8192&&(a=o.memoizedState!==null,o.stateNode.isHidden=a,!a||o.alternate!==null&&o.alternate.memoizedState!==null||(Wi=he())),r&4&&iu(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(Re=(c=Re)||h,ct(t,e),Re=c):ct(t,e),wt(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!h&&e.mode&1)for(U=e,h=e.child;h!==null;){for(p=U=h;U!==null;){switch(g=U,y=g.child,g.tag){case 0:case 11:case 14:case 15:Nr(4,g,g.return);break;case 1:Fn(g,g.return);var x=g.stateNode;if(typeof x.componentWillUnmount=="function"){r=g,n=g.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(w){me(r,n,w)}}break;case 5:Fn(g,g.return);break;case 22:if(g.memoizedState!==null){uu(p);continue}}y!==null?(y.return=g,U=y):uu(p)}h=h.sibling}e:for(h=null,p=e;;){if(p.tag===5){if(h===null){h=p;try{o=p.stateNode,c?(a=o.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(l=p.stateNode,u=p.memoizedProps.style,i=u!=null&&u.hasOwnProperty("display")?u.display:null,l.style.display=oc("display",i))}catch(w){me(e,e.return,w)}}}else if(p.tag===6){if(h===null)try{p.stateNode.nodeValue=c?"":p.memoizedProps}catch(w){me(e,e.return,w)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;h===p&&(h=null),p=p.return}h===p&&(h=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:ct(t,e),wt(e),r&4&&iu(e);break;case 21:break;default:ct(t,e),wt(e)}}function wt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Id(n)){var r=n;break e}n=n.return}throw Error(L(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Tr(o,""),r.flags&=-33);var a=su(e);Qs(e,a,o);break;case 3:case 4:var i=r.stateNode.containerInfo,l=su(e);Gs(e,l,i);break;default:throw Error(L(161))}}catch(u){me(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Bm(e,t,n){U=e,zd(e)}function zd(e,t,n){for(var r=(e.mode&1)!==0;U!==null;){var o=U,a=o.child;if(o.tag===22&&r){var i=o.memoizedState!==null||ho;if(!i){var l=o.alternate,u=l!==null&&l.memoizedState!==null||Re;l=ho;var c=Re;if(ho=i,(Re=u)&&!c)for(U=o;U!==null;)i=U,u=i.child,i.tag===22&&i.memoizedState!==null?cu(o):u!==null?(u.return=i,U=u):cu(o);for(;a!==null;)U=a,zd(a),a=a.sibling;U=o,ho=l,Re=c}lu(e)}else o.subtreeFlags&8772&&a!==null?(a.return=o,U=a):lu(e)}}function lu(e){for(;U!==null;){var t=U;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Re||ya(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Re)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:dt(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;a!==null&&Kl(t,a,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}Kl(t,i,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var h=c.memoizedState;if(h!==null){var p=h.dehydrated;p!==null&&zr(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(L(163))}Re||t.flags&512&&Ks(t)}catch(g){me(t,t.return,g)}}if(t===e){U=null;break}if(n=t.sibling,n!==null){n.return=t.return,U=n;break}U=t.return}}function uu(e){for(;U!==null;){var t=U;if(t===e){U=null;break}var n=t.sibling;if(n!==null){n.return=t.return,U=n;break}U=t.return}}function cu(e){for(;U!==null;){var t=U;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ya(4,t)}catch(u){me(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(u){me(t,o,u)}}var a=t.return;try{Ks(t)}catch(u){me(t,a,u)}break;case 5:var i=t.return;try{Ks(t)}catch(u){me(t,i,u)}}}catch(u){me(t,t.return,u)}if(t===e){U=null;break}var l=t.sibling;if(l!==null){l.return=t.return,U=l;break}U=t.return}}var Dm=Math.ceil,ea=Dt.ReactCurrentDispatcher,Di=Dt.ReactCurrentOwner,ot=Dt.ReactCurrentBatchConfig,Z=0,je=null,ge=null,Ee=0,Ke=0,On=ln(0),xe=0,Hr=null,kn=0,xa=0,Ui=0,Er=null,Oe=null,Wi=0,qn=1/0,It=null,ta=!1,Ys=null,tn=null,go=!1,Yt=null,na=0,br=0,Js=null,Io=-1,Ro=0;function Le(){return Z&6?he():Io!==-1?Io:Io=he()}function nn(e){return e.mode&1?Z&2&&Ee!==0?Ee&-Ee:Cm.transition!==null?(Ro===0&&(Ro=vc()),Ro):(e=te,e!==0||(e=window.event,e=e===void 0?16:Cc(e.type)),e):1}function ht(e,t,n,r){if(50<br)throw br=0,Js=null,Error(L(185));Gr(e,n,r),(!(Z&2)||e!==je)&&(e===je&&(!(Z&2)&&(xa|=n),xe===4&&Gt(e,Ee)),We(e,r),n===1&&Z===0&&!(t.mode&1)&&(qn=he()+500,ha&&un()))}function We(e,t){var n=e.callbackNode;Cp(e,t);var r=Oo(e,e===je?Ee:0);if(r===0)n!==null&&xl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&xl(n),t===1)e.tag===0?km(du.bind(null,e)):Wc(du.bind(null,e)),xm(function(){!(Z&6)&&un()}),n=null;else{switch(yc(r)){case 1:n=hi;break;case 4:n=hc;break;case 16:n=Fo;break;case 536870912:n=gc;break;default:n=Fo}n=Dd(n,Ad.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Ad(e,t){if(Io=-1,Ro=0,Z&6)throw Error(L(327));var n=e.callbackNode;if(Vn()&&e.callbackNode!==n)return null;var r=Oo(e,e===je?Ee:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=ra(e,r);else{t=r;var o=Z;Z|=2;var a=Ld();(je!==e||Ee!==t)&&(It=null,qn=he()+500,yn(e,t));do try{Hm();break}catch(l){$d(e,l)}while(!0);Pi(),ea.current=a,Z=o,ge!==null?t=0:(je=null,Ee=0,t=xe)}if(t!==0){if(t===2&&(o=ks(e),o!==0&&(r=o,t=Xs(e,o))),t===1)throw n=Hr,yn(e,0),Gt(e,r),We(e,he()),n;if(t===6)Gt(e,r);else{if(o=e.current.alternate,!(r&30)&&!Um(o)&&(t=ra(e,r),t===2&&(a=ks(e),a!==0&&(r=a,t=Xs(e,a))),t===1))throw n=Hr,yn(e,0),Gt(e,r),We(e,he()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(L(345));case 2:fn(e,Oe,It);break;case 3:if(Gt(e,r),(r&130023424)===r&&(t=Wi+500-he(),10<t)){if(Oo(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Le(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Rs(fn.bind(null,e,Oe,It),t);break}fn(e,Oe,It);break;case 4:if(Gt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var i=31-mt(r);a=1<<i,i=t[i],i>o&&(o=i),r&=~a}if(r=o,r=he()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Dm(r/1960))-r,10<r){e.timeoutHandle=Rs(fn.bind(null,e,Oe,It),r);break}fn(e,Oe,It);break;case 5:fn(e,Oe,It);break;default:throw Error(L(329))}}}return We(e,he()),e.callbackNode===n?Ad.bind(null,e):null}function Xs(e,t){var n=Er;return e.current.memoizedState.isDehydrated&&(yn(e,t).flags|=256),e=ra(e,t),e!==2&&(t=Oe,Oe=n,t!==null&&qs(t)),e}function qs(e){Oe===null?Oe=e:Oe.push.apply(Oe,e)}function Um(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],a=o.getSnapshot;o=o.value;try{if(!gt(a(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Gt(e,t){for(t&=~Ui,t&=~xa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-mt(t),r=1<<n;e[n]=-1,t&=~r}}function du(e){if(Z&6)throw Error(L(327));Vn();var t=Oo(e,0);if(!(t&1))return We(e,he()),null;var n=ra(e,t);if(e.tag!==0&&n===2){var r=ks(e);r!==0&&(t=r,n=Xs(e,r))}if(n===1)throw n=Hr,yn(e,0),Gt(e,t),We(e,he()),n;if(n===6)throw Error(L(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,fn(e,Oe,It),We(e,he()),null}function Hi(e,t){var n=Z;Z|=1;try{return e(t)}finally{Z=n,Z===0&&(qn=he()+500,ha&&un())}}function Cn(e){Yt!==null&&Yt.tag===0&&!(Z&6)&&Vn();var t=Z;Z|=1;var n=ot.transition,r=te;try{if(ot.transition=null,te=1,e)return e()}finally{te=r,ot.transition=n,Z=t,!(Z&6)&&un()}}function Vi(){Ke=On.current,ae(On)}function yn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ym(n)),ge!==null)for(n=ge.return;n!==null;){var r=n;switch(Ni(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ho();break;case 3:Jn(),ae(De),ae(ze),Ai();break;case 5:zi(r);break;case 4:Jn();break;case 13:ae(ce);break;case 19:ae(ce);break;case 10:Ti(r.type._context);break;case 22:case 23:Vi()}n=n.return}if(je=e,ge=e=rn(e.current,null),Ee=Ke=t,xe=0,Hr=null,Ui=xa=kn=0,Oe=Er=null,hn!==null){for(t=0;t<hn.length;t++)if(n=hn[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,a=n.pending;if(a!==null){var i=a.next;a.next=o,r.next=i}n.pending=r}hn=null}return e}function $d(e,t){do{var n=ge;try{if(Pi(),bo.current=Zo,qo){for(var r=de.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}qo=!1}if(jn=0,Se=ye=de=null,Cr=!1,Dr=0,Di.current=null,n===null||n.return===null){xe=1,Hr=t,ge=null;break}e:{var a=e,i=n.return,l=n,u=t;if(t=Ee,l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var c=u,h=l,p=h.tag;if(!(h.mode&1)&&(p===0||p===11||p===15)){var g=h.alternate;g?(h.updateQueue=g.updateQueue,h.memoizedState=g.memoizedState,h.lanes=g.lanes):(h.updateQueue=null,h.memoizedState=null)}var y=ql(i);if(y!==null){y.flags&=-257,Zl(y,i,l,a,t),y.mode&1&&Xl(a,c,t),t=y,u=c;var x=t.updateQueue;if(x===null){var w=new Set;w.add(u),t.updateQueue=w}else x.add(u);break e}else{if(!(t&1)){Xl(a,c,t),Ki();break e}u=Error(L(426))}}else if(se&&l.mode&1){var j=ql(i);if(j!==null){!(j.flags&65536)&&(j.flags|=256),Zl(j,i,l,a,t),Ei(Xn(u,l));break e}}a=u=Xn(u,l),xe!==4&&(xe=2),Er===null?Er=[a]:Er.push(a),a=i;do{switch(a.tag){case 3:a.flags|=65536,t&=-t,a.lanes|=t;var m=yd(a,u,t);Vl(a,m);break e;case 1:l=u;var f=a.type,v=a.stateNode;if(!(a.flags&128)&&(typeof f.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(tn===null||!tn.has(v)))){a.flags|=65536,t&=-t,a.lanes|=t;var S=xd(a,l,t);Vl(a,S);break e}}a=a.return}while(a!==null)}Fd(n)}catch(b){t=b,ge===n&&n!==null&&(ge=n=n.return);continue}break}while(!0)}function Ld(){var e=ea.current;return ea.current=Zo,e===null?Zo:e}function Ki(){(xe===0||xe===3||xe===2)&&(xe=4),je===null||!(kn&268435455)&&!(xa&268435455)||Gt(je,Ee)}function ra(e,t){var n=Z;Z|=2;var r=Ld();(je!==e||Ee!==t)&&(It=null,yn(e,t));do try{Wm();break}catch(o){$d(e,o)}while(!0);if(Pi(),Z=n,ea.current=r,ge!==null)throw Error(L(261));return je=null,Ee=0,xe}function Wm(){for(;ge!==null;)Md(ge)}function Hm(){for(;ge!==null&&!hp();)Md(ge)}function Md(e){var t=Bd(e.alternate,e,Ke);e.memoizedProps=e.pendingProps,t===null?Fd(e):ge=t,Di.current=null}function Fd(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Mm(n,t),n!==null){n.flags&=32767,ge=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{xe=6,ge=null;return}}else if(n=Lm(n,t,Ke),n!==null){ge=n;return}if(t=t.sibling,t!==null){ge=t;return}ge=t=e}while(t!==null);xe===0&&(xe=5)}function fn(e,t,n){var r=te,o=ot.transition;try{ot.transition=null,te=1,Vm(e,t,n,r)}finally{ot.transition=o,te=r}return null}function Vm(e,t,n,r){do Vn();while(Yt!==null);if(Z&6)throw Error(L(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(L(177));e.callbackNode=null,e.callbackPriority=0;var a=n.lanes|n.childLanes;if(Np(e,a),e===je&&(ge=je=null,Ee=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||go||(go=!0,Dd(Fo,function(){return Vn(),null})),a=(n.flags&15990)!==0,n.subtreeFlags&15990||a){a=ot.transition,ot.transition=null;var i=te;te=1;var l=Z;Z|=4,Di.current=null,Om(e,n),_d(n,e),dm(Ts),Bo=!!Ps,Ts=Ps=null,e.current=n,Bm(n),gp(),Z=l,te=i,ot.transition=a}else e.current=n;if(go&&(go=!1,Yt=e,na=o),a=e.pendingLanes,a===0&&(tn=null),xp(n.stateNode),We(e,he()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(ta)throw ta=!1,e=Ys,Ys=null,e;return na&1&&e.tag!==0&&Vn(),a=e.pendingLanes,a&1?e===Js?br++:(br=0,Js=e):br=0,un(),null}function Vn(){if(Yt!==null){var e=yc(na),t=ot.transition,n=te;try{if(ot.transition=null,te=16>e?16:e,Yt===null)var r=!1;else{if(e=Yt,Yt=null,na=0,Z&6)throw Error(L(331));var o=Z;for(Z|=4,U=e.current;U!==null;){var a=U,i=a.child;if(U.flags&16){var l=a.deletions;if(l!==null){for(var u=0;u<l.length;u++){var c=l[u];for(U=c;U!==null;){var h=U;switch(h.tag){case 0:case 11:case 15:Nr(8,h,a)}var p=h.child;if(p!==null)p.return=h,U=p;else for(;U!==null;){h=U;var g=h.sibling,y=h.return;if(Td(h),h===c){U=null;break}if(g!==null){g.return=y,U=g;break}U=y}}}var x=a.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)}}U=a}}if(a.subtreeFlags&2064&&i!==null)i.return=a,U=i;else e:for(;U!==null;){if(a=U,a.flags&2048)switch(a.tag){case 0:case 11:case 15:Nr(9,a,a.return)}var m=a.sibling;if(m!==null){m.return=a.return,U=m;break e}U=a.return}}var f=e.current;for(U=f;U!==null;){i=U;var v=i.child;if(i.subtreeFlags&2064&&v!==null)v.return=i,U=v;else e:for(i=f;U!==null;){if(l=U,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:ya(9,l)}}catch(b){me(l,l.return,b)}if(l===i){U=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,U=S;break e}U=l.return}}if(Z=o,un(),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(ca,e)}catch{}r=!0}return r}finally{te=n,ot.transition=t}}return!1}function fu(e,t,n){t=Xn(n,t),t=yd(e,t,1),e=en(e,t,1),t=Le(),e!==null&&(Gr(e,1,t),We(e,t))}function me(e,t,n){if(e.tag===3)fu(e,e,n);else for(;t!==null;){if(t.tag===3){fu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(tn===null||!tn.has(r))){e=Xn(n,e),e=xd(t,e,1),t=en(t,e,1),e=Le(),t!==null&&(Gr(t,1,e),We(t,e));break}}t=t.return}}function Km(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Le(),e.pingedLanes|=e.suspendedLanes&n,je===e&&(Ee&n)===n&&(xe===4||xe===3&&(Ee&130023424)===Ee&&500>he()-Wi?yn(e,0):Ui|=n),We(e,t)}function Od(e,t){t===0&&(e.mode&1?(t=ao,ao<<=1,!(ao&130023424)&&(ao=4194304)):t=1);var n=Le();e=Ft(e,t),e!==null&&(Gr(e,t,n),We(e,n))}function Gm(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Od(e,n)}function Qm(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(L(314))}r!==null&&r.delete(t),Od(e,n)}var Bd;Bd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||De.current)Be=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Be=!1,$m(e,t,n);Be=!!(e.flags&131072)}else Be=!1,se&&t.flags&1048576&&Hc(t,Go,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;To(e,t),e=t.pendingProps;var o=Gn(t,ze.current);Hn(t,n),o=Li(null,t,r,e,o,n);var a=Mi();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ue(r)?(a=!0,Vo(t)):a=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Ri(t),o.updater=va,t.stateNode=o,o._reactInternals=t,Fs(t,r,e,n),t=Ds(null,t,r,!0,a,n)):(t.tag=0,se&&a&&Ci(t),$e(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(To(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=Jm(r),e=dt(r,e),o){case 0:t=Bs(null,t,r,e,n);break e;case 1:t=nu(null,t,r,e,n);break e;case 11:t=eu(null,t,r,e,n);break e;case 14:t=tu(null,t,r,dt(r.type,e),n);break e}throw Error(L(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:dt(r,o),Bs(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:dt(r,o),nu(e,t,r,o,n);case 3:e:{if(kd(t),e===null)throw Error(L(387));r=t.pendingProps,a=t.memoizedState,o=a.element,Jc(e,t),Jo(t,r,null,n);var i=t.memoizedState;if(r=i.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){o=Xn(Error(L(423)),t),t=ru(e,t,r,n,o);break e}else if(r!==o){o=Xn(Error(L(424)),t),t=ru(e,t,r,n,o);break e}else for(Ge=Zt(t.stateNode.containerInfo.firstChild),Qe=t,se=!0,pt=null,n=Qc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Qn(),r===o){t=Ot(e,t,n);break e}$e(e,t,r,n)}t=t.child}return t;case 5:return Xc(t),e===null&&$s(t),r=t.type,o=t.pendingProps,a=e!==null?e.memoizedProps:null,i=o.children,Is(r,o)?i=null:a!==null&&Is(r,a)&&(t.flags|=32),jd(e,t),$e(e,t,i,n),t.child;case 6:return e===null&&$s(t),null;case 13:return Cd(e,t,n);case 4:return _i(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Yn(t,null,r,n):$e(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:dt(r,o),eu(e,t,r,o,n);case 7:return $e(e,t,t.pendingProps,n),t.child;case 8:return $e(e,t,t.pendingProps.children,n),t.child;case 12:return $e(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,a=t.memoizedProps,i=o.value,re(Qo,r._currentValue),r._currentValue=i,a!==null)if(gt(a.value,i)){if(a.children===o.children&&!De.current){t=Ot(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){i=a.child;for(var u=l.firstContext;u!==null;){if(u.context===r){if(a.tag===1){u=$t(-1,n&-n),u.tag=2;var c=a.updateQueue;if(c!==null){c=c.shared;var h=c.pending;h===null?u.next=u:(u.next=h.next,h.next=u),c.pending=u}}a.lanes|=n,u=a.alternate,u!==null&&(u.lanes|=n),Ls(a.return,n,t),l.lanes|=n;break}u=u.next}}else if(a.tag===10)i=a.type===t.type?null:a.child;else if(a.tag===18){if(i=a.return,i===null)throw Error(L(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Ls(i,n,t),i=a.sibling}else i=a.child;if(i!==null)i.return=a;else for(i=a;i!==null;){if(i===t){i=null;break}if(a=i.sibling,a!==null){a.return=i.return,i=a;break}i=i.return}a=i}$e(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Hn(t,n),o=at(o),r=r(o),t.flags|=1,$e(e,t,r,n),t.child;case 14:return r=t.type,o=dt(r,t.pendingProps),o=dt(r.type,o),tu(e,t,r,o,n);case 15:return wd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:dt(r,o),To(e,t),t.tag=1,Ue(r)?(e=!0,Vo(t)):e=!1,Hn(t,n),vd(t,r,o),Fs(t,r,o,n),Ds(null,t,r,!0,e,n);case 19:return Nd(e,t,n);case 22:return Sd(e,t,n)}throw Error(L(156,t.tag))};function Dd(e,t){return mc(e,t)}function Ym(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rt(e,t,n,r){return new Ym(e,t,n,r)}function Gi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jm(e){if(typeof e=="function")return Gi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===fi)return 11;if(e===pi)return 14}return 2}function rn(e,t){var n=e.alternate;return n===null?(n=rt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function _o(e,t,n,r,o,a){var i=2;if(r=e,typeof e=="function")Gi(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Tn:return xn(n.children,o,a,t);case di:i=8,o|=8;break;case ls:return e=rt(12,n,t,o|2),e.elementType=ls,e.lanes=a,e;case us:return e=rt(13,n,t,o),e.elementType=us,e.lanes=a,e;case cs:return e=rt(19,n,t,o),e.elementType=cs,e.lanes=a,e;case Xu:return wa(n,o,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Yu:i=10;break e;case Ju:i=9;break e;case fi:i=11;break e;case pi:i=14;break e;case Wt:i=16,r=null;break e}throw Error(L(130,e==null?e:typeof e,""))}return t=rt(i,n,t,o),t.elementType=e,t.type=r,t.lanes=a,t}function xn(e,t,n,r){return e=rt(7,e,r,t),e.lanes=n,e}function wa(e,t,n,r){return e=rt(22,e,r,t),e.elementType=Xu,e.lanes=n,e.stateNode={isHidden:!1},e}function Za(e,t,n){return e=rt(6,e,null,t),e.lanes=n,e}function es(e,t,n){return t=rt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Xm(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Aa(0),this.expirationTimes=Aa(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Aa(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Qi(e,t,n,r,o,a,i,l,u){return e=new Xm(e,t,n,l,u),t===1?(t=1,a===!0&&(t|=8)):t=0,a=rt(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ri(a),e}function qm(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Pn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Ud(e){if(!e)return an;e=e._reactInternals;e:{if(En(e)!==e||e.tag!==1)throw Error(L(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ue(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(L(171))}if(e.tag===1){var n=e.type;if(Ue(n))return Uc(e,n,t)}return t}function Wd(e,t,n,r,o,a,i,l,u){return e=Qi(n,r,!0,e,o,a,i,l,u),e.context=Ud(null),n=e.current,r=Le(),o=nn(n),a=$t(r,o),a.callback=t??null,en(n,a,o),e.current.lanes=o,Gr(e,o,r),We(e,r),e}function Sa(e,t,n,r){var o=t.current,a=Le(),i=nn(o);return n=Ud(n),t.context===null?t.context=n:t.pendingContext=n,t=$t(a,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=en(o,t,i),e!==null&&(ht(e,o,i,a),Eo(e,o,i)),i}function oa(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 pu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Yi(e,t){pu(e,t),(e=e.alternate)&&pu(e,t)}function Zm(){return null}var Hd=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ji(e){this._internalRoot=e}ja.prototype.render=Ji.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(L(409));Sa(e,t,null,null)};ja.prototype.unmount=Ji.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Cn(function(){Sa(null,e,null,null)}),t[Mt]=null}};function ja(e){this._internalRoot=e}ja.prototype.unstable_scheduleHydration=function(e){if(e){var t=Sc();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Kt.length&&t!==0&&t<Kt[n].priority;n++);Kt.splice(n,0,e),n===0&&kc(e)}};function Xi(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function ka(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function mu(){}function eh(e,t,n,r,o){if(o){if(typeof r=="function"){var a=r;r=function(){var c=oa(i);a.call(c)}}var i=Wd(t,r,e,0,null,!1,!1,"",mu);return e._reactRootContainer=i,e[Mt]=i.current,Lr(e.nodeType===8?e.parentNode:e),Cn(),i}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var l=r;r=function(){var c=oa(u);l.call(c)}}var u=Qi(e,0,!1,null,null,!1,!1,"",mu);return e._reactRootContainer=u,e[Mt]=u.current,Lr(e.nodeType===8?e.parentNode:e),Cn(function(){Sa(t,u,n,r)}),u}function Ca(e,t,n,r,o){var a=n._reactRootContainer;if(a){var i=a;if(typeof o=="function"){var l=o;o=function(){var u=oa(i);l.call(u)}}Sa(t,i,e,o)}else i=eh(n,t,e,o,r);return oa(i)}xc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=gr(t.pendingLanes);n!==0&&(gi(t,n|1),We(t,he()),!(Z&6)&&(qn=he()+500,un()))}break;case 13:Cn(function(){var r=Ft(e,1);if(r!==null){var o=Le();ht(r,e,1,o)}}),Yi(e,1)}};vi=function(e){if(e.tag===13){var t=Ft(e,134217728);if(t!==null){var n=Le();ht(t,e,134217728,n)}Yi(e,134217728)}};wc=function(e){if(e.tag===13){var t=nn(e),n=Ft(e,t);if(n!==null){var r=Le();ht(n,e,t,r)}Yi(e,t)}};Sc=function(){return te};jc=function(e,t){var n=te;try{return te=e,t()}finally{te=n}};ws=function(e,t,n){switch(t){case"input":if(ps(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=ma(r);if(!o)throw Error(L(90));Zu(r),ps(r,o)}}}break;case"textarea":tc(e,n);break;case"select":t=n.value,t!=null&&Bn(e,!!n.multiple,t,!1)}};lc=Hi;uc=Cn;var th={usingClientEntryPoint:!1,Events:[Yr,zn,ma,sc,ic,Hi]},fr={findFiberByHostInstance:mn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},nh={bundleType:fr.bundleType,version:fr.version,rendererPackageName:fr.rendererPackageName,rendererConfig:fr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Dt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=fc(e),e===null?null:e.stateNode},findFiberByHostInstance:fr.findFiberByHostInstance||Zm,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 vo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vo.isDisabled&&vo.supportsFiber)try{ca=vo.inject(nh),Ct=vo}catch{}}Je.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=th;Je.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Xi(t))throw Error(L(200));return qm(e,t,null,n)};Je.createRoot=function(e,t){if(!Xi(e))throw Error(L(299));var n=!1,r="",o=Hd;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Qi(e,1,!1,null,null,n,!1,r,o),e[Mt]=t.current,Lr(e.nodeType===8?e.parentNode:e),new Ji(t)};Je.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(L(188)):(e=Object.keys(e).join(","),Error(L(268,e)));return e=fc(t),e=e===null?null:e.stateNode,e};Je.flushSync=function(e){return Cn(e)};Je.hydrate=function(e,t,n){if(!ka(t))throw Error(L(200));return Ca(null,e,t,!0,n)};Je.hydrateRoot=function(e,t,n){if(!Xi(e))throw Error(L(405));var r=n!=null&&n.hydratedSources||null,o=!1,a="",i=Hd;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=Wd(t,null,e,1,n??null,o,!1,a,i),e[Mt]=t.current,Lr(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new ja(t)};Je.render=function(e,t,n){if(!ka(t))throw Error(L(200));return Ca(null,e,t,!1,n)};Je.unmountComponentAtNode=function(e){if(!ka(e))throw Error(L(40));return e._reactRootContainer?(Cn(function(){Ca(null,null,e,!1,function(){e._reactRootContainer=null,e[Mt]=null})}),!0):!1};Je.unstable_batchedUpdates=Hi;Je.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!ka(n))throw Error(L(200));if(e==null||e._reactInternals===void 0)throw Error(L(38));return Ca(e,t,n,!1,r)};Je.version="18.3.1-next-f1338f8080-20240426";function Vd(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Vd)}catch(e){console.error(e)}}Vd(),Vu.exports=Je;var Kd=Vu.exports,Gd,hu=Kd;Gd=hu.createRoot,hu.hydrateRoot;/**
40
+ `+a.stack}return{value:e,source:t,stack:o,digest:null}}function qa(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Bs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Am=typeof WeakMap=="function"?WeakMap:Map;function wd(e,t,n){n=At(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){na||(na=!0,Js=r),Bs(e,t)},n}function Sd(e,t,n){n=At(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Bs(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch=="function"&&(n.callback=function(){Bs(e,t),typeof r!="function"&&(tn===null?tn=new Set([this]):tn.add(this));var i=t.stack;this.componentDidCatch(t.value,{componentStack:i!==null?i:""})}),n}function tu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Am;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=Qm.bind(null,e,t,n),t.then(e,e))}function nu(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 ru(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=At(-1,1),t.tag=2,en(n,t,1))),n.lanes|=1),e)}var $m=Bt.ReactCurrentOwner,Be=!1;function $e(e,t,n,r){t.child=e===null?Jc(t,null,n,r):Yn(t,e.child,n,r)}function ou(e,t,n,r,o){n=n.render;var a=t.ref;return Hn(t,o),r=Bi(e,t,n,r,a,o),n=Di(),e!==null&&!Be?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ft(e,t,o)):(se&&n&&Pi(t),t.flags|=1,$e(e,t,r,o),t.child)}function au(e,t,n,r,o){if(e===null){var a=n.type;return typeof a=="function"&&!Xi(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,jd(e,t,a,r,o)):(e=zo(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!(e.lanes&o)){var i=a.memoizedProps;if(n=n.compare,n=n!==null?n:Lr,n(i,r)&&e.ref===t.ref)return Ft(e,t,o)}return t.flags|=1,e=rn(a,r),e.ref=t.ref,e.return=t,t.child=e}function jd(e,t,n,r,o){if(e!==null){var a=e.memoizedProps;if(Lr(a,r)&&e.ref===t.ref)if(Be=!1,t.pendingProps=r=a,(e.lanes&o)!==0)e.flags&131072&&(Be=!0);else return t.lanes=e.lanes,Ft(e,t,o)}return Ds(e,t,n,r,o)}function kd(e,t,n){var r=t.pendingProps,o=r.children,a=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},re(On,Ke),Ke|=n;else{if(!(n&1073741824))return e=a!==null?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,re(On,Ke),Ke|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a!==null?a.baseLanes:n,re(On,Ke),Ke|=r}else a!==null?(r=a.baseLanes|n,t.memoizedState=null):r=n,re(On,Ke),Ke|=r;return $e(e,t,o,n),t.child}function Cd(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ds(e,t,n,r,o){var a=Ue(n)?wn:ze.current;return a=Gn(t,a),Hn(t,o),n=Bi(e,t,n,r,a,o),r=Di(),e!==null&&!Be?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ft(e,t,o)):(se&&r&&Pi(t),t.flags|=1,$e(e,t,n,o),t.child)}function su(e,t,n,r,o){if(Ue(n)){var a=!0;Ko(t)}else a=!1;if(Hn(t,o),t.stateNode===null)Io(e,t),xd(t,n,r),Os(t,n,r,o),r=!0;else if(e===null){var i=t.stateNode,l=t.memoizedProps;i.props=l;var u=i.context,c=n.contextType;typeof c=="object"&&c!==null?c=at(c):(c=Ue(n)?wn:ze.current,c=Gn(t,c));var h=n.getDerivedStateFromProps,f=typeof h=="function"||typeof i.getSnapshotBeforeUpdate=="function";f||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==r||u!==c)&&eu(t,i,r,c),Ht=!1;var g=t.memoizedState;i.state=g,Xo(t,r,i,o),u=t.memoizedState,l!==r||g!==u||De.current||Ht?(typeof h=="function"&&(Fs(t,n,h,r),u=t.memoizedState),(l=Ht||Zl(t,n,l,r,g,u,c))?(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=u),i.props=r,i.state=u,i.context=c,r=l):(typeof i.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,qc(e,t),l=t.memoizedProps,c=t.type===t.elementType?l:dt(t.type,l),i.props=c,f=t.pendingProps,g=i.context,u=n.contextType,typeof u=="object"&&u!==null?u=at(u):(u=Ue(n)?wn:ze.current,u=Gn(t,u));var y=n.getDerivedStateFromProps;(h=typeof y=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l!==f||g!==u)&&eu(t,i,r,u),Ht=!1,g=t.memoizedState,i.state=g,Xo(t,r,i,o);var x=t.memoizedState;l!==f||g!==x||De.current||Ht?(typeof y=="function"&&(Fs(t,n,y,r),x=t.memoizedState),(c=Ht||Zl(t,n,c,r,g,x,u)||!1)?(h||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,x,u),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,x,u)),typeof i.componentDidUpdate=="function"&&(t.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=x),i.props=r,i.state=x,i.context=u,r=c):(typeof i.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),r=!1)}return Us(e,t,n,r,a,o)}function Us(e,t,n,r,o,a){Cd(e,t);var i=(t.flags&128)!==0;if(!r&&!i)return o&&Vl(t,n,!1),Ft(e,t,a);r=t.stateNode,$m.current=t;var l=i&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&i?(t.child=Yn(t,e.child,null,a),t.child=Yn(t,null,l,a)):$e(e,t,l,a),t.memoizedState=r.state,o&&Vl(t,n,!0),t.child}function Nd(e){var t=e.stateNode;t.pendingContext?Hl(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Hl(e,t.context,!1),Li(e,t.containerInfo)}function iu(e,t,n,r,o){return Qn(),Ii(o),t.flags|=256,$e(e,t,n,r),t.child}var Ws={dehydrated:null,treeContext:null,retryLane:0};function Hs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Ed(e,t,n){var r=t.pendingProps,o=ce.current,a=!1,i=(t.flags&128)!==0,l;if((l=i)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),re(ce,o&1),e===null)return Ls(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(i=r.children,e=r.fallback,a?(r=t.mode,a=t.child,i={mode:"hidden",children:i},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=i):a=Sa(i,r,0,null),e=xn(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Hs(n),t.memoizedState=Ws,e):Hi(t,i));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return Lm(e,t,i,r,l,o,n);if(a){a=r.fallback,i=t.mode,o=e.child,l=o.sibling;var u={mode:"hidden",children:r.children};return!(i&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=u,t.deletions=null):(r=rn(o,u),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?a=rn(l,a):(a=xn(a,i,n,null),a.flags|=2),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,i=e.child.memoizedState,i=i===null?Hs(n):{baseLanes:i.baseLanes|n,cachePool:null,transitions:i.transitions},a.memoizedState=i,a.childLanes=e.childLanes&~n,t.memoizedState=Ws,r}return a=e.child,e=a.sibling,r=rn(a,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Hi(e,t){return t=Sa({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ho(e,t,n,r){return r!==null&&Ii(r),Yn(t,e.child,null,n),e=Hi(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Lm(e,t,n,r,o,a,i){if(n)return t.flags&256?(t.flags&=-257,r=qa(Error(L(422))),ho(e,t,i,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(a=r.fallback,o=t.mode,r=Sa({mode:"visible",children:r.children},o,0,null),a=xn(a,o,i,null),a.flags|=2,r.return=t,a.return=t,r.sibling=a,t.child=r,t.mode&1&&Yn(t,e.child,null,i),t.child.memoizedState=Hs(i),t.memoizedState=Ws,a);if(!(t.mode&1))return ho(e,t,i,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,a=Error(L(419)),r=qa(a,r,void 0),ho(e,t,i,r)}if(l=(i&e.childLanes)!==0,Be||l){if(r=je,r!==null){switch(i&-i){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|i)?0:o,o!==0&&o!==a.retryLane&&(a.retryLane=o,Mt(e,o),ht(r,e,o,-1))}return Ji(),r=qa(Error(L(421))),ho(e,t,i,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=Ym.bind(null,e),o._reactRetry=t,null):(e=a.treeContext,Ge=Zt(o.nextSibling),Qe=t,se=!0,pt=null,e!==null&&(et[tt++]=_t,et[tt++]=Rt,et[tt++]=Sn,_t=e.id,Rt=e.overflow,Sn=t),t=Hi(t,r.children),t.flags|=4096,t)}function lu(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ms(e.return,t,n)}function Za(e,t,n,r,o){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=o)}function bd(e,t,n){var r=t.pendingProps,o=r.revealOrder,a=r.tail;if($e(e,t,r.children,n),r=ce.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&&lu(e,n,t);else if(e.tag===19)lu(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(re(ce,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&qo(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Za(t,!1,o,n,a);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&qo(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Za(t,!0,n,null,a);break;case"together":Za(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Io(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ft(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),kn|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(L(153));if(t.child!==null){for(e=t.child,n=rn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=rn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Mm(e,t,n){switch(t.tag){case 3:Nd(t),Qn();break;case 5:Zc(t);break;case 1:Ue(t.type)&&Ko(t);break;case 4:Li(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;re(Yo,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(re(ce,ce.current&1),t.flags|=128,null):n&t.child.childLanes?Ed(e,t,n):(re(ce,ce.current&1),e=Ft(e,t,n),e!==null?e.sibling:null);re(ce,ce.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return bd(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),re(ce,ce.current),r)break;return null;case 22:case 23:return t.lanes=0,kd(e,t,n)}return Ft(e,t,n)}var Pd,Vs,Td,Id;Pd=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Vs=function(){};Td=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,gn(Nt.current);var a=null;switch(n){case"input":o=ps(e,o),r=ps(e,r),a=[];break;case"select":o=fe({},o,{value:void 0}),r=fe({},r,{value:void 0}),a=[];break;case"textarea":o=gs(e,o),r=gs(e,r),a=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Ho)}ys(n,r);var i;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var l=o[c];for(i in l)l.hasOwnProperty(i)&&(n||(n={}),n[i]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Tr.hasOwnProperty(c)?a||(a=[]):(a=a||[]).push(c,null));for(c in r){var u=r[c];if(l=o!=null?o[c]:void 0,r.hasOwnProperty(c)&&u!==l&&(u!=null||l!=null))if(c==="style")if(l){for(i in l)!l.hasOwnProperty(i)||u&&u.hasOwnProperty(i)||(n||(n={}),n[i]="");for(i in u)u.hasOwnProperty(i)&&l[i]!==u[i]&&(n||(n={}),n[i]=u[i])}else n||(a||(a=[]),a.push(c,n)),n=u;else c==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,l=l?l.__html:void 0,u!=null&&l!==u&&(a=a||[]).push(c,u)):c==="children"?typeof u!="string"&&typeof u!="number"||(a=a||[]).push(c,""+u):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Tr.hasOwnProperty(c)?(u!=null&&c==="onScroll"&&oe("scroll",e),a||l===u||(a=[])):(a=a||[]).push(c,u))}n&&(a=a||[]).push("style",n);var c=a;(t.updateQueue=c)&&(t.flags|=4)}};Id=function(e,t,n,r){n!==r&&(t.flags|=4)};function dr(e,t){if(!se)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ie(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Fm(e,t,n){var r=t.pendingProps;switch(Ti(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return Ue(t.type)&&Vo(),Ie(t),null;case 3:return r=t.stateNode,Jn(),ae(De),ae(ze),Fi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(po(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pt!==null&&(Zs(pt),pt=null))),Vs(e,t),Ie(t),null;case 5:Mi(t);var o=gn(Dr.current);if(n=t.type,e!==null&&t.stateNode!=null)Td(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(L(166));return Ie(t),null}if(e=gn(Nt.current),po(t)){r=t.stateNode,n=t.type;var a=t.memoizedProps;switch(r[kt]=t,r[Or]=a,e=(t.mode&1)!==0,n){case"dialog":oe("cancel",r),oe("close",r);break;case"iframe":case"object":case"embed":oe("load",r);break;case"video":case"audio":for(o=0;o<vr.length;o++)oe(vr[o],r);break;case"source":oe("error",r);break;case"img":case"image":case"link":oe("error",r),oe("load",r);break;case"details":oe("toggle",r);break;case"input":vl(r,a),oe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!a.multiple},oe("invalid",r);break;case"textarea":xl(r,a),oe("invalid",r)}ys(n,a),o=null;for(var i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="children"?typeof l=="string"?r.textContent!==l&&(a.suppressHydrationWarning!==!0&&fo(r.textContent,l,e),o=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(a.suppressHydrationWarning!==!0&&fo(r.textContent,l,e),o=["children",""+l]):Tr.hasOwnProperty(i)&&l!=null&&i==="onScroll"&&oe("scroll",r)}switch(n){case"input":ro(r),yl(r,a,!0);break;case"textarea":ro(r),wl(r);break;case"select":case"option":break;default:typeof a.onClick=="function"&&(r.onclick=Ho)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{i=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=oc(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=i.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[kt]=t,e[Or]=r,Pd(e,t,!1,!1),t.stateNode=e;e:{switch(i=xs(n,r),n){case"dialog":oe("cancel",e),oe("close",e),o=r;break;case"iframe":case"object":case"embed":oe("load",e),o=r;break;case"video":case"audio":for(o=0;o<vr.length;o++)oe(vr[o],e);o=r;break;case"source":oe("error",e),o=r;break;case"img":case"image":case"link":oe("error",e),oe("load",e),o=r;break;case"details":oe("toggle",e),o=r;break;case"input":vl(e,r),o=ps(e,r),oe("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=fe({},r,{value:void 0}),oe("invalid",e);break;case"textarea":xl(e,r),o=gs(e,r),oe("invalid",e);break;default:o=r}ys(n,o),l=o;for(a in l)if(l.hasOwnProperty(a)){var u=l[a];a==="style"?ic(e,u):a==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&ac(e,u)):a==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Ir(e,u):typeof u=="number"&&Ir(e,""+u):a!=="suppressContentEditableWarning"&&a!=="suppressHydrationWarning"&&a!=="autoFocus"&&(Tr.hasOwnProperty(a)?u!=null&&a==="onScroll"&&oe("scroll",e):u!=null&&mi(e,a,u,i))}switch(n){case"input":ro(e),yl(e,r,!1);break;case"textarea":ro(e),wl(e);break;case"option":r.value!=null&&e.setAttribute("value",""+on(r.value));break;case"select":e.multiple=!!r.multiple,a=r.value,a!=null?Bn(e,!!r.multiple,a,!1):r.defaultValue!=null&&Bn(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Ho)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Ie(t),null;case 6:if(e&&t.stateNode!=null)Id(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(L(166));if(n=gn(Dr.current),gn(Nt.current),po(t)){if(r=t.stateNode,n=t.memoizedProps,r[kt]=t,(a=r.nodeValue!==n)&&(e=Qe,e!==null))switch(e.tag){case 3:fo(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&fo(r.nodeValue,n,(e.mode&1)!==0)}a&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[kt]=t,t.stateNode=r}return Ie(t),null;case 13:if(ae(ce),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(se&&Ge!==null&&t.mode&1&&!(t.flags&128))Qc(),Qn(),t.flags|=98560,a=!1;else if(a=po(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(L(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(L(317));a[kt]=t}else Qn(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ie(t),a=!1}else pt!==null&&(Zs(pt),pt=null),a=!0;if(!a)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||ce.current&1?xe===0&&(xe=3):Ji())),t.updateQueue!==null&&(t.flags|=4),Ie(t),null);case 4:return Jn(),Vs(e,t),e===null&&Mr(t.stateNode.containerInfo),Ie(t),null;case 10:return zi(t.type._context),Ie(t),null;case 17:return Ue(t.type)&&Vo(),Ie(t),null;case 19:if(ae(ce),a=t.memoizedState,a===null)return Ie(t),null;if(r=(t.flags&128)!==0,i=a.rendering,i===null)if(r)dr(a,!1);else{if(xe!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(i=qo(e),i!==null){for(t.flags|=128,dr(a,!1),r=i.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)a=n,e=r,a.flags&=14680066,i=a.alternate,i===null?(a.childLanes=0,a.lanes=e,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,a.type=i.type,e=i.dependencies,a.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return re(ce,ce.current&1|2),t.child}e=e.sibling}a.tail!==null&&he()>qn&&(t.flags|=128,r=!0,dr(a,!1),t.lanes=4194304)}else{if(!r)if(e=qo(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dr(a,!0),a.tail===null&&a.tailMode==="hidden"&&!i.alternate&&!se)return Ie(t),null}else 2*he()-a.renderingStartTime>qn&&n!==1073741824&&(t.flags|=128,r=!0,dr(a,!1),t.lanes=4194304);a.isBackwards?(i.sibling=t.child,t.child=i):(n=a.last,n!==null?n.sibling=i:t.child=i,a.last=i)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=he(),t.sibling=null,n=ce.current,re(ce,r?n&1|2:n&1),t):(Ie(t),null);case 22:case 23:return Yi(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ke&1073741824&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),null;case 24:return null;case 25:return null}throw Error(L(156,t.tag))}function Om(e,t){switch(Ti(t),t.tag){case 1:return Ue(t.type)&&Vo(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Jn(),ae(De),ae(ze),Fi(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Mi(t),null;case 13:if(ae(ce),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(L(340));Qn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ae(ce),null;case 4:return Jn(),null;case 10:return zi(t.type._context),null;case 22:case 23:return Yi(),null;case 24:return null;default:return null}}var go=!1,_e=!1,Bm=typeof WeakSet=="function"?WeakSet:Set,U=null;function Fn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){me(e,t,r)}else n.current=null}function Ks(e,t,n){try{n()}catch(r){me(e,t,r)}}var uu=!1;function Dm(e,t){if(Ts=Do,e=$c(),bi(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var i=0,l=-1,u=-1,c=0,h=0,f=e,g=null;t:for(;;){for(var y;f!==n||o!==0&&f.nodeType!==3||(l=i+o),f!==a||r!==0&&f.nodeType!==3||(u=i+r),f.nodeType===3&&(i+=f.nodeValue.length),(y=f.firstChild)!==null;)g=f,f=y;for(;;){if(f===e)break t;if(g===n&&++c===o&&(l=i),g===a&&++h===r&&(u=i),(y=f.nextSibling)!==null)break;f=g,g=f.parentNode}f=y}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Is={focusedElem:e,selectionRange:n},Do=!1,U=t;U!==null;)if(t=U,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,U=e;else for(;U!==null;){t=U;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var w=x.memoizedProps,j=x.memoizedState,m=t.stateNode,p=m.getSnapshotBeforeUpdate(t.elementType===t.type?w:dt(t.type,w),j);m.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(L(163))}}catch(S){me(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,U=e;break}U=t.return}return x=uu,uu=!1,x}function Nr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var a=o.destroy;o.destroy=void 0,a!==void 0&&Ks(t,n,a)}o=o.next}while(o!==r)}}function xa(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Gs(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function _d(e){var t=e.alternate;t!==null&&(e.alternate=null,_d(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[kt],delete t[Or],delete t[zs],delete t[km],delete t[Cm])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Rd(e){return e.tag===5||e.tag===3||e.tag===4}function cu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rd(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Qs(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Ho));else if(r!==4&&(e=e.child,e!==null))for(Qs(e,t,n),e=e.sibling;e!==null;)Qs(e,t,n),e=e.sibling}function Ys(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ys(e,t,n),e=e.sibling;e!==null;)Ys(e,t,n),e=e.sibling}var Ne=null,ft=!1;function Ut(e,t,n){for(n=n.child;n!==null;)zd(e,t,n),n=n.sibling}function zd(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(da,n)}catch{}switch(n.tag){case 5:_e||Fn(n,t);case 6:var r=Ne,o=ft;Ne=null,Ut(e,t,n),Ne=r,ft=o,Ne!==null&&(ft?(e=Ne,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ne.removeChild(n.stateNode));break;case 18:Ne!==null&&(ft?(e=Ne,n=n.stateNode,e.nodeType===8?Ka(e.parentNode,n):e.nodeType===1&&Ka(e,n),Ar(e)):Ka(Ne,n.stateNode));break;case 4:r=Ne,o=ft,Ne=n.stateNode.containerInfo,ft=!0,Ut(e,t,n),Ne=r,ft=o;break;case 0:case 11:case 14:case 15:if(!_e&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var a=o,i=a.destroy;a=a.tag,i!==void 0&&(a&2||a&4)&&Ks(n,t,i),o=o.next}while(o!==r)}Ut(e,t,n);break;case 1:if(!_e&&(Fn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){me(n,t,l)}Ut(e,t,n);break;case 21:Ut(e,t,n);break;case 22:n.mode&1?(_e=(r=_e)||n.memoizedState!==null,Ut(e,t,n),_e=r):Ut(e,t,n);break;default:Ut(e,t,n)}}function du(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Bm),t.forEach(function(r){var o=Jm.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function ct(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var a=e,i=t,l=i;e:for(;l!==null;){switch(l.tag){case 5:Ne=l.stateNode,ft=!1;break e;case 3:Ne=l.stateNode.containerInfo,ft=!0;break e;case 4:Ne=l.stateNode.containerInfo,ft=!0;break e}l=l.return}if(Ne===null)throw Error(L(160));zd(a,i,o),Ne=null,ft=!1;var u=o.alternate;u!==null&&(u.return=null),o.return=null}catch(c){me(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Ad(t,e),t=t.sibling}function Ad(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ct(t,e),wt(e),r&4){try{Nr(3,e,e.return),xa(3,e)}catch(w){me(e,e.return,w)}try{Nr(5,e,e.return)}catch(w){me(e,e.return,w)}}break;case 1:ct(t,e),wt(e),r&512&&n!==null&&Fn(n,n.return);break;case 5:if(ct(t,e),wt(e),r&512&&n!==null&&Fn(n,n.return),e.flags&32){var o=e.stateNode;try{Ir(o,"")}catch(w){me(e,e.return,w)}}if(r&4&&(o=e.stateNode,o!=null)){var a=e.memoizedProps,i=n!==null?n.memoizedProps:a,l=e.type,u=e.updateQueue;if(e.updateQueue=null,u!==null)try{l==="input"&&a.type==="radio"&&a.name!=null&&nc(o,a),xs(l,i);var c=xs(l,a);for(i=0;i<u.length;i+=2){var h=u[i],f=u[i+1];h==="style"?ic(o,f):h==="dangerouslySetInnerHTML"?ac(o,f):h==="children"?Ir(o,f):mi(o,h,f,c)}switch(l){case"input":ms(o,a);break;case"textarea":rc(o,a);break;case"select":var g=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!a.multiple;var y=a.value;y!=null?Bn(o,!!a.multiple,y,!1):g!==!!a.multiple&&(a.defaultValue!=null?Bn(o,!!a.multiple,a.defaultValue,!0):Bn(o,!!a.multiple,a.multiple?[]:"",!1))}o[Or]=a}catch(w){me(e,e.return,w)}}break;case 6:if(ct(t,e),wt(e),r&4){if(e.stateNode===null)throw Error(L(162));o=e.stateNode,a=e.memoizedProps;try{o.nodeValue=a}catch(w){me(e,e.return,w)}}break;case 3:if(ct(t,e),wt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ar(t.containerInfo)}catch(w){me(e,e.return,w)}break;case 4:ct(t,e),wt(e);break;case 13:ct(t,e),wt(e),o=e.child,o.flags&8192&&(a=o.memoizedState!==null,o.stateNode.isHidden=a,!a||o.alternate!==null&&o.alternate.memoizedState!==null||(Gi=he())),r&4&&du(e);break;case 22:if(h=n!==null&&n.memoizedState!==null,e.mode&1?(_e=(c=_e)||h,ct(t,e),_e=c):ct(t,e),wt(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!h&&e.mode&1)for(U=e,h=e.child;h!==null;){for(f=U=h;U!==null;){switch(g=U,y=g.child,g.tag){case 0:case 11:case 14:case 15:Nr(4,g,g.return);break;case 1:Fn(g,g.return);var x=g.stateNode;if(typeof x.componentWillUnmount=="function"){r=g,n=g.return;try{t=r,x.props=t.memoizedProps,x.state=t.memoizedState,x.componentWillUnmount()}catch(w){me(r,n,w)}}break;case 5:Fn(g,g.return);break;case 22:if(g.memoizedState!==null){pu(f);continue}}y!==null?(y.return=g,U=y):pu(f)}h=h.sibling}e:for(h=null,f=e;;){if(f.tag===5){if(h===null){h=f;try{o=f.stateNode,c?(a=o.style,typeof a.setProperty=="function"?a.setProperty("display","none","important"):a.display="none"):(l=f.stateNode,u=f.memoizedProps.style,i=u!=null&&u.hasOwnProperty("display")?u.display:null,l.style.display=sc("display",i))}catch(w){me(e,e.return,w)}}}else if(f.tag===6){if(h===null)try{f.stateNode.nodeValue=c?"":f.memoizedProps}catch(w){me(e,e.return,w)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;h===f&&(h=null),f=f.return}h===f&&(h=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:ct(t,e),wt(e),r&4&&du(e);break;case 21:break;default:ct(t,e),wt(e)}}function wt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(Rd(n)){var r=n;break e}n=n.return}throw Error(L(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Ir(o,""),r.flags&=-33);var a=cu(e);Ys(e,a,o);break;case 3:case 4:var i=r.stateNode.containerInfo,l=cu(e);Qs(e,l,i);break;default:throw Error(L(161))}}catch(u){me(e,e.return,u)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Um(e,t,n){U=e,$d(e)}function $d(e,t,n){for(var r=(e.mode&1)!==0;U!==null;){var o=U,a=o.child;if(o.tag===22&&r){var i=o.memoizedState!==null||go;if(!i){var l=o.alternate,u=l!==null&&l.memoizedState!==null||_e;l=go;var c=_e;if(go=i,(_e=u)&&!c)for(U=o;U!==null;)i=U,u=i.child,i.tag===22&&i.memoizedState!==null?mu(o):u!==null?(u.return=i,U=u):mu(o);for(;a!==null;)U=a,$d(a),a=a.sibling;U=o,go=l,_e=c}fu(e)}else o.subtreeFlags&8772&&a!==null?(a.return=o,U=a):fu(e)}}function fu(e){for(;U!==null;){var t=U;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:_e||xa(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!_e)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:dt(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var a=t.updateQueue;a!==null&&Jl(t,a,r);break;case 3:var i=t.updateQueue;if(i!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}Jl(t,i,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var h=c.memoizedState;if(h!==null){var f=h.dehydrated;f!==null&&Ar(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(L(163))}_e||t.flags&512&&Gs(t)}catch(g){me(t,t.return,g)}}if(t===e){U=null;break}if(n=t.sibling,n!==null){n.return=t.return,U=n;break}U=t.return}}function pu(e){for(;U!==null;){var t=U;if(t===e){U=null;break}var n=t.sibling;if(n!==null){n.return=t.return,U=n;break}U=t.return}}function mu(e){for(;U!==null;){var t=U;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{xa(4,t)}catch(u){me(t,n,u)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(u){me(t,o,u)}}var a=t.return;try{Gs(t)}catch(u){me(t,a,u)}break;case 5:var i=t.return;try{Gs(t)}catch(u){me(t,i,u)}}}catch(u){me(t,t.return,u)}if(t===e){U=null;break}var l=t.sibling;if(l!==null){l.return=t.return,U=l;break}U=t.return}}var Wm=Math.ceil,ta=Bt.ReactCurrentDispatcher,Vi=Bt.ReactCurrentOwner,ot=Bt.ReactCurrentBatchConfig,Z=0,je=null,ge=null,Ee=0,Ke=0,On=ln(0),xe=0,Vr=null,kn=0,wa=0,Ki=0,Er=null,Oe=null,Gi=0,qn=1/0,Tt=null,na=!1,Js=null,tn=null,vo=!1,Yt=null,ra=0,br=0,Xs=null,_o=-1,Ro=0;function Le(){return Z&6?he():_o!==-1?_o:_o=he()}function nn(e){return e.mode&1?Z&2&&Ee!==0?Ee&-Ee:Em.transition!==null?(Ro===0&&(Ro=xc()),Ro):(e=te,e!==0||(e=window.event,e=e===void 0?16:Ec(e.type)),e):1}function ht(e,t,n,r){if(50<br)throw br=0,Xs=null,Error(L(185));Qr(e,n,r),(!(Z&2)||e!==je)&&(e===je&&(!(Z&2)&&(wa|=n),xe===4&&Gt(e,Ee)),We(e,r),n===1&&Z===0&&!(t.mode&1)&&(qn=he()+500,ga&&un()))}function We(e,t){var n=e.callbackNode;Ep(e,t);var r=Bo(e,e===je?Ee:0);if(r===0)n!==null&&kl(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&kl(n),t===1)e.tag===0?Nm(hu.bind(null,e)):Vc(hu.bind(null,e)),Sm(function(){!(Z&6)&&un()}),n=null;else{switch(wc(r)){case 1:n=xi;break;case 4:n=vc;break;case 16:n=Oo;break;case 536870912:n=yc;break;default:n=Oo}n=Wd(n,Ld.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Ld(e,t){if(_o=-1,Ro=0,Z&6)throw Error(L(327));var n=e.callbackNode;if(Vn()&&e.callbackNode!==n)return null;var r=Bo(e,e===je?Ee:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=oa(e,r);else{t=r;var o=Z;Z|=2;var a=Fd();(je!==e||Ee!==t)&&(Tt=null,qn=he()+500,yn(e,t));do try{Km();break}catch(l){Md(e,l)}while(!0);Ri(),ta.current=a,Z=o,ge!==null?t=0:(je=null,Ee=0,t=xe)}if(t!==0){if(t===2&&(o=Cs(e),o!==0&&(r=o,t=qs(e,o))),t===1)throw n=Vr,yn(e,0),Gt(e,r),We(e,he()),n;if(t===6)Gt(e,r);else{if(o=e.current.alternate,!(r&30)&&!Hm(o)&&(t=oa(e,r),t===2&&(a=Cs(e),a!==0&&(r=a,t=qs(e,a))),t===1))throw n=Vr,yn(e,0),Gt(e,r),We(e,he()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(L(345));case 2:fn(e,Oe,Tt);break;case 3:if(Gt(e,r),(r&130023424)===r&&(t=Gi+500-he(),10<t)){if(Bo(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Le(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Rs(fn.bind(null,e,Oe,Tt),t);break}fn(e,Oe,Tt);break;case 4:if(Gt(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var i=31-mt(r);a=1<<i,i=t[i],i>o&&(o=i),r&=~a}if(r=o,r=he()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Wm(r/1960))-r,10<r){e.timeoutHandle=Rs(fn.bind(null,e,Oe,Tt),r);break}fn(e,Oe,Tt);break;case 5:fn(e,Oe,Tt);break;default:throw Error(L(329))}}}return We(e,he()),e.callbackNode===n?Ld.bind(null,e):null}function qs(e,t){var n=Er;return e.current.memoizedState.isDehydrated&&(yn(e,t).flags|=256),e=oa(e,t),e!==2&&(t=Oe,Oe=n,t!==null&&Zs(t)),e}function Zs(e){Oe===null?Oe=e:Oe.push.apply(Oe,e)}function Hm(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],a=o.getSnapshot;o=o.value;try{if(!gt(a(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Gt(e,t){for(t&=~Ki,t&=~wa,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-mt(t),r=1<<n;e[n]=-1,t&=~r}}function hu(e){if(Z&6)throw Error(L(327));Vn();var t=Bo(e,0);if(!(t&1))return We(e,he()),null;var n=oa(e,t);if(e.tag!==0&&n===2){var r=Cs(e);r!==0&&(t=r,n=qs(e,r))}if(n===1)throw n=Vr,yn(e,0),Gt(e,t),We(e,he()),n;if(n===6)throw Error(L(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,fn(e,Oe,Tt),We(e,he()),null}function Qi(e,t){var n=Z;Z|=1;try{return e(t)}finally{Z=n,Z===0&&(qn=he()+500,ga&&un())}}function Cn(e){Yt!==null&&Yt.tag===0&&!(Z&6)&&Vn();var t=Z;Z|=1;var n=ot.transition,r=te;try{if(ot.transition=null,te=1,e)return e()}finally{te=r,ot.transition=n,Z=t,!(Z&6)&&un()}}function Yi(){Ke=On.current,ae(On)}function yn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,wm(n)),ge!==null)for(n=ge.return;n!==null;){var r=n;switch(Ti(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Vo();break;case 3:Jn(),ae(De),ae(ze),Fi();break;case 5:Mi(r);break;case 4:Jn();break;case 13:ae(ce);break;case 19:ae(ce);break;case 10:zi(r.type._context);break;case 22:case 23:Yi()}n=n.return}if(je=e,ge=e=rn(e.current,null),Ee=Ke=t,xe=0,Vr=null,Ki=wa=kn=0,Oe=Er=null,hn!==null){for(t=0;t<hn.length;t++)if(n=hn[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,a=n.pending;if(a!==null){var i=a.next;a.next=o,r.next=i}n.pending=r}hn=null}return e}function Md(e,t){do{var n=ge;try{if(Ri(),Po.current=ea,Zo){for(var r=de.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Zo=!1}if(jn=0,Se=ye=de=null,Cr=!1,Ur=0,Vi.current=null,n===null||n.return===null){xe=1,Vr=t,ge=null;break}e:{var a=e,i=n.return,l=n,u=t;if(t=Ee,l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var c=u,h=l,f=h.tag;if(!(h.mode&1)&&(f===0||f===11||f===15)){var g=h.alternate;g?(h.updateQueue=g.updateQueue,h.memoizedState=g.memoizedState,h.lanes=g.lanes):(h.updateQueue=null,h.memoizedState=null)}var y=nu(i);if(y!==null){y.flags&=-257,ru(y,i,l,a,t),y.mode&1&&tu(a,c,t),t=y,u=c;var x=t.updateQueue;if(x===null){var w=new Set;w.add(u),t.updateQueue=w}else x.add(u);break e}else{if(!(t&1)){tu(a,c,t),Ji();break e}u=Error(L(426))}}else if(se&&l.mode&1){var j=nu(i);if(j!==null){!(j.flags&65536)&&(j.flags|=256),ru(j,i,l,a,t),Ii(Xn(u,l));break e}}a=u=Xn(u,l),xe!==4&&(xe=2),Er===null?Er=[a]:Er.push(a),a=i;do{switch(a.tag){case 3:a.flags|=65536,t&=-t,a.lanes|=t;var m=wd(a,u,t);Yl(a,m);break e;case 1:l=u;var p=a.type,v=a.stateNode;if(!(a.flags&128)&&(typeof p.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(tn===null||!tn.has(v)))){a.flags|=65536,t&=-t,a.lanes|=t;var S=Sd(a,l,t);Yl(a,S);break e}}a=a.return}while(a!==null)}Bd(n)}catch(b){t=b,ge===n&&n!==null&&(ge=n=n.return);continue}break}while(!0)}function Fd(){var e=ta.current;return ta.current=ea,e===null?ea:e}function Ji(){(xe===0||xe===3||xe===2)&&(xe=4),je===null||!(kn&268435455)&&!(wa&268435455)||Gt(je,Ee)}function oa(e,t){var n=Z;Z|=2;var r=Fd();(je!==e||Ee!==t)&&(Tt=null,yn(e,t));do try{Vm();break}catch(o){Md(e,o)}while(!0);if(Ri(),Z=n,ta.current=r,ge!==null)throw Error(L(261));return je=null,Ee=0,xe}function Vm(){for(;ge!==null;)Od(ge)}function Km(){for(;ge!==null&&!vp();)Od(ge)}function Od(e){var t=Ud(e.alternate,e,Ke);e.memoizedProps=e.pendingProps,t===null?Bd(e):ge=t,Vi.current=null}function Bd(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=Om(n,t),n!==null){n.flags&=32767,ge=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{xe=6,ge=null;return}}else if(n=Fm(n,t,Ke),n!==null){ge=n;return}if(t=t.sibling,t!==null){ge=t;return}ge=t=e}while(t!==null);xe===0&&(xe=5)}function fn(e,t,n){var r=te,o=ot.transition;try{ot.transition=null,te=1,Gm(e,t,n,r)}finally{ot.transition=o,te=r}return null}function Gm(e,t,n,r){do Vn();while(Yt!==null);if(Z&6)throw Error(L(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(L(177));e.callbackNode=null,e.callbackPriority=0;var a=n.lanes|n.childLanes;if(bp(e,a),e===je&&(ge=je=null,Ee=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||vo||(vo=!0,Wd(Oo,function(){return Vn(),null})),a=(n.flags&15990)!==0,n.subtreeFlags&15990||a){a=ot.transition,ot.transition=null;var i=te;te=1;var l=Z;Z|=4,Vi.current=null,Dm(e,n),Ad(n,e),pm(Is),Do=!!Ts,Is=Ts=null,e.current=n,Um(n),yp(),Z=l,te=i,ot.transition=a}else e.current=n;if(vo&&(vo=!1,Yt=e,ra=o),a=e.pendingLanes,a===0&&(tn=null),Sp(n.stateNode),We(e,he()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(na)throw na=!1,e=Js,Js=null,e;return ra&1&&e.tag!==0&&Vn(),a=e.pendingLanes,a&1?e===Xs?br++:(br=0,Xs=e):br=0,un(),null}function Vn(){if(Yt!==null){var e=wc(ra),t=ot.transition,n=te;try{if(ot.transition=null,te=16>e?16:e,Yt===null)var r=!1;else{if(e=Yt,Yt=null,ra=0,Z&6)throw Error(L(331));var o=Z;for(Z|=4,U=e.current;U!==null;){var a=U,i=a.child;if(U.flags&16){var l=a.deletions;if(l!==null){for(var u=0;u<l.length;u++){var c=l[u];for(U=c;U!==null;){var h=U;switch(h.tag){case 0:case 11:case 15:Nr(8,h,a)}var f=h.child;if(f!==null)f.return=h,U=f;else for(;U!==null;){h=U;var g=h.sibling,y=h.return;if(_d(h),h===c){U=null;break}if(g!==null){g.return=y,U=g;break}U=y}}}var x=a.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)}}U=a}}if(a.subtreeFlags&2064&&i!==null)i.return=a,U=i;else e:for(;U!==null;){if(a=U,a.flags&2048)switch(a.tag){case 0:case 11:case 15:Nr(9,a,a.return)}var m=a.sibling;if(m!==null){m.return=a.return,U=m;break e}U=a.return}}var p=e.current;for(U=p;U!==null;){i=U;var v=i.child;if(i.subtreeFlags&2064&&v!==null)v.return=i,U=v;else e:for(i=p;U!==null;){if(l=U,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:xa(9,l)}}catch(b){me(l,l.return,b)}if(l===i){U=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,U=S;break e}U=l.return}}if(Z=o,un(),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(da,e)}catch{}r=!0}return r}finally{te=n,ot.transition=t}}return!1}function gu(e,t,n){t=Xn(n,t),t=wd(e,t,1),e=en(e,t,1),t=Le(),e!==null&&(Qr(e,1,t),We(e,t))}function me(e,t,n){if(e.tag===3)gu(e,e,n);else for(;t!==null;){if(t.tag===3){gu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(tn===null||!tn.has(r))){e=Xn(n,e),e=Sd(t,e,1),t=en(t,e,1),e=Le(),t!==null&&(Qr(t,1,e),We(t,e));break}}t=t.return}}function Qm(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Le(),e.pingedLanes|=e.suspendedLanes&n,je===e&&(Ee&n)===n&&(xe===4||xe===3&&(Ee&130023424)===Ee&&500>he()-Gi?yn(e,0):Ki|=n),We(e,t)}function Dd(e,t){t===0&&(e.mode&1?(t=so,so<<=1,!(so&130023424)&&(so=4194304)):t=1);var n=Le();e=Mt(e,t),e!==null&&(Qr(e,t,n),We(e,n))}function Ym(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Dd(e,n)}function Jm(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(L(314))}r!==null&&r.delete(t),Dd(e,n)}var Ud;Ud=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||De.current)Be=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Be=!1,Mm(e,t,n);Be=!!(e.flags&131072)}else Be=!1,se&&t.flags&1048576&&Kc(t,Qo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Io(e,t),e=t.pendingProps;var o=Gn(t,ze.current);Hn(t,n),o=Bi(null,t,r,e,o,n);var a=Di();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ue(r)?(a=!0,Ko(t)):a=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,$i(t),o.updater=ya,t.stateNode=o,o._reactInternals=t,Os(t,r,e,n),t=Us(null,t,r,!0,a,n)):(t.tag=0,se&&a&&Pi(t),$e(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Io(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=qm(r),e=dt(r,e),o){case 0:t=Ds(null,t,r,e,n);break e;case 1:t=su(null,t,r,e,n);break e;case 11:t=ou(null,t,r,e,n);break e;case 14:t=au(null,t,r,dt(r.type,e),n);break e}throw Error(L(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:dt(r,o),Ds(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:dt(r,o),su(e,t,r,o,n);case 3:e:{if(Nd(t),e===null)throw Error(L(387));r=t.pendingProps,a=t.memoizedState,o=a.element,qc(e,t),Xo(t,r,null,n);var i=t.memoizedState;if(r=i.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){o=Xn(Error(L(423)),t),t=iu(e,t,r,n,o);break e}else if(r!==o){o=Xn(Error(L(424)),t),t=iu(e,t,r,n,o);break e}else for(Ge=Zt(t.stateNode.containerInfo.firstChild),Qe=t,se=!0,pt=null,n=Jc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Qn(),r===o){t=Ft(e,t,n);break e}$e(e,t,r,n)}t=t.child}return t;case 5:return Zc(t),e===null&&Ls(t),r=t.type,o=t.pendingProps,a=e!==null?e.memoizedProps:null,i=o.children,_s(r,o)?i=null:a!==null&&_s(r,a)&&(t.flags|=32),Cd(e,t),$e(e,t,i,n),t.child;case 6:return e===null&&Ls(t),null;case 13:return Ed(e,t,n);case 4:return Li(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Yn(t,null,r,n):$e(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:dt(r,o),ou(e,t,r,o,n);case 7:return $e(e,t,t.pendingProps,n),t.child;case 8:return $e(e,t,t.pendingProps.children,n),t.child;case 12:return $e(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,a=t.memoizedProps,i=o.value,re(Yo,r._currentValue),r._currentValue=i,a!==null)if(gt(a.value,i)){if(a.children===o.children&&!De.current){t=Ft(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){i=a.child;for(var u=l.firstContext;u!==null;){if(u.context===r){if(a.tag===1){u=At(-1,n&-n),u.tag=2;var c=a.updateQueue;if(c!==null){c=c.shared;var h=c.pending;h===null?u.next=u:(u.next=h.next,h.next=u),c.pending=u}}a.lanes|=n,u=a.alternate,u!==null&&(u.lanes|=n),Ms(a.return,n,t),l.lanes|=n;break}u=u.next}}else if(a.tag===10)i=a.type===t.type?null:a.child;else if(a.tag===18){if(i=a.return,i===null)throw Error(L(341));i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Ms(i,n,t),i=a.sibling}else i=a.child;if(i!==null)i.return=a;else for(i=a;i!==null;){if(i===t){i=null;break}if(a=i.sibling,a!==null){a.return=i.return,i=a;break}i=i.return}a=i}$e(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Hn(t,n),o=at(o),r=r(o),t.flags|=1,$e(e,t,r,n),t.child;case 14:return r=t.type,o=dt(r,t.pendingProps),o=dt(r.type,o),au(e,t,r,o,n);case 15:return jd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:dt(r,o),Io(e,t),t.tag=1,Ue(r)?(e=!0,Ko(t)):e=!1,Hn(t,n),xd(t,r,o),Os(t,r,o,n),Us(null,t,r,!0,e,n);case 19:return bd(e,t,n);case 22:return kd(e,t,n)}throw Error(L(156,t.tag))};function Wd(e,t){return gc(e,t)}function Xm(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rt(e,t,n,r){return new Xm(e,t,n,r)}function Xi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qm(e){if(typeof e=="function")return Xi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===gi)return 11;if(e===vi)return 14}return 2}function rn(e,t){var n=e.alternate;return n===null?(n=rt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function zo(e,t,n,r,o,a){var i=2;if(r=e,typeof e=="function")Xi(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case Tn:return xn(n.children,o,a,t);case hi:i=8,o|=8;break;case us:return e=rt(12,n,t,o|2),e.elementType=us,e.lanes=a,e;case cs:return e=rt(13,n,t,o),e.elementType=cs,e.lanes=a,e;case ds:return e=rt(19,n,t,o),e.elementType=ds,e.lanes=a,e;case Zu:return Sa(n,o,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Xu:i=10;break e;case qu:i=9;break e;case gi:i=11;break e;case vi:i=14;break e;case Wt:i=16,r=null;break e}throw Error(L(130,e==null?e:typeof e,""))}return t=rt(i,n,t,o),t.elementType=e,t.type=r,t.lanes=a,t}function xn(e,t,n,r){return e=rt(7,e,r,t),e.lanes=n,e}function Sa(e,t,n,r){return e=rt(22,e,r,t),e.elementType=Zu,e.lanes=n,e.stateNode={isHidden:!1},e}function es(e,t,n){return e=rt(6,e,null,t),e.lanes=n,e}function ts(e,t,n){return t=rt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Zm(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=$a(0),this.expirationTimes=$a(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$a(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function qi(e,t,n,r,o,a,i,l,u){return e=new Zm(e,t,n,l,u),t===1?(t=1,a===!0&&(t|=8)):t=0,a=rt(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},$i(a),e}function eh(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Pn,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function Hd(e){if(!e)return an;e=e._reactInternals;e:{if(En(e)!==e||e.tag!==1)throw Error(L(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ue(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(L(171))}if(e.tag===1){var n=e.type;if(Ue(n))return Hc(e,n,t)}return t}function Vd(e,t,n,r,o,a,i,l,u){return e=qi(n,r,!0,e,o,a,i,l,u),e.context=Hd(null),n=e.current,r=Le(),o=nn(n),a=At(r,o),a.callback=t??null,en(n,a,o),e.current.lanes=o,Qr(e,o,r),We(e,r),e}function ja(e,t,n,r){var o=t.current,a=Le(),i=nn(o);return n=Hd(n),t.context===null?t.context=n:t.pendingContext=n,t=At(a,i),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=en(o,t,i),e!==null&&(ht(e,o,i,a),bo(e,o,i)),i}function aa(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 vu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Zi(e,t){vu(e,t),(e=e.alternate)&&vu(e,t)}function th(){return null}var Kd=typeof reportError=="function"?reportError:function(e){console.error(e)};function el(e){this._internalRoot=e}ka.prototype.render=el.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(L(409));ja(e,t,null,null)};ka.prototype.unmount=el.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Cn(function(){ja(null,e,null,null)}),t[Lt]=null}};function ka(e){this._internalRoot=e}ka.prototype.unstable_scheduleHydration=function(e){if(e){var t=kc();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Kt.length&&t!==0&&t<Kt[n].priority;n++);Kt.splice(n,0,e),n===0&&Nc(e)}};function tl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ca(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function yu(){}function nh(e,t,n,r,o){if(o){if(typeof r=="function"){var a=r;r=function(){var c=aa(i);a.call(c)}}var i=Vd(t,r,e,0,null,!1,!1,"",yu);return e._reactRootContainer=i,e[Lt]=i.current,Mr(e.nodeType===8?e.parentNode:e),Cn(),i}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var l=r;r=function(){var c=aa(u);l.call(c)}}var u=qi(e,0,!1,null,null,!1,!1,"",yu);return e._reactRootContainer=u,e[Lt]=u.current,Mr(e.nodeType===8?e.parentNode:e),Cn(function(){ja(t,u,n,r)}),u}function Na(e,t,n,r,o){var a=n._reactRootContainer;if(a){var i=a;if(typeof o=="function"){var l=o;o=function(){var u=aa(i);l.call(u)}}ja(t,i,e,o)}else i=nh(n,t,e,o,r);return aa(i)}Sc=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=gr(t.pendingLanes);n!==0&&(wi(t,n|1),We(t,he()),!(Z&6)&&(qn=he()+500,un()))}break;case 13:Cn(function(){var r=Mt(e,1);if(r!==null){var o=Le();ht(r,e,1,o)}}),Zi(e,1)}};Si=function(e){if(e.tag===13){var t=Mt(e,134217728);if(t!==null){var n=Le();ht(t,e,134217728,n)}Zi(e,134217728)}};jc=function(e){if(e.tag===13){var t=nn(e),n=Mt(e,t);if(n!==null){var r=Le();ht(n,e,t,r)}Zi(e,t)}};kc=function(){return te};Cc=function(e,t){var n=te;try{return te=e,t()}finally{te=n}};Ss=function(e,t,n){switch(t){case"input":if(ms(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=ha(r);if(!o)throw Error(L(90));tc(r),ms(r,o)}}}break;case"textarea":rc(e,n);break;case"select":t=n.value,t!=null&&Bn(e,!!n.multiple,t,!1)}};cc=Qi;dc=Cn;var rh={usingClientEntryPoint:!1,Events:[Jr,zn,ha,lc,uc,Qi]},fr={findFiberByHostInstance:mn,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},oh={bundleType:fr.bundleType,version:fr.version,rendererPackageName:fr.rendererPackageName,rendererConfig:fr.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Bt.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=mc(e),e===null?null:e.stateNode},findFiberByHostInstance:fr.findFiberByHostInstance||th,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 yo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yo.isDisabled&&yo.supportsFiber)try{da=yo.inject(oh),Ct=yo}catch{}}Je.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rh;Je.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!tl(t))throw Error(L(200));return eh(e,t,null,n)};Je.createRoot=function(e,t){if(!tl(e))throw Error(L(299));var n=!1,r="",o=Kd;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=qi(e,1,!1,null,null,n,!1,r,o),e[Lt]=t.current,Mr(e.nodeType===8?e.parentNode:e),new el(t)};Je.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(L(188)):(e=Object.keys(e).join(","),Error(L(268,e)));return e=mc(t),e=e===null?null:e.stateNode,e};Je.flushSync=function(e){return Cn(e)};Je.hydrate=function(e,t,n){if(!Ca(t))throw Error(L(200));return Na(null,e,t,!0,n)};Je.hydrateRoot=function(e,t,n){if(!tl(e))throw Error(L(405));var r=n!=null&&n.hydratedSources||null,o=!1,a="",i=Kd;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(a=n.identifierPrefix),n.onRecoverableError!==void 0&&(i=n.onRecoverableError)),t=Vd(t,null,e,1,n??null,o,!1,a,i),e[Lt]=t.current,Mr(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new ka(t)};Je.render=function(e,t,n){if(!Ca(t))throw Error(L(200));return Na(null,e,t,!1,n)};Je.unmountComponentAtNode=function(e){if(!Ca(e))throw Error(L(40));return e._reactRootContainer?(Cn(function(){Na(null,null,e,!1,function(){e._reactRootContainer=null,e[Lt]=null})}),!0):!1};Je.unstable_batchedUpdates=Qi;Je.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ca(n))throw Error(L(200));if(e==null||e._reactInternals===void 0)throw Error(L(38));return Na(e,t,n,!1,r)};Je.version="18.3.1-next-f1338f8080-20240426";function Gd(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Gd)}catch(e){console.error(e)}}Gd(),Gu.exports=Je;var Qd=Gu.exports,Yd,xu=Qd;Yd=xu.createRoot,xu.hydrateRoot;/**
41
41
  * react-router v7.13.1
42
42
  *
43
43
  * Copyright (c) Remix Software Inc.
@@ -46,29 +46,30 @@ Error generating stack: `+a.message+`
46
46
  * LICENSE.md file in the root directory of this source tree.
47
47
  *
48
48
  * @license MIT
49
- */var gu="popstate";function vu(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function rh(e={}){function t(r,o){var c;let a=(c=o.state)==null?void 0:c.masked,{pathname:i,search:l,hash:u}=a||r.location;return Zs("",{pathname:i,search:l,hash:u},o.state&&o.state.usr||null,o.state&&o.state.key||"default",a?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,o){return typeof o=="string"?o:Vr(o)}return ah(t,n,null,e)}function ie(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function it(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function oh(){return Math.random().toString(36).substring(2,10)}function yu(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 Zs(e,t,n=null,r,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?nr(t):t,state:n,key:t&&t.key||r||oh(),unstable_mask:o}}function Vr({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function nr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ah(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:a=!1}=r,i=o.history,l="POP",u=null,c=h();c==null&&(c=0,i.replaceState({...i.state,idx:c},""));function h(){return(i.state||{idx:null}).idx}function p(){l="POP";let j=h(),m=j==null?null:j-c;c=j,u&&u({action:l,location:w.location,delta:m})}function g(j,m){l="PUSH";let f=vu(j)?j:Zs(w.location,j,m);c=h()+1;let v=yu(f,c),S=w.createHref(f.unstable_mask||f);try{i.pushState(v,"",S)}catch(b){if(b instanceof DOMException&&b.name==="DataCloneError")throw b;o.location.assign(S)}a&&u&&u({action:l,location:w.location,delta:1})}function y(j,m){l="REPLACE";let f=vu(j)?j:Zs(w.location,j,m);c=h();let v=yu(f,c),S=w.createHref(f.unstable_mask||f);i.replaceState(v,"",S),a&&u&&u({action:l,location:w.location,delta:0})}function x(j){return sh(j)}let w={get action(){return l},get location(){return e(o,i)},listen(j){if(u)throw new Error("A history only accepts one active listener");return o.addEventListener(gu,p),u=j,()=>{o.removeEventListener(gu,p),u=null}},createHref(j){return t(o,j)},createURL:x,encodeLocation(j){let m=x(j);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:g,replace:y,go(j){return i.go(j)}};return w}function sh(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ie(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Vr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Qd(e,t,n="/"){return ih(e,t,n,!1)}function ih(e,t,n,r){let o=typeof t=="string"?nr(t):t,a=Bt(o.pathname||"/",n);if(a==null)return null;let i=Yd(e);lh(i);let l=null;for(let u=0;l==null&&u<i.length;++u){let c=xh(a);l=vh(i[u],c,r)}return l}function Yd(e,t=[],n=[],r="",o=!1){let a=(i,l,u=o,c)=>{let h={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&u)return;ie(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let p=Et([r,h.relativePath]),g=n.concat(h);i.children&&i.children.length>0&&(ie(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),Yd(i.children,t,g,p,u)),!(i.path==null&&!i.index)&&t.push({path:p,score:hh(p,i.index),routesMeta:g})};return e.forEach((i,l)=>{var u;if(i.path===""||!((u=i.path)!=null&&u.includes("?")))a(i,l);else for(let c of Jd(i.path))a(i,l,!0,c)}),t}function Jd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return o?[a,""]:[a];let i=Jd(r.join("/")),l=[];return l.push(...i.map(u=>u===""?a:[a,u].join("/"))),o&&l.push(...i),l.map(u=>e.startsWith("/")&&u===""?"/":u)}function lh(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:gh(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var uh=/^:[\w-]+$/,ch=3,dh=2,fh=1,ph=10,mh=-2,xu=e=>e==="*";function hh(e,t){let n=e.split("/"),r=n.length;return n.some(xu)&&(r+=mh),t&&(r+=dh),n.filter(o=>!xu(o)).reduce((o,a)=>o+(uh.test(a)?ch:a===""?fh:ph),r)}function gh(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function vh(e,t,n=!1){let{routesMeta:r}=e,o={},a="/",i=[];for(let l=0;l<r.length;++l){let u=r[l],c=l===r.length-1,h=a==="/"?t:t.slice(a.length)||"/",p=aa({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},h),g=u.route;if(!p&&c&&n&&!r[r.length-1].route.index&&(p=aa({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},h)),!p)return null;Object.assign(o,p.params),i.push({params:o,pathname:Et([a,p.pathname]),pathnameBase:kh(Et([a,p.pathnameBase])),route:g}),p.pathnameBase!=="/"&&(a=Et([a,p.pathnameBase]))}return i}function aa(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=yh(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let a=o[0],i=a.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce((c,{paramName:h,isOptional:p},g)=>{if(h==="*"){let x=l[g]||"";i=a.slice(0,a.length-x.length).replace(/(.)\/+$/,"$1")}const y=l[g];return p&&!y?c[h]=void 0:c[h]=(y||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:i,pattern:e}}function yh(e,t=!1,n=!0){it(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,u,c,h)=>{if(r.push({paramName:l,isOptional:u!=null}),u){let p=h.charAt(c+i.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function xh(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return it(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Bt(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 wh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Sh(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?nr(e):e,a;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?a=wu(n.substring(1),"/"):a=wu(n,t)):a=t,{pathname:a,search:Ch(r),hash:Nh(o)}}function wu(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function ts(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 jh(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function qi(e){let t=jh(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Na(e,t,n,r=!1){let o;typeof e=="string"?o=nr(e):(o={...e},ie(!o.pathname||!o.pathname.includes("?"),ts("?","pathname","search",o)),ie(!o.pathname||!o.pathname.includes("#"),ts("#","pathname","hash",o)),ie(!o.search||!o.search.includes("#"),ts("#","search","hash",o)));let a=e===""||o.pathname==="",i=a?"/":o.pathname,l;if(i==null)l=n;else{let p=t.length-1;if(!r&&i.startsWith("..")){let g=i.split("/");for(;g[0]==="..";)g.shift(),p-=1;o.pathname=g.join("/")}l=p>=0?t[p]:"/"}let u=Sh(o,l),c=i&&i!=="/"&&i.endsWith("/"),h=(a||i===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||h)&&(u.pathname+="/"),u}var Et=e=>e.join("/").replace(/\/\/+/g,"/"),kh=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Ch=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Nh=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Eh=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function bh(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Ph(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Xd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function qd(e,t){let n=e;if(typeof n!="string"||!wh.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(Xd)try{let a=new URL(window.location.href),i=n.startsWith("//")?new URL(a.protocol+n):new URL(n),l=Bt(i.pathname,t);i.origin===a.origin&&l!=null?n=l+i.search+i.hash:o=!0}catch{it(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Zd=["POST","PUT","PATCH","DELETE"];new Set(Zd);var Th=["GET",...Zd];new Set(Th);var rr=d.createContext(null);rr.displayName="DataRouter";var Ea=d.createContext(null);Ea.displayName="DataRouterState";var Ih=d.createContext(!1),ef=d.createContext({isTransitioning:!1});ef.displayName="ViewTransition";var Rh=d.createContext(new Map);Rh.displayName="Fetchers";var _h=d.createContext(null);_h.displayName="Await";var qe=d.createContext(null);qe.displayName="Navigation";var Xr=d.createContext(null);Xr.displayName="Location";var vt=d.createContext({outlet:null,matches:[],isDataRoute:!1});vt.displayName="Route";var Zi=d.createContext(null);Zi.displayName="RouteError";var tf="REACT_ROUTER_ERROR",zh="REDIRECT",Ah="ROUTE_ERROR_RESPONSE";function $h(e){if(e.startsWith(`${tf}:${zh}:{`))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 Lh(e){if(e.startsWith(`${tf}:${Ah}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Eh(t.status,t.statusText,t.data)}catch{}}function Mh(e,{relative:t}={}){ie(or(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=d.useContext(qe),{hash:o,pathname:a,search:i}=qr(e,{relative:t}),l=a;return n!=="/"&&(l=a==="/"?n:Et([n,a])),r.createHref({pathname:l,search:i,hash:o})}function or(){return d.useContext(Xr)!=null}function lt(){return ie(or(),"useLocation() may be used only in the context of a <Router> component."),d.useContext(Xr).location}var nf="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function rf(e){d.useContext(qe).static||d.useLayoutEffect(e)}function bt(){let{isDataRoute:e}=d.useContext(vt);return e?qh():Fh()}function Fh(){ie(or(),"useNavigate() may be used only in the context of a <Router> component.");let e=d.useContext(rr),{basename:t,navigator:n}=d.useContext(qe),{matches:r}=d.useContext(vt),{pathname:o}=lt(),a=JSON.stringify(qi(r)),i=d.useRef(!1);return rf(()=>{i.current=!0}),d.useCallback((u,c={})=>{if(it(i.current,nf),!i.current)return;if(typeof u=="number"){n.go(u);return}let h=Na(u,JSON.parse(a),o,c.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Et([t,h.pathname])),(c.replace?n.replace:n.push)(h,c.state,c)},[t,n,a,o,e])}var Oh=d.createContext(null);function Bh(e){let t=d.useContext(vt).outlet;return d.useMemo(()=>t&&d.createElement(Oh.Provider,{value:e},t),[t,e])}function qr(e,{relative:t}={}){let{matches:n}=d.useContext(vt),{pathname:r}=lt(),o=JSON.stringify(qi(n));return d.useMemo(()=>Na(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function Dh(e,t){return of(e,t)}function of(e,t,n){var j;ie(or(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=d.useContext(qe),{matches:o}=d.useContext(vt),a=o[o.length-1],i=a?a.params:{},l=a?a.pathname:"/",u=a?a.pathnameBase:"/",c=a&&a.route;{let m=c&&c.path||"";sf(l,!c||m.endsWith("*")||m.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${m}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
49
+ */var wu="popstate";function Su(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ah(e={}){function t(r,o){var c;let a=(c=o.state)==null?void 0:c.masked,{pathname:i,search:l,hash:u}=a||r.location;return ei("",{pathname:i,search:l,hash:u},o.state&&o.state.usr||null,o.state&&o.state.key||"default",a?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,o){return typeof o=="string"?o:Kr(o)}return ih(t,n,null,e)}function ie(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function it(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function sh(){return Math.random().toString(36).substring(2,10)}function ju(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ei(e,t,n=null,r,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?nr(t):t,state:n,key:t&&t.key||r||sh(),unstable_mask:o}}function Kr({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function nr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ih(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:a=!1}=r,i=o.history,l="POP",u=null,c=h();c==null&&(c=0,i.replaceState({...i.state,idx:c},""));function h(){return(i.state||{idx:null}).idx}function f(){l="POP";let j=h(),m=j==null?null:j-c;c=j,u&&u({action:l,location:w.location,delta:m})}function g(j,m){l="PUSH";let p=Su(j)?j:ei(w.location,j,m);c=h()+1;let v=ju(p,c),S=w.createHref(p.unstable_mask||p);try{i.pushState(v,"",S)}catch(b){if(b instanceof DOMException&&b.name==="DataCloneError")throw b;o.location.assign(S)}a&&u&&u({action:l,location:w.location,delta:1})}function y(j,m){l="REPLACE";let p=Su(j)?j:ei(w.location,j,m);c=h();let v=ju(p,c),S=w.createHref(p.unstable_mask||p);i.replaceState(v,"",S),a&&u&&u({action:l,location:w.location,delta:0})}function x(j){return lh(j)}let w={get action(){return l},get location(){return e(o,i)},listen(j){if(u)throw new Error("A history only accepts one active listener");return o.addEventListener(wu,f),u=j,()=>{o.removeEventListener(wu,f),u=null}},createHref(j){return t(o,j)},createURL:x,encodeLocation(j){let m=x(j);return{pathname:m.pathname,search:m.search,hash:m.hash}},push:g,replace:y,go(j){return i.go(j)}};return w}function lh(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),ie(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:Kr(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function Jd(e,t,n="/"){return uh(e,t,n,!1)}function uh(e,t,n,r){let o=typeof t=="string"?nr(t):t,a=Ot(o.pathname||"/",n);if(a==null)return null;let i=Xd(e);ch(i);let l=null;for(let u=0;l==null&&u<i.length;++u){let c=Sh(a);l=xh(i[u],c,r)}return l}function Xd(e,t=[],n=[],r="",o=!1){let a=(i,l,u=o,c)=>{let h={relativePath:c===void 0?i.path||"":c,caseSensitive:i.caseSensitive===!0,childrenIndex:l,route:i};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&u)return;ie(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let f=Et([r,h.relativePath]),g=n.concat(h);i.children&&i.children.length>0&&(ie(i.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),Xd(i.children,t,g,f,u)),!(i.path==null&&!i.index)&&t.push({path:f,score:vh(f,i.index),routesMeta:g})};return e.forEach((i,l)=>{var u;if(i.path===""||!((u=i.path)!=null&&u.includes("?")))a(i,l);else for(let c of qd(i.path))a(i,l,!0,c)}),t}function qd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return o?[a,""]:[a];let i=qd(r.join("/")),l=[];return l.push(...i.map(u=>u===""?a:[a,u].join("/"))),o&&l.push(...i),l.map(u=>e.startsWith("/")&&u===""?"/":u)}function ch(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:yh(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var dh=/^:[\w-]+$/,fh=3,ph=2,mh=1,hh=10,gh=-2,ku=e=>e==="*";function vh(e,t){let n=e.split("/"),r=n.length;return n.some(ku)&&(r+=gh),t&&(r+=ph),n.filter(o=>!ku(o)).reduce((o,a)=>o+(dh.test(a)?fh:a===""?mh:hh),r)}function yh(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function xh(e,t,n=!1){let{routesMeta:r}=e,o={},a="/",i=[];for(let l=0;l<r.length;++l){let u=r[l],c=l===r.length-1,h=a==="/"?t:t.slice(a.length)||"/",f=sa({path:u.relativePath,caseSensitive:u.caseSensitive,end:c},h),g=u.route;if(!f&&c&&n&&!r[r.length-1].route.index&&(f=sa({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},h)),!f)return null;Object.assign(o,f.params),i.push({params:o,pathname:Et([a,f.pathname]),pathnameBase:Nh(Et([a,f.pathnameBase])),route:g}),f.pathnameBase!=="/"&&(a=Et([a,f.pathnameBase]))}return i}function sa(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=wh(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let a=o[0],i=a.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:r.reduce((c,{paramName:h,isOptional:f},g)=>{if(h==="*"){let x=l[g]||"";i=a.slice(0,a.length-x.length).replace(/(.)\/+$/,"$1")}const y=l[g];return f&&!y?c[h]=void 0:c[h]=(y||"").replace(/%2F/g,"/"),c},{}),pathname:a,pathnameBase:i,pattern:e}}function wh(e,t=!1,n=!0){it(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,l,u,c,h)=>{if(r.push({paramName:l,isOptional:u!=null}),u){let f=h.charAt(c+i.length);return f&&f!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function Sh(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return it(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ot(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 jh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function kh(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?nr(e):e,a;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?a=Cu(n.substring(1),"/"):a=Cu(n,t)):a=t,{pathname:a,search:Eh(r),hash:bh(o)}}function Cu(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function ns(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ch(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function nl(e){let t=Ch(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function Ea(e,t,n,r=!1){let o;typeof e=="string"?o=nr(e):(o={...e},ie(!o.pathname||!o.pathname.includes("?"),ns("?","pathname","search",o)),ie(!o.pathname||!o.pathname.includes("#"),ns("#","pathname","hash",o)),ie(!o.search||!o.search.includes("#"),ns("#","search","hash",o)));let a=e===""||o.pathname==="",i=a?"/":o.pathname,l;if(i==null)l=n;else{let f=t.length-1;if(!r&&i.startsWith("..")){let g=i.split("/");for(;g[0]==="..";)g.shift(),f-=1;o.pathname=g.join("/")}l=f>=0?t[f]:"/"}let u=kh(o,l),c=i&&i!=="/"&&i.endsWith("/"),h=(a||i===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(c||h)&&(u.pathname+="/"),u}var Et=e=>e.join("/").replace(/\/\/+/g,"/"),Nh=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Eh=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,bh=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Ph=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 Th(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Ih(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var Zd=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ef(e,t){let n=e;if(typeof n!="string"||!jh.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,o=!1;if(Zd)try{let a=new URL(window.location.href),i=n.startsWith("//")?new URL(a.protocol+n):new URL(n),l=Ot(i.pathname,t);i.origin===a.origin&&l!=null?n=l+i.search+i.hash:o=!0}catch{it(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var tf=["POST","PUT","PATCH","DELETE"];new Set(tf);var _h=["GET",...tf];new Set(_h);var rr=d.createContext(null);rr.displayName="DataRouter";var ba=d.createContext(null);ba.displayName="DataRouterState";var Rh=d.createContext(!1),nf=d.createContext({isTransitioning:!1});nf.displayName="ViewTransition";var zh=d.createContext(new Map);zh.displayName="Fetchers";var Ah=d.createContext(null);Ah.displayName="Await";var qe=d.createContext(null);qe.displayName="Navigation";var qr=d.createContext(null);qr.displayName="Location";var vt=d.createContext({outlet:null,matches:[],isDataRoute:!1});vt.displayName="Route";var rl=d.createContext(null);rl.displayName="RouteError";var rf="REACT_ROUTER_ERROR",$h="REDIRECT",Lh="ROUTE_ERROR_RESPONSE";function Mh(e){if(e.startsWith(`${rf}:${$h}:{`))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 Fh(e){if(e.startsWith(`${rf}:${Lh}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ph(t.status,t.statusText,t.data)}catch{}}function Oh(e,{relative:t}={}){ie(or(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=d.useContext(qe),{hash:o,pathname:a,search:i}=Zr(e,{relative:t}),l=a;return n!=="/"&&(l=a==="/"?n:Et([n,a])),r.createHref({pathname:l,search:i,hash:o})}function or(){return d.useContext(qr)!=null}function lt(){return ie(or(),"useLocation() may be used only in the context of a <Router> component."),d.useContext(qr).location}var of="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function af(e){d.useContext(qe).static||d.useLayoutEffect(e)}function Dt(){let{isDataRoute:e}=d.useContext(vt);return e?eg():Bh()}function Bh(){ie(or(),"useNavigate() may be used only in the context of a <Router> component.");let e=d.useContext(rr),{basename:t,navigator:n}=d.useContext(qe),{matches:r}=d.useContext(vt),{pathname:o}=lt(),a=JSON.stringify(nl(r)),i=d.useRef(!1);return af(()=>{i.current=!0}),d.useCallback((u,c={})=>{if(it(i.current,of),!i.current)return;if(typeof u=="number"){n.go(u);return}let h=Ea(u,JSON.parse(a),o,c.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Et([t,h.pathname])),(c.replace?n.replace:n.push)(h,c.state,c)},[t,n,a,o,e])}var Dh=d.createContext(null);function Uh(e){let t=d.useContext(vt).outlet;return d.useMemo(()=>t&&d.createElement(Dh.Provider,{value:e},t),[t,e])}function Zr(e,{relative:t}={}){let{matches:n}=d.useContext(vt),{pathname:r}=lt(),o=JSON.stringify(nl(n));return d.useMemo(()=>Ea(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function Wh(e,t){return sf(e,t)}function sf(e,t,n){var j;ie(or(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=d.useContext(qe),{matches:o}=d.useContext(vt),a=o[o.length-1],i=a?a.params:{},l=a?a.pathname:"/",u=a?a.pathnameBase:"/",c=a&&a.route;{let m=c&&c.path||"";uf(l,!c||m.endsWith("*")||m.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${m}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
50
50
 
51
- Please change the parent <Route path="${m}"> to <Route path="${m==="/"?"*":`${m}/*`}">.`)}let h=lt(),p;if(t){let m=typeof t=="string"?nr(t):t;ie(u==="/"||((j=m.pathname)==null?void 0:j.startsWith(u)),`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 "${u}" but pathname "${m.pathname}" was given in the \`location\` prop.`),p=m}else p=h;let g=p.pathname||"/",y=g;if(u!=="/"){let m=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(m.length).join("/")}let x=Qd(e,{pathname:y});it(c||x!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),it(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.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=Kh(x&&x.map(m=>Object.assign({},m,{params:Object.assign({},i,m.params),pathname:Et([u,r.encodeLocation?r.encodeLocation(m.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?u:Et([u,r.encodeLocation?r.encodeLocation(m.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathnameBase])})),o,n);return t&&w?d.createElement(Xr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},w):w}function Uh(){let e=Xh(),t=bh(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={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:a},"ErrorBoundary")," or"," ",d.createElement("code",{style:a},"errorElement")," prop on your route.")),d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},t),n?d.createElement("pre",{style:o},n):null,i)}var Wh=d.createElement(Uh,null),af=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=Lh(e.digest);n&&(e=n)}let t=e!==void 0?d.createElement(vt.Provider,{value:this.props.routeContext},d.createElement(Zi.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?d.createElement(Hh,{error:e},t):t}};af.contextType=Ih;var ns=new WeakMap;function Hh({children:e,error:t}){let{basename:n}=d.useContext(qe);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=$h(t.digest);if(r){let o=ns.get(t);if(o)throw o;let a=qd(r.location,n);if(Xd&&!ns.get(t))if(a.isExternal||r.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:r.replace}));throw ns.set(t,i),i}return d.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function Vh({routeContext:e,match:t,children:n}){let r=d.useContext(rr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(vt.Provider,{value:e},n)}function Kh(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,a=r==null?void 0:r.errors;if(a!=null){let h=o.findIndex(p=>p.route.id&&(a==null?void 0:a[p.route.id])!==void 0);ie(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),o=o.slice(0,Math.min(o.length,h+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let h=0;h<o.length;h++){let p=o[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(l=h),p.route.id){let{loaderData:g,errors:y}=r,x=p.route.loader&&!g.hasOwnProperty(p.route.id)&&(!y||y[p.route.id]===void 0);if(p.route.lazy||x){n.isStatic&&(i=!0),l>=0?o=o.slice(0,l+1):o=[o[0]];break}}}}let u=n==null?void 0:n.onError,c=r&&u?(h,p)=>{var g,y;u(h,{location:r.location,params:((y=(g=r.matches)==null?void 0:g[0])==null?void 0:y.params)??{},unstable_pattern:Ph(r.matches),errorInfo:p})}:void 0;return o.reduceRight((h,p,g)=>{let y,x=!1,w=null,j=null;r&&(y=a&&p.route.id?a[p.route.id]:void 0,w=p.route.errorElement||Wh,i&&(l<0&&g===0?(sf("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,j=null):l===g&&(x=!0,j=p.route.hydrateFallbackElement||null)));let m=t.concat(o.slice(0,g+1)),f=()=>{let v;return y?v=w:x?v=j:p.route.Component?v=d.createElement(p.route.Component,null):p.route.element?v=p.route.element:v=h,d.createElement(Vh,{match:p,routeContext:{outlet:h,matches:m,isDataRoute:r!=null},children:v})};return r&&(p.route.ErrorBoundary||p.route.errorElement||g===0)?d.createElement(af,{location:r.location,revalidation:r.revalidation,component:w,error:y,children:f(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:c}):f()},null)}function el(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Gh(e){let t=d.useContext(rr);return ie(t,el(e)),t}function Qh(e){let t=d.useContext(Ea);return ie(t,el(e)),t}function Yh(e){let t=d.useContext(vt);return ie(t,el(e)),t}function tl(e){let t=Yh(e),n=t.matches[t.matches.length-1];return ie(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Jh(){return tl("useRouteId")}function Xh(){var r;let e=d.useContext(Zi),t=Qh("useRouteError"),n=tl("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function qh(){let{router:e}=Gh("useNavigate"),t=tl("useNavigate"),n=d.useRef(!1);return rf(()=>{n.current=!0}),d.useCallback(async(o,a={})=>{it(n.current,nf),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...a}))},[e,t])}var Su={};function sf(e,t,n){!t&&!Su[e]&&(Su[e]=!0,it(!1,n))}d.memo(Zh);function Zh({routes:e,future:t,state:n,isStatic:r,onError:o}){return of(e,void 0,{state:n,isStatic:r,onError:o})}function Vt({to:e,replace:t,state:n,relative:r}){ie(or(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=d.useContext(qe);it(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=d.useContext(vt),{pathname:i}=lt(),l=bt(),u=Na(e,qi(a),i,r==="path"),c=JSON.stringify(u);return d.useEffect(()=>{l(JSON.parse(c),{replace:t,state:n,relative:r})},[l,c,r,t,n]),null}function eg(e){return Bh(e.context)}function we(e){ie(!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 tg({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:a=!1,unstable_useTransitions:i}){ie(!or(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),u=d.useMemo(()=>({basename:l,navigator:o,static:a,unstable_useTransitions:i,future:{}}),[l,o,a,i]);typeof n=="string"&&(n=nr(n));let{pathname:c="/",search:h="",hash:p="",state:g=null,key:y="default",unstable_mask:x}=n,w=d.useMemo(()=>{let j=Bt(c,l);return j==null?null:{location:{pathname:j,search:h,hash:p,state:g,key:y,unstable_mask:x},navigationType:r}},[l,c,h,p,g,y,r,x]);return it(w!=null,`<Router basename="${l}"> is not able to match the URL "${c}${h}${p}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:d.createElement(qe.Provider,{value:u},d.createElement(Xr.Provider,{children:t,value:w}))}function ng({children:e,location:t}){return Dh(ei(e),t)}function ei(e,t=[]){let n=[];return d.Children.forEach(e,(r,o)=>{if(!d.isValidElement(r))return;let a=[...t,o];if(r.type===d.Fragment){n.push.apply(n,ei(r.props.children,a));return}ie(r.type===we,`[${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>`),ie(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||a.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=ei(r.props.children,a)),n.push(i)}),n}var zo="get",Ao="application/x-www-form-urlencoded";function ba(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function rg(e){return ba(e)&&e.tagName.toLowerCase()==="button"}function og(e){return ba(e)&&e.tagName.toLowerCase()==="form"}function ag(e){return ba(e)&&e.tagName.toLowerCase()==="input"}function sg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ig(e,t){return e.button===0&&(!t||t==="_self")&&!sg(e)}function ti(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function lg(e,t){let n=ti(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(a=>{n.append(o,a)})}),n}var yo=null;function ug(){if(yo===null)try{new FormData(document.createElement("form"),0),yo=!1}catch{yo=!0}return yo}var cg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function rs(e){return e!=null&&!cg.has(e)?(it(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ao}"`),null):e}function dg(e,t){let n,r,o,a,i;if(og(e)){let l=e.getAttribute("action");r=l?Bt(l,t):null,n=e.getAttribute("method")||zo,o=rs(e.getAttribute("enctype"))||Ao,a=new FormData(e)}else if(rg(e)||ag(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 u=e.getAttribute("formaction")||l.getAttribute("action");if(r=u?Bt(u,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||zo,o=rs(e.getAttribute("formenctype"))||rs(l.getAttribute("enctype"))||Ao,a=new FormData(l,e),!ug()){let{name:c,type:h,value:p}=e;if(h==="image"){let g=c?`${c}.`:"";a.append(`${g}x`,"0"),a.append(`${g}y`,"0")}else c&&a.append(c,p)}}else{if(ba(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=zo,r=null,o=Ao,i=e}return a&&o==="text/plain"&&(i=a,a=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:a,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function nl(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function fg(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Bt(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${r}`,o}async function pg(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 mg(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 hg(e,t,n){let r=await Promise.all(e.map(async o=>{let a=t.routes[o.route.id];if(a){let i=await pg(a,n);return i.links?i.links():[]}return[]}));return xg(r.flat(1).filter(mg).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function ju(e,t,n,r,o,a){let i=(u,c)=>n[c]?u.route.id!==n[c].route.id:!0,l=(u,c)=>{var h;return n[c].pathname!==u.pathname||((h=n[c].route.path)==null?void 0:h.endsWith("*"))&&n[c].params["*"]!==u.params["*"]};return a==="assets"?t.filter((u,c)=>i(u,c)||l(u,c)):a==="data"?t.filter((u,c)=>{var p;let h=r.routes[u.route.id];if(!h||!h.hasLoader)return!1;if(i(u,c)||l(u,c))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function gg(e,t,{includeHydrateFallback:n}={}){return vg(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let a=[o.module];return o.clientActionModule&&(a=a.concat(o.clientActionModule)),o.clientLoaderModule&&(a=a.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(a=a.concat(o.hydrateFallbackModule)),o.imports&&(a=a.concat(o.imports)),a}).flat(1))}function vg(e){return[...new Set(e)]}function yg(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function xg(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let a=JSON.stringify(yg(o));return n.has(a)||(n.add(a),r.push({key:a,link:o})),r},[])}function lf(){let e=d.useContext(rr);return nl(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function wg(){let e=d.useContext(Ea);return nl(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var rl=d.createContext(void 0);rl.displayName="FrameworkContext";function uf(){let e=d.useContext(rl);return nl(e,"You must render this element inside a <HydratedRouter> element"),e}function Sg(e,t){let n=d.useContext(rl),[r,o]=d.useState(!1),[a,i]=d.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:c,onMouseLeave:h,onTouchStart:p}=t,g=d.useRef(null);d.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let w=m=>{m.forEach(f=>{i(f.isIntersecting)})},j=new IntersectionObserver(w,{threshold:.5});return g.current&&j.observe(g.current),()=>{j.disconnect()}}},[e]),d.useEffect(()=>{if(r){let w=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(w)}}},[r]);let y=()=>{o(!0)},x=()=>{o(!1),i(!1)};return n?e!=="intent"?[a,g,{}]:[a,g,{onFocus:pr(l,y),onBlur:pr(u,x),onMouseEnter:pr(c,y),onMouseLeave:pr(h,x),onTouchStart:pr(p,y)}]:[!1,g,{}]}function pr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function jg({page:e,...t}){let{router:n}=lf(),r=d.useMemo(()=>Qd(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?d.createElement(Cg,{page:e,matches:r,...t}):null}function kg(e){let{manifest:t,routeModules:n}=uf(),[r,o]=d.useState([]);return d.useEffect(()=>{let a=!1;return hg(e,t,n).then(i=>{a||o(i)}),()=>{a=!0}},[e,t,n]),r}function Cg({page:e,matches:t,...n}){let r=lt(),{future:o,manifest:a,routeModules:i}=uf(),{basename:l}=lf(),{loaderData:u,matches:c}=wg(),h=d.useMemo(()=>ju(e,t,c,a,r,"data"),[e,t,c,a,r]),p=d.useMemo(()=>ju(e,t,c,a,r,"assets"),[e,t,c,a,r]),g=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,j=!1;if(t.forEach(f=>{var S;let v=a.routes[f.route.id];!v||!v.hasLoader||(!h.some(b=>b.route.id===f.route.id)&&f.route.id in u&&((S=i[f.route.id])!=null&&S.shouldRevalidate)||v.hasClientLoader?j=!0:w.add(f.route.id))}),w.size===0)return[];let m=fg(e,l,o.unstable_trailingSlashAwareDataRequests,"data");return j&&w.size>0&&m.searchParams.set("_routes",t.filter(f=>w.has(f.route.id)).map(f=>f.route.id).join(",")),[m.pathname+m.search]},[l,o.unstable_trailingSlashAwareDataRequests,u,r,a,h,t,e,i]),y=d.useMemo(()=>gg(p,a),[p,a]),x=kg(p);return d.createElement(d.Fragment,null,g.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 Ng(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Eg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Eg&&(window.__reactRouterVersion="7.13.1")}catch{}function bg({basename:e,children:t,unstable_useTransitions:n,window:r}){let o=d.useRef();o.current==null&&(o.current=rh({window:r,v5Compat:!0}));let a=o.current,[i,l]=d.useState({action:a.action,location:a.location}),u=d.useCallback(c=>{n===!1?l(c):d.startTransition(()=>l(c))},[n]);return d.useLayoutEffect(()=>a.listen(u),[a,u]),d.createElement(tg,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:a,unstable_useTransitions:n})}var cf=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,nt=d.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:a,replace:i,unstable_mask:l,state:u,target:c,to:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:y,...x},w){let{basename:j,navigator:m,unstable_useTransitions:f}=d.useContext(qe),v=typeof h=="string"&&cf.test(h),S=qd(h,j);h=S.to;let b=Mh(h,{relative:o}),T=lt(),k=null;if(l){let R=Na(l,[],T.unstable_mask?T.unstable_mask.pathname:"/",!0);j!=="/"&&(R.pathname=R.pathname==="/"?j:Et([j,R.pathname])),k=m.createHref(R)}let[N,C,I]=Sg(r,x),M=Ig(h,{replace:i,unstable_mask:l,state:u,target:c,preventScrollReset:p,relative:o,viewTransition:g,unstable_defaultShouldRevalidate:y,unstable_useTransitions:f});function B(R){t&&t(R),R.defaultPrevented||M(R)}let A=!(S.isExternal||a),z=d.createElement("a",{...x,...I,href:(A?k:void 0)||S.absoluteURL||b,onClick:A?B:t,ref:Ng(w,C),target:c,"data-discover":!v&&n==="render"?"true":void 0});return N&&!v?d.createElement(d.Fragment,null,z,d.createElement(jg,{page:b})):z});nt.displayName="Link";var ol=d.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:a,to:i,viewTransition:l,children:u,...c},h){let p=qr(i,{relative:c.relative}),g=lt(),y=d.useContext(Ea),{navigator:x,basename:w}=d.useContext(qe),j=y!=null&&$g(p)&&l===!0,m=x.encodeLocation?x.encodeLocation(p).pathname:p.pathname,f=g.pathname,v=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(f=f.toLowerCase(),v=v?v.toLowerCase():null,m=m.toLowerCase()),v&&w&&(v=Bt(v,w)||v);const S=m!=="/"&&m.endsWith("/")?m.length-1:m.length;let b=f===m||!o&&f.startsWith(m)&&f.charAt(S)==="/",T=v!=null&&(v===m||!o&&v.startsWith(m)&&v.charAt(m.length)==="/"),k={isActive:b,isPending:T,isTransitioning:j},N=b?t:void 0,C;typeof r=="function"?C=r(k):C=[r,b?"active":null,T?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let I=typeof a=="function"?a(k):a;return d.createElement(nt,{...c,"aria-current":N,className:C,ref:h,style:I,to:i,viewTransition:l},typeof u=="function"?u(k):u)});ol.displayName="NavLink";var Pg=d.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:a,method:i=zo,action:l,onSubmit:u,relative:c,preventScrollReset:h,viewTransition:p,unstable_defaultShouldRevalidate:g,...y},x)=>{let{unstable_useTransitions:w}=d.useContext(qe),j=zg(),m=Ag(l,{relative:c}),f=i.toLowerCase()==="get"?"get":"post",v=typeof l=="string"&&cf.test(l),S=b=>{if(u&&u(b),b.defaultPrevented)return;b.preventDefault();let T=b.nativeEvent.submitter,k=(T==null?void 0:T.getAttribute("formmethod"))||i,N=()=>j(T||b.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:o,state:a,relative:c,preventScrollReset:h,viewTransition:p,unstable_defaultShouldRevalidate:g});w&&n!==!1?d.startTransition(()=>N()):N()};return d.createElement("form",{ref:x,method:f,action:m,onSubmit:r?u:S,...y,"data-discover":!v&&e==="render"?"true":void 0})});Pg.displayName="Form";function Tg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function df(e){let t=d.useContext(rr);return ie(t,Tg(e)),t}function Ig(e,{target:t,replace:n,unstable_mask:r,state:o,preventScrollReset:a,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:u,unstable_useTransitions:c}={}){let h=bt(),p=lt(),g=qr(e,{relative:i});return d.useCallback(y=>{if(ig(y,t)){y.preventDefault();let x=n!==void 0?n:Vr(p)===Vr(g),w=()=>h(e,{replace:x,unstable_mask:r,state:o,preventScrollReset:a,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:u});c?d.startTransition(()=>w()):w()}},[p,h,g,n,r,o,t,e,a,i,l,u,c])}function ff(e){it(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=d.useRef(ti(e)),n=d.useRef(!1),r=lt(),o=d.useMemo(()=>lg(r.search,n.current?null:t.current),[r.search]),a=bt(),i=d.useCallback((l,u)=>{const c=ti(typeof l=="function"?l(new URLSearchParams(o)):l);n.current=!0,a("?"+c,u)},[a,o]);return[o,i]}var Rg=0,_g=()=>`__${String(++Rg)}__`;function zg(){let{router:e}=df("useSubmit"),{basename:t}=d.useContext(qe),n=Jh(),r=e.fetch,o=e.navigate;return d.useCallback(async(a,i={})=>{let{action:l,method:u,encType:c,formData:h,body:p}=dg(a,t);if(i.navigate===!1){let g=i.fetcherKey||_g();await r(g,n,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:p,formMethod:i.method||u,formEncType:i.encType||c,flushSync:i.flushSync})}else await o(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:p,formMethod:i.method||u,formEncType:i.encType||c,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,o,t,n])}function Ag(e,{relative:t}={}){let{basename:n}=d.useContext(qe),r=d.useContext(vt);ie(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),a={...qr(e||".",{relative:t})},i=lt();if(e==null){a.search=i.search;let l=new URLSearchParams(a.search),u=l.getAll("index");if(u.some(h=>h==="")){l.delete("index"),u.filter(p=>p).forEach(p=>l.append("index",p));let h=l.toString();a.search=h?`?${h}`:""}}return(!e||e===".")&&o.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:Et([n,a.pathname])),Vr(a)}function $g(e,{relative:t}={}){let n=d.useContext(ef);ie(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=df("useViewTransitionState"),o=qr(e,{relative:t});if(!n.isTransitioning)return!1;let a=Bt(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Bt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return aa(o.pathname,i)!=null||aa(o.pathname,a)!=null}class pf extends Error{constructor(n){super("different_account");Pa(this,"summary");this.name="DifferentAccountError",this.summary=n}}class Lg{constructor(){Pa(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 a=await r.json().catch(()=>({}));if(a!=null&&a.wouldWipe)throw new pf(a.summary??{credentialCount:0,serviceCount:0,credentialIds:[]})}if(!r.ok){const a=await r.json().catch(()=>({error:"Invalid API key"}));throw new Error(a.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(a=>{var i,l;return{frame_hash:a.frameHash??a.boundsHash,profile_id:a.profileId,path:a.path,title:a.title??null,sp_status:a.status??null,frame:a.bounds??a.frame??{},required_domains:a.requiredDomains??[],attested_domains:a.attestedDomains??[],missing_domains:(a.requiredDomains??[]).filter(u=>!(a.attestedDomains??[]).includes(u)),deferred_commitment_domains:a.deferredCommitmentDomains??[],approvers_frozen:a.approversFrozen??[],above_cap:a.aboveCap??!1,created_at:a.createdAt?new Date(a.createdAt*1e3).toISOString():"",earliest_expiry:(i=a.attestations)!=null&&i.length?new Date(Math.min(...a.attestations.map(u=>u.expiresAt))*1e3).toISOString():null,remaining_seconds:(l=a.attestations)!=null&&l.length?Math.max(0,Math.min(...a.attestations.map(u=>u.expiresAt))-Math.floor(Date.now()/1e3)):null}})}async getMyReceipts(t){const n=new URLSearchParams;t!=null&&t.date&&n.set("date",t.date),t!=null&&t.profile&&n.set("profile",t.profile),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString(),o=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!o.ok)throw new Error(`Failed to fetch receipts: ${o.status}`);return(await o.json()).receipts??[]}async revokeAttestation(t,n){const r=await this.fetch(`/api/attestations/${encodeURIComponent(t)}/revoke`,{method:"POST",body:JSON.stringify({reason:n??"Revoked by user"})});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed to revoke"}));throw new Error(o.error||`Revoke failed: ${r.status}`)}}async getAttestations(t){const n=await this.fetch(`/api/attestations?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 a=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(a.error||`Create group failed: ${n.status}`)}const r=await n.json(),o=r.group||r;return{id:o.id,name:o.name,myDomains:o.myDomains||[],isAdmin:!0}}async joinGroup(t){const n=await this.fetch("/api/groups/join",{method:"POST",body:JSON.stringify({inviteCode:t})});if(!n.ok){const a=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(a.error||`Join group failed: ${n.status}`)}const r=await n.json(),o=r.group||r;return{id:o.id,name:o.name,myDomains:o.myDomains||[],isAdmin:o.isAdmin||!1}}async inviteToGroup(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/invite`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(r.error||`Invite failed: ${n.status}`)}return n.json()}async getMyTeam(){const t=await this.fetch("/api/groups/me");if(!t.ok)return null;const n=await t.json();return n.group?{group:n.group,membership:n.membership}:null}async listUsers(){const t=await this.fetch("/api/users");return t.ok?(await t.json()).users??[]:[]}async setPubkey(t){const n=await this.fetch("/api/users/me/pubkey",{method:"PUT",body:JSON.stringify({pubkey:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to set pubkey"}));throw new Error(r.error||`setPubkey failed: ${n.status}`)}}async getPubkey(t){const n=await this.fetch(`/api/users/${encodeURIComponent(t)}/pubkey`);return n.status===404||!n.ok?null:(await n.json()).pubkey??null}async leaveTeam(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/leave`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to leave team"}));throw new Error(r.error||`Leave failed: ${n.status}`)}}async getVaultStatus(){const t=await this.fetch("/vault/status");if(!t.ok)throw new Error(`Failed to fetch vault status: ${t.status}`);return t.json()}async getCredential(t){const n=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to check credential: ${n.status}`);return n.json()}async setCredential(t,n){const r=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to save credential: ${r.status}`)}async testCredential(t){const n=await this.fetch(`/vault/test/${encodeURIComponent(t)}`,{method:"POST"});if(!n.ok)throw new Error(`Test failed: ${n.status}`);return n.json()}async aiAssist(t){const n=await this.fetch("/ai/assist",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI request failed"}))).error,disclaimer:"AI surfaces reality. You supply intent."}}async 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 getIntegrationManifests(){const t=await this.fetch("/mcp/integrations/manifests");if(!t.ok)throw new Error(`Failed to fetch manifests: ${t.status}`);return t.json()}async discoverScopeField(t,n){const r=await this.fetch(`/integrations/${encodeURIComponent(t)}/discover/${encodeURIComponent(n)}`);if(!r.ok){const o=await r.json().catch(()=>({error:`Discovery failed: ${r.status}`}));throw new Error(o.error)}return r.json()}async activateIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}/activate`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`Failed: ${n.status}`)}return n.json()}async removeMcpIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to remove integration: ${n.status}`)}async getTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`);if(r.status===404||!r.ok)return null;const o=await r.json();return(o==null?void 0:o.config)??null}async setTeamProfileConfig(t,n,r){const o=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(r)});if(!o.ok){const a=await o.json().catch(()=>({error:"Failed to set profile config"}));throw new Error(a.error||`setTeamProfileConfig failed: ${o.status}`)}}async encryptIntent(t,n){const r=await this.fetch("/api/encrypt-intent",{method:"POST",body:JSON.stringify({intent:t,recipients:n})});if(!r.ok){const o=await r.json().catch(()=>({error:"Encryption failed"}));throw new Error(o.error||`encryptIntent failed: ${r.status}`)}return r.json()}async getApproversPubkeys(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}/approvers/pubkeys`);return r.ok?(await r.json()).approvers??[]:[]}async deleteTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"DELETE"});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed to delete profile config"}));throw new Error(o.error||`deleteTeamProfileConfig failed: ${r.status}`)}}async getProposals(t){const n=await this.fetch(`/api/proposals?domain=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch proposals: ${n.status}`);return(await n.json()).proposals??[]}async resolveProposal(t,n,r){const o=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/resolve`,{method:"POST",body:JSON.stringify({action:n,domain:r})});if(!o.ok){const a=await o.json().catch(()=>({error:"Failed"}));throw new Error(a.error||`Failed: ${o.status}`)}return o.json()}async getProposalsForApprover(){const t=await this.fetch("/api/proposals?approver=me");if(!t.ok)throw new Error(`Failed to fetch approver proposals: ${t.status}`);return(await t.json()).proposals??[]}async approveProposal(t){const n=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/approve`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`approveProposal failed: ${n.status}`)}return n.json()}async rejectProposal(t,n){const r=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/reject`,{method:"POST",body:JSON.stringify({reason:n})});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed"}));throw new Error(o.error||`rejectProposal failed: ${r.status}`)}return r.json()}async getAttestationIntent(t){const n=await this.fetch(`/api/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 o=await n.json().catch(()=>({error:"Decryption failed"}));throw new Error(o.error||`decryptIntent failed: ${n.status}`)}return(await n.json()).intent}async storeApprovedIntent(t,n){const r=await this.fetch("/api/approved-intents",{method:"POST",body:JSON.stringify({authorityId:t,intent:n})});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed"}));throw new Error(o.error||`storeApprovedIntent failed: ${r.status}`)}}async listTeamAuthorizations(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/attestations`);if(!n.ok)throw new Error(`Failed to fetch team authorizations: ${n.status}`);return((await n.json()).items??[]).map(o=>{var l,u;const a=o.owner??{userId:""};return{frame_hash:o.boundsHash??o.frameHash??o.frame_hash,profile_id:o.profileId??o.profile_id,path:o.path??"",title:o.title??null,sp_status:o.status??o.sp_status??null,frame:o.bounds??o.frame??{},required_domains:o.requiredDomains??o.required_domains??[],attested_domains:o.attestedDomains??o.attested_domains??[],missing_domains:(o.requiredDomains??o.required_domains??[]).filter(c=>!(o.attestedDomains??o.attested_domains??[]).includes(c)),deferred_commitment_domains:o.deferredCommitmentDomains??o.deferred_commitment_domains??[],approvers_frozen:o.approversFrozen??o.approvers_frozen??[],above_cap:o.aboveCap??o.above_cap??!1,created_at:o.createdAt?new Date(o.createdAt*1e3).toISOString():o.created_at??"",earliest_expiry:(l=o.attestations)!=null&&l.length?new Date(Math.min(...o.attestations.map(c=>c.expiresAt))*1e3).toISOString():null,remaining_seconds:(u=o.attestations)!=null&&u.length?Math.max(0,Math.min(...o.attestations.map(c=>c.expiresAt))-Math.floor(Date.now()/1e3)):null,owner:a}})}async listTeamReceipts(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/receipts`);if(!n.ok)throw new Error(`Failed to fetch team receipts: ${n.status}`);return(await n.json()).receipts??[]}async getThread(t){const n=t.sinceDays??7,r=t.status??"pending",o=t.domain||"owner",a=await this.getProposals(o);let i=[];if(r==="all"){const l=[],u=new Date;for(let h=0;h<n;h++){const p=new Date(u);p.setUTCDate(u.getUTCDate()-h),l.push(p.toISOString().slice(0,10))}i=(await Promise.all(l.map(h=>this.getMyReceipts({date:h,profile:t.profile})))).flat()}return{proposals:a,receipts:i}}async getGateContent(t){const n=await this.fetch(`/gate-content?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch gate content: ${n.status}`);return(await n.json()).entry??null}async pushGateContent(t){const n=await this.fetch("/gate-content",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to push gate content"}));throw new Error(r.error||`Push gate content failed: ${n.status}`)}}async getAgentContext(){const t=await this.fetch("/agent-brief/context");if(!t.ok)throw new Error(`Failed to fetch agent context: ${t.status}`);return(await t.json()).content}async saveAgentContext(t){const n=await this.fetch("/agent-brief/context",{method:"PUT",body:JSON.stringify({content:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to save agent context"}));throw new Error(r.error||`Save failed: ${n.status}`)}}async aiChat(t){const n=await this.fetch("/ai/chat",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI chat failed"}))).error||`Chat failed: ${n.status}`}}async getAIPrompts(){const t=await this.fetch("/ai-prompts");if(!t.ok)throw new Error(`Failed to load AI prompts: ${t.status}`);return t.json()}async setAIPrompt(t,n){const r=await this.fetch(`/ai-prompts/${t}`,{method:"PUT",body:JSON.stringify({value:n})});if(!r.ok){const o=await r.json().catch(()=>({error:"Save failed"}));throw new Error(o.error||`Save failed: ${r.status}`)}}}const O=new Lg,mf=d.createContext(null);function Mg({children:e}){const[t,n]=d.useState(null),[r,o]=d.useState("personal"),[a,i]=d.useState(null),[l,u]=d.useState(""),[c,h]=d.useState(null),[p,g]=d.useState(null),[y,x]=d.useState(!1),[w,j]=d.useState(""),m=d.useRef(!1),f=d.useRef(null),v=d.useCallback(async()=>{if(m.current)try{const N=await O.getMyTeam();if(N){const{group:C,membership:I}=N;h(C),g(I),o("team"),i(C);const M=f.current??I.domains[0]??"owner";u(M)}else h(null),g(null),o("personal")}catch{}},[]);d.useEffect(()=>{const N=()=>{document.visibilityState==="visible"&&v()};return document.addEventListener("visibilitychange",N),()=>document.removeEventListener("visibilitychange",N)},[v]);const S=d.useCallback(async(N,C={})=>{x(!0),j("");try{O.setApiKey(N),m.current=!0;const I=await O.login(N,C);n(I),f.current=I.id;const M=await O.getGroups(),B=M.find(A=>A.isPersonal)??M[0]??null;i(B),u("owner"),await v()}catch(I){throw O.clearApiKey(),m.current=!1,j(I instanceof Error?I.message:"Login failed"),I}finally{x(!1)}},[v]),b=d.useCallback(async()=>{await O.logout(),O.clearApiKey(),m.current=!1,f.current=null,n(null),i(null),u(""),h(null),g(null),o("personal"),j("")},[]),T=d.useCallback(()=>j(""),[]),k=d.useCallback((N,C)=>{i(N),u(C)},[]);return s.jsx(mf.Provider,{value:{user:t,mode:r,group:a,domain:l,groupId:(a==null?void 0:a.id)??null,activeTeam:c,activeMembership:p,isLoading:y,error:w,login:S,logout:b,clearError:T,activeGroup:a,activeDomain:l,groups:a?[a]:[],setActiveContext:k,refreshGroups:v},children:e})}function ke(){const e=d.useContext(mf);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const hf=d.createContext(null);function Fg({children:e}){const{user:t}=ke(),n=d.useRef(null),[r,o]=d.useState(!1),a=d.useRef(new Map),i=d.useCallback((l,u)=>{const c=a.current;return c.has(l)||c.set(l,new Set),c.get(l).add(u),()=>{var h;(h=c.get(l))==null||h.delete(u)}},[]);return d.useEffect(()=>{if(!t){n.current&&(n.current.close(),n.current=null,o(!1));return}if(n.current)return;const l=O.getApiKey();if(!l)return;const u=new EventSource(`/events?key=${encodeURIComponent(l)}`);n.current=u,u.onopen=()=>o(!0),u.onerror=()=>o(!1);const c=["integration-changed","attestation-changed","proposal-added","proposal-resolved","team-membership-changed","action-approval-needed","action-resolved","proposal-approved","proposal-rejected"];for(const h of c)u.addEventListener(h,p=>{let g;try{g=JSON.parse(p.data)}catch{g=null}const y=a.current.get(h);if(y)for(const x of y)try{x(g)}catch(w){console.error(`[EventSource] handler for "${h}" threw:`,w)}});return()=>{u.close(),n.current=null,o(!1)}},[t]),s.jsx(hf.Provider,{value:{connected:r,addListener:i},children:e})}function ue(e,t){const n=d.useContext(hf);if(!n)return;const{addListener:r}=n;d.useEffect(()=>r(e,t),[e,t,r])}function xo(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function gf(){const[e,t]=d.useState(()=>{const a=localStorage.getItem("hap-theme");return a==="light"||a==="dark"?a:"system"}),[n,r]=d.useState(()=>xo(e));d.useEffect(()=>{const a=document.documentElement,i=xo(e);a.setAttribute("data-theme",i),e==="system"?localStorage.removeItem("hap-theme"):localStorage.setItem("hap-theme",e),r(xo(e))},[e]),d.useEffect(()=>{if(e!=="system")return;const a=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>r(xo("system"));return a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[e]);const o=d.useCallback(()=>{t(a=>a==="system"?"light":a==="light"?"dark":"system")},[]);return{theme:e,effectiveTheme:n,toggle:o}}const Og=5*60*1e3;function vf(){const[e,t]=d.useState(!1),[n,r]=d.useState("docker"),[o,a]=d.useState(""),[i,l]=d.useState(!1);return d.useEffect(()=>{const u=(h=!1)=>{fetch(h?"/health?refresh=1":"/health").then(p=>p.json()).then(p=>{p.updateAvailable&&t(!0),p.installMethod&&r(p.installMethod),p.version&&a(p.version)}).catch(()=>{})};u(!0);const c=setInterval(()=>u(!1),Og);return()=>clearInterval(c)},[]),{updateAvailable:e&&!i,installMethod:n,version:o,dismiss:()=>l(!0)}}function Bg(e){return e?e==="dev"?"dev":/^[0-9a-f]{40}$/i.test(e)?e.slice(0,7):e:""}const ku={system:"◑",light:"☀",dark:"☾"};function Dg(){const{mode:e,group:t,domain:n}=ke();return e==="personal"?s.jsx("span",{children:"personal"}):t?s.jsxs("span",{children:[t.name," / ",n]}):s.jsx("span",{children:n})}function al({onMenuToggle:e}){const{user:t,logout:n}=ke(),{theme:r,toggle:o}=gf(),{version:a}=vf(),i=Bg(a);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(Dg,{})]}),s.jsx("button",{className:"theme-toggle",onClick:o,title:`Theme: ${r}`,children:ku[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:o,title:`Theme: ${r}`,children:ku[r]})]})}),t&&e&&s.jsx("button",{className:"mobile-menu-btn",onClick:e,"aria-label":"Menu",children:"☰"})]})})}function jt(e,t){var n;return(n=t==null?void 0:t.revokedSet)!=null&&n.has(e.frame_hash)||e.sp_status==="revoked"?"revoked":e.sp_status==="expired"||e.remaining_seconds===null||e.remaining_seconds<=0?"expired":e.missing_domains.length>0?"pending":"active"}function yf(e,t){const n={active:[],pending:[],expired:[],revoked:[]};for(const r of e)n[jt(r,t)].push(r);return n}function At(e,t,n){const r=d.useRef(e);r.current=e,d.useEffect(()=>{let o=null;const a=()=>typeof document>"u"?!0:document.visibilityState==="visible",i=()=>{a()&&r.current()},l=()=>{o===null&&(o=setInterval(i,t))},u=()=>{o!==null&&(clearInterval(o),o=null)},c=()=>{a()?(r.current(),l()):u()};return a()&&(r.current(),l()),document.addEventListener("visibilitychange",c),()=>{u(),document.removeEventListener("visibilitychange",c)}},[t,n])}const xf=d.createContext(null),Ug=3e4;function Wg({children:e}){const[t,n]=d.useState({manifests:[],integrations:[],activeSessions:0,mcpServerUp:null,fetchCount:0}),r=d.useRef(null),o=d.useCallback(async()=>{const[u,c]=await Promise.all([O.getIntegrationManifests().catch(()=>({manifests:[]})),O.getMcpHealth().catch(()=>null)]);n(h=>({manifests:u.manifests,integrations:(c==null?void 0:c.integrations)??h.integrations,activeSessions:(c==null?void 0:c.activeSessions)??h.activeSessions,mcpServerUp:!!c,fetchCount:h.fetchCount+1}))},[]);ue("integration-changed",o),At(o,3e5);const a=d.useMemo(()=>{const u=new Map(t.integrations.map(g=>[g.id,g])),c=Date.now(),h=t.fetchCount>0&&t.manifests.some(g=>{const y=u.get(g.id);return y&&!y.running});h&&r.current===null?r.current=c:h||(r.current=null);const p=r.current!==null&&c-r.current<Ug;return t.manifests.map(g=>{const y=u.get(g.id);let x;return t.fetchCount===0?x="loading":y!=null&&y.running?x="running":y!=null&&y.error?x="error":y&&p?x="starting":x="not-running",{id:g.id,manifest:g,integration:y,state:x}})},[t]),i=d.useMemo(()=>a.filter(u=>u.state==="not-running"||u.state==="error").length,[a]),l={loading:t.fetchCount===0,mcpServerUp:t.mcpServerUp,entries:a,attentionCount:i,activeSessions:t.activeSessions,refresh:o};return s.jsx(xf.Provider,{value:l,children:e})}function sl(){const e=d.useContext(xf);if(!e)throw new Error("useIntegrationStatus must be used inside IntegrationStatusProvider");return e}const Hg=[{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 Vg(){const{activeDomain:e}=ke(),[t,n]=d.useState({}),r=d.useCallback(async()=>{try{const[o,a,i,l,u]=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(()=>"")]),c={};if(o&&!o.configured&&(c.assistant=1),a){const y=yf(a).expired.length;y>0&&(c.authorizations=y)}const h=(i==null?void 0:i.length)??0,p=(l==null?void 0:l.length)??0,g=h+p;g>0&&(c.proposals=g),(!u||!u.trim())&&(c.brief=1),n(c)}catch{}},[e]);return ue("attestation-changed",r),ue("proposal-added",r),ue("proposal-resolved",r),ue("proposal-approved",r),ue("proposal-rejected",r),ue("team-membership-changed",r),At(r,3e5,e),t}const Kg={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},Gg={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 Qg(){const{mode:e,group:t,domain:n,activeTeam:r}=ke(),o=Vg(),{attentionCount:a}=sl(),i={...o};a>0&&(i.integrations=a);const l=Hg.filter(g=>!g.teamOnly||e==="team"),u=d.useRef(null),[c,h]=d.useState(null),p=lt();return d.useEffect(()=>{if(u.current===null){u.current=e;return}u.current!==e&&(e==="team"&&r?h(`You are now acting in team context — ${r.name}`):e==="personal"&&h("You have left the team — back to personal context"),u.current=e)},[e,r]),d.useEffect(()=>{h(null)},[p.pathname]),s.jsxs("div",{className:"sidebar",children:[s.jsx("ul",{className:"sidebar-nav",children:l.map(g=>{const y=g.statusKey?i[g.statusKey]:0;return s.jsx("li",{children:s.jsxs(ol,{to:g.to,end:g.to==="/",className:({isActive:x})=>`sidebar-item${x?" active":""}`,children:[s.jsx("span",{className:"icon",children:g.icon}),g.label,y?s.jsx("span",{style:Kg,children:y}):null]})},g.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})]}),c&&s.jsx("div",{style:Gg,role:"status","aria-live":"polite",children:c})]})}function Yg(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 Jg(){const{updateAvailable:e,installMethod:t}=vf(),n=Yg(t),r=e,[o,a]=d.useState(!1),[i,l]=d.useState(!1),u=d.useRef(null);if(d.useEffect(()=>{if(!r){document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner");return}document.body.classList.add("has-update-banner");const h=()=>{var y;const g=((y=u.current)==null?void 0:y.offsetHeight)??0;document.documentElement.style.setProperty("--update-banner-h",`${g}px`)};h();const p=new ResizeObserver(h);return u.current&&p.observe(u.current),()=>{p.disconnect(),document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner")}},[r,o]),!r)return null;const c=async()=>{try{await navigator.clipboard.writeText(n),l(!0),setTimeout(()=>l(!1),1800)}catch{}};return s.jsxs("div",{ref:u,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.jsx("button",{type:"button",className:`btn btn-sm ${o?"btn-secondary":"btn-primary"}`,onClick:()=>a(h=>!h),children:o?"Hide":"Update"})]}),o&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"update-banner-hint",children:"Paste this into your terminal (Terminal on macOS/Linux, PowerShell on Windows) to update:"}),s.jsxs("div",{className:"update-banner-row update-banner-cmd-row",children:[s.jsx("code",{className:"update-banner-cmd",children:n}),s.jsx("button",{type:"button",className:"btn btn-sm btn-primary",onClick:c,children:i?"Copied":"Copy Command"})]})]})]})}const Xg={system:"◑",light:"☀",dark:"☾"},qg=[{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 Zg({open:e,onClose:t}){const{user:n,activeGroup:r,activeDomain:o,logout:a}=ke(),{theme:i,toggle:l}=gf(),u=lt();return d.useEffect(()=>{t()},[u.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} / ${o}`:o||"personal"})]}),s.jsx("nav",{className:"mobile-menu-nav",children:qg.map(c=>s.jsxs(ol,{to:c.to,end:c.to==="/",className:({isActive:h})=>`mobile-menu-item${h?" active":""}`,onClick:t,children:[s.jsx("span",{className:"icon",children:c.icon}),c.label]},c.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:Xg[i]}),"Theme: ",i]}),s.jsx("button",{className:"mobile-menu-action",onClick:()=>{a(),t()},children:"Logout"})]})]})]}):null}function ev(){const[e,t]=d.useState(!1);return s.jsxs(Wg,{children:[s.jsx(al,{onMenuToggle:()=>t(!e)}),s.jsx(Jg,{}),s.jsx(Qg,{}),s.jsx(Zg,{open:e,onClose:()=>t(!1)}),s.jsx("div",{className:"main-content",children:s.jsx("div",{className:"page-inner",children:s.jsx(eg,{})})})]})}function tv(){const[e,t]=d.useState(""),{login:n,isLoading:r,error:o,clearError:a}=ke(),i=bt(),[l,u]=d.useState(null),c=async()=>{if(e.trim()){a();try{await n(e),i("/")}catch(g){if(g instanceof pf){u(g.summary);return}}}},h=async()=>{u(null),a();try{await n(e,{confirmWipe:!0}),i("/")}catch{}},p=()=>{u(null)};return s.jsxs(s.Fragment,{children:[s.jsx(al,{}),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."})]}),o&&s.jsx("div",{className:"error-message",children:o}),s.jsxs("div",{className:"form-group",style:{marginBottom:"1.5rem"},children:[s.jsx("label",{className:"form-label",children:"API Key"}),s.jsx("input",{className:"form-input",type:"password",placeholder:"hap_sk_...",value:e,onChange:g=>t(g.target.value),onKeyDown:g=>g.key==="Enter"&&c(),disabled:r,style:{padding:"0.75rem"}}),s.jsx("div",{className:"form-hint",children:"From your Suveren account."})]}),s.jsx("button",{className:"btn btn-primary btn-full btn-lg",onClick:c,disabled:r,style:{marginBottom:"2rem"},children:r?"Signing in...":"Sign In"}),s.jsx("div",{className:"login-divider",children:"New here?"}),s.jsxs("div",{style:{textAlign:"center",marginBottom:"2.5rem"},children:[s.jsxs("p",{style:{fontSize:"0.9rem",color:"var(--text-secondary)",marginBottom:"1rem",lineHeight:1.5},children:["Create an account on Suveren,",s.jsx("br",{}),"then come back to sign in."]}),s.jsx("a",{href:"https://www.suveren.ai/get-started",target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary btn-full",style:{textDecoration:"none"},children:"Create Account"})]}),s.jsxs("div",{style:{paddingTop:"1.75rem",borderTop:"1px solid var(--border)"},children:[s.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:"var(--text-tertiary)",marginBottom:"0.875rem"},children:"Getting started"}),s.jsx("div",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",lineHeight:1.8},children:[s.jsxs(s.Fragment,{children:["Create an account at ",s.jsx("a",{href:"https://www.suveren.ai/get-started",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)"},children:"Suveren"})]}),"Join or create a team to get domain authority","Sign in here with your API key to start authorizing agents"].map((g,y)=>s.jsxs("div",{style:{display:"flex",gap:"0.625rem",alignItems:"baseline",marginBottom:y<2?"0.5rem":0},children:[s.jsxs("span",{style:{color:"var(--accent)",fontWeight:700,fontSize:"0.95rem"},children:[y+1,"."]}),g]},y))})]})]})})]}),l&&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:g=>g.stopPropagation(),style:{maxWidth:520,width:"100%",margin:0},children:[s.jsx("h3",{id:"wipe-warning-title",className:"card-title",style:{marginBottom:"0.5rem"},children:"Sign in with a different account?"}),s.jsxs("p",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["This gateway already holds data for another account. Signing in with this API key will ",s.jsx("strong",{children:"permanently wipe"})," the following local data:"]}),s.jsxs("ul",{style:{fontSize:"0.875rem",color:"var(--text-secondary)",marginBottom:"1rem",paddingLeft:"1.25rem",lineHeight:1.6},children:[s.jsxs("li",{children:[l.credentialCount," stored service credential",l.credentialCount===1?"":"s",l.credentialIds.length>0&&s.jsxs("span",{style:{color:"var(--text-tertiary)",fontSize:"0.825rem"},children:[" ","(",l.credentialIds.slice(0,5).join(", "),l.credentialIds.length>5?`, +${l.credentialIds.length-5} more`:"",")"]})]}),s.jsxs("li",{children:[l.serviceCount," configured integration",l.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:h,disabled:r,children:r?"Signing in...":"Wipe local data and sign in"})]})]})})]})}function nv(){const{setActiveContext:e}=ke(),t=bt(),[n,r]=d.useState(""),[o,a]=d.useState(""),[i,l]=d.useState(""),[u,c]=d.useState(!1),h=async()=>{if(n.trim()){c(!0),l("");try{const g=await O.joinGroup(n.trim());e(g,g.myDomains[0]||""),t("/")}catch(g){l(g instanceof Error?g.message:"Failed to join group")}finally{c(!1)}}},p=async()=>{if(o.trim()){c(!0),l("");try{const g=await O.createGroup(o.trim());e(g,g.myDomains[0]||""),t("/")}catch(g){l(g instanceof Error?g.message:"Failed to create group")}finally{c(!1)}}};return s.jsxs(s.Fragment,{children:[s.jsx(al,{}),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:g=>r(g.target.value),onKeyDown:g=>g.key==="Enter"&&h(),style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem"},disabled:u}),s.jsx("button",{className:"btn btn-primary",onClick:h,disabled:u,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:o,onChange:g=>a(g.target.value),onKeyDown:g=>g.key==="Enter"&&p(),style:{flex:1},disabled:u}),s.jsx("button",{className:"btn btn-secondary",onClick:p,disabled:u,children:"Create"})]})]})]})})]})}const Cu="hap-setup-ai-skipped",Nu="hap-setup-agent-done",Eu="hap-setup-dismissed",os={"claude-code":{label:"Claude Code",snippet:e=>JSON.stringify({mcpServers:{hap:{url:`${e}/sse`}}},null,2)},"claude-desktop":{label:"Claude Desktop",snippet:e=>`Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
51
+ Please change the parent <Route path="${m}"> to <Route path="${m==="/"?"*":`${m}/*`}">.`)}let h=lt(),f;if(t){let m=typeof t=="string"?nr(t):t;ie(u==="/"||((j=m.pathname)==null?void 0:j.startsWith(u)),`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 "${u}" but pathname "${m.pathname}" was given in the \`location\` prop.`),f=m}else f=h;let g=f.pathname||"/",y=g;if(u!=="/"){let m=u.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(m.length).join("/")}let x=Jd(e,{pathname:y});it(c||x!=null,`No routes matched location "${f.pathname}${f.search}${f.hash}" `),it(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=Qh(x&&x.map(m=>Object.assign({},m,{params:Object.assign({},i,m.params),pathname:Et([u,r.encodeLocation?r.encodeLocation(m.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathname]),pathnameBase:m.pathnameBase==="/"?u:Et([u,r.encodeLocation?r.encodeLocation(m.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:m.pathnameBase])})),o,n);return t&&w?d.createElement(qr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...f},navigationType:"POP"}},w):w}function Hh(){let e=Zh(),t=Th(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},a={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:a},"ErrorBoundary")," or"," ",d.createElement("code",{style:a},"errorElement")," prop on your route.")),d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},t),n?d.createElement("pre",{style:o},n):null,i)}var Vh=d.createElement(Hh,null),lf=class extends d.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=Fh(e.digest);n&&(e=n)}let t=e!==void 0?d.createElement(vt.Provider,{value:this.props.routeContext},d.createElement(rl.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?d.createElement(Kh,{error:e},t):t}};lf.contextType=Rh;var rs=new WeakMap;function Kh({children:e,error:t}){let{basename:n}=d.useContext(qe);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let r=Mh(t.digest);if(r){let o=rs.get(t);if(o)throw o;let a=ef(r.location,n);if(Zd&&!rs.get(t))if(a.isExternal||r.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const i=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:r.replace}));throw rs.set(t,i),i}return d.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return e}function Gh({routeContext:e,match:t,children:n}){let r=d.useContext(rr);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(vt.Provider,{value:e},n)}function Qh(e,t=[],n){let r=n==null?void 0:n.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,a=r==null?void 0:r.errors;if(a!=null){let h=o.findIndex(f=>f.route.id&&(a==null?void 0:a[f.route.id])!==void 0);ie(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),o=o.slice(0,Math.min(o.length,h+1))}let i=!1,l=-1;if(n&&r){i=r.renderFallback;for(let h=0;h<o.length;h++){let f=o[h];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(l=h),f.route.id){let{loaderData:g,errors:y}=r,x=f.route.loader&&!g.hasOwnProperty(f.route.id)&&(!y||y[f.route.id]===void 0);if(f.route.lazy||x){n.isStatic&&(i=!0),l>=0?o=o.slice(0,l+1):o=[o[0]];break}}}}let u=n==null?void 0:n.onError,c=r&&u?(h,f)=>{var g,y;u(h,{location:r.location,params:((y=(g=r.matches)==null?void 0:g[0])==null?void 0:y.params)??{},unstable_pattern:Ih(r.matches),errorInfo:f})}:void 0;return o.reduceRight((h,f,g)=>{let y,x=!1,w=null,j=null;r&&(y=a&&f.route.id?a[f.route.id]:void 0,w=f.route.errorElement||Vh,i&&(l<0&&g===0?(uf("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,j=null):l===g&&(x=!0,j=f.route.hydrateFallbackElement||null)));let m=t.concat(o.slice(0,g+1)),p=()=>{let v;return y?v=w:x?v=j:f.route.Component?v=d.createElement(f.route.Component,null):f.route.element?v=f.route.element:v=h,d.createElement(Gh,{match:f,routeContext:{outlet:h,matches:m,isDataRoute:r!=null},children:v})};return r&&(f.route.ErrorBoundary||f.route.errorElement||g===0)?d.createElement(lf,{location:r.location,revalidation:r.revalidation,component:w,error:y,children:p(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:c}):p()},null)}function ol(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Yh(e){let t=d.useContext(rr);return ie(t,ol(e)),t}function Jh(e){let t=d.useContext(ba);return ie(t,ol(e)),t}function Xh(e){let t=d.useContext(vt);return ie(t,ol(e)),t}function al(e){let t=Xh(e),n=t.matches[t.matches.length-1];return ie(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function qh(){return al("useRouteId")}function Zh(){var r;let e=d.useContext(rl),t=Jh("useRouteError"),n=al("useRouteError");return e!==void 0?e:(r=t.errors)==null?void 0:r[n]}function eg(){let{router:e}=Yh("useNavigate"),t=al("useNavigate"),n=d.useRef(!1);return af(()=>{n.current=!0}),d.useCallback(async(o,a={})=>{it(n.current,of),n.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...a}))},[e,t])}var Nu={};function uf(e,t,n){!t&&!Nu[e]&&(Nu[e]=!0,it(!1,n))}d.memo(tg);function tg({routes:e,future:t,state:n,isStatic:r,onError:o}){return sf(e,void 0,{state:n,isStatic:r,onError:o})}function Vt({to:e,replace:t,state:n,relative:r}){ie(or(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=d.useContext(qe);it(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=d.useContext(vt),{pathname:i}=lt(),l=Dt(),u=Ea(e,nl(a),i,r==="path"),c=JSON.stringify(u);return d.useEffect(()=>{l(JSON.parse(c),{replace:t,state:n,relative:r})},[l,c,r,t,n]),null}function ng(e){return Uh(e.context)}function we(e){ie(!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 rg({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:a=!1,unstable_useTransitions:i}){ie(!or(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),u=d.useMemo(()=>({basename:l,navigator:o,static:a,unstable_useTransitions:i,future:{}}),[l,o,a,i]);typeof n=="string"&&(n=nr(n));let{pathname:c="/",search:h="",hash:f="",state:g=null,key:y="default",unstable_mask:x}=n,w=d.useMemo(()=>{let j=Ot(c,l);return j==null?null:{location:{pathname:j,search:h,hash:f,state:g,key:y,unstable_mask:x},navigationType:r}},[l,c,h,f,g,y,r,x]);return it(w!=null,`<Router basename="${l}"> is not able to match the URL "${c}${h}${f}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:d.createElement(qe.Provider,{value:u},d.createElement(qr.Provider,{children:t,value:w}))}function og({children:e,location:t}){return Wh(ti(e),t)}function ti(e,t=[]){let n=[];return d.Children.forEach(e,(r,o)=>{if(!d.isValidElement(r))return;let a=[...t,o];if(r.type===d.Fragment){n.push.apply(n,ti(r.props.children,a));return}ie(r.type===we,`[${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>`),ie(!r.props.index||!r.props.children,"An index route cannot have child routes.");let i={id:r.props.id||a.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(i.children=ti(r.props.children,a)),n.push(i)}),n}var Ao="get",$o="application/x-www-form-urlencoded";function Pa(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function ag(e){return Pa(e)&&e.tagName.toLowerCase()==="button"}function sg(e){return Pa(e)&&e.tagName.toLowerCase()==="form"}function ig(e){return Pa(e)&&e.tagName.toLowerCase()==="input"}function lg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function ug(e,t){return e.button===0&&(!t||t==="_self")&&!lg(e)}function ni(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function cg(e,t){let n=ni(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(a=>{n.append(o,a)})}),n}var xo=null;function dg(){if(xo===null)try{new FormData(document.createElement("form"),0),xo=!1}catch{xo=!0}return xo}var fg=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function os(e){return e!=null&&!fg.has(e)?(it(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${$o}"`),null):e}function pg(e,t){let n,r,o,a,i;if(sg(e)){let l=e.getAttribute("action");r=l?Ot(l,t):null,n=e.getAttribute("method")||Ao,o=os(e.getAttribute("enctype"))||$o,a=new FormData(e)}else if(ag(e)||ig(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 u=e.getAttribute("formaction")||l.getAttribute("action");if(r=u?Ot(u,t):null,n=e.getAttribute("formmethod")||l.getAttribute("method")||Ao,o=os(e.getAttribute("formenctype"))||os(l.getAttribute("enctype"))||$o,a=new FormData(l,e),!dg()){let{name:c,type:h,value:f}=e;if(h==="image"){let g=c?`${c}.`:"";a.append(`${g}x`,"0"),a.append(`${g}y`,"0")}else c&&a.append(c,f)}}else{if(Pa(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Ao,r=null,o=$o,i=e}return a&&o==="text/plain"&&(i=a,a=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:a,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function sl(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function mg(e,t,n,r){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${r}`:o.pathname=`${o.pathname}.${r}`:o.pathname==="/"?o.pathname=`_root.${r}`:t&&Ot(o.pathname,t)==="/"?o.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:o.pathname=`${o.pathname.replace(/\/$/,"")}.${r}`,o}async function hg(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 gg(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function vg(e,t,n){let r=await Promise.all(e.map(async o=>{let a=t.routes[o.route.id];if(a){let i=await hg(a,n);return i.links?i.links():[]}return[]}));return Sg(r.flat(1).filter(gg).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Eu(e,t,n,r,o,a){let i=(u,c)=>n[c]?u.route.id!==n[c].route.id:!0,l=(u,c)=>{var h;return n[c].pathname!==u.pathname||((h=n[c].route.path)==null?void 0:h.endsWith("*"))&&n[c].params["*"]!==u.params["*"]};return a==="assets"?t.filter((u,c)=>i(u,c)||l(u,c)):a==="data"?t.filter((u,c)=>{var f;let h=r.routes[u.route.id];if(!h||!h.hasLoader)return!1;if(i(u,c)||l(u,c))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:((f=n[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function yg(e,t,{includeHydrateFallback:n}={}){return xg(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let a=[o.module];return o.clientActionModule&&(a=a.concat(o.clientActionModule)),o.clientLoaderModule&&(a=a.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(a=a.concat(o.hydrateFallbackModule)),o.imports&&(a=a.concat(o.imports)),a}).flat(1))}function xg(e){return[...new Set(e)]}function wg(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Sg(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let a=JSON.stringify(wg(o));return n.has(a)||(n.add(a),r.push({key:a,link:o})),r},[])}function cf(){let e=d.useContext(rr);return sl(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function jg(){let e=d.useContext(ba);return sl(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var il=d.createContext(void 0);il.displayName="FrameworkContext";function df(){let e=d.useContext(il);return sl(e,"You must render this element inside a <HydratedRouter> element"),e}function kg(e,t){let n=d.useContext(il),[r,o]=d.useState(!1),[a,i]=d.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:c,onMouseLeave:h,onTouchStart:f}=t,g=d.useRef(null);d.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let w=m=>{m.forEach(p=>{i(p.isIntersecting)})},j=new IntersectionObserver(w,{threshold:.5});return g.current&&j.observe(g.current),()=>{j.disconnect()}}},[e]),d.useEffect(()=>{if(r){let w=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(w)}}},[r]);let y=()=>{o(!0)},x=()=>{o(!1),i(!1)};return n?e!=="intent"?[a,g,{}]:[a,g,{onFocus:pr(l,y),onBlur:pr(u,x),onMouseEnter:pr(c,y),onMouseLeave:pr(h,x),onTouchStart:pr(f,y)}]:[!1,g,{}]}function pr(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Cg({page:e,...t}){let{router:n}=cf(),r=d.useMemo(()=>Jd(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?d.createElement(Eg,{page:e,matches:r,...t}):null}function Ng(e){let{manifest:t,routeModules:n}=df(),[r,o]=d.useState([]);return d.useEffect(()=>{let a=!1;return vg(e,t,n).then(i=>{a||o(i)}),()=>{a=!0}},[e,t,n]),r}function Eg({page:e,matches:t,...n}){let r=lt(),{future:o,manifest:a,routeModules:i}=df(),{basename:l}=cf(),{loaderData:u,matches:c}=jg(),h=d.useMemo(()=>Eu(e,t,c,a,r,"data"),[e,t,c,a,r]),f=d.useMemo(()=>Eu(e,t,c,a,r,"assets"),[e,t,c,a,r]),g=d.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,j=!1;if(t.forEach(p=>{var S;let v=a.routes[p.route.id];!v||!v.hasLoader||(!h.some(b=>b.route.id===p.route.id)&&p.route.id in u&&((S=i[p.route.id])!=null&&S.shouldRevalidate)||v.hasClientLoader?j=!0:w.add(p.route.id))}),w.size===0)return[];let m=mg(e,l,o.unstable_trailingSlashAwareDataRequests,"data");return j&&w.size>0&&m.searchParams.set("_routes",t.filter(p=>w.has(p.route.id)).map(p=>p.route.id).join(",")),[m.pathname+m.search]},[l,o.unstable_trailingSlashAwareDataRequests,u,r,a,h,t,e,i]),y=d.useMemo(()=>yg(f,a),[f,a]),x=Ng(f);return d.createElement(d.Fragment,null,g.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 bg(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var Pg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Pg&&(window.__reactRouterVersion="7.13.1")}catch{}function Tg({basename:e,children:t,unstable_useTransitions:n,window:r}){let o=d.useRef();o.current==null&&(o.current=ah({window:r,v5Compat:!0}));let a=o.current,[i,l]=d.useState({action:a.action,location:a.location}),u=d.useCallback(c=>{n===!1?l(c):d.startTransition(()=>l(c))},[n]);return d.useLayoutEffect(()=>a.listen(u),[a,u]),d.createElement(rg,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:a,unstable_useTransitions:n})}var ff=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,nt=d.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:a,replace:i,unstable_mask:l,state:u,target:c,to:h,preventScrollReset:f,viewTransition:g,unstable_defaultShouldRevalidate:y,...x},w){let{basename:j,navigator:m,unstable_useTransitions:p}=d.useContext(qe),v=typeof h=="string"&&ff.test(h),S=ef(h,j);h=S.to;let b=Oh(h,{relative:o}),T=lt(),k=null;if(l){let _=Ea(l,[],T.unstable_mask?T.unstable_mask.pathname:"/",!0);j!=="/"&&(_.pathname=_.pathname==="/"?j:Et([j,_.pathname])),k=m.createHref(_)}let[N,C,I]=kg(r,x),M=Rg(h,{replace:i,unstable_mask:l,state:u,target:c,preventScrollReset:f,relative:o,viewTransition:g,unstable_defaultShouldRevalidate:y,unstable_useTransitions:p});function B(_){t&&t(_),_.defaultPrevented||M(_)}let A=!(S.isExternal||a),z=d.createElement("a",{...x,...I,href:(A?k:void 0)||S.absoluteURL||b,onClick:A?B:t,ref:bg(w,C),target:c,"data-discover":!v&&n==="render"?"true":void 0});return N&&!v?d.createElement(d.Fragment,null,z,d.createElement(Cg,{page:b})):z});nt.displayName="Link";var ll=d.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:a,to:i,viewTransition:l,children:u,...c},h){let f=Zr(i,{relative:c.relative}),g=lt(),y=d.useContext(ba),{navigator:x,basename:w}=d.useContext(qe),j=y!=null&&Mg(f)&&l===!0,m=x.encodeLocation?x.encodeLocation(f).pathname:f.pathname,p=g.pathname,v=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(p=p.toLowerCase(),v=v?v.toLowerCase():null,m=m.toLowerCase()),v&&w&&(v=Ot(v,w)||v);const S=m!=="/"&&m.endsWith("/")?m.length-1:m.length;let b=p===m||!o&&p.startsWith(m)&&p.charAt(S)==="/",T=v!=null&&(v===m||!o&&v.startsWith(m)&&v.charAt(m.length)==="/"),k={isActive:b,isPending:T,isTransitioning:j},N=b?t:void 0,C;typeof r=="function"?C=r(k):C=[r,b?"active":null,T?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let I=typeof a=="function"?a(k):a;return d.createElement(nt,{...c,"aria-current":N,className:C,ref:h,style:I,to:i,viewTransition:l},typeof u=="function"?u(k):u)});ll.displayName="NavLink";var Ig=d.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:a,method:i=Ao,action:l,onSubmit:u,relative:c,preventScrollReset:h,viewTransition:f,unstable_defaultShouldRevalidate:g,...y},x)=>{let{unstable_useTransitions:w}=d.useContext(qe),j=$g(),m=Lg(l,{relative:c}),p=i.toLowerCase()==="get"?"get":"post",v=typeof l=="string"&&ff.test(l),S=b=>{if(u&&u(b),b.defaultPrevented)return;b.preventDefault();let T=b.nativeEvent.submitter,k=(T==null?void 0:T.getAttribute("formmethod"))||i,N=()=>j(T||b.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:o,state:a,relative:c,preventScrollReset:h,viewTransition:f,unstable_defaultShouldRevalidate:g});w&&n!==!1?d.startTransition(()=>N()):N()};return d.createElement("form",{ref:x,method:p,action:m,onSubmit:r?u:S,...y,"data-discover":!v&&e==="render"?"true":void 0})});Ig.displayName="Form";function _g(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pf(e){let t=d.useContext(rr);return ie(t,_g(e)),t}function Rg(e,{target:t,replace:n,unstable_mask:r,state:o,preventScrollReset:a,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:u,unstable_useTransitions:c}={}){let h=Dt(),f=lt(),g=Zr(e,{relative:i});return d.useCallback(y=>{if(ug(y,t)){y.preventDefault();let x=n!==void 0?n:Kr(f)===Kr(g),w=()=>h(e,{replace:x,unstable_mask:r,state:o,preventScrollReset:a,relative:i,viewTransition:l,unstable_defaultShouldRevalidate:u});c?d.startTransition(()=>w()):w()}},[f,h,g,n,r,o,t,e,a,i,l,u,c])}function mf(e){it(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=d.useRef(ni(e)),n=d.useRef(!1),r=lt(),o=d.useMemo(()=>cg(r.search,n.current?null:t.current),[r.search]),a=Dt(),i=d.useCallback((l,u)=>{const c=ni(typeof l=="function"?l(new URLSearchParams(o)):l);n.current=!0,a("?"+c,u)},[a,o]);return[o,i]}var zg=0,Ag=()=>`__${String(++zg)}__`;function $g(){let{router:e}=pf("useSubmit"),{basename:t}=d.useContext(qe),n=qh(),r=e.fetch,o=e.navigate;return d.useCallback(async(a,i={})=>{let{action:l,method:u,encType:c,formData:h,body:f}=pg(a,t);if(i.navigate===!1){let g=i.fetcherKey||Ag();await r(g,n,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:f,formMethod:i.method||u,formEncType:i.encType||c,flushSync:i.flushSync})}else await o(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:f,formMethod:i.method||u,formEncType:i.encType||c,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[r,o,t,n])}function Lg(e,{relative:t}={}){let{basename:n}=d.useContext(qe),r=d.useContext(vt);ie(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),a={...Zr(e||".",{relative:t})},i=lt();if(e==null){a.search=i.search;let l=new URLSearchParams(a.search),u=l.getAll("index");if(u.some(h=>h==="")){l.delete("index"),u.filter(f=>f).forEach(f=>l.append("index",f));let h=l.toString();a.search=h?`?${h}`:""}}return(!e||e===".")&&o.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:Et([n,a.pathname])),Kr(a)}function Mg(e,{relative:t}={}){let n=d.useContext(nf);ie(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=pf("useViewTransitionState"),o=Zr(e,{relative:t});if(!n.isTransitioning)return!1;let a=Ot(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Ot(n.nextLocation.pathname,r)||n.nextLocation.pathname;return sa(o.pathname,i)!=null||sa(o.pathname,a)!=null}class hf extends Error{constructor(n){super("different_account");Ta(this,"summary");this.name="DifferentAccountError",this.summary=n}}class Fg{constructor(){Ta(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 a=await r.json().catch(()=>({}));if(a!=null&&a.wouldWipe)throw new hf(a.summary??{credentialCount:0,serviceCount:0,credentialIds:[]})}if(!r.ok){const a=await r.json().catch(()=>({error:"Invalid API key"}));throw new Error(a.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(a=>{var i,l;return{frame_hash:a.frameHash??a.boundsHash,profile_id:a.profileId,path:a.path,title:a.title??null,sp_status:a.status??null,frame:a.bounds??a.frame??{},required_domains:a.requiredDomains??[],attested_domains:a.attestedDomains??[],missing_domains:(a.requiredDomains??[]).filter(u=>!(a.attestedDomains??[]).includes(u)),deferred_commitment_domains:a.deferredCommitmentDomains??[],approvers_frozen:a.approversFrozen??[],above_cap:a.aboveCap??!1,created_at:a.createdAt?new Date(a.createdAt*1e3).toISOString():"",earliest_expiry:(i=a.attestations)!=null&&i.length?new Date(Math.min(...a.attestations.map(u=>u.expiresAt))*1e3).toISOString():null,remaining_seconds:(l=a.attestations)!=null&&l.length?Math.max(0,Math.min(...a.attestations.map(u=>u.expiresAt))-Math.floor(Date.now()/1e3)):null}})}async getMyReceipts(t){const n=new URLSearchParams;t!=null&&t.date&&n.set("date",t.date),t!=null&&t.profile&&n.set("profile",t.profile),t!=null&&t.limit&&n.set("limit",String(t.limit));const r=n.toString(),o=await this.fetch(`/api/receipts/mine${r?"?"+r:""}`);if(!o.ok)throw new Error(`Failed to fetch receipts: ${o.status}`);return(await o.json()).receipts??[]}async revokeAttestation(t,n){const r=await this.fetch(`/api/attestations/${encodeURIComponent(t)}/revoke`,{method:"POST",body:JSON.stringify({reason:n??"Revoked by user"})});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed to revoke"}));throw new Error(o.error||`Revoke failed: ${r.status}`)}}async getAttestations(t){const n=await this.fetch(`/api/attestations?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 a=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(a.error||`Create group failed: ${n.status}`)}const r=await n.json(),o=r.group||r;return{id:o.id,name:o.name,myDomains:o.myDomains||[],isAdmin:!0}}async joinGroup(t){const n=await this.fetch("/api/groups/join",{method:"POST",body:JSON.stringify({inviteCode:t})});if(!n.ok){const a=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(a.error||`Join group failed: ${n.status}`)}const r=await n.json(),o=r.group||r;return{id:o.id,name:o.name,myDomains:o.myDomains||[],isAdmin:o.isAdmin||!1}}async inviteToGroup(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/invite`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(r.error||`Invite failed: ${n.status}`)}return n.json()}async getMyTeam(){const t=await this.fetch("/api/groups/me");if(!t.ok)return null;const n=await t.json();return n.group?{group:n.group,membership:n.membership}:null}async listUsers(){const t=await this.fetch("/api/users");return t.ok?(await t.json()).users??[]:[]}async setPubkey(t){const n=await this.fetch("/api/users/me/pubkey",{method:"PUT",body:JSON.stringify({pubkey:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to set pubkey"}));throw new Error(r.error||`setPubkey failed: ${n.status}`)}}async getPubkey(t){const n=await this.fetch(`/api/users/${encodeURIComponent(t)}/pubkey`);return n.status===404||!n.ok?null:(await n.json()).pubkey??null}async leaveTeam(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/leave`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to leave team"}));throw new Error(r.error||`Leave failed: ${n.status}`)}}async getVaultStatus(){const t=await this.fetch("/vault/status");if(!t.ok)throw new Error(`Failed to fetch vault status: ${t.status}`);return t.json()}async getCredential(t){const n=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to check credential: ${n.status}`);return n.json()}async setCredential(t,n){const r=await this.fetch(`/vault/credentials/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to save credential: ${r.status}`)}async testCredential(t){const n=await this.fetch(`/vault/test/${encodeURIComponent(t)}`,{method:"POST"});if(!n.ok)throw new Error(`Test failed: ${n.status}`);return n.json()}async aiAssist(t){const n=await this.fetch("/ai/assist",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI request failed"}))).error,disclaimer:"AI surfaces reality. You supply intent."}}async 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 getIntegrationManifests(){const t=await this.fetch("/mcp/integrations/manifests");if(!t.ok)throw new Error(`Failed to fetch manifests: ${t.status}`);return t.json()}async discoverScopeField(t,n){const r=await this.fetch(`/integrations/${encodeURIComponent(t)}/discover/${encodeURIComponent(n)}`);if(!r.ok){const o=await r.json().catch(()=>({error:`Discovery failed: ${r.status}`}));throw new Error(o.error)}return r.json()}async activateIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}/activate`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`Failed: ${n.status}`)}return n.json()}async removeMcpIntegration(t){const n=await this.fetch(`/mcp/integrations/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to remove integration: ${n.status}`)}async getTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`);if(r.status===404||!r.ok)return null;const o=await r.json();return(o==null?void 0:o.config)??null}async setTeamProfileConfig(t,n,r){const o=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(r)});if(!o.ok){const a=await o.json().catch(()=>({error:"Failed to set profile config"}));throw new Error(a.error||`setTeamProfileConfig failed: ${o.status}`)}}async encryptIntent(t,n){const r=await this.fetch("/api/encrypt-intent",{method:"POST",body:JSON.stringify({intent:t,recipients:n})});if(!r.ok){const o=await r.json().catch(()=>({error:"Encryption failed"}));throw new Error(o.error||`encryptIntent failed: ${r.status}`)}return r.json()}async getApproversPubkeys(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}/approvers/pubkeys`);return r.ok?(await r.json()).approvers??[]:[]}async deleteTeamProfileConfig(t,n){const r=await this.fetch(`/api/groups/${encodeURIComponent(t)}/profile-config/${encodeURIComponent(n)}`,{method:"DELETE"});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed to delete profile config"}));throw new Error(o.error||`deleteTeamProfileConfig failed: ${r.status}`)}}async getProposals(t){const n=await this.fetch(`/api/proposals?domain=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch proposals: ${n.status}`);return(await n.json()).proposals??[]}async resolveProposal(t,n,r){const o=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/resolve`,{method:"POST",body:JSON.stringify({action:n,domain:r})});if(!o.ok){const a=await o.json().catch(()=>({error:"Failed"}));throw new Error(a.error||`Failed: ${o.status}`)}return o.json()}async getProposalsForApprover(){const t=await this.fetch("/api/proposals?approver=me");if(!t.ok)throw new Error(`Failed to fetch approver proposals: ${t.status}`);return(await t.json()).proposals??[]}async approveProposal(t){const n=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/approve`,{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed"}));throw new Error(r.error||`approveProposal failed: ${n.status}`)}return n.json()}async rejectProposal(t,n){const r=await this.fetch(`/api/proposals/${encodeURIComponent(t)}/reject`,{method:"POST",body:JSON.stringify({reason:n})});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed"}));throw new Error(o.error||`rejectProposal failed: ${r.status}`)}return r.json()}async getAttestationIntent(t){const n=await this.fetch(`/api/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 o=await n.json().catch(()=>({error:"Decryption failed"}));throw new Error(o.error||`decryptIntent failed: ${n.status}`)}return(await n.json()).intent}async storeApprovedIntent(t,n){const r=await this.fetch("/api/approved-intents",{method:"POST",body:JSON.stringify({authorityId:t,intent:n})});if(!r.ok){const o=await r.json().catch(()=>({error:"Failed"}));throw new Error(o.error||`storeApprovedIntent failed: ${r.status}`)}}async listTeamAuthorizations(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/attestations`);if(!n.ok)throw new Error(`Failed to fetch team authorizations: ${n.status}`);return((await n.json()).items??[]).map(o=>{var l,u;const a=o.owner??{userId:""};return{frame_hash:o.boundsHash??o.frameHash??o.frame_hash,profile_id:o.profileId??o.profile_id,path:o.path??"",title:o.title??null,sp_status:o.status??o.sp_status??null,frame:o.bounds??o.frame??{},required_domains:o.requiredDomains??o.required_domains??[],attested_domains:o.attestedDomains??o.attested_domains??[],missing_domains:(o.requiredDomains??o.required_domains??[]).filter(c=>!(o.attestedDomains??o.attested_domains??[]).includes(c)),deferred_commitment_domains:o.deferredCommitmentDomains??o.deferred_commitment_domains??[],approvers_frozen:o.approversFrozen??o.approvers_frozen??[],above_cap:o.aboveCap??o.above_cap??!1,created_at:o.createdAt?new Date(o.createdAt*1e3).toISOString():o.created_at??"",earliest_expiry:(l=o.attestations)!=null&&l.length?new Date(Math.min(...o.attestations.map(c=>c.expiresAt))*1e3).toISOString():null,remaining_seconds:(u=o.attestations)!=null&&u.length?Math.max(0,Math.min(...o.attestations.map(c=>c.expiresAt))-Math.floor(Date.now()/1e3)):null,owner:a}})}async listTeamReceipts(t){const n=await this.fetch(`/api/groups/${encodeURIComponent(t)}/receipts`);if(!n.ok)throw new Error(`Failed to fetch team receipts: ${n.status}`);return(await n.json()).receipts??[]}async getThread(t){const n=t.sinceDays??7,r=t.status??"pending",o=t.domain||"owner",a=await this.getProposals(o);let i=[];if(r==="all"){const l=[],u=new Date;for(let h=0;h<n;h++){const f=new Date(u);f.setUTCDate(u.getUTCDate()-h),l.push(f.toISOString().slice(0,10))}i=(await Promise.all(l.map(h=>this.getMyReceipts({date:h,profile:t.profile})))).flat()}return{proposals:a,receipts:i}}async getGateContent(t){const n=await this.fetch(`/gate-content?path=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(`Failed to fetch gate content: ${n.status}`);return(await n.json()).entry??null}async pushGateContent(t){const n=await this.fetch("/gate-content",{method:"POST",body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to push gate content"}));throw new Error(r.error||`Push gate content failed: ${n.status}`)}}async getAgentContext(){const t=await this.fetch("/agent-brief/context");if(!t.ok)throw new Error(`Failed to fetch agent context: ${t.status}`);return(await t.json()).content}async saveAgentContext(t){const n=await this.fetch("/agent-brief/context",{method:"PUT",body:JSON.stringify({content:t})});if(!n.ok){const r=await n.json().catch(()=>({error:"Failed to save agent context"}));throw new Error(r.error||`Save failed: ${n.status}`)}}async aiChat(t){const n=await this.fetch("/ai/chat",{method:"POST",body:JSON.stringify(t)});return n.ok?n.json():{success:!1,error:(await n.json().catch(()=>({error:"AI chat failed"}))).error||`Chat failed: ${n.status}`}}async getAIPrompts(){const t=await this.fetch("/ai-prompts");if(!t.ok)throw new Error(`Failed to load AI prompts: ${t.status}`);return t.json()}async setAIPrompt(t,n){const r=await this.fetch(`/ai-prompts/${t}`,{method:"PUT",body:JSON.stringify({value:n})});if(!r.ok){const o=await r.json().catch(()=>({error:"Save failed"}));throw new Error(o.error||`Save failed: ${r.status}`)}}}const O=new Fg,gf=d.createContext(null);function Og({children:e}){const[t,n]=d.useState(null),[r,o]=d.useState("personal"),[a,i]=d.useState(null),[l,u]=d.useState(""),[c,h]=d.useState(null),[f,g]=d.useState(null),[y,x]=d.useState(!1),[w,j]=d.useState(""),m=d.useRef(!1),p=d.useRef(null),v=d.useCallback(async()=>{if(m.current)try{const N=await O.getMyTeam();if(N){const{group:C,membership:I}=N;h(C),g(I),o("team"),i(C);const M=p.current??I.domains[0]??"owner";u(M)}else h(null),g(null),o("personal")}catch{}},[]);d.useEffect(()=>{const N=()=>{document.visibilityState==="visible"&&v()};return document.addEventListener("visibilitychange",N),()=>document.removeEventListener("visibilitychange",N)},[v]);const S=d.useCallback(async(N,C={})=>{x(!0),j("");try{O.setApiKey(N),m.current=!0;const I=await O.login(N,C);n(I),p.current=I.id;const M=await O.getGroups(),B=M.find(A=>A.isPersonal)??M[0]??null;i(B),u("owner"),await v()}catch(I){throw O.clearApiKey(),m.current=!1,j(I instanceof Error?I.message:"Login failed"),I}finally{x(!1)}},[v]),b=d.useCallback(async()=>{await O.logout(),O.clearApiKey(),m.current=!1,p.current=null,n(null),i(null),u(""),h(null),g(null),o("personal"),j("")},[]),T=d.useCallback(()=>j(""),[]),k=d.useCallback((N,C)=>{i(N),u(C)},[]);return s.jsx(gf.Provider,{value:{user:t,mode:r,group:a,domain:l,groupId:(a==null?void 0:a.id)??null,activeTeam:c,activeMembership:f,isLoading:y,error:w,login:S,logout:b,clearError:T,activeGroup:a,activeDomain:l,groups:a?[a]:[],setActiveContext:k,refreshGroups:v},children:e})}function ke(){const e=d.useContext(gf);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const vf=d.createContext(null);function Bg({children:e}){const{user:t}=ke(),n=d.useRef(null),[r,o]=d.useState(!1),a=d.useRef(new Map),i=d.useCallback((l,u)=>{const c=a.current;return c.has(l)||c.set(l,new Set),c.get(l).add(u),()=>{var h;(h=c.get(l))==null||h.delete(u)}},[]);return d.useEffect(()=>{if(!t){n.current&&(n.current.close(),n.current=null,o(!1));return}if(n.current)return;const l=O.getApiKey();if(!l)return;const u=new EventSource(`/events?key=${encodeURIComponent(l)}`);n.current=u,u.onopen=()=>o(!0),u.onerror=()=>o(!1);const c=["integration-changed","attestation-changed","proposal-added","proposal-resolved","team-membership-changed","action-approval-needed","action-resolved","proposal-approved","proposal-rejected"];for(const h of c)u.addEventListener(h,f=>{let g;try{g=JSON.parse(f.data)}catch{g=null}const y=a.current.get(h);if(y)for(const x of y)try{x(g)}catch(w){console.error(`[EventSource] handler for "${h}" threw:`,w)}});return()=>{u.close(),n.current=null,o(!1)}},[t]),s.jsx(vf.Provider,{value:{connected:r,addListener:i},children:e})}function ue(e,t){const n=d.useContext(vf);if(!n)return;const{addListener:r}=n;d.useEffect(()=>r(e,t),[e,t,r])}const Pr="suveren-theme",bu="hap-theme";function wo(e){return e!=="system"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}(function(){const t=localStorage.getItem(bu);t!==null&&localStorage.getItem(Pr)===null&&localStorage.setItem(Pr,t),t!==null&&localStorage.removeItem(bu)})();function yf(){const[e,t]=d.useState(()=>{const a=localStorage.getItem(Pr);return a==="light"||a==="dark"?a:"system"}),[n,r]=d.useState(()=>wo(e));d.useEffect(()=>{const a=document.documentElement,i=wo(e);a.setAttribute("data-theme",i),e==="system"?localStorage.removeItem(Pr):localStorage.setItem(Pr,e),r(wo(e))},[e]),d.useEffect(()=>{if(e!=="system")return;const a=window.matchMedia("(prefers-color-scheme: dark)"),i=()=>r(wo("system"));return a.addEventListener("change",i),()=>a.removeEventListener("change",i)},[e]);const o=d.useCallback(()=>{t(a=>a==="system"?"light":a==="light"?"dark":"system")},[]);return{theme:e,effectiveTheme:n,toggle:o}}const Dg=5*60*1e3;function xf(){const[e,t]=d.useState(!1),[n,r]=d.useState("docker"),[o,a]=d.useState(""),[i,l]=d.useState(!1);return d.useEffect(()=>{const u=(h=!1)=>{fetch(h?"/health?refresh=1":"/health").then(f=>f.json()).then(f=>{f.updateAvailable&&t(!0),f.installMethod&&r(f.installMethod),f.version&&a(f.version)}).catch(()=>{})};u(!0);const c=setInterval(()=>u(!1),Dg);return()=>clearInterval(c)},[]),{updateAvailable:e&&!i,installMethod:n,version:o,dismiss:()=>l(!0)}}function Ug(e){return e?e==="dev"?"dev":/^[0-9a-f]{40}$/i.test(e)?e.slice(0,7):e:""}const Pu={system:"◑",light:"☀",dark:"☾"};function Wg(){const{mode:e,group:t,domain:n}=ke();return e==="personal"?s.jsx("span",{children:"personal"}):t?s.jsxs("span",{children:[t.name," / ",n]}):s.jsx("span",{children:n})}function ul({onMenuToggle:e}){const{user:t,logout:n}=ke(),{theme:r,toggle:o}=yf(),{version:a}=xf(),i=Ug(a);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(Wg,{})]}),s.jsx("button",{className:"theme-toggle",onClick:o,title:`Theme: ${r}`,children:Pu[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:o,title:`Theme: ${r}`,children:Pu[r]})]})}),t&&e&&s.jsx("button",{className:"mobile-menu-btn",onClick:e,"aria-label":"Menu",children:"☰"})]})})}function jt(e,t){var n;return(n=t==null?void 0:t.revokedSet)!=null&&n.has(e.frame_hash)||e.sp_status==="revoked"?"revoked":e.sp_status==="expired"||e.remaining_seconds===null||e.remaining_seconds<=0?"expired":e.missing_domains.length>0?"pending":"active"}function wf(e,t){const n={active:[],pending:[],expired:[],revoked:[]};for(const r of e)n[jt(r,t)].push(r);return n}function zt(e,t,n){const r=d.useRef(e);r.current=e,d.useEffect(()=>{let o=null;const a=()=>typeof document>"u"?!0:document.visibilityState==="visible",i=()=>{a()&&r.current()},l=()=>{o===null&&(o=setInterval(i,t))},u=()=>{o!==null&&(clearInterval(o),o=null)},c=()=>{a()?(r.current(),l()):u()};return a()&&(r.current(),l()),document.addEventListener("visibilitychange",c),()=>{u(),document.removeEventListener("visibilitychange",c)}},[t,n])}const Sf=d.createContext(null),Hg=3e4;function Vg({children:e}){const[t,n]=d.useState({manifests:[],integrations:[],activeSessions:0,mcpServerUp:null,fetchCount:0}),r=d.useRef(null),o=d.useCallback(async()=>{const[u,c]=await Promise.all([O.getIntegrationManifests().catch(()=>({manifests:[]})),O.getMcpHealth().catch(()=>null)]);n(h=>({manifests:u.manifests,integrations:(c==null?void 0:c.integrations)??h.integrations,activeSessions:(c==null?void 0:c.activeSessions)??h.activeSessions,mcpServerUp:!!c,fetchCount:h.fetchCount+1}))},[]);ue("integration-changed",o),zt(o,3e5);const a=d.useMemo(()=>{const u=new Map(t.integrations.map(g=>[g.id,g])),c=Date.now(),h=t.fetchCount>0&&t.manifests.some(g=>{const y=u.get(g.id);return y&&!y.running});h&&r.current===null?r.current=c:h||(r.current=null);const f=r.current!==null&&c-r.current<Hg;return t.manifests.map(g=>{const y=u.get(g.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:g.id,manifest:g,integration:y,state:x}})},[t]),i=d.useMemo(()=>a.filter(u=>u.state==="not-running"||u.state==="error").length,[a]),l={loading:t.fetchCount===0,mcpServerUp:t.mcpServerUp,entries:a,attentionCount:i,activeSessions:t.activeSessions,refresh:o};return s.jsx(Sf.Provider,{value:l,children:e})}function cl(){const e=d.useContext(Sf);if(!e)throw new Error("useIntegrationStatus must be used inside IntegrationStatusProvider");return e}const Kg=[{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 Gg(){const{activeDomain:e}=ke(),[t,n]=d.useState({}),r=d.useCallback(async()=>{try{const[o,a,i,l,u]=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(()=>"")]),c={};if(o&&!o.configured&&(c.assistant=1),a){const y=wf(a).expired.length;y>0&&(c.authorizations=y)}const h=(i==null?void 0:i.length)??0,f=(l==null?void 0:l.length)??0,g=h+f;g>0&&(c.proposals=g),(!u||!u.trim())&&(c.brief=1),n(c)}catch{}},[e]);return ue("attestation-changed",r),ue("proposal-added",r),ue("proposal-resolved",r),ue("proposal-approved",r),ue("proposal-rejected",r),ue("team-membership-changed",r),zt(r,3e5,e),t}const Qg={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},Yg={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 Jg(){const{mode:e,group:t,domain:n,activeTeam:r}=ke(),o=Gg(),{attentionCount:a}=cl(),i={...o};a>0&&(i.integrations=a);const l=Kg.filter(g=>!g.teamOnly||e==="team"),u=d.useRef(null),[c,h]=d.useState(null),f=lt();return d.useEffect(()=>{if(u.current===null){u.current=e;return}u.current!==e&&(e==="team"&&r?h(`You are now acting in team context — ${r.name}`):e==="personal"&&h("You have left the team — back to personal context"),u.current=e)},[e,r]),d.useEffect(()=>{h(null)},[f.pathname]),s.jsxs("div",{className:"sidebar",children:[s.jsx("ul",{className:"sidebar-nav",children:l.map(g=>{const y=g.statusKey?i[g.statusKey]:0;return s.jsx("li",{children:s.jsxs(ll,{to:g.to,end:g.to==="/",className:({isActive:x})=>`sidebar-item${x?" active":""}`,children:[s.jsx("span",{className:"icon",children:g.icon}),g.label,y?s.jsx("span",{style:Qg,children:y}):null]})},g.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})]}),c&&s.jsx("div",{style:Yg,role:"status","aria-live":"polite",children:c})]})}function Xg(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 qg(){const{updateAvailable:e,installMethod:t}=xf(),n=Xg(t),r=e,[o,a]=d.useState(!1),[i,l]=d.useState(!1),u=d.useRef(null);if(d.useEffect(()=>{if(!r){document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner");return}document.body.classList.add("has-update-banner");const h=()=>{var y;const g=((y=u.current)==null?void 0:y.offsetHeight)??0;document.documentElement.style.setProperty("--update-banner-h",`${g}px`)};h();const f=new ResizeObserver(h);return u.current&&f.observe(u.current),()=>{f.disconnect(),document.documentElement.style.removeProperty("--update-banner-h"),document.body.classList.remove("has-update-banner")}},[r,o]),!r)return null;const c=async()=>{try{await navigator.clipboard.writeText(n),l(!0),setTimeout(()=>l(!1),1800)}catch{}};return s.jsxs("div",{ref:u,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.jsx("button",{type:"button",className:`btn btn-sm ${o?"btn-secondary":"btn-primary"}`,onClick:()=>a(h=>!h),children:o?"Hide":"Update"})]}),o&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"update-banner-hint",children:"Paste this into your terminal (Terminal on macOS/Linux, PowerShell on Windows) to update:"}),s.jsxs("div",{className:"update-banner-row update-banner-cmd-row",children:[s.jsx("code",{className:"update-banner-cmd",children:n}),s.jsx("button",{type:"button",className:"btn btn-sm btn-primary",onClick:c,children:i?"Copied":"Copy Command"})]})]})]})}const Zg={system:"◑",light:"☀",dark:"☾"},ev=[{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 tv({open:e,onClose:t}){const{user:n,activeGroup:r,activeDomain:o,logout:a}=ke(),{theme:i,toggle:l}=yf(),u=lt();return d.useEffect(()=>{t()},[u.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} / ${o}`:o||"personal"})]}),s.jsx("nav",{className:"mobile-menu-nav",children:ev.map(c=>s.jsxs(ll,{to:c.to,end:c.to==="/",className:({isActive:h})=>`mobile-menu-item${h?" active":""}`,onClick:t,children:[s.jsx("span",{className:"icon",children:c.icon}),c.label]},c.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:Zg[i]}),"Theme: ",i]}),s.jsx("button",{className:"mobile-menu-action",onClick:()=>{a(),t()},children:"Logout"})]})]})]}):null}function nv(){const[e,t]=d.useState(!1);return s.jsxs(Vg,{children:[s.jsx(ul,{onMenuToggle:()=>t(!e)}),s.jsx(qg,{}),s.jsx(Jg,{}),s.jsx(tv,{open:e,onClose:()=>t(!1)}),s.jsx("div",{className:"main-content",children:s.jsx("div",{className:"page-inner",children:s.jsx(ng,{})})})]})}function rv(){const[e,t]=d.useState(""),{login:n,isLoading:r,error:o,clearError:a}=ke(),[i,l]=d.useState(null),u=async()=>{if(e.trim()){a();try{await n(e)}catch(f){if(f instanceof hf){l(f.summary);return}}}},c=async()=>{l(null),a();try{await n(e,{confirmWipe:!0})}catch{}},h=()=>{l(null)};return s.jsxs(s.Fragment,{children:[s.jsx(ul,{}),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."})]}),o&&s.jsx("div",{className:"error-message",children:o}),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"&&u(),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:u,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,g)=>s.jsxs("div",{style:{display:"flex",gap:"0.625rem",alignItems:"baseline",marginBottom:g<2?"0.5rem":0},children:[s.jsxs("span",{style:{color:"var(--accent)",fontWeight:700,fontSize:"0.95rem"},children:[g+1,"."]}),f]},g))})]})]})})]}),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:h,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:h,disabled:r,children:"Cancel"}),s.jsx("button",{className:"btn btn-secondary",style:{color:"var(--danger, #e53e3e)"},onClick:c,disabled:r,children:r?"Signing in...":"Wipe local data and sign in"})]})]})})]})}function ov(){const{setActiveContext:e}=ke(),t=Dt(),[n,r]=d.useState(""),[o,a]=d.useState(""),[i,l]=d.useState(""),[u,c]=d.useState(!1),h=async()=>{if(n.trim()){c(!0),l("");try{const g=await O.joinGroup(n.trim());e(g,g.myDomains[0]||""),t("/")}catch(g){l(g instanceof Error?g.message:"Failed to join group")}finally{c(!1)}}},f=async()=>{if(o.trim()){c(!0),l("");try{const g=await O.createGroup(o.trim());e(g,g.myDomains[0]||""),t("/")}catch(g){l(g instanceof Error?g.message:"Failed to create group")}finally{c(!1)}}};return s.jsxs(s.Fragment,{children:[s.jsx(ul,{}),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:g=>r(g.target.value),onKeyDown:g=>g.key==="Enter"&&h(),style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem"},disabled:u}),s.jsx("button",{className:"btn btn-primary",onClick:h,disabled:u,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:o,onChange:g=>a(g.target.value),onKeyDown:g=>g.key==="Enter"&&f(),style:{flex:1},disabled:u}),s.jsx("button",{className:"btn btn-secondary",onClick:f,disabled:u,children:"Create"})]})]})]})})]})}const ri="suveren-setup-ai-skipped",oi="suveren-setup-agent-done",ai="suveren-setup-dismissed",av={"hap-setup-ai-skipped":ri,"hap-setup-agent-done":oi,"hap-setup-dismissed":ai};function sv(){for(const[e,t]of Object.entries(av)){const n=localStorage.getItem(e);n!==null&&localStorage.getItem(t)===null&&localStorage.setItem(t,n),n!==null&&localStorage.removeItem(e)}}sv();const as={"claude-code":{label:"Claude Code",snippet:e=>JSON.stringify({mcpServers:{"suveren-gateway":{url:`${e}/sse`}}},null,2)},"claude-desktop":{label:"Claude Desktop",snippet:e=>`Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
52
52
 
53
- ${JSON.stringify({mcpServers:{hap:{url:`${e}/sse`}}},null,2)}`},other:{label:"Other",snippet:e=>`Streamable HTTP: POST ${e}/mcp
53
+ ${JSON.stringify({mcpServers:{"suveren-gateway":{url:`${e}/sse`}}},null,2)}`},other:{label:"Other",snippet:e=>`Streamable HTTP: POST ${e}/mcp
54
54
  SSE transport: GET ${e}/sse
55
- Health check: GET ${e}/health`}};function rv({aiConfigured:e,hasRunningIntegration:t,hasActiveAuth:n,hasAgentConnected:r,mcpEndpoint:o}){const[a,i]=d.useState(()=>localStorage.getItem(Cu)==="true"),[l,u]=d.useState(()=>localStorage.getItem(Nu)==="true"),[c,h]=d.useState(()=>localStorage.getItem(Eu)==="true"),[p,g]=d.useState(null),[y,x]=d.useState("claude-code"),[w,j]=d.useState(!1),m=[{label:"AI Assistant",detail:"A trusted AI helps you think through authorizations — surfacing risks and asking the right questions.",to:"/settings",status:e?"done":a?"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"}],f=m.filter(C=>C.status==="done"||C.status==="skipped").length,v=f===m.length,S=d.useCallback(()=>{localStorage.setItem(Cu,"true"),i(!0)},[]),b=d.useCallback(()=>{localStorage.setItem(Nu,"true"),u(!0),g(null)},[]),T=d.useCallback(()=>{localStorage.setItem(Eu,"true"),h(!0)},[]),k=d.useCallback(async C=>{try{await navigator.clipboard.writeText(C),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},[]);if(c||v)return null;const N=m.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:m.map((C,I)=>{const M=I===N,B=C.status==="done"||C.status==="skipped"?"●":"○",A=C.status==="done"?"var(--success)":C.status==="skipped"?"var(--text-tertiary)":M?"var(--accent)":"var(--text-tertiary)";return s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:M?"0.75rem":"0.25rem 0",borderRadius:M?"0.5rem":void 0,background:M?"var(--accent-subtle)":void 0},children:[s.jsx("span",{style:{color:A,fontSize:"0.75rem",marginTop:"0.2rem",flexShrink:0},children:B}),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(nt,{to:C.to,style:{fontSize:"0.9rem",fontWeight:M?600:500,color:M?"var(--accent)":"var(--text-primary)",textDecoration:"none"},children:C.label}):C.status==="pending"&&I===3?s.jsx("button",{onClick:()=>g(p===3?null:3),style:{background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"0.9rem",fontWeight:M?600:500,color:M?"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"&&M&&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(nt,{to:C.to,style:{color:"var(--text-tertiary)",textDecoration:"none",fontSize:"0.8rem",flexShrink:0},children:"›"})]}),I===3&&p===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:o}),s.jsx("div",{style:{display:"flex",gap:"0.25rem",marginBottom:"0.75rem"},children:Object.entries(os).map(([z,R])=>s.jsx("button",{onClick:()=>x(z),style:{padding:"0.375rem 0.75rem",fontSize:"0.75rem",fontWeight:y===z?600:400,background:y===z?"var(--accent-subtle)":"transparent",color:y===z?"var(--accent)":"var(--text-secondary)",border:`1px solid ${y===z?"var(--accent)":"var(--border)"}`,borderRadius:"0.375rem",cursor:"pointer"},children:R.label},z))}),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:os[y].snippet(o)}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>k(os[y].snippet(o)),children:w?"Copied":"Copy"}),s.jsx("button",{className:"btn btn-primary btn-sm",onClick:b,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:`${f/m.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:[f," of ",m.length," complete"]})]})]})}function vn({variant:e="base",style:t,className:n,...r}){const o=e==="title"?"skeleton skeleton-title":e==="line"?"skeleton skeleton-line":e==="line-sm"?"skeleton skeleton-line-sm":"skeleton";return s.jsx("span",{className:`${o}${n?` ${n}`:""}`,style:t,role:"status","aria-busy":"true","aria-label":r["aria-label"]??"Loading"})}function as(){return s.jsxs("div",{className:"skeleton-card",role:"status","aria-busy":"true","aria-label":"Loading",children:[s.jsx(vn,{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(vn,{variant:"line",style:{width:"35%"}}),s.jsx(vn,{variant:"line-sm",style:{width:"65%"}})]})]})}const ov=30*60;function ss(e){return e.replace(/@.*$/,"").split("/").pop()??e}function av(){var z;const{domain:e}=ke(),[t,n]=d.useState([]),[r,o]=d.useState([]),[a,i]=d.useState([]),[l,u]=d.useState(!0),[c,h]=d.useState(!1),[p,g]=d.useState(!1),[y,x]=d.useState(!1),{entries:w,activeSessions:j,loading:m}=sl(),f=!m,v=d.useCallback(()=>{O.getMyAttestations().then(R=>{n(R),h(!0)}).catch(()=>h(!0)),O.getProposals(e||"owner").then(R=>{o(R),g(!0)}).catch(()=>g(!0)),O.getProposalsForApprover().then(R=>i(R)).catch(()=>i([])),O.getCredential("ai-config").then(R=>{u(R.configured),x(!0)}).catch(()=>x(!0))},[e]);ue("attestation-changed",v),ue("proposal-added",v),ue("proposal-resolved",v),ue("proposal-approved",v),ue("proposal-rejected",v),At(v,3e5,e);const S=c&&p&&y&&f,b=yf(t),T=b.active,k=b.expired,N=T.filter(R=>R.remaining_seconds!==null&&R.remaining_seconds<=ov),C=r.filter(R=>R.status==="pending"),I=w.filter(R=>R.state==="running"),M=w.filter(R=>R.state==="starting"),B=w.filter(R=>R.state==="not-running"||R.state==="error"),A=[];for(const R of a)A.push({label:"Approval needed",detail:`${R.tool} — above-cap action under ${ss(R.profileId)}`,to:"/proposals",color:"var(--warning)"});for(const R of C)A.push({label:"Approval pending",detail:`${R.tool} awaiting your approval`,to:"/proposals",color:"var(--warning)"});for(const R of N){const V=Math.ceil((R.remaining_seconds??0)/60);A.push({label:"Expiring soon",detail:`${R.title??ss(R.profile_id)} — ${V} min remaining`,to:"/authorizations",color:"var(--warning)"})}for(const R of k)A.push({label:"Expired",detail:R.title??ss(R.profile_id),to:"/authorizations",color:"var(--danger)"});for(const R of B)A.push({label:R.state==="error"?"Integration error":"Integration stopped",detail:R.state==="error"&&((z=R.integration)!=null&&z.error)?`${R.manifest.name}: ${R.integration.error}`:`${R.manifest.name} is not running`,to:"/integrations",color:"var(--danger)"});for(const R of M)A.push({label:"Integration starting",detail:`${R.manifest.name} is coming up…`,to:"/integrations",color:"var(--warning)"});return l||A.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(rv,{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(nt,{to:"/authorizations",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[c?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:T.length>0?"var(--success)":"var(--text-tertiary)"},children:T.length}):s.jsx(vn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Active"})]})}),s.jsx(nt,{to:"/proposals",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[p?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:C.length>0?"var(--warning)":"var(--text-tertiary)"},children:C.length}):s.jsx(vn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pending Approvals"})]})}),s.jsx(nt,{to:"/authorizations",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[c?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:k.length>0?"var(--danger)":"var(--text-tertiary)"},children:k.length}):s.jsx(vn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Expired"})]})}),s.jsx(nt,{to:"/integrations",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:I.length>0?"var(--success)":"var(--text-tertiary)"},children:I.length}):s.jsx(vn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Integrations Running"})]})})]}),A.length>0?s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:A.map((R,V)=>s.jsx(nt,{to:R.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:R.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:R.label}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:R.detail})]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"›"})]})},V))}):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(as,{}),s.jsx(as,{}),s.jsx(as,{})]})]})}const sv=["Scope & Limits","Intent","Authorize"];function wf({currentStep:e,onStepClick:t}){const n=bt();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,o)=>{const a=o+2,i=a<e,l=a===e;return s.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[o>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(a):void 0,style:i&&t?{cursor:"pointer"}:void 0,children:i?"✓":o+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})]})]},a)})}),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 bu=40;function _e(e,t){if(t)return t.slice(0,bu);const n=e.lastIndexOf("/"),r=n>=0?e.slice(n+1):e,o=r.indexOf("@"),a=o>=0?r.slice(0,o):r;return(a.charAt(0).toUpperCase()+a.slice(1)).slice(0,bu)}function iv({profileId:e,bounds:t,groupName:n,domain:r,onSwitch:o}){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:"})," ",_e(e)]}),t&&s.jsxs("span",{children:[s.jsx("strong",{children:"Bounds:"})," ",t]}),o&&s.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginLeft:"auto",padding:"0.2rem 0.5rem",fontSize:"0.7rem"},onClick:o,children:"Switch"})]})}function lv({integrationId:e,field:t,value:n,onChange:r,disabled:o}){const[a,i]=d.useState(null),[l,u]=d.useState(null),[c,h]=d.useState(!0);d.useEffect(()=>{let y=!1;return O.discoverScopeField(e,t).then(x=>{y||(i(x.options),h(!1))}).catch(x=>{y||(u(x instanceof Error?x.message:String(x)),h(!1))}),()=>{y=!0}},[e,t]);const p=new Set(n.split(",").map(y=>y.trim()).filter(Boolean)),g=y=>{const x=new Set(p);x.has(y)?x.delete(y):x.add(y),r(Array.from(x).join(","))};return c?s.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["Loading options from ",e,"…"]}):l||!a?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:o})]}):a.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:a.map(y=>{const x=y.extras??{},w=typeof x.access=="string"?x.access:void 0,j=w==="reader",m=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:o||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:p.has(String(y.value)),onChange:()=>g(String(y.value)),disabled:o||j}),s.jsx("span",{children:y.label||y.value}),m&&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 uv(e){return e.replace(/@.*$/,"").split("/").pop()??e}function cv(e,t){return t.displayName?t.displayName:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function dv(e){return e.type==="string"&&(e.format==="email"||e.format==="domain")}function fv(e){var t;return!!(e.enum&&((t=e.constraint)!=null&&t.enforceable.includes("subset")))}function Pu(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 mv(e){return e?e==="minutes"?15:e==="percent"?5:e.startsWith("currency:")?10:1:1}function hv(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 gv(e,t){if(!e||!t)return"";const n=Number(e);if(!Number.isFinite(n)||n<=0)return"";if(t==="minutes"&&n>=60){const r=Math.floor(n/60),o=n%60;return o===0?`${r} hour${r!==1?"s":""}`:`${r}h ${o}m`}if(t==="hours"&&n>=24&&n%24===0){const r=n/24;return`${r} day${r!==1?"s":""}`}if(t==="days"){if(n>=30&&n%30===0)return`${n/30} month${n/30!==1?"s":""}`;if(n>=7&&n%7===0)return`${n/7} week${n/7!==1?"s":""}`}return""}function vv({id:e,value:t,onChange:n,disabled:r,placeholder:o,unit:a}){const i=mv(a),l=hv(a),u=pv(a),c=gv(t,a),h=t===""?null:Number(t),p=()=>{const y=t===""?0:Number(t),x=y%i,w=x===0?y+i:y+(i-x);n(String(w))},g=()=>{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:g,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:o??"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:p,disabled:r,"aria-label":"Increase",children:"+"}),u&&s.jsx("span",{className:"bounded-input-unit","aria-hidden":"true",children:u})]}),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${h===y.value?" preset-chip-selected":""}`,onClick:()=>n(String(y.value)),children:y.label},y.value))}),c&&s.jsxs("div",{className:"bounded-input-echo",children:["≈ ",c]})]})}function Tu({htmlFor:e,label:t,description:n}){const[r,o]=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:()=>o(a=>!a),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onBlur:()=>o(!1),children:"i"}),r&&s.jsx("div",{className:"field-tip-bubble",role:"tooltip",children:n})]})]})}function yv({id:e,value:t,onChange:n,disabled:r,format:o,placeholder:a}){const[i,l]=d.useState(""),[u,c]=d.useState(!1),h=d.useRef(null),p=t?t.split(",").map(m=>m.trim()).filter(Boolean):[],g=m=>{const f=m.trim();if(!f)return;if(!Pu(f,o)){c(!0);return}c(!1);const v=p.includes(f)?p:[...p,f];n(v.join(",")),l("")},y=m=>{const f=p.filter((v,S)=>S!==m);n(f.join(","))},x=m=>{m.key==="Enter"||m.key===","||m.key==="Tab"?i.trim()&&(m.preventDefault(),g(i)):m.key==="Backspace"&&!i&&p.length>0&&y(p.length-1)},w=m=>{const f=m.clipboardData.getData("text");if(f.includes(",")){m.preventDefault();const S=f.split(",").map(T=>T.trim()).filter(Boolean).filter(T=>Pu(T,o)),b=[...new Set([...p,...S])];n(b.join(",")),l(""),c(!1)}},j=o==="email"?"Type email and press Enter...":"Type domain and press Enter...";return s.jsxs("div",{className:`tag-input${u?" tag-input-invalid":""}`,onClick:()=>{var m;return(m=h.current)==null?void 0:m.focus()},children:[p.map((m,f)=>s.jsxs("span",{className:"tag-pill",children:[m,!r&&s.jsx("button",{type:"button",className:"tag-remove",onClick:v=>{v.stopPropagation(),y(f)},"aria-label":`Remove ${m}`,children:"×"})]},m)),!r&&s.jsx("input",{ref:h,id:e,className:"tag-input-field",type:"text",value:i,onChange:m=>{l(m.target.value),c(!1)},onKeyDown:x,onPaste:w,onBlur:()=>{i.trim()&&g(i)},placeholder:p.length===0?a??j:""})]})}function xv({id:e,options:t,value:n,onChange:r,disabled:o}){const a=n?n.split(",").map(l=>l.trim()).filter(Boolean):[],i=l=>{const u=a.includes(l)?a.filter(c=>c!==l):[...a,l];r(u.join(","))};return s.jsx("div",{className:"checkbox-group",id:e,children:t.map(l=>s.jsxs("label",{className:`checkbox-pill${a.includes(l)?" checkbox-pill-selected":""}`,children:[s.jsx("input",{type:"checkbox",checked:a.includes(l),onChange:()=>i(l),disabled:o}),s.jsx("span",{children:l})]},l))})}function Iu({fieldKey:e,fieldDef:t,value:n,onChange:r,prefix:o,readOnly:a,twoColumn:i,discoveryIntegrationId:l}){const u=cv(e,t),c=`${o}-field-${e}`,h=s.jsx(s.Fragment,{children:fv(t)?s.jsx(xv,{id:c,options:t.enum,value:n,onChange:p=>r(e,p),disabled:a}):(()=>{const p=t.boundType;return(p==null?void 0:p.kind)==="enum"&&Array.isArray(p.values)})()?s.jsxs("select",{id:c,className:"form-select",value:n,onChange:p=>r(e,p.target.value),disabled:a,children:[s.jsx("option",{value:"",children:"Select..."}),t.boundType.values.map(p=>s.jsx("option",{value:p,children:p},p))]}):"enum"in t&&t.enum?s.jsxs("select",{id:c,className:"form-select",value:n,onChange:p=>r(e,p.target.value),disabled:a,children:[s.jsx("option",{value:"",children:"Select..."}),t.enum.map(p=>s.jsx("option",{value:p,children:p},p))]}):t.type==="number"?s.jsx(vv,{id:c,value:n,onChange:p=>r(e,p),disabled:a,unit:t.unit}):dv(t)?s.jsx(yv,{id:c,value:n,onChange:p=>r(e,p),disabled:a,format:t.format}):l?s.jsx(lv,{integrationId:l,field:e,value:n,onChange:p=>r(e,p),disabled:a}):s.jsx("input",{id:c,className:"form-input",type:"text",value:n,onChange:p=>r(e,p.target.value),disabled:a})});return i?s.jsxs("div",{className:"bounds-field-row",children:[s.jsx("div",{className:"bounds-field-label",children:s.jsx(Tu,{htmlFor:c,label:u,description:t.description})}),s.jsx("div",{className:"bounds-field-input",children:h})]},`${o}-${e}`):s.jsxs("div",{className:"form-group",children:[s.jsx(Tu,{htmlFor:c,label:u,description:t.description}),h]},`${o}-${e}`)}function wv(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 a=!1;for(const[i,l]of Object.entries(n)){const u=e[i];if(u===""||u===void 0)continue;const c=Number(u);if(!isNaN(c)&&c>l){a=!0;break}}return a?r?"above-approvers":"hard-ceiling":"within-cap"}function Sv(e,t){const n=new Set;if(!t)return n;for(const[r,o]of Object.entries(t)){const a=e[r];if(a===""||a===void 0)continue;const i=Number(a);!isNaN(i)&&i>o&&n.add(r)}return n}function jv({profile:e,onConfirm:t,onCancel:n,readOnly:r,initialBounds:o,initialContext:a,initialFrame:i,profileConfig:l,approverNames:u,adminName:c}){const h=e.boundsSchema??e.frameSchema,p=e.contextSchema,g=h?Object.entries(h.fields).filter(([E])=>!(E==="profile"||E==="path")):[],y=p&&p.keyOrder.length>0?Object.entries(p.fields):[],x=o??i??{},w=a??{},j={};for(const[E]of g)j[E]=x[E]!==void 0?String(x[E]):"";const m={};for(const[E]of y)m[E]=w[E]!==void 0?String(w[E]):"";const[f,v]=d.useState(j),[S,b]=d.useState(m),[T,k]=d.useState(null);d.useEffect(()=>{const E=uv(e.id);O.getIntegrationManifests().then(({manifests:P})=>{const $=P.find(F=>F.profile===E&&F.contextDiscovery&&Object.keys(F.contextDiscovery).length>0);k($??null)}).catch(()=>k(null))},[e.id]);const N=wv(f,l),C=Sv(f,l==null?void 0:l.caps),I=(E,P)=>{v($=>({...$,[E]:P}))},M=(E,P)=>{b($=>({...$,[E]:P}))},B=()=>{const E={profile:e.id};for(const[$,F]of g)F.type==="number"?E[$]=f[$]===""?0:Number(f[$]):E[$]=f[$];const P={};for(const[$,F]of y)F.type==="number"?P[$]=S[$]===""?0:Number(S[$]):P[$]=S[$];return[E,P]},A=()=>{const[E,P]=B();t(E,P)},z=()=>{const E=(l==null?void 0:l.caps)??{},P={...f};for(const W of C)E[W]!==void 0&&(P[W]=String(E[W]));v(P);const $={profile:e.id};for(const[W,ne]of g)if(ne.type==="number"){const Q=P[W]??"";$[W]=Q===""?0:Number(Q)}else $[W]=P[W]??"";const F={};for(const[W,ne]of y)ne.type==="number"?F[W]=S[W]===""?0:Number(S[W]):F[W]=S[W];t($,F)},R=E=>{const P=l==null?void 0:l.caps;if(!P||P[E]===void 0)return null;const $=P[E],F=C.has(E);return N==="hard-ceiling"&&F?s.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--danger)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",$," — exceeds team ceiling"]}):N==="above-approvers"&&F?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"]})},V=()=>{var E;if(N==="no-config")return null;if(N==="approvers-dormant"){const P=u&&u.length>0?u.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: ",P]}),s.jsxs("div",{children:["No caps are set on this profile, so ",P," won't gate any action under this authority. Your intent will still be encrypted and shared with them as an accountability record — they can read what you authorised, even though they aren't reviewing individual actions."]})]})}if(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 P=u&&u.length>0?u.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 ",P,". Within-cap actions run per the mode you choose."]})]})}if(N==="hard-ceiling"){const P=Array.from(C)[0],$=P?(E=l==null?void 0:l.caps)==null?void 0:E[P]:void 0,F=c??"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 ",F," 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:z,children:"Save below cap"}),n&&s.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"})]})]})}return null},_=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(([E,P])=>{var F;const $=!!((F=T==null?void 0:T.contextDiscovery)!=null&&F[E]);return s.jsx(Iu,{fieldKey:E,fieldDef:P,value:S[E],onChange:M,prefix:"context",readOnly:r,discoveryIntegrationId:$?T.id:void 0},`context-${E}`)})]}),g.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:g.map(([E,P])=>{var $;return s.jsxs("div",{style:{display:"contents"},children:[s.jsx(Iu,{fieldKey:E,fieldDef:P,value:f[E],onChange:I,prefix:"bounds",readOnly:r,twoColumn:!0}),N!=="no-config"&&(($=l==null?void 0:l.caps)==null?void 0:$[E])!==void 0&&s.jsx("div",{style:{gridColumn:"2 / 3",display:"flex",alignItems:"center",paddingBottom:"0.5rem"},children:R(E)})]},`bounds-${E}`)})}),V()]}),s.jsx("button",{className:"btn btn-primary",onClick:A,disabled:_,style:{marginTop:"0.5rem"},children:r?"Next: Gates":"Next: Problem Statement"})]})}function kv(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 Cv(e){return e.replace(/```(?:markdown|md)?\s*\n[\s\S]*?```/,"").trim()}const Nv="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 sa({target:e,currentText:t,onApply:n,greeting:r,placeholder:o,title:a}){const[i,l]=d.useState([{role:"assistant",content:r??Nv}]),[u,c]=d.useState(""),[h,p]=d.useState(!1),[g,y]=d.useState(null),x=d.useRef(null);d.useEffect(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[i,h]);const w=async()=>{const m=u.trim();if(!m||h)return;const f=[...i,{role:"user",content:m}];l(f),c(""),y(null),p(!0);try{const v=await O.aiChat({target:e,currentText:t,messages:f.filter((S,b)=>!(b===0&&S.role==="assistant"))});v.success&&v.reply?l(S=>[...S,{role:"assistant",content:v.reply}]):y(v.error??"AI returned no reply")}catch(v){y(v instanceof Error?v.message:"Chat failed")}finally{p(!1)}},j=m=>{m.key==="Enter"&&!m.shiftKey&&!m.nativeEvent.isComposing&&(m.preventDefault(),w())};return s.jsxs("div",{className:"intent-chat",children:[s.jsx("h3",{className:"card-title",children:a??"AI Assistant"}),s.jsxs("div",{ref:x,className:"chat-messages",children:[i.map((m,f)=>{const v=m.role==="assistant"?kv(m.content):null,S=v?Cv(m.content):m.content;return s.jsx("div",{className:`chat-msg ${m.role}`,children:s.jsxs("div",{className:"chat-msg-body",children:[S&&s.jsx("div",{className:"chat-msg-prose",children:S}),v!==null&&s.jsxs(s.Fragment,{children:[s.jsx("pre",{className:"chat-fenced-block",children:v}),s.jsx("button",{type:"button",className:"btn btn-primary btn-sm chat-apply-btn",onClick:()=>n(v),children:"Apply this draft"})]})]})},f)}),h&&s.jsx("div",{className:"chat-msg assistant",children:s.jsx("div",{className:"chat-msg-body chat-msg-thinking",children:"Thinking…"})})]}),g&&s.jsx("div",{className:"error-message",children:g}),s.jsxs("div",{className:"chat-composer",children:[s.jsxs("div",{className:"chat-composer-pill",children:[s.jsx("textarea",{className:"chat-input",value:u,onChange:m=>c(m.target.value),onKeyDown:j,placeholder:o??"Ask for help articulating the intent…",rows:1,disabled:h}),s.jsx("button",{type:"button",className:"chat-send-btn",onClick:w,disabled:h||!u.trim(),"aria-label":"Send",children:"↑"})]}),s.jsx("div",{className:"chat-composer-hint",children:"Enter to send · Shift+Enter for newline"})]})]})}function Sf({open:e,onClose:t,children:n,ariaLabel:r}){const o=d.useRef(null),a=d.useRef(null);return d.useEffect(()=>{var l;if(!e)return;a.current=document.activeElement,document.body.style.overflow="hidden";const i=u=>{u.key==="Escape"&&t()};return document.addEventListener("keydown",i),(l=o.current)==null||l.focus(),()=>{document.removeEventListener("keydown",i),document.body.style.overflow="",a.current instanceof HTMLElement&&a.current.focus()}},[e,t]),Kd.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:o,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)}const Ru=`Why — What's the situation? Why does this need to happen?
55
+ Health check: GET ${e}/health`}};function iv({aiConfigured:e,hasRunningIntegration:t,hasActiveAuth:n,hasAgentConnected:r,mcpEndpoint:o}){const[a,i]=d.useState(()=>localStorage.getItem(ri)==="true"),[l,u]=d.useState(()=>localStorage.getItem(oi)==="true"),[c,h]=d.useState(()=>localStorage.getItem(ai)==="true"),[f,g]=d.useState(null),[y,x]=d.useState("claude-code"),[w,j]=d.useState(!1),m=[{label:"AI Assistant",detail:"A trusted AI helps you think through authorizations — surfacing risks and asking the right questions.",to:"/settings",status:e?"done":a?"skipped":"pending",optional:!0},{label:"Connect a service",to:"/integrations",status:t?"done":"pending"},{label:"Authorize your agent",to:"/agent/new",status:n?"done":"pending"},{label:"Connect your agent",status:r||l?"done":"pending"}],p=m.filter(C=>C.status==="done"||C.status==="skipped").length,v=p===m.length,S=d.useCallback(()=>{localStorage.setItem(ri,"true"),i(!0)},[]),b=d.useCallback(()=>{localStorage.setItem(oi,"true"),u(!0),g(null)},[]),T=d.useCallback(()=>{localStorage.setItem(ai,"true"),h(!0)},[]),k=d.useCallback(async C=>{try{await navigator.clipboard.writeText(C),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},[]);if(c||v)return null;const N=m.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:m.map((C,I)=>{const M=I===N,B=C.status==="done"||C.status==="skipped"?"●":"○",A=C.status==="done"?"var(--success)":C.status==="skipped"?"var(--text-tertiary)":M?"var(--accent)":"var(--text-tertiary)";return s.jsxs("div",{children:[s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",padding:M?"0.75rem":"0.25rem 0",borderRadius:M?"0.5rem":void 0,background:M?"var(--accent-subtle)":void 0},children:[s.jsx("span",{style:{color:A,fontSize:"0.75rem",marginTop:"0.2rem",flexShrink:0},children:B}),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(nt,{to:C.to,style:{fontSize:"0.9rem",fontWeight:M?600:500,color:M?"var(--accent)":"var(--text-primary)",textDecoration:"none"},children:C.label}):C.status==="pending"&&I===3?s.jsx("button",{onClick:()=>g(f===3?null:3),style:{background:"none",border:"none",padding:0,cursor:"pointer",fontSize:"0.9rem",fontWeight:M?600:500,color:M?"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"&&M&&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(nt,{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:o}),s.jsx("div",{style:{display:"flex",gap:"0.25rem",marginBottom:"0.75rem"},children:Object.entries(as).map(([z,_])=>s.jsx("button",{onClick:()=>x(z),style:{padding:"0.375rem 0.75rem",fontSize:"0.75rem",fontWeight:y===z?600:400,background:y===z?"var(--accent-subtle)":"transparent",color:y===z?"var(--accent)":"var(--text-secondary)",border:`1px solid ${y===z?"var(--accent)":"var(--border)"}`,borderRadius:"0.375rem",cursor:"pointer"},children:_.label},z))}),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:as[y].snippet(o)}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>k(as[y].snippet(o)),children:w?"Copied":"Copy"}),s.jsx("button",{className:"btn btn-primary btn-sm",onClick:b,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:`${p/m.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:[p," of ",m.length," complete"]})]})]})}function vn({variant:e="base",style:t,className:n,...r}){const o=e==="title"?"skeleton skeleton-title":e==="line"?"skeleton skeleton-line":e==="line-sm"?"skeleton skeleton-line-sm":"skeleton";return s.jsx("span",{className:`${o}${n?` ${n}`:""}`,style:t,role:"status","aria-busy":"true","aria-label":r["aria-label"]??"Loading"})}function ss(){return s.jsxs("div",{className:"skeleton-card",role:"status","aria-busy":"true","aria-label":"Loading",children:[s.jsx(vn,{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(vn,{variant:"line",style:{width:"35%"}}),s.jsx(vn,{variant:"line-sm",style:{width:"65%"}})]})]})}const lv=30*60;function is(e){return e.replace(/@.*$/,"").split("/").pop()??e}function uv(){var z;const{domain:e}=ke(),[t,n]=d.useState([]),[r,o]=d.useState([]),[a,i]=d.useState([]),[l,u]=d.useState(!0),[c,h]=d.useState(!1),[f,g]=d.useState(!1),[y,x]=d.useState(!1),{entries:w,activeSessions:j,loading:m}=cl(),p=!m,v=d.useCallback(()=>{O.getMyAttestations().then(_=>{n(_),h(!0)}).catch(()=>h(!0)),O.getProposals(e||"owner").then(_=>{o(_),g(!0)}).catch(()=>g(!0)),O.getProposalsForApprover().then(_=>i(_)).catch(()=>i([])),O.getCredential("ai-config").then(_=>{u(_.configured),x(!0)}).catch(()=>x(!0))},[e]);ue("attestation-changed",v),ue("proposal-added",v),ue("proposal-resolved",v),ue("proposal-approved",v),ue("proposal-rejected",v),zt(v,3e5,e);const S=c&&f&&y&&p,b=wf(t),T=b.active,k=b.expired,N=T.filter(_=>_.remaining_seconds!==null&&_.remaining_seconds<=lv),C=r.filter(_=>_.status==="pending"),I=w.filter(_=>_.state==="running"),M=w.filter(_=>_.state==="starting"),B=w.filter(_=>_.state==="not-running"||_.state==="error"),A=[];for(const _ of a)A.push({label:"Approval needed",detail:`${_.tool} — above-cap action under ${is(_.profileId)}`,to:"/proposals",color:"var(--warning)"});for(const _ of C)A.push({label:"Approval pending",detail:`${_.tool} awaiting your approval`,to:"/proposals",color:"var(--warning)"});for(const _ of N){const V=Math.ceil((_.remaining_seconds??0)/60);A.push({label:"Expiring soon",detail:`${_.title??is(_.profile_id)} — ${V} min remaining`,to:"/authorizations",color:"var(--warning)"})}for(const _ of k)A.push({label:"Expired",detail:_.title??is(_.profile_id),to:"/authorizations",color:"var(--danger)"});for(const _ of B)A.push({label:_.state==="error"?"Integration error":"Integration stopped",detail:_.state==="error"&&((z=_.integration)!=null&&z.error)?`${_.manifest.name}: ${_.integration.error}`:`${_.manifest.name} is not running`,to:"/integrations",color:"var(--danger)"});for(const _ of M)A.push({label:"Integration starting",detail:`${_.manifest.name} is coming up…`,to:"/integrations",color:"var(--warning)"});return l||A.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(iv,{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(nt,{to:"/authorizations",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[c?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:T.length>0?"var(--success)":"var(--text-tertiary)"},children:T.length}):s.jsx(vn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Active"})]})}),s.jsx(nt,{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(vn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Pending Approvals"})]})}),s.jsx(nt,{to:"/authorizations",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[c?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:k.length>0?"var(--danger)":"var(--text-tertiary)"},children:k.length}):s.jsx(vn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Expired"})]})}),s.jsx(nt,{to:"/integrations",style:{textDecoration:"none"},children:s.jsxs("div",{className:"card",style:{padding:"1rem",textAlign:"center"},children:[p?s.jsx("div",{style:{fontSize:"1.5rem",fontWeight:700,color:I.length>0?"var(--success)":"var(--text-tertiary)"},children:I.length}):s.jsx(vn,{variant:"title"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"Integrations Running"})]})})]}),A.length>0?s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:A.map((_,V)=>s.jsx(nt,{to:_.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:_.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:_.label}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:_.detail})]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"›"})]})},V))}):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(ss,{}),s.jsx(ss,{}),s.jsx(ss,{})]})]})}const cv=["Scope & Limits","Intent","Authorize"];function jf({currentStep:e,onStepClick:t}){const n=Dt();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:cv.map((r,o)=>{const a=o+2,i=a<e,l=a===e;return s.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[o>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(a):void 0,style:i&&t?{cursor:"pointer"}:void 0,children:i?"✓":o+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})]})]},a)})}),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 Tu=40;function Re(e,t){if(t)return t.slice(0,Tu);const n=e.lastIndexOf("/"),r=n>=0?e.slice(n+1):e,o=r.indexOf("@"),a=o>=0?r.slice(0,o):r;return(a.charAt(0).toUpperCase()+a.slice(1)).slice(0,Tu)}function dv({profileId:e,bounds:t,groupName:n,domain:r,onSwitch:o}){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:"})," ",Re(e)]}),t&&s.jsxs("span",{children:[s.jsx("strong",{children:"Bounds:"})," ",t]}),o&&s.jsx("button",{className:"btn btn-ghost btn-sm",style:{marginLeft:"auto",padding:"0.2rem 0.5rem",fontSize:"0.7rem"},onClick:o,children:"Switch"})]})}function fv({integrationId:e,field:t,value:n,onChange:r,disabled:o}){const[a,i]=d.useState(null),[l,u]=d.useState(null),[c,h]=d.useState(!0);d.useEffect(()=>{let y=!1;return O.discoverScopeField(e,t).then(x=>{y||(i(x.options),h(!1))}).catch(x=>{y||(u(x instanceof Error?x.message:String(x)),h(!1))}),()=>{y=!0}},[e,t]);const f=new Set(n.split(",").map(y=>y.trim()).filter(Boolean)),g=y=>{const x=new Set(f);x.has(y)?x.delete(y):x.add(y),r(Array.from(x).join(","))};return c?s.jsxs("p",{className:"hint-text",style:{color:"var(--text-tertiary)"},children:["Loading options from ",e,"…"]}):l||!a?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:o})]}):a.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:a.map(y=>{const x=y.extras??{},w=typeof x.access=="string"?x.access:void 0,j=w==="reader",m=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:o||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:()=>g(String(y.value)),disabled:o||j}),s.jsx("span",{children:y.label||y.value}),m&&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 pv(e){return e.replace(/@.*$/,"").split("/").pop()??e}function mv(e,t){return t.displayName?t.displayName:e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function hv(e){return e.type==="string"&&(e.format==="email"||e.format==="domain")}function gv(e){var t;return!!(e.enum&&((t=e.constraint)!=null&&t.enforceable.includes("subset")))}function Iu(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 vv(e){return!e||e==="count"?"":e==="minutes"?"min":e==="hours"?"hr":e==="days"?"days":e==="percent"?"%":e.startsWith("currency:")?e.slice(9):e}function yv(e){return e?e==="minutes"?15:e==="percent"?5:e.startsWith("currency:")?10:1:1}function xv(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 wv(e,t){if(!e||!t)return"";const n=Number(e);if(!Number.isFinite(n)||n<=0)return"";if(t==="minutes"&&n>=60){const r=Math.floor(n/60),o=n%60;return o===0?`${r} hour${r!==1?"s":""}`:`${r}h ${o}m`}if(t==="hours"&&n>=24&&n%24===0){const r=n/24;return`${r} day${r!==1?"s":""}`}if(t==="days"){if(n>=30&&n%30===0)return`${n/30} month${n/30!==1?"s":""}`;if(n>=7&&n%7===0)return`${n/7} week${n/7!==1?"s":""}`}return""}function Sv({id:e,value:t,onChange:n,disabled:r,placeholder:o,unit:a}){const i=yv(a),l=xv(a),u=vv(a),c=wv(t,a),h=t===""?null:Number(t),f=()=>{const y=t===""?0:Number(t),x=y%i,w=x===0?y+i:y+(i-x);n(String(w))},g=()=>{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:g,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:o??"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:"+"}),u&&s.jsx("span",{className:"bounded-input-unit","aria-hidden":"true",children:u})]}),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${h===y.value?" preset-chip-selected":""}`,onClick:()=>n(String(y.value)),children:y.label},y.value))}),c&&s.jsxs("div",{className:"bounded-input-echo",children:["≈ ",c]})]})}function _u({htmlFor:e,label:t,description:n}){const[r,o]=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:()=>o(a=>!a),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onBlur:()=>o(!1),children:"i"}),r&&s.jsx("div",{className:"field-tip-bubble",role:"tooltip",children:n})]})]})}function jv({id:e,value:t,onChange:n,disabled:r,format:o,placeholder:a}){const[i,l]=d.useState(""),[u,c]=d.useState(!1),h=d.useRef(null),f=t?t.split(",").map(m=>m.trim()).filter(Boolean):[],g=m=>{const p=m.trim();if(!p)return;if(!Iu(p,o)){c(!0);return}c(!1);const v=f.includes(p)?f:[...f,p];n(v.join(",")),l("")},y=m=>{const p=f.filter((v,S)=>S!==m);n(p.join(","))},x=m=>{m.key==="Enter"||m.key===","||m.key==="Tab"?i.trim()&&(m.preventDefault(),g(i)):m.key==="Backspace"&&!i&&f.length>0&&y(f.length-1)},w=m=>{const p=m.clipboardData.getData("text");if(p.includes(",")){m.preventDefault();const S=p.split(",").map(T=>T.trim()).filter(Boolean).filter(T=>Iu(T,o)),b=[...new Set([...f,...S])];n(b.join(",")),l(""),c(!1)}},j=o==="email"?"Type email and press Enter...":"Type domain and press Enter...";return s.jsxs("div",{className:`tag-input${u?" tag-input-invalid":""}`,onClick:()=>{var m;return(m=h.current)==null?void 0:m.focus()},children:[f.map((m,p)=>s.jsxs("span",{className:"tag-pill",children:[m,!r&&s.jsx("button",{type:"button",className:"tag-remove",onClick:v=>{v.stopPropagation(),y(p)},"aria-label":`Remove ${m}`,children:"×"})]},m)),!r&&s.jsx("input",{ref:h,id:e,className:"tag-input-field",type:"text",value:i,onChange:m=>{l(m.target.value),c(!1)},onKeyDown:x,onPaste:w,onBlur:()=>{i.trim()&&g(i)},placeholder:f.length===0?a??j:""})]})}function kv({id:e,options:t,value:n,onChange:r,disabled:o}){const a=n?n.split(",").map(l=>l.trim()).filter(Boolean):[],i=l=>{const u=a.includes(l)?a.filter(c=>c!==l):[...a,l];r(u.join(","))};return s.jsx("div",{className:"checkbox-group",id:e,children:t.map(l=>s.jsxs("label",{className:`checkbox-pill${a.includes(l)?" checkbox-pill-selected":""}`,children:[s.jsx("input",{type:"checkbox",checked:a.includes(l),onChange:()=>i(l),disabled:o}),s.jsx("span",{children:l})]},l))})}function Ru({fieldKey:e,fieldDef:t,value:n,onChange:r,prefix:o,readOnly:a,twoColumn:i,discoveryIntegrationId:l}){const u=mv(e,t),c=`${o}-field-${e}`,h=s.jsx(s.Fragment,{children:gv(t)?s.jsx(kv,{id:c,options:t.enum,value:n,onChange:f=>r(e,f),disabled:a}):(()=>{const f=t.boundType;return(f==null?void 0:f.kind)==="enum"&&Array.isArray(f.values)})()?s.jsxs("select",{id:c,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:a,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:c,className:"form-select",value:n,onChange:f=>r(e,f.target.value),disabled:a,children:[s.jsx("option",{value:"",children:"Select..."}),t.enum.map(f=>s.jsx("option",{value:f,children:f},f))]}):t.type==="number"?s.jsx(Sv,{id:c,value:n,onChange:f=>r(e,f),disabled:a,unit:t.unit}):hv(t)?s.jsx(jv,{id:c,value:n,onChange:f=>r(e,f),disabled:a,format:t.format}):l?s.jsx(fv,{integrationId:l,field:e,value:n,onChange:f=>r(e,f),disabled:a}):s.jsx("input",{id:c,className:"form-input",type:"text",value:n,onChange:f=>r(e,f.target.value),disabled:a})});return i?s.jsxs("div",{className:"bounds-field-row",children:[s.jsx("div",{className:"bounds-field-label",children:s.jsx(_u,{htmlFor:c,label:u,description:t.description})}),s.jsx("div",{className:"bounds-field-input",children:h})]},`${o}-${e}`):s.jsxs("div",{className:"form-group",children:[s.jsx(_u,{htmlFor:c,label:u,description:t.description}),h]},`${o}-${e}`)}function Cv(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 a=!1;for(const[i,l]of Object.entries(n)){const u=e[i];if(u===""||u===void 0)continue;const c=Number(u);if(!isNaN(c)&&c>l){a=!0;break}}return a?r?"above-approvers":"hard-ceiling":"within-cap"}function Nv(e,t){const n=new Set;if(!t)return n;for(const[r,o]of Object.entries(t)){const a=e[r];if(a===""||a===void 0)continue;const i=Number(a);!isNaN(i)&&i>o&&n.add(r)}return n}function Ev({profile:e,onConfirm:t,onCancel:n,readOnly:r,initialBounds:o,initialContext:a,initialFrame:i,profileConfig:l,approverNames:u,adminName:c}){const h=e.boundsSchema??e.frameSchema,f=e.contextSchema,g=h?Object.entries(h.fields).filter(([E])=>!(E==="profile"||E==="path")):[],y=f&&f.keyOrder.length>0?Object.entries(f.fields):[],x=o??i??{},w=a??{},j={};for(const[E]of g)j[E]=x[E]!==void 0?String(x[E]):"";const m={};for(const[E]of y)m[E]=w[E]!==void 0?String(w[E]):"";const[p,v]=d.useState(j),[S,b]=d.useState(m),[T,k]=d.useState(null);d.useEffect(()=>{const E=pv(e.id);O.getIntegrationManifests().then(({manifests:P})=>{const $=P.find(F=>F.profile===E&&F.contextDiscovery&&Object.keys(F.contextDiscovery).length>0);k($??null)}).catch(()=>k(null))},[e.id]);const N=Cv(p,l),C=Nv(p,l==null?void 0:l.caps),I=(E,P)=>{v($=>({...$,[E]:P}))},M=(E,P)=>{b($=>({...$,[E]:P}))},B=()=>{const E={profile:e.id};for(const[$,F]of g)F.type==="number"?E[$]=p[$]===""?0:Number(p[$]):E[$]=p[$];const P={};for(const[$,F]of y)F.type==="number"?P[$]=S[$]===""?0:Number(S[$]):P[$]=S[$];return[E,P]},A=()=>{const[E,P]=B();t(E,P)},z=()=>{const E=(l==null?void 0:l.caps)??{},P={...p};for(const W of C)E[W]!==void 0&&(P[W]=String(E[W]));v(P);const $={profile:e.id};for(const[W,ne]of g)if(ne.type==="number"){const Q=P[W]??"";$[W]=Q===""?0:Number(Q)}else $[W]=P[W]??"";const F={};for(const[W,ne]of y)ne.type==="number"?F[W]=S[W]===""?0:Number(S[W]):F[W]=S[W];t($,F)},_=E=>{const P=l==null?void 0:l.caps;if(!P||P[E]===void 0)return null;const $=P[E],F=C.has(E);return N==="hard-ceiling"&&F?s.jsxs("span",{style:{fontSize:"0.72rem",color:"var(--danger)",marginLeft:"0.5rem",whiteSpace:"nowrap"},children:["Cap: ",$," — exceeds team ceiling"]}):N==="above-approvers"&&F?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"]})},V=()=>{var E;if(N==="no-config")return null;if(N==="approvers-dormant"){const P=u&&u.length>0?u.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: ",P]}),s.jsxs("div",{children:["No caps are set on this profile, so ",P," won't gate any action under this authority. Your intent will still be encrypted and shared with them as an accountability record — they can read what you authorised, even though they aren't reviewing individual actions."]})]})}if(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 P=u&&u.length>0?u.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 ",P,". Within-cap actions run per the mode you choose."]})]})}if(N==="hard-ceiling"){const P=Array.from(C)[0],$=P?(E=l==null?void 0:l.caps)==null?void 0:E[P]:void 0,F=c??"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 ",F," 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:z,children:"Save below cap"}),n&&s.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:n,children:"Cancel"})]})]})}return null},R=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(([E,P])=>{var F;const $=!!((F=T==null?void 0:T.contextDiscovery)!=null&&F[E]);return s.jsx(Ru,{fieldKey:E,fieldDef:P,value:S[E],onChange:M,prefix:"context",readOnly:r,discoveryIntegrationId:$?T.id:void 0},`context-${E}`)})]}),g.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:g.map(([E,P])=>{var $;return s.jsxs("div",{style:{display:"contents"},children:[s.jsx(Ru,{fieldKey:E,fieldDef:P,value:p[E],onChange:I,prefix:"bounds",readOnly:r,twoColumn:!0}),N!=="no-config"&&(($=l==null?void 0:l.caps)==null?void 0:$[E])!==void 0&&s.jsx("div",{style:{gridColumn:"2 / 3",display:"flex",alignItems:"center",paddingBottom:"0.5rem"},children:_(E)})]},`bounds-${E}`)})}),V()]}),s.jsx("button",{className:"btn btn-primary",onClick:A,disabled:R,style:{marginTop:"0.5rem"},children:r?"Next: Gates":"Next: Problem Statement"})]})}function bv(e){var n;const t=e.match(/```(?:markdown|md)?\s*\n([\s\S]*?)```/);return((n=t==null?void 0:t[1])==null?void 0:n.trim())??null}function Pv(e){return e.replace(/```(?:markdown|md)?\s*\n[\s\S]*?```/,"").trim()}const Tv="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 ia({target:e,currentText:t,onApply:n,greeting:r,placeholder:o,title:a}){const[i,l]=d.useState([{role:"assistant",content:r??Tv}]),[u,c]=d.useState(""),[h,f]=d.useState(!1),[g,y]=d.useState(null),x=d.useRef(null);d.useEffect(()=>{x.current&&(x.current.scrollTop=x.current.scrollHeight)},[i,h]);const w=async()=>{const m=u.trim();if(!m||h)return;const p=[...i,{role:"user",content:m}];l(p),c(""),y(null),f(!0);try{const v=await O.aiChat({target:e,currentText:t,messages:p.filter((S,b)=>!(b===0&&S.role==="assistant"))});v.success&&v.reply?l(S=>[...S,{role:"assistant",content:v.reply}]):y(v.error??"AI returned no reply")}catch(v){y(v instanceof Error?v.message:"Chat failed")}finally{f(!1)}},j=m=>{m.key==="Enter"&&!m.shiftKey&&!m.nativeEvent.isComposing&&(m.preventDefault(),w())};return s.jsxs("div",{className:"intent-chat",children:[s.jsx("h3",{className:"card-title",children:a??"AI Assistant"}),s.jsxs("div",{ref:x,className:"chat-messages",children:[i.map((m,p)=>{const v=m.role==="assistant"?bv(m.content):null,S=v?Pv(m.content):m.content;return s.jsx("div",{className:`chat-msg ${m.role}`,children:s.jsxs("div",{className:"chat-msg-body",children:[S&&s.jsx("div",{className:"chat-msg-prose",children:S}),v!==null&&s.jsxs(s.Fragment,{children:[s.jsx("pre",{className:"chat-fenced-block",children:v}),s.jsx("button",{type:"button",className:"btn btn-primary btn-sm chat-apply-btn",onClick:()=>n(v),children:"Apply this draft"})]})]})},p)}),h&&s.jsx("div",{className:"chat-msg assistant",children:s.jsx("div",{className:"chat-msg-body chat-msg-thinking",children:"Thinking…"})})]}),g&&s.jsx("div",{className:"error-message",children:g}),s.jsxs("div",{className:"chat-composer",children:[s.jsxs("div",{className:"chat-composer-pill",children:[s.jsx("textarea",{className:"chat-input",value:u,onChange:m=>c(m.target.value),onKeyDown:j,placeholder:o??"Ask for help articulating the intent…",rows:1,disabled:h}),s.jsx("button",{type:"button",className:"chat-send-btn",onClick:w,disabled:h||!u.trim(),"aria-label":"Send",children:"↑"})]}),s.jsx("div",{className:"chat-composer-hint",children:"Enter to send · Shift+Enter for newline"})]})]})}function kf({open:e,onClose:t,children:n,ariaLabel:r}){const o=d.useRef(null),a=d.useRef(null);return d.useEffect(()=>{var l;if(!e)return;a.current=document.activeElement,document.body.style.overflow="hidden";const i=u=>{u.key==="Escape"&&t()};return document.addEventListener("keydown",i),(l=o.current)==null||l.focus(),()=>{document.removeEventListener("keydown",i),document.body.style.overflow="",a.current instanceof HTMLElement&&a.current.focus()}},[e,t]),Qd.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:o,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)}const zu=`Why — What's the situation? Why does this need to happen?
56
56
 
57
57
  Goal — What should the agent try to achieve?
58
58
 
59
- Watch out — What should the agent avoid or be careful about?`;function Ev(){var z;const e=bt(),[t]=ff(),n=Number(t.get("step"))||2,[r,o]=d.useState(null),[a,i]=d.useState(null),[l,u]=d.useState(n),[c,h]=d.useState(null),[p,g]=d.useState(null),[y,x]=d.useState(Ru),[w,j]=d.useState(!1),[m,f]=d.useState(!0),[v,S]=d.useState(null),[b,T]=d.useState([]),[k,N]=d.useState(void 0);d.useEffect(()=>{var E;const R=sessionStorage.getItem("agentAuth");if(!R){e("/agent/new");return}const V=JSON.parse(R);o(V);const _=sessionStorage.getItem("agentGate");if(_){const P=JSON.parse(_);P.bounds&&h(P.bounds),P.context&&g(P.context),(E=P.gateContent)!=null&&E.intent&&x(P.gateContent.intent)}O.getProfile(V.profileId).then(P=>i(P)).catch(()=>e("/agent/new")).finally(()=>f(!1)),V.groupId&&Promise.all([O.getTeamProfileConfig(V.groupId,V.profileId).catch(()=>null),O.getGroupById(V.groupId).catch(()=>null),O.listUsers().catch(()=>[])]).then(([P,$,F])=>{if(S(P),P){const W=new Map;for(const G of F){const H=G.name&&G.email?`${G.name} (${G.email})`:G.name||G.email||G.id;W.set(G.id,H)}const ne=($==null?void 0:$.members)??[];for(const G of ne){const H=G.userId??G.id;H&&(G.name&&G.email?W.set(H,`${G.name} (${G.email})`):G.name&&W.set(H,G.name))}const Q=(P.approvers??[]).map(G=>W.get(G)??G);T(Q);const Pe=ne.find(G=>G.role==="admin");if(Pe){const G=Pe.userId??Pe.id;G&&N(W.get(G)??Pe.name)}}})},[e]);const C=c?Object.entries(c).filter(([R])=>R!=="profile"&&R!=="path").map(([R,V])=>`${R} = ${V}`).join(", "):"",I=(R,V)=>{h(R),g(V),u(3)},M=y.trim()!==Ru.trim()&&y.trim()!=="",B=R=>{M&&!confirm("Replace your current intent with the AI draft?")||x(R)},A=()=>{const R=a==null?void 0:a.ttl,V={intent:y};sessionStorage.setItem("agentGate",JSON.stringify({bounds:c,context:p,gateContent:V,ttlConfig:R})),e("/agent/review")};return m||!r||!a?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):s.jsxs(s.Fragment,{children:[s.jsx(wf,{currentStep:l,onStepClick:R=>{R>=2&&u(R)}}),s.jsx(iv,{profileId:r.profileId,bounds:C||void 0,groupName:r.groupName,domain:r.domain}),l===2&&s.jsx("div",{className:"card",children:s.jsx(jv,{profile:a,onConfirm:I,onCancel:()=>e("/agent/new"),initialBounds:c||void 0,initialContext:p||void 0,profileConfig:v,approverNames:b,adminName:k})}),l===3&&s.jsxs("div",{className:"intent-layout",children:[s.jsx("div",{className:"card intent-pane chat",children:s.jsx(sa,{target:{kind:"intent",profileId:r.profileId,bounds:C||void 0},currentText:y,onApply:B})}),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=>x(R.target.value)}),s.jsxs("div",{className:"char-counter",children:[y.length," / 2000"]}),s.jsxs("div",{className:"intent-footer",children:[s.jsx("button",{className:"btn btn-ghost",onClick:()=>u(2),children:"Back"}),s.jsx("button",{className:"btn btn-primary intent-continue-btn",onClick:A,disabled:!M,children:"Continue to Review"})]}),(((z=v==null?void 0:v.approvers)==null?void 0:z.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 ",b.length>0?b.join(", "):"the configured approvers"]}),"Your intent will be encrypted and shared with"," ",b.length>0?b.join(", "):"this profile's required approvers",". Only they can decrypt it — your Service Provider cannot. Each approver stores a copy as their accountability record."]})]})]}),s.jsx("button",{type:"button",className:"floating-help",onClick:()=>j(!0),"aria-label":"Open intent assistant",children:"Get help with intent"}),s.jsx(Sf,{open:w,onClose:()=>j(!1),ariaLabel:"Intent assistant",children:s.jsx(sa,{target:{kind:"intent",profileId:r.profileId,bounds:C||void 0},currentText:y,onApply:R=>{B(R),j(!1)}})})]})]})}async function ia(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map(a=>a.toString(16).padStart(2,"0")).join("")}async function jf(e,t){const n=t.boundsSchema??t.frameSchema;if(!n)throw new Error("Profile has no boundsSchema or frameSchema");const o=n.keyOrder.map(i=>`${i}=${String(e[i])}`).join(`
60
- `);return`sha256:${await ia(o)}`}async function kf(e,t){if(!t.contextSchema||t.contextSchema.keyOrder.length===0)return`sha256:${await ia("")}`;const r=t.contextSchema.keyOrder.map(a=>`${a}=${String(e[a])}`).join(`
61
- `);return`sha256:${await ia(r)}`}async function la(e){return`sha256:${await ia(e)}`}function bv(){var X,le;const e=bt(),{user:t,mode:n,domain:r}=ke(),[o,a]=d.useState(null),[i,l]=d.useState(null),[u,c]=d.useState(null),[h,p]=d.useState("immediate"),[g,y]=d.useState(1800),[x,w]=d.useState(86400),[j,m]=d.useState(""),[f,v]=d.useState("hours"),[S,b]=d.useState(""),[T,k]=d.useState(!1),[N,C]=d.useState(""),[I,M]=d.useState(null),[B,A]=d.useState([]),[z,R]=d.useState(!1);d.useEffect(()=>{const K=sessionStorage.getItem("agentAuth"),pe=sessionStorage.getItem("agentGate");if(!K||!pe){e("/agent/new");return}const ve=JSON.parse(K),yt=JSON.parse(pe),cn={bounds:yt.bounds??{},context:yt.context??{},gateContent:yt.gateContent};a(ve),l(cn),yt.ttlConfig&&(y(yt.ttlConfig.default??1800),w(yt.ttlConfig.max??86400)),O.getProfile(ve.profileId).then(He=>{var ut;if(c(He),!S){const Ae=He.name??((ut=ve.profileId.split("/").pop())==null?void 0:ut.replace(/@.*$/,""))??"",Ve=[];if(cn.context&&He.contextSchema)for(const Ze of He.contextSchema.keyOrder){const ee=cn.context[Ze];if(ee!==void 0&&ee!==""){const Tt=String(ee).split(",").map(D=>D.trim()).filter(Boolean);Ve.push(Tt.join(", "))}}const Pt=Ve.length>0?`${Ae}: ${Ve.join(" · ")}`:Ae;b(Pt)}}).catch(()=>{}),ve.groupId?Promise.all([O.getTeamProfileConfig(ve.groupId,ve.profileId).catch(()=>null),O.getGroupById(ve.groupId).catch(()=>null),O.listUsers().catch(()=>[])]).then(([He,ut,Ae])=>{if(M(He),He){const Ve=new Map;for(const ee of Ae){const Tt=ee.name&&ee.email?`${ee.name} (${ee.email})`:ee.name||ee.email||ee.id;Ve.set(ee.id,Tt)}const Pt=(ut==null?void 0:ut.members)??[];for(const ee of Pt){const Tt=ee.userId??ee.id;Tt&&(ee.name&&ee.email?Ve.set(Tt,`${ee.name} (${ee.email})`):ee.name&&Ve.set(Tt,ee.name))}const Ze=(He.approvers??[]).map(ee=>Ve.get(ee)??ee);A(Ze)}}).finally(()=>{R(!0)}):R(!0)},[e]);const V=async()=>{if(!(!o||!i||!u||!t)){if(!o.groupId){C("No active group; cannot create authorization.");return}k(!0),C("");try{const K=r||o.domain||"owner",pe=await jf(i.bounds,u),ve=await kf(i.context,u),[yt,cn]=await Promise.all([la(i.gateContent.intent),la(JSON.stringify({profile:o.profileId,domain:K,group:o.groupId}))]);let He,ut,Ae;if(o.isTeam){const Ze=await O.getApproversPubkeys(o.groupId,o.profileId);if(Ze.length>0){const ee=await O.encryptIntent(i.gateContent.intent,Ze);He=ee.intentCiphertext,ut=ee.encryptedKeys,Ae=ee.approversFrozen}}const Ve=await O.attest({profile_id:o.profileId,bounds:i.bounds,bounds_hash:pe,context_hash:ve,domain:K,did:t.did,gate_content_hashes:{intent:yt},execution_context_hash:cn,group_id:o.groupId,ttl:g,commitment_mode:h==="per-action"?"review":"automatic",title:S.trim(),intent_ciphertext:He,encrypted_keys:ut,approvers_frozen:Ae}),Pt=Ve.frame_hash??Ve.bounds_hash??pe;try{await O.pushGateContent({frameHash:Pt,boundsHash:pe,contextHash:ve,context:i.context,gateContent:i.gateContent})}catch(Ze){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. (${Ze instanceof Error?Ze.message:"Unknown error"})`)}sessionStorage.removeItem("agentAuth"),sessionStorage.removeItem("agentGate"),e(`/authorizations?highlight=${encodeURIComponent(Pt)}`)}catch(K){C(K instanceof Error?K.message:"Attestation failed")}finally{k(!1)}}};if(!o||!i)return s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."});const _=Object.entries(i.bounds).filter(([K])=>K!=="profile"&&K!=="path"),E=Object.entries(i.context),$=((I==null?void 0:I.caps)!=null?Object.keys(I.caps):[]).length!==0,F=B.length>0?B.join(", "):((I==null?void 0:I.approvers)??[]).join(", "),W=$?`Within-cap actions run per the mode you choose above. Over-cap actions will require approval from you and ${F}, regardless of your mode.`:"No caps set — they won't gate any action, but your intent is encrypted and shared with them as an accountability record.",ne=$?`Over-cap actions will be reviewed by you and ${F}. Within-cap actions run per the mode you chose above.`:`Approvers ${F} can read your intent but won't gate any action — no caps configured on this profile.`,Q=!!((X=I==null?void 0:I.approvers)!=null&&X.length),Pe=g>x,G={flex:1,padding:"0.75rem",border:h==="immediate"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:h==="immediate"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},H={flex:1,padding:"0.75rem",border:h==="per-action"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:h==="per-action"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"};return s.jsxs(s.Fragment,{children:[s.jsx(wf,{currentStep:4,onStepClick:K=>{K<=3&&e(`/agent/gate?step=${K}`)}}),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."}),N&&s.jsx("div",{className:"error-message",children:N}),s.jsxs("dl",{className:"review-grid",children:[s.jsx("dt",{children:"Profile"}),s.jsxs("dd",{children:[_e(o.profileId),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:o.profileId})]}),o.groupName&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Team"}),s.jsx("dd",{children:o.groupName})]}),o.groupId&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Approvers"}),s.jsx("dd",{children:z?(((le=I==null?void 0:I.approvers)==null?void 0:le.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:[F,s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:W})]}):s.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Loading…"})})]}),s.jsx("dt",{children:"TTL"}),s.jsx("dd",{children:"30 minutes"})]}),!!_.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:_.map(([K,pe])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:K}),s.jsx("dd",{children:String(pe)})]},K))})]}),!!E.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:E.map(([K,pe])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:K}),s.jsx("dd",{children:String(pe)})]},K))})]}),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:()=>p("immediate"),style:G,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:()=>p("per-action"),style:H,children:[s.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Review Each Action"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"You review and approve each action before it executes."})]})]}),s.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(K=>K.seconds<=x).map(K=>s.jsx("button",{onClick:()=>{y(K.seconds),m("")},style:{padding:"0.5rem 0.85rem",border:g===K.seconds?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"0.375rem",background:g===K.seconds?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"inherit",color:"var(--text-primary)"},children:K.label},K.seconds)),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:K=>{m(K.target.value);const pe=parseInt(K.target.value,10);if(pe>0){const ve=f==="days"?pe*86400:pe*3600;y(Math.min(ve,x))}}}),s.jsxs("select",{className:"form-input",style:{padding:"0.45rem 0.5rem",fontSize:"0.85rem"},value:f,onChange:K=>{v(K.target.value);const pe=parseInt(j,10);if(pe>0){const ve=K.target.value==="days"?pe*86400:pe*3600;y(Math.min(ve,x))}},children:[s.jsx("option",{value:"hours",children:"hours"}),s.jsx("option",{value:"days",children:"days"})]})]}),Pe&&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. ${_e(o.profileId)}: daily operations`,value:S,onChange:K=>b(K.target.value),maxLength:80,style:{fontSize:"0.9rem"}}),s.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"A short name to identify this authorization on your dashboard."})]}),s.jsxs("div",{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:V,disabled:T||!S.trim(),children:T?"Signing...":h==="immediate"?"Authorize":"Authorize (Review Mode)"})]}),s.jsx("div",{style:{marginTop:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)",textAlign:"center",display:Q?"block":"none"},children:ne})]})]})}const Pv={card:"💳",mail:"✉️"};function Tv({manifest:e,integration:t,state:n,onStatusChange:r,onSuccess:o}){const[a,i]=d.useState({}),[l,u]=d.useState(!1),[c,h]=d.useState(!1),[p,g]=d.useState(!1),[y,x]=d.useState(!1),[w,j]=d.useState(!1),[m,f]=d.useState(!1),[v,S]=d.useState({});d.useEffect(()=>{O.getCredential(e.id).then(M=>{var B;M.configured&&(u(!0),h(!0),e.oauth&&g(((B=M.fieldNames)==null?void 0:B.includes(e.oauth.tokenStorage))??!1))}).catch(()=>{})},[e.id,e.oauth]);const b=n==="starting"?"starting":t!=null&&t.running?"running":l?e.oauth&&!p?"needs-oauth":"ready":"unconfigured",T=async()=>{if(e.credentials.fields.some(B=>{var A;return(A=a[B.key])==null?void 0:A.trim()})){x(!0);try{await O.setCredential(e.id,a),u(!0),i({}),e.oauth?o(`${e.name} credentials saved!`):(o(`${e.name} credentials saved — starting integration...`),await N())}catch{o(`Failed to save ${e.name} credentials`)}finally{x(!1)}}},k=()=>{window.open(`/auth/oauth/${e.id}/start`,"_blank","width=600,height=700");const M=setInterval(async()=>{var B;try{const A=await O.getCredential(e.id);A.configured&&e.oauth&&((B=A.fieldNames)!=null&&B.includes(e.oauth.tokenStorage))&&(g(!0),clearInterval(M),o(`${e.name} connected — starting integration...`),await N())}catch{}},2e3);setTimeout(()=>clearInterval(M),12e4)},N=async()=>{f(!0);try{const M=await O.activateIntegration(e.id);M.warning?o(M.warning):o(`${e.name} integration started with ${M.tools.length} tools`),r()}catch(M){o(`Failed to start ${e.name}: ${M instanceof Error?M.message:"Unknown error"}`)}finally{f(!1)}},C=async()=>{try{await O.removeMcpIntegration(e.id),o(`${e.name} integration removed`),r()}catch{o(`Failed to remove ${e.name}`)}},I=Pv[e.icon]??"🔧";return s.jsxs("div",{className:"card",style:{marginBottom:"1.5rem"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"0.75rem"},children:[s.jsx("span",{style:{fontSize:"1.5rem"},children:I}),s.jsxs("div",{style:{flex:1},children:[s.jsx("h3",{className:"card-title",style:{margin:0},children:e.name}),s.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",margin:0},children:e.description})]}),e.profile&&s.jsx("span",{className:"profile-badge",children:e.profile})]}),e.setupGuide&&e.setupGuide.length>0&&b!=="running"&&s.jsxs("div",{style:{marginBottom:"0.75rem"},children:[s.jsxs("button",{onClick:()=>j(!w),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:w?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"}),"How to set up ",e.name]}),w&&s.jsx("div",{style:{marginTop:"0.75rem",paddingLeft:"0.25rem"},children:e.setupGuide.map((M,B)=>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:B+1}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.125rem"},children:M.title}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",lineHeight:1.5},children:[M.description,M.link&&s.jsxs(s.Fragment,{children:[" ",s.jsxs("a",{href:M.link,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"0.8rem"},children:["Open ","↗"]})]})]})]})]},B))})]}),b==="starting"&&s.jsxs("div",{className:"service-status",style:{color:"var(--warning)"},children:[s.jsx("span",{className:"service-status-dot",style:{background:"var(--warning)"}}),"Starting…"]}),b==="running"&&t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[s.jsxs("div",{className:"service-status service-status-connected",children:[s.jsx("span",{className:"service-status-dot"}),"Running (",t.toolCount," tools)"]}),s.jsx("button",{className:"btn btn-sm btn-ghost",style:{color:"var(--danger)"},onClick:C,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:{marginTop:"1rem",paddingTop:"1rem",borderTop:"1px solid var(--border)"},children:s.jsx(nt,{to:"/agent/new",className:"btn btn-ghost btn-sm",style:{textDecoration:"none",display:"block",textAlign:"center"},children:"Authorize your agent"})})]}),b==="unconfigured"&&(()=>{const M=e.credentials.fields.every(z=>z.optional),B=e.credentials.fields.some(z=>!z.optional),A=e.credentials.fields.some(z=>{var R;return(R=a[z.key])==null?void 0:R.trim()});return s.jsxs(s.Fragment,{children:[c&&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:()=>{u(!0),e.oauth&&g(!0)},style:{background:"none",border:"none",padding:0,color:"var(--accent)",cursor:"pointer",textDecoration:"underline"},children:"keep existing"}),"."]}),e.oauth&&!c&&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&&!c&&s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:e.setupHint}),e.credentials.fields.map(z=>s.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[s.jsx("label",{className:"form-label",children:z.label}),z.type==="password"?s.jsxs("div",{className:"cred-field",children:[s.jsx("input",{className:"form-input",type:v[z.key]?"text":"password",placeholder:z.placeholder,value:a[z.key]||"",onChange:R=>i(V=>({...V,[z.key]:R.target.value}))}),s.jsx("button",{className:"cred-toggle",onClick:()=>S(R=>({...R,[z.key]:!R[z.key]})),children:v[z.key]?"hide":"show"})]}):s.jsx("input",{className:"form-input",type:"text",placeholder:z.placeholder,value:a[z.key]||"",onChange:R=>i(V=>({...V,[z.key]:R.target.value}))})]},z.key)),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[A&&s.jsx("button",{className:"btn btn-primary",onClick:T,disabled:y||B&&!e.credentials.fields.filter(z=>!z.optional).every(z=>{var R;return(R=a[z.key])==null?void 0:R.trim()}),children:y?"Saving...":"Save & Encrypt"}),M&&!A&&s.jsx("button",{className:"btn btn-primary",onClick:N,disabled:m,children:m?"Starting...":`Activate ${e.name}`})]})]})})(),b==="needs-oauth"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.25rem"},children:["✓"," Step 1 done — credentials saved"]}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["Step 2: connect your ",e.name," account to authorize access."]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[s.jsxs("button",{className:"btn btn-primary",onClick:k,children:["Connect ",e.name," Account"]}),s.jsx("button",{className:"btn btn-ghost",onClick:()=>u(!1),children:"Change Credentials"})]})]}),b==="ready"&&!t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.75rem"},children:["✓"," ",e.oauth?`${e.name} account connected`:"Credentials configured"]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[s.jsx("button",{className:"btn btn-primary",onClick:N,disabled:m,children:m?"Starting...":`Start ${e.name} Integration`}),!e.oauth&&s.jsx("button",{className:"btn btn-ghost",onClick:()=>u(!1),children:"Update Credentials"}),e.oauth&&s.jsx("button",{className:"btn btn-ghost",onClick:()=>{u(!1),g(!1)},children:"Change Credentials"})]})]}),b==="ready"&&t&&!t.running&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"service-status service-status-error",style:{marginBottom:"0.75rem"},children:[s.jsx("span",{className:"service-status-dot"}),"Not running"]}),t.error&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--danger)",marginBottom:"0.75rem"},children:t.error}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{className:"btn btn-primary",onClick:N,disabled:m,children:m?"Starting...":"Start"}),s.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:C,children:"Disable"})]})]})]})}function Iv(){const{loading:e,mcpServerUp:t,entries:n,refresh:r}=sl(),[o,a]=d.useState(""),i=d.useCallback(l=>{a(l),setTimeout(()=>a(""),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:[n.map(l=>s.jsx(Tv,{manifest:l.manifest,integration:l.integration,state:l.state,onStatusChange:r,onSuccess:i},l.id)),n.length===0&&s.jsx("p",{style:{color:"var(--text-tertiary)",textAlign:"center",marginTop:"2rem"},children:"No integration manifests found."})]})]})}function Rv(){var M,B,A;const{activeTeam:e,activeMembership:t,refreshGroups:n,user:r}=ke(),[o,a]=d.useState(null),[i,l]=d.useState(!1),[u,c]=d.useState(""),[h,p]=d.useState(""),[g,y]=d.useState(!1),[x,w]=d.useState(""),[j,m]=d.useState("");d.useEffect(()=>{fetch("/health").then(z=>z.json()).then(z=>{typeof z.spUrl=="string"&&m(z.spUrl)}).catch(()=>{})},[]),d.useEffect(()=>{if(!e){a(null);return}O.getGroupById(e.id).then(z=>{const R=z.group??z,V=z.members??[],_=z.isAdmin??!1,E=V.map(P=>{const $=P.userId||P.id||"",F=P.role||(_&&$===R.createdBy?"admin":"member");return{id:$,name:P.name||$.slice(0,8)||"Member",email:P.email||"",domains:P.domains||[],role:F,isAdmin:F==="admin"||_&&$===R.createdBy}});a({id:R.id,name:R.name,members:E})}).catch(()=>a(null))},[e==null?void 0:e.id]);const f=(o==null?void 0:o.members.filter(z=>z.isAdmin))??[],v=(e==null?void 0:e.isAdmin)===!0&&f.length<=1&&f.some(z=>z.id===(r==null?void 0:r.id)),S=(e==null?void 0:e.name)??"",b=x.trim()===S&&!i,T=()=>{w(""),y(!0)},k=()=>{y(!1),w("")},N=async()=>{if(!(!e||!b)){l(!0),c("");try{await O.leaveTeam(e.id),await n(),p("You have left the team."),a(null),k()}catch(z){c(z instanceof Error?z.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."})]})}),u&&s.jsx("div",{className:"error-message",children:u}),h&&s.jsx("div",{className:"alert alert-success",children:h}),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:[((M=o==null?void 0:o.members)==null?void 0:M.length)??0," ",(((B=o==null?void 0:o.members)==null?void 0:B.length)??0)===1?"member":"members",e.isAdmin&&" · You are admin"]})]}),s.jsx("span",{className:"status-badge status-active",children:"Active"})]}),(A=o==null?void 0:o.members)==null?void 0:A.map(z=>s.jsxs("div",{className:"member-row",children:[s.jsx("div",{className:"member-avatar",children:z.name.split(" ").map(R=>R[0]).join("").slice(0,2).toUpperCase()}),s.jsxs("div",{className:"member-info",children:[s.jsx("div",{className:"member-name",children:z.name}),s.jsx("div",{className:"member-email",children:z.email})]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:z.role})]},z.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:v?"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||v,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 →"})]}),g&&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:z=>z.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:z=>w(z.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:!b,children:i?"Leaving...":"Leave team"})]})]})})]})}function _v({onDismiss:e}){const t=bt(),{group:n,groupId:r,domain:o}=ke(),[a,i]=d.useState([]),[l,u]=d.useState([]),[c,h]=d.useState([]),[p,g]=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),u(N),h(C),r){const I=await Promise.all(k.map(B=>O.getTeamProfileConfig(r,B.id).catch(()=>null))),M={};k.forEach((B,A)=>{const z=I[A];z&&(M[B.id]=z)}),x(M)}}).finally(()=>g(!1))},[r]);const m=new Map,f=new Map;for(const k of l)k.profile&&m.set(k.profile,k);for(const k of c){const N=l.find(C=>C.id===k.id);N!=null&&N.profile&&f.set(N.profile,k)}const v=a.filter(k=>{const N=k.id.replace(/@.*$/,"").split("/").pop()??k.id;return m.has(N)}),S=k=>k in y,b=(k,N)=>{if(!r){console.error("No active group when creating authorization");return}const C=S(k);sessionStorage.setItem("agentAuth",JSON.stringify({profileId:k,groupId:r,groupName:(n==null?void 0:n.name)??null,domain:o,isTeam:C})),N?sessionStorage.setItem("agentGate",JSON.stringify({bounds:N.bounds,context:N.context,gateContent:{intent:N.intent},ttlConfig:{max:N.ttl},templateMode:N.mode,templateTtl:N.ttl})):sessionStorage.removeItem("agentGate"),j(null),e==null||e(),t("/agent/gate")},T=k=>{if(!r)return;const N=k.replace(/@.*$/,"").split("/").pop()??k,C=m.get(N);C!=null&&C.templates&&C.templates.length>0?j({profileId:k,manifest:C}):b(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:()=>b(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:()=>b(w.profileId),children:"Custom — define your own limits and scope"})]})}return s.jsxs(s.Fragment,{children:[s.jsx("style",{children:`
59
+ Watch out — What should the agent avoid or be careful about?`;function Iv(){var z;const e=Dt(),[t]=mf(),n=Number(t.get("step"))||2,[r,o]=d.useState(null),[a,i]=d.useState(null),[l,u]=d.useState(n),[c,h]=d.useState(null),[f,g]=d.useState(null),[y,x]=d.useState(zu),[w,j]=d.useState(!1),[m,p]=d.useState(!0),[v,S]=d.useState(null),[b,T]=d.useState([]),[k,N]=d.useState(void 0);d.useEffect(()=>{var E;const _=sessionStorage.getItem("agentAuth");if(!_){e("/agent/new");return}const V=JSON.parse(_);o(V);const R=sessionStorage.getItem("agentGate");if(R){const P=JSON.parse(R);P.bounds&&h(P.bounds),P.context&&g(P.context),(E=P.gateContent)!=null&&E.intent&&x(P.gateContent.intent)}O.getProfile(V.profileId).then(P=>i(P)).catch(()=>e("/agent/new")).finally(()=>p(!1)),V.groupId&&Promise.all([O.getTeamProfileConfig(V.groupId,V.profileId).catch(()=>null),O.getGroupById(V.groupId).catch(()=>null),O.listUsers().catch(()=>[])]).then(([P,$,F])=>{if(S(P),P){const W=new Map;for(const G of F){const H=G.name&&G.email?`${G.name} (${G.email})`:G.name||G.email||G.id;W.set(G.id,H)}const ne=($==null?void 0:$.members)??[];for(const G of ne){const H=G.userId??G.id;H&&(G.name&&G.email?W.set(H,`${G.name} (${G.email})`):G.name&&W.set(H,G.name))}const Q=(P.approvers??[]).map(G=>W.get(G)??G);T(Q);const Pe=ne.find(G=>G.role==="admin");if(Pe){const G=Pe.userId??Pe.id;G&&N(W.get(G)??Pe.name)}}})},[e]);const C=c?Object.entries(c).filter(([_])=>_!=="profile"&&_!=="path").map(([_,V])=>`${_} = ${V}`).join(", "):"",I=(_,V)=>{h(_),g(V),u(3)},M=y.trim()!==zu.trim()&&y.trim()!=="",B=_=>{M&&!confirm("Replace your current intent with the AI draft?")||x(_)},A=()=>{const _=a==null?void 0:a.ttl,V={intent:y};sessionStorage.setItem("agentGate",JSON.stringify({bounds:c,context:f,gateContent:V,ttlConfig:_})),e("/agent/review")};return m||!r||!a?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):s.jsxs(s.Fragment,{children:[s.jsx(jf,{currentStep:l,onStepClick:_=>{_>=2&&u(_)}}),s.jsx(dv,{profileId:r.profileId,bounds:C||void 0,groupName:r.groupName,domain:r.domain}),l===2&&s.jsx("div",{className:"card",children:s.jsx(Ev,{profile:a,onConfirm:I,onCancel:()=>e("/agent/new"),initialBounds:c||void 0,initialContext:f||void 0,profileConfig:v,approverNames:b,adminName:k})}),l===3&&s.jsxs("div",{className:"intent-layout",children:[s.jsx("div",{className:"card intent-pane chat",children:s.jsx(ia,{target:{kind:"intent",profileId:r.profileId,bounds:C||void 0},currentText:y,onApply:B})}),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:_=>x(_.target.value)}),s.jsxs("div",{className:"char-counter",children:[y.length," / 2000"]}),s.jsxs("div",{className:"intent-footer",children:[s.jsx("button",{className:"btn btn-ghost",onClick:()=>u(2),children:"Back"}),s.jsx("button",{className:"btn btn-primary intent-continue-btn",onClick:A,disabled:!M,children:"Continue to Review"})]}),(((z=v==null?void 0:v.approvers)==null?void 0:z.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 ",b.length>0?b.join(", "):"the configured approvers"]}),"Your intent will be encrypted and shared with"," ",b.length>0?b.join(", "):"this profile's required approvers",". Only they can decrypt it — your Service Provider cannot. Each approver stores a copy as their accountability record."]})]})]}),s.jsx("button",{type:"button",className:"floating-help",onClick:()=>j(!0),"aria-label":"Open intent assistant",children:"Get help with intent"}),s.jsx(kf,{open:w,onClose:()=>j(!1),ariaLabel:"Intent assistant",children:s.jsx(ia,{target:{kind:"intent",profileId:r.profileId,bounds:C||void 0},currentText:y,onApply:_=>{B(_),j(!1)}})})]})]})}async function la(e){const n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return Array.from(new Uint8Array(r)).map(a=>a.toString(16).padStart(2,"0")).join("")}async function Cf(e,t){const n=t.boundsSchema??t.frameSchema;if(!n)throw new Error("Profile has no boundsSchema or frameSchema");const o=n.keyOrder.map(i=>`${i}=${String(e[i])}`).join(`
60
+ `);return`sha256:${await la(o)}`}async function Nf(e,t){if(!t.contextSchema||t.contextSchema.keyOrder.length===0)return`sha256:${await la("")}`;const r=t.contextSchema.keyOrder.map(a=>`${a}=${String(e[a])}`).join(`
61
+ `);return`sha256:${await la(r)}`}async function ua(e){return`sha256:${await la(e)}`}function _v(){var X,le;const e=Dt(),{user:t,mode:n,domain:r}=ke(),[o,a]=d.useState(null),[i,l]=d.useState(null),[u,c]=d.useState(null),[h,f]=d.useState("immediate"),[g,y]=d.useState(1800),[x,w]=d.useState(86400),[j,m]=d.useState(""),[p,v]=d.useState("hours"),[S,b]=d.useState(""),[T,k]=d.useState(!1),[N,C]=d.useState(""),[I,M]=d.useState(null),[B,A]=d.useState([]),[z,_]=d.useState(!1);d.useEffect(()=>{const K=sessionStorage.getItem("agentAuth"),pe=sessionStorage.getItem("agentGate");if(!K||!pe){e("/agent/new");return}const ve=JSON.parse(K),yt=JSON.parse(pe),cn={bounds:yt.bounds??{},context:yt.context??{},gateContent:yt.gateContent};a(ve),l(cn),yt.ttlConfig&&(y(yt.ttlConfig.default??1800),w(yt.ttlConfig.max??86400)),O.getProfile(ve.profileId).then(He=>{var ut;if(c(He),!S){const Ae=He.name??((ut=ve.profileId.split("/").pop())==null?void 0:ut.replace(/@.*$/,""))??"",Ve=[];if(cn.context&&He.contextSchema)for(const Ze of He.contextSchema.keyOrder){const ee=cn.context[Ze];if(ee!==void 0&&ee!==""){const Pt=String(ee).split(",").map(D=>D.trim()).filter(Boolean);Ve.push(Pt.join(", "))}}const bt=Ve.length>0?`${Ae}: ${Ve.join(" · ")}`:Ae;b(bt)}}).catch(()=>{}),ve.groupId?Promise.all([O.getTeamProfileConfig(ve.groupId,ve.profileId).catch(()=>null),O.getGroupById(ve.groupId).catch(()=>null),O.listUsers().catch(()=>[])]).then(([He,ut,Ae])=>{if(M(He),He){const Ve=new Map;for(const ee of Ae){const Pt=ee.name&&ee.email?`${ee.name} (${ee.email})`:ee.name||ee.email||ee.id;Ve.set(ee.id,Pt)}const bt=(ut==null?void 0:ut.members)??[];for(const ee of bt){const Pt=ee.userId??ee.id;Pt&&(ee.name&&ee.email?Ve.set(Pt,`${ee.name} (${ee.email})`):ee.name&&Ve.set(Pt,ee.name))}const Ze=(He.approvers??[]).map(ee=>Ve.get(ee)??ee);A(Ze)}}).finally(()=>{_(!0)}):_(!0)},[e]);const V=async()=>{if(!(!o||!i||!u||!t)){if(!o.groupId){C("No active group; cannot create authorization.");return}k(!0),C("");try{const K=r||o.domain||"owner",pe=await Cf(i.bounds,u),ve=await Nf(i.context,u),[yt,cn]=await Promise.all([ua(i.gateContent.intent),ua(JSON.stringify({profile:o.profileId,domain:K,group:o.groupId}))]);let He,ut,Ae;if(o.isTeam){const Ze=await O.getApproversPubkeys(o.groupId,o.profileId);if(Ze.length>0){const ee=await O.encryptIntent(i.gateContent.intent,Ze);He=ee.intentCiphertext,ut=ee.encryptedKeys,Ae=ee.approversFrozen}}const Ve=await O.attest({profile_id:o.profileId,bounds:i.bounds,bounds_hash:pe,context_hash:ve,domain:K,did:t.did,gate_content_hashes:{intent:yt},execution_context_hash:cn,group_id:o.groupId,ttl:g,commitment_mode:h==="per-action"?"review":"automatic",title:S.trim(),intent_ciphertext:He,encrypted_keys:ut,approvers_frozen:Ae}),bt=Ve.frame_hash??Ve.bounds_hash??pe;try{await O.pushGateContent({frameHash:bt,boundsHash:pe,contextHash:ve,context:i.context,gateContent:i.gateContent})}catch(Ze){try{await O.revokeAttestation(bt,"Auto-revoked: gate content push failed")}catch{}throw new Error(`Authorization signed but gate content delivery failed. The attestation was revoked. Please try again. (${Ze instanceof Error?Ze.message:"Unknown error"})`)}sessionStorage.removeItem("agentAuth"),sessionStorage.removeItem("agentGate"),e(`/authorizations?highlight=${encodeURIComponent(bt)}`)}catch(K){C(K instanceof Error?K.message:"Attestation failed")}finally{k(!1)}}};if(!o||!i)return s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."});const R=Object.entries(i.bounds).filter(([K])=>K!=="profile"&&K!=="path"),E=Object.entries(i.context),$=((I==null?void 0:I.caps)!=null?Object.keys(I.caps):[]).length!==0,F=B.length>0?B.join(", "):((I==null?void 0:I.approvers)??[]).join(", "),W=$?`Within-cap actions run per the mode you choose above. Over-cap actions will require approval from you and ${F}, regardless of your mode.`:"No caps set — they won't gate any action, but your intent is encrypted and shared with them as an accountability record.",ne=$?`Over-cap actions will be reviewed by you and ${F}. Within-cap actions run per the mode you chose above.`:`Approvers ${F} can read your intent but won't gate any action — no caps configured on this profile.`,Q=!!((X=I==null?void 0:I.approvers)!=null&&X.length),Pe=g>x,G={flex:1,padding:"0.75rem",border:h==="immediate"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:h==="immediate"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"},H={flex:1,padding:"0.75rem",border:h==="per-action"?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"var(--radius)",background:h==="per-action"?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",textAlign:"left",fontFamily:"inherit"};return s.jsxs(s.Fragment,{children:[s.jsx(jf,{currentStep:4,onStepClick:K=>{K<=3&&e(`/agent/gate?step=${K}`)}}),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."}),N&&s.jsx("div",{className:"error-message",children:N}),s.jsxs("dl",{className:"review-grid",children:[s.jsx("dt",{children:"Profile"}),s.jsxs("dd",{children:[Re(o.profileId),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:o.profileId})]}),o.groupName&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Team"}),s.jsx("dd",{children:o.groupName})]}),o.groupId&&s.jsxs(s.Fragment,{children:[s.jsx("dt",{children:"Approvers"}),s.jsx("dd",{children:z?(((le=I==null?void 0:I.approvers)==null?void 0:le.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:[F,s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"0.125rem"},children:W})]}):s.jsx("span",{style:{color:"var(--text-tertiary)"},children:"Loading…"})})]}),s.jsx("dt",{children:"TTL"}),s.jsx("dd",{children:"30 minutes"})]}),!!R.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:R.map(([K,pe])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:K}),s.jsx("dd",{children:String(pe)})]},K))})]}),!!E.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:E.map(([K,pe])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:K}),s.jsx("dd",{children:String(pe)})]},K))})]}),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:G,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:H,children:[s.jsx("div",{style:{fontWeight:600,fontSize:"0.85rem",marginBottom:"0.25rem",color:"var(--text-primary)"},children:"Review Each Action"}),s.jsx("div",{style:{fontSize:"0.75rem",color:"var(--text-secondary)"},children:"You review and approve each action before it executes."})]})]}),s.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(K=>K.seconds<=x).map(K=>s.jsx("button",{onClick:()=>{y(K.seconds),m("")},style:{padding:"0.5rem 0.85rem",border:g===K.seconds?"2px solid var(--accent)":"1px solid var(--border)",borderRadius:"0.375rem",background:g===K.seconds?"var(--accent-subtle)":"var(--bg-elevated)",cursor:"pointer",fontSize:"0.85rem",fontFamily:"inherit",color:"var(--text-primary)"},children:K.label},K.seconds)),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:K=>{m(K.target.value);const pe=parseInt(K.target.value,10);if(pe>0){const ve=p==="days"?pe*86400:pe*3600;y(Math.min(ve,x))}}}),s.jsxs("select",{className:"form-input",style:{padding:"0.45rem 0.5rem",fontSize:"0.85rem"},value:p,onChange:K=>{v(K.target.value);const pe=parseInt(j,10);if(pe>0){const ve=K.target.value==="days"?pe*86400:pe*3600;y(Math.min(ve,x))}},children:[s.jsx("option",{value:"hours",children:"hours"}),s.jsx("option",{value:"days",children:"days"})]})]}),Pe&&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. ${Re(o.profileId)}: daily operations`,value:S,onChange:K=>b(K.target.value),maxLength:80,style:{fontSize:"0.9rem"}}),s.jsx("div",{style:{fontSize:"0.7rem",color:"var(--text-tertiary)",marginTop:"0.25rem"},children:"A short name to identify this authorization on your dashboard."})]}),s.jsxs("div",{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:V,disabled:T||!S.trim(),children:T?"Signing...":h==="immediate"?"Authorize":"Authorize (Review Mode)"})]}),s.jsx("div",{style:{marginTop:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)",textAlign:"center",display:Q?"block":"none"},children:ne})]})]})}const Rv={card:"💳",mail:"✉️"};function zv({manifest:e,integration:t,state:n,onStatusChange:r,onSuccess:o}){const[a,i]=d.useState({}),[l,u]=d.useState(!1),[c,h]=d.useState(!1),[f,g]=d.useState(!1),[y,x]=d.useState(!1),[w,j]=d.useState(!1),[m,p]=d.useState(!1),[v,S]=d.useState({});d.useEffect(()=>{O.getCredential(e.id).then(M=>{var B;M.configured&&(u(!0),h(!0),e.oauth&&g(((B=M.fieldNames)==null?void 0:B.includes(e.oauth.tokenStorage))??!1))}).catch(()=>{})},[e.id,e.oauth]);const b=n==="starting"?"starting":t!=null&&t.running?"running":l?e.oauth&&!f?"needs-oauth":"ready":"unconfigured",T=async()=>{if(e.credentials.fields.some(B=>{var A;return(A=a[B.key])==null?void 0:A.trim()})){x(!0);try{await O.setCredential(e.id,a),u(!0),i({}),e.oauth?o(`${e.name} credentials saved!`):(o(`${e.name} credentials saved — starting integration...`),await N())}catch{o(`Failed to save ${e.name} credentials`)}finally{x(!1)}}},k=()=>{window.open(`/auth/oauth/${e.id}/start`,"_blank","width=600,height=700");const M=setInterval(async()=>{var B;try{const A=await O.getCredential(e.id);A.configured&&e.oauth&&((B=A.fieldNames)!=null&&B.includes(e.oauth.tokenStorage))&&(g(!0),clearInterval(M),o(`${e.name} connected — starting integration...`),await N())}catch{}},2e3);setTimeout(()=>clearInterval(M),12e4)},N=async()=>{p(!0);try{const M=await O.activateIntegration(e.id);M.warning?o(M.warning):o(`${e.name} integration started with ${M.tools.length} tools`),r()}catch(M){o(`Failed to start ${e.name}: ${M instanceof Error?M.message:"Unknown error"}`)}finally{p(!1)}},C=async()=>{try{await O.removeMcpIntegration(e.id),o(`${e.name} integration removed`),r()}catch{o(`Failed to remove ${e.name}`)}},I=Rv[e.icon]??"🔧";return s.jsxs("div",{className:"card",style:{marginBottom:"1.5rem"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"0.75rem"},children:[s.jsx("span",{style:{fontSize:"1.5rem"},children:I}),s.jsxs("div",{style:{flex:1},children:[s.jsx("h3",{className:"card-title",style:{margin:0},children:e.name}),s.jsx("p",{style:{fontSize:"0.85rem",color:"var(--text-secondary)",margin:0},children:e.description})]}),e.profile&&s.jsx("span",{className:"profile-badge",children:e.profile})]}),e.setupGuide&&e.setupGuide.length>0&&b!=="running"&&s.jsxs("div",{style:{marginBottom:"0.75rem"},children:[s.jsxs("button",{onClick:()=>j(!w),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:w?"rotate(90deg)":"rotate(0deg)",display:"inline-block"},children:"▶"}),"How to set up ",e.name]}),w&&s.jsx("div",{style:{marginTop:"0.75rem",paddingLeft:"0.25rem"},children:e.setupGuide.map((M,B)=>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:B+1}),s.jsxs("div",{children:[s.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:"var(--text-primary)",marginBottom:"0.125rem"},children:M.title}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",lineHeight:1.5},children:[M.description,M.link&&s.jsxs(s.Fragment,{children:[" ",s.jsxs("a",{href:M.link,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"0.8rem"},children:["Open ","↗"]})]})]})]})]},B))})]}),b==="starting"&&s.jsxs("div",{className:"service-status",style:{color:"var(--warning)"},children:[s.jsx("span",{className:"service-status-dot",style:{background:"var(--warning)"}}),"Starting…"]}),b==="running"&&t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[s.jsxs("div",{className:"service-status service-status-connected",children:[s.jsx("span",{className:"service-status-dot"}),"Running (",t.toolCount," tools)"]}),s.jsx("button",{className:"btn btn-sm btn-ghost",style:{color:"var(--danger)"},onClick:C,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:{marginTop:"1rem",paddingTop:"1rem",borderTop:"1px solid var(--border)"},children:s.jsx(nt,{to:"/agent/new",className:"btn btn-ghost btn-sm",style:{textDecoration:"none",display:"block",textAlign:"center"},children:"Authorize your agent"})})]}),b==="unconfigured"&&(()=>{const M=e.credentials.fields.every(z=>z.optional),B=e.credentials.fields.some(z=>!z.optional),A=e.credentials.fields.some(z=>{var _;return(_=a[z.key])==null?void 0:_.trim()});return s.jsxs(s.Fragment,{children:[c&&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:()=>{u(!0),e.oauth&&g(!0)},style:{background:"none",border:"none",padding:0,color:"var(--accent)",cursor:"pointer",textDecoration:"underline"},children:"keep existing"}),"."]}),e.oauth&&!c&&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&&!c&&s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.75rem"},children:e.setupHint}),e.credentials.fields.map(z=>s.jsxs("div",{className:"form-group",style:{marginBottom:"0.75rem"},children:[s.jsx("label",{className:"form-label",children:z.label}),z.type==="password"?s.jsxs("div",{className:"cred-field",children:[s.jsx("input",{className:"form-input",type:v[z.key]?"text":"password",placeholder:z.placeholder,value:a[z.key]||"",onChange:_=>i(V=>({...V,[z.key]:_.target.value}))}),s.jsx("button",{className:"cred-toggle",onClick:()=>S(_=>({..._,[z.key]:!_[z.key]})),children:v[z.key]?"hide":"show"})]}):s.jsx("input",{className:"form-input",type:"text",placeholder:z.placeholder,value:a[z.key]||"",onChange:_=>i(V=>({...V,[z.key]:_.target.value}))})]},z.key)),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[A&&s.jsx("button",{className:"btn btn-primary",onClick:T,disabled:y||B&&!e.credentials.fields.filter(z=>!z.optional).every(z=>{var _;return(_=a[z.key])==null?void 0:_.trim()}),children:y?"Saving...":"Save & Encrypt"}),M&&!A&&s.jsx("button",{className:"btn btn-primary",onClick:N,disabled:m,children:m?"Starting...":`Activate ${e.name}`})]})]})})(),b==="needs-oauth"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.25rem"},children:["✓"," Step 1 done — credentials saved"]}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.75rem"},children:["Step 2: connect your ",e.name," account to authorize access."]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[s.jsxs("button",{className:"btn btn-primary",onClick:k,children:["Connect ",e.name," Account"]}),s.jsx("button",{className:"btn btn-ghost",onClick:()=>u(!1),children:"Change Credentials"})]})]}),b==="ready"&&!t&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--success)",marginBottom:"0.75rem"},children:["✓"," ",e.oauth?`${e.name} account connected`:"Credentials configured"]}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[s.jsx("button",{className:"btn btn-primary",onClick:N,disabled:m,children:m?"Starting...":`Start ${e.name} Integration`}),!e.oauth&&s.jsx("button",{className:"btn btn-ghost",onClick:()=>u(!1),children:"Update Credentials"}),e.oauth&&s.jsx("button",{className:"btn btn-ghost",onClick:()=>{u(!1),g(!1)},children:"Change Credentials"})]})]}),b==="ready"&&t&&!t.running&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"service-status service-status-error",style:{marginBottom:"0.75rem"},children:[s.jsx("span",{className:"service-status-dot"}),"Not running"]}),t.error&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--danger)",marginBottom:"0.75rem"},children:t.error}),s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{className:"btn btn-primary",onClick:N,disabled:m,children:m?"Starting...":"Start"}),s.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:C,children:"Disable"})]})]})]})}function Av(){const{loading:e,mcpServerUp:t,entries:n,refresh:r}=cl(),[o,a]=d.useState(""),i=d.useCallback(l=>{a(l),setTimeout(()=>a(""),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:[n.map(l=>s.jsx(zv,{manifest:l.manifest,integration:l.integration,state:l.state,onStatusChange:r,onSuccess:i},l.id)),n.length===0&&s.jsx("p",{style:{color:"var(--text-tertiary)",textAlign:"center",marginTop:"2rem"},children:"No integration manifests found."})]})]})}function $v(){var M,B,A;const{activeTeam:e,activeMembership:t,refreshGroups:n,user:r}=ke(),[o,a]=d.useState(null),[i,l]=d.useState(!1),[u,c]=d.useState(""),[h,f]=d.useState(""),[g,y]=d.useState(!1),[x,w]=d.useState(""),[j,m]=d.useState("");d.useEffect(()=>{fetch("/health").then(z=>z.json()).then(z=>{typeof z.spUrl=="string"&&m(z.spUrl)}).catch(()=>{})},[]),d.useEffect(()=>{if(!e){a(null);return}O.getGroupById(e.id).then(z=>{const _=z.group??z,V=z.members??[],R=z.isAdmin??!1,E=V.map(P=>{const $=P.userId||P.id||"",F=P.role||(R&&$===_.createdBy?"admin":"member");return{id:$,name:P.name||$.slice(0,8)||"Member",email:P.email||"",domains:P.domains||[],role:F,isAdmin:F==="admin"||R&&$===_.createdBy}});a({id:_.id,name:_.name,members:E})}).catch(()=>a(null))},[e==null?void 0:e.id]);const p=(o==null?void 0:o.members.filter(z=>z.isAdmin))??[],v=(e==null?void 0:e.isAdmin)===!0&&p.length<=1&&p.some(z=>z.id===(r==null?void 0:r.id)),S=(e==null?void 0:e.name)??"",b=x.trim()===S&&!i,T=()=>{w(""),y(!0)},k=()=>{y(!1),w("")},N=async()=>{if(!(!e||!b)){l(!0),c("");try{await O.leaveTeam(e.id),await n(),f("You have left the team."),a(null),k()}catch(z){c(z instanceof Error?z.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."})]})}),u&&s.jsx("div",{className:"error-message",children:u}),h&&s.jsx("div",{className:"alert alert-success",children:h}),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:[((M=o==null?void 0:o.members)==null?void 0:M.length)??0," ",(((B=o==null?void 0:o.members)==null?void 0:B.length)??0)===1?"member":"members",e.isAdmin&&" · You are admin"]})]}),s.jsx("span",{className:"status-badge status-active",children:"Active"})]}),(A=o==null?void 0:o.members)==null?void 0:A.map(z=>s.jsxs("div",{className:"member-row",children:[s.jsx("div",{className:"member-avatar",children:z.name.split(" ").map(_=>_[0]).join("").slice(0,2).toUpperCase()}),s.jsxs("div",{className:"member-info",children:[s.jsx("div",{className:"member-name",children:z.name}),s.jsx("div",{className:"member-email",children:z.email})]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:z.role})]},z.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:v?"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||v,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 →"})]}),g&&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:z=>z.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:z=>w(z.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:!b,children:i?"Leaving...":"Leave team"})]})]})})]})}function Lv({onDismiss:e}){const t=Dt(),{group:n,groupId:r,domain:o}=ke(),[a,i]=d.useState([]),[l,u]=d.useState([]),[c,h]=d.useState([]),[f,g]=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),u(N),h(C),r){const I=await Promise.all(k.map(B=>O.getTeamProfileConfig(r,B.id).catch(()=>null))),M={};k.forEach((B,A)=>{const z=I[A];z&&(M[B.id]=z)}),x(M)}}).finally(()=>g(!1))},[r]);const m=new Map,p=new Map;for(const k of l)k.profile&&m.set(k.profile,k);for(const k of c){const N=l.find(C=>C.id===k.id);N!=null&&N.profile&&p.set(N.profile,k)}const v=a.filter(k=>{const N=k.id.replace(/@.*$/,"").split("/").pop()??k.id;return m.has(N)}),S=k=>k in y,b=(k,N)=>{if(!r){console.error("No active group when creating authorization");return}const C=S(k);sessionStorage.setItem("agentAuth",JSON.stringify({profileId:k,groupId:r,groupName:(n==null?void 0:n.name)??null,domain:o,isTeam:C})),N?sessionStorage.setItem("agentGate",JSON.stringify({bounds:N.bounds,context:N.context,gateContent:{intent:N.intent},ttlConfig:{max:N.ttl},templateMode:N.mode,templateTtl:N.ttl})):sessionStorage.removeItem("agentGate"),j(null),e==null||e(),t("/agent/gate")},T=k=>{if(!r)return;const N=k.replace(/@.*$/,"").split("/").pop()??k,C=m.get(N);C!=null&&C.templates&&C.templates.length>0?j({profileId:k,manifest:C}):b(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:()=>b(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:()=>b(w.profileId),children:"Custom — define your own limits and scope"})]})}return s.jsxs(s.Fragment,{children:[s.jsx("style",{children:`
62
62
  .profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; align-items: stretch; }
63
63
  .profile-grid .card { display: flex; flex-direction: column; height: 100%; margin-top: 0 !important; }
64
64
  @media (max-width: 900px) { .profile-grid { grid-template-columns: repeat(2, 1fr); } }
65
65
  @media (max-width: 560px) { .profile-grid { grid-template-columns: 1fr; } }
66
- `}),p?s.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem"},children:"Loading..."}):v.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(nt,{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:v.map(k=>{const N=S(k.id),C=k.id.replace(/@.*$/,"").split("/").pop()??k.id,I=m.get(C),M=f.get(C),B=(M==null?void 0:M.running)===!0;return s.jsxs("div",{className:"card",style:B?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:_e(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}),B?s.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>T(k.id),children:"Authorize"}):s.jsxs(nt,{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 zv={active:"Active",pending:"Pending",expired:"Expired",revoked:"Revoked"};function Av({status:e,label:t}){return s.jsx("span",{className:`status-badge status-${e}`,children:t||zv[e]})}function $v({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 pn=86400,yr=3600,wo=60,Lv=30*pn;function Mv(e){if(e<=0)return"Expired";if(e>90*pn){const t=Math.floor(e/Lv);return`${t} ${t===1?"month":"months"} remaining`}if(e>7*pn){const t=Math.floor(e/pn);return`${t} ${t===1?"day":"days"} remaining`}if(e>=2*pn){const t=Math.floor(e/pn),n=Math.floor(e%pn/yr);return`${t} ${t===1?"day":"days"} ${n}h remaining`}if(e>=2*yr){const t=Math.floor(e/yr),n=Math.floor(e%yr/wo);return`${t}h ${String(n).padStart(2,"0")}m remaining`}if(e>=wo){const t=Math.floor(e/wo),n=Math.floor(e%wo);return`${t}m ${String(n).padStart(2,"0")}s remaining`}return`${Math.floor(e)}s remaining`}function Fv({expiresAt:e}){const[t,n]=d.useState(()=>e-Date.now()/1e3),r=t<2*yr;d.useEffect(()=>{const a=setInterval(()=>n(e-Date.now()/1e3),r?1e3:6e4);return()=>clearInterval(a)},[e,r]);const o=t<300;return s.jsx("span",{className:`ttl-badge ${o?"ttl-warn":"ttl-ok"}`,children:Mv(t)})}function Cf({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 Ov(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 Bv=[{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 Dv({item:e,onClose:t,onSuccess:n}){var m;const{user:r,activeDomain:o,groupId:a}=ke(),i=e.remaining_seconds??0,l=Bv.filter(f=>f.seconds>i),u=((m=l[0])==null?void 0:m.seconds)??2592e3,[c,h]=d.useState(u),[p,g]=d.useState(!1),[y,x]=d.useState(""),w=Object.entries(e.frame).filter(([f])=>f!=="profile"&&f!=="path"),j=async()=>{var f;if(r){g(!0),x("");try{const v=e.frame_hash||e.profile_id||e.path,S=await O.getGateContent(v);if(!S)throw new Error("Gate content not found locally. The MCP server may have restarted. Please re-authorize through the full wizard instead.");const b=await O.getProfile(e.profile_id),T=e.frame,k=S.context??{},N=e.attested_domains[0]||o||"owner",C=await jf(T,b),I=await kf(k,b),[M,B]=await Promise.all([la(S.gateContent.intent),la(JSON.stringify({profile:e.profile_id,path:e.path,domain:N}))]);if(!a)throw new Error("No active group; cannot extend authorization.");const A=(((f=e.deferred_commitment_domains)==null?void 0:f.length)??0)>0?"review":"automatic",z=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:M},execution_context_hash:B,group_id:a,commitment_mode:A,ttl:c});await O.pushGateContent({boundsHash:z.bounds_hash??C,contextHash:I,context:k,path:e.path,gateContent:S.gateContent}),n()}catch(v){x(v instanceof Error?v.message:"Extension failed")}finally{g(!1)}}};return s.jsx("div",{className:"modal-backdrop",onClick:f=>f.target===f.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:[_e(e.profile_id)," / ",e.path]}),w.length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:w.map(([f,v])=>`${f}=${v}`).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 ",Ov(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(f=>s.jsx("button",{className:`btn ${c===f.seconds?"btn-primary":"btn-secondary"}`,onClick:()=>h(f.seconds),style:{minWidth:"3.5rem"},children:f.label},f.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:p,children:"Cancel"}),s.jsx("button",{className:"btn btn-primary",onClick:j,disabled:p,children:p?"Extending...":"Extend"})]})]})})}function Uv(e,t,n){return[...e].sort((r,o)=>{if(n){if(r.frame_hash===n&&o.frame_hash!==n)return-1;if(o.frame_hash===n&&r.frame_hash!==n)return 1}const a=jt(r,{revokedSet:t}),i=jt(o,{revokedSet:t}),l={active:0,pending:1,expired:2,revoked:3};return l[a]!==l[i]?l[a]-l[i]:new Date(o.created_at).getTime()-new Date(r.created_at).getTime()})}function Wv({item:e,revokedSet:t,expandedHash:n,gateCache:r,gateLoading:o,copiedHash:a,revokingHash:i,copyingHash:l,profileConfigCache:u,mode:c,ownerLabel:h,isAdmin:p,onExpand:g,onCopyHash:y,onCopy:x,onRevoke:w,onExtend:j,highlightHash:m}){var $;const f=jt(e,{revokedSet:t}),v=n===e.frame_hash,S=r[e.frame_hash||e.profile_id||e.path],b=f==="active"||f==="pending"||f==="expired",T=Object.entries(e.frame).filter(([F])=>F!=="profile"&&F!=="path"),k=u.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&&c==="team")for(const[F,W]of T){const ne=k.caps[F];ne!==void 0&&Number(W)>ne&&C.set(F,{authorized:Number(W),cap:ne})}const I=C.size>0,M=e.approvers_frozen??[],B=(k==null?void 0:k.approvers)??[],A=c==="team"&&M.length>0&&B.length>0&&(M.length!==B.length||M.some(F=>!B.includes(F))||B.some(F=>!M.includes(F))),z=Array.from(C.entries()).map(([F,W])=>`${F}: ${W.authorized} (cap ${W.cap})`).join(", "),R=Array.from(C.entries()).map(([F,W])=>`${F}: ${W.authorized} → ${W.cap}`).join(", "),V=I?N?C.size===1?`Above team cap: ${z} — actions require approval`:`Above team cap (${C.size}): ${z} — actions require approval`:C.size===1?`Reduced by hard cap: ${R}`:`Reduced by hard cap (${C.size}): ${R}`:"",_=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,E=_e(e.profile_id),P=m!=null&&e.frame_hash===m;return s.jsxs("div",{className:`card${P?" card-highlight":""}`,style:{marginBottom:0},children:[h&&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:h})]}),s.jsxs("div",{className:"auth-card-header",children:[s.jsx("span",{style:{fontWeight:700,fontSize:"1rem",color:"var(--text-primary)",letterSpacing:"0.01em"},children:E}),e.title&&s.jsx("span",{style:{fontWeight:500,fontSize:"0.85rem",color:"var(--text-secondary)"},children:e.title}),s.jsx(Av,{status:f}),f==="active"&&e.earliest_expiry&&s.jsx(Fv,{expiresAt:new Date(e.earliest_expiry).getTime()/1e3}),f==="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(F=>s.jsx($v,{domain:F,attested:e.attested_domains.includes(F)},F)),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:_,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:V}),A&&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(([F,W],ne)=>{const Q=C.get(F);return s.jsxs("span",{children:[ne>0&&" · ",Q?N?s.jsxs("span",{title:`Team cap on ${F} is ${Q.cap}. Actions exceeding the cap require per-action approval. Bound remains authorized at ${Q.authorized}.`,children:[s.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[F,"=",String(W)]}),s.jsxs("span",{style:{color:"var(--accent)",marginLeft:"0.25rem",fontWeight:600},children:["↑ approval at ",Q.cap]})]}):s.jsxs("span",{title:`Team cap on ${F} is ${Q.cap} with no approvers configured (hard cap). Authorized for ${Q.authorized}; effective ${Q.cap}.`,children:[s.jsxs("span",{style:{textDecoration:"line-through",color:"var(--text-tertiary)"},children:[F,"=",String(W)]}),s.jsxs("span",{style:{color:"var(--danger)",marginLeft:"0.25rem",fontWeight:600},children:["→"," ",Q.cap]})]}):s.jsxs("span",{children:[F,"=",String(W)]})]},F)})}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>g(e),children:v?"▲ Hide Details":"▼ Details"})}),v&&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(([F,W])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:F}),s.jsx("dd",{children:String(W)})]},F))})]}),(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(([F,W])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:F}),s.jsx("dd",{children:String(W)})]},F))})]}),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"}),o===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:a===e.frame_hash?"copied":"copy"})]}),s.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.75rem"},children:[!h&&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"}),!h&&b&&s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>j(e),children:"↻ Extend"}),h&&p&&f!=="revoked"?s.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.frame_hash,h,E),disabled:i===e.frame_hash,children:i===e.frame_hash?"Revoking…":"Revoke"}):!h&&(f==="active"||f==="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 Hv(){const[e,t]=d.useState([]),[n,r]=d.useState(!0),[o,a]=d.useState([]),[i,l]=d.useState(!1),[u,c]=d.useState("mine"),[h,p]=d.useState("active"),[g,y]=d.useState(null),[x,w]=d.useState(null),[j,m]=ff(),[f,v]=d.useState(()=>j.get("new")==="1"),[S,b]=d.useState(()=>j.get("highlight")),[T,k]=d.useState(null),[N,C]=d.useState({}),[I,M]=d.useState(null),[B,A]=d.useState(null),[z,R]=d.useState(null),[V,_]=d.useState(new Set),[E,P]=d.useState(null),[$,F]=d.useState(null),W=bt(),{group:ne,groupId:Q,domain:Pe,mode:G,activeTeam:H}=ke(),X=(H==null?void 0:H.isAdmin)===!0,[le,K]=d.useState(()=>new Map),pe=d.useCallback(()=>{r(!0),O.getMyAttestations().then(t).catch(()=>{}).finally(()=>r(!1))},[]),ve=d.useCallback(()=>{Q&&(l(!0),O.listTeamAuthorizations(Q).then(a).catch(()=>{}).finally(()=>l(!1)))},[Q]);ue("attestation-changed",()=>{pe(),X&&Q&&ve()}),d.useEffect(()=>{if(!S)return;j.get("highlight")&&(j.delete("highlight"),m(j,{replace:!0}));const D=window.setTimeout(()=>b(null),3e3);return()=>window.clearTimeout(D)},[]),At(pe,3e5),d.useEffect(()=>{u==="team"&&X&&Q&&o.length===0&&!i&&ve()},[u,X,Q,o.length,i,ve]),d.useEffect(()=>{if(G!=="team"||!Q)return;const D=u==="mine"?e:o;if(D.length===0)return;const Y=[...new Set(D.map(q=>q.profile_id))].filter(q=>!le.has(q));if(Y.length!==0){K(q=>{const Ce=new Map(q);for(const xt of Y)Ce.set(xt,null);return Ce});for(const q of Y)O.getTeamProfileConfig(Q,q).then(Ce=>{K(xt=>new Map(xt).set(q,Ce))}).catch(()=>{})}},[e,o,u,Q,G,le]);const yt=async D=>{if(T===D.frame_hash){k(null);return}k(D.frame_hash);const Y=D.frame_hash||D.profile_id||D.path;if(!(Y in N)){M(D.frame_hash);try{const q=await O.getGateContent(Y);C(Ce=>({...Ce,[Y]:q}))}catch{C(q=>({...q,[Y]:null}))}finally{M(null)}}},cn=D=>{navigator.clipboard.writeText(D).then(()=>{R(D),setTimeout(()=>R(null),2e3)})},He=async D=>{var Y;if(!Q){alert("No active group; cannot copy authorization.");return}F(D.frame_hash);try{const q=D.frame_hash||D.profile_id||D.path;let Ce=N[q]??null;q in N||(Ce=await O.getGateContent(q),C(Zr=>({...Zr,[q]:Ce})));const xt=Object.fromEntries(Object.entries(D.frame).filter(([Zr])=>Zr!=="profile"&&Zr!=="path")),Ef=(Ce==null?void 0:Ce.context)??{},bf=((Y=Ce==null?void 0:Ce.gateContent)==null?void 0:Y.intent)??"",Pf=D.deferred_commitment_domains.length>0?"review":"automatic",Tf=D.attested_domains[0]||Pe||"owner";sessionStorage.setItem("agentAuth",JSON.stringify({profileId:D.profile_id,groupId:Q,groupName:(ne==null?void 0:ne.name)??null,domain:Tf})),sessionStorage.setItem("agentGate",JSON.stringify({bounds:xt,context:Ef,gateContent:{intent:bf},templateMode:Pf})),W("/agent/gate")}catch(q){alert(q instanceof Error?q.message:"Failed to copy authorization")}finally{F(null)}},ut=async(D,Y,q)=>{const Ce=Y&&q?`Revoke ${Y}'s ${q} authorization? This cannot be undone.`:"Revoke this authorization? The agent will no longer be able to execute actions under this attestation.";if(confirm(Ce)){P(D);try{await O.revokeAttestation(D),_(xt=>new Set(xt).add(D)),Y&&Q&&ve()}catch(xt){alert(xt instanceof Error?xt.message:"Failed to revoke authorization")}finally{P(null)}}},Ae=u==="mine"?e:o,Ve=u==="mine"?n:i,Pt={active:Ae.filter(D=>jt(D,{revokedSet:V})==="active").length,pending:Ae.filter(D=>jt(D,{revokedSet:V})==="pending").length,expired:Ae.filter(D=>jt(D,{revokedSet:V})==="expired").length,revoked:Ae.filter(D=>jt(D,{revokedSet:V})==="revoked").length},Ze=(()=>{const D=new Map;for(const Y of Ae){if(jt(Y,{revokedSet:V})!==h)continue;const q=D.get(Y.profile_id)??{count:0,review:!1};q.count+=1,Y.deferred_commitment_domains.length>0&&(q.review=!0),D.set(Y.profile_id,q)}return Array.from(D.entries()).map(([Y,q])=>({profileId:Y,...q})).sort((Y,q)=>_e(Y.profileId).localeCompare(_e(q.profileId)))})(),ee=Uv(Ae.filter(D=>{if(jt(D,{revokedSet:V})!==h||g!==null&&D.profile_id!==g)return!1;if(x!==null){const Y=D.deferred_commitment_domains.length>0;if(x==="review"&&!Y||x==="auto"&&Y)return!1}return!0}),V,S),Tt={revokedSet:V,expandedHash:T,gateCache:N,gateLoading:I,copiedHash:z,revokingHash:E,copyingHash:$,profileConfigCache:le,mode:G,activeDomain:Pe,group:ne,groupId:Q,onExpand:yt,onCopyHash:cn,onCopy:He,onRevoke:ut,onExtend:A,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:()=>v(!0),children:"+ New authorization"})]}),f&&s.jsx("div",{className:"modal-backdrop",onClick:()=>{v(!1),j.get("new")&&(j.delete("new"),m(j,{replace:!0}))},children:s.jsxs("div",{className:"modal",onClick:D=>D.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:()=>{v(!1),j.get("new")&&(j.delete("new"),m(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(_v,{onDismiss:()=>v(!1)})]})]})}),X&&s.jsxs("div",{className:"nav-tabs",style:{marginBottom:"0.5rem"},children:[s.jsx("button",{className:`nav-tab${u==="mine"?" active":""}`,onClick:()=>{c("mine"),p("active"),y(null),w(null),k(null)},children:"Mine"}),s.jsx("button",{className:`nav-tab${u==="team"?" active":""}`,onClick:()=>{c("team"),p("active"),y(null),w(null),k(null)},children:"Team"})]}),s.jsx("div",{className:"nav-tabs",children:["active","pending","expired","revoked"].map(D=>s.jsxs("button",{className:`nav-tab${h===D?" active":""}`,onClick:()=>{p(D),y(null),w(null)},children:[D.charAt(0).toUpperCase()+D.slice(1)," (",Pt[D],")"]},D))}),Ze.length>0&&s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"center",marginTop:"-0.25rem",marginBottom:"1rem"},children:[Ze.map(D=>{const Y=g===D.profileId;return s.jsx("button",{className:`btn btn-sm ${Y?"btn-primary":"btn-secondary"}`,onClick:()=>y(Y?null:D.profileId),children:_e(D.profileId)},D.profileId)}),s.jsx("span",{"aria-hidden":"true",style:{color:"var(--border)",fontSize:"1.1rem",padding:"0 0.25rem",userSelect:"none"},children:"|"}),["auto","review"].map(D=>{const Y=x===D;return s.jsx("button",{className:`btn btn-sm ${Y?"btn-primary":"btn-secondary"}`,onClick:()=>w(Y?null:D),children:D==="auto"?"Auto":"Review"},D)})]}),Ve&&Ae.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):ee.length===0?s.jsx(Cf,{icon:"☰",title:"No authorizations",text:`No ${h} authorizations found.`}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:ee.map(D=>{const Y=u==="team"?D:null,q=Y!=null&&Y.owner?Y.owner.name??Y.owner.email??Y.owner.userId:void 0;return s.jsx(Wv,{item:D,ownerLabel:q,isAdmin:X,...Tt},D.frame_hash)})}),B&&s.jsx(Dv,{item:B,onClose:()=>A(null),onSuccess:()=>{A(null),pe()}})]})}function Nf({profileId:e}){return s.jsx("span",{className:"profile-badge",children:_e(e)})}function Vv(e){return new Date(e*1e3).toLocaleString()}function Kv(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 Gv(e,t){if(!t)return!0;const n=t.toLowerCase();return e.profileId.toLowerCase().includes(n)||_e(e.profileId).toLowerCase().includes(n)||e.path.toLowerCase().includes(n)||e.action.toLowerCase().includes(n)||e.attestationHash.toLowerCase().includes(n)||e.id.toLowerCase().includes(n)||JSON.stringify(e.executionContext).toLowerCase().includes(n)}function Qv(){const{activeTeam:e,groupId:t}=ke(),n=(e==null?void 0:e.isAdmin)===!0,[r,o]=d.useState("mine"),[a,i]=d.useState([]),[l,u]=d.useState(!0),[c,h]=d.useState({}),[p,g]=d.useState(new Set),[y,x]=d.useState(""),[w,j]=d.useState(new Set),[m,f]=d.useState(new Set),[v,S]=d.useState("all"),[b,T]=d.useState(!1),k=d.useCallback(()=>{u(!0),r==="team"&&n&&t?O.listTeamReceipts(t).then(i).catch(()=>i([])).finally(()=>u(!1)):O.getMyReceipts({limit:200}).then(i).catch(()=>{}).finally(()=>u(!1))},[r,n,t]);At(k,12e4),d.useEffect(()=>{r!=="team"||Object.keys(c).length>0||O.listUsers().then(_=>{const E={};for(const P of _)E[P.id]={name:P.name,email:P.email};h(E)}).catch(()=>{})},[r,c]);const N=d.useMemo(()=>{const _=new Set;for(const E of a)_.add(_e(E.profileId));return[..._].sort()},[a]),C=d.useMemo(()=>{const _=new Set;for(const E of a)_.add(E.action);return[..._].sort()},[a]),I=d.useMemo(()=>{if(r!=="team")return[];const _=new Set;for(const E of a)E.userId&&_.add(E.userId);return[..._].map(E=>{var P;return{id:E,label:(P=c[E])!=null&&P.name?`${c[E].name} (${c[E].email})`:E}}).sort((E,P)=>E.label.localeCompare(P.label))},[r,a,c]),M=d.useMemo(()=>a.filter(_=>!(!Gv(_,y)||w.size>0&&!w.has(_e(_.profileId))||m.size>0&&!m.has(_.action)||p.size>0&&_.userId&&!p.has(_.userId)||!Kv(_,v))),[a,y,w,m,p,v]),B=w.size>0||m.size>0||p.size>0||v!=="all";function A(_){j(E=>{const P=new Set(E);return P.has(_)?P.delete(_):P.add(_),P})}function z(_){f(E=>{const P=new Set(E);return P.has(_)?P.delete(_):P.add(_),P})}function R(_){g(E=>{const P=new Set(E);return P.has(_)?P.delete(_):P.add(_),P})}function V(){j(new Set),f(new Set),g(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(_=>s.jsx("button",{onClick:()=>o(_),className:"btn btn-ghost",style:{borderRadius:0,padding:"0.5rem 0.875rem",borderBottom:r===_?"2px solid var(--accent)":"2px solid transparent",color:r===_?"var(--text-primary)":"var(--text-tertiary)",fontWeight:r===_?600:500},children:_==="mine"?"Mine":"Team"},_))}),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:_=>x(_.target.value)}),y&&s.jsx("button",{className:"search-clear",onClick:()=>x(""),children:"×"})]}),s.jsxs("button",{className:`btn btn-sm btn-secondary${b?" active":""}`,onClick:()=>T(!b),children:["Filters",B?` (${w.size+m.size+(v!=="all"?1:0)})`:""]})]}),b&&s.jsxs("div",{className:"filter-panel",children:[N.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Profile"}),s.jsx("div",{className:"filter-chips",children:N.map(_=>s.jsx("button",{className:`filter-chip${w.has(_)?" selected":""}`,onClick:()=>A(_),children:_},_))})]}),C.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Action"}),s.jsx("div",{className:"filter-chips",children:C.map(_=>s.jsx("button",{className:`filter-chip${m.has(_)?" selected":""}`,onClick:()=>z(_),children:_},_))})]}),r==="team"&&I.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Owner"}),s.jsx("div",{className:"filter-chips",children:I.map(_=>s.jsx("button",{className:`filter-chip${p.has(_.id)?" selected":""}`,onClick:()=>R(_.id),children:_.label},_.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(([_,E])=>s.jsx("button",{className:`filter-chip${v===_?" selected":""}`,onClick:()=>S(_),children:E},_))})]})]}),B&&s.jsxs("div",{className:"active-filters",children:[[...w].map(_=>s.jsxs("span",{className:"active-chip",onClick:()=>A(_),children:[_," ",s.jsx("span",{className:"chip-remove",children:"×"})]},_)),[...m].map(_=>s.jsxs("span",{className:"active-chip",onClick:()=>z(_),children:[_," ",s.jsx("span",{className:"chip-remove",children:"×"})]},_)),[...p].map(_=>{const E=c[_],P=E?E.name:_;return s.jsxs("span",{className:"active-chip",onClick:()=>R(_),children:[P," ",s.jsx("span",{className:"chip-remove",children:"×"})]},_)}),v!=="all"&&s.jsxs("span",{className:"active-chip",onClick:()=>S("all"),children:[v==="1d"?"Today":v==="7d"?"7 days":"30 days"," ",s.jsx("span",{className:"chip-remove",children:"×"})]}),s.jsx("button",{className:"clear-filters",onClick:V,children:"Clear all"})]}),l&&a.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):M.length===0?s.jsx(Cf,{icon:"⌕",title:a.length===0?"No receipts yet":"No matching receipts",text:a.length===0?"Execution receipts will appear here after an agent uses an authorized tool.":"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:M.length===a.length?`${a.length} receipt${a.length!==1?"s":""}`:`${M.length} of ${a.length} receipts`}),s.jsx("div",{className:"timeline",children:M.map(_=>{var E;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(Nf,{profileId:_.profileId}),s.jsx("span",{className:"auth-card-path",children:_.path}),s.jsx("span",{className:"receipt-action",children:_.action}),s.jsx("span",{className:"auth-card-time",children:Vv(_.timestamp)})]}),r==="team"&&_.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:(E=c[_.userId])!=null&&E.name?`${c[_.userId].name} (${c[_.userId].email})`:_.userId})]}),Object.keys(_.executionContext).length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:Object.entries(_.executionContext).map(([P,$])=>`${P}=${$}`).join(" · ")}),s.jsxs("div",{style:{display:"flex",gap:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:[s.jsxs("span",{children:["Daily: ",_.cumulativeState.daily.count," calls, $",_.cumulativeState.daily.amount]}),s.jsxs("span",{children:["Monthly: ",_.cumulativeState.monthly.count," calls, $",_.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:_.attestationHash})]})},_.id)})})]})]})}const _u={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 Yv(){const[e,t]=d.useState(""),[n,r]=d.useState("openrouter"),[o,a]=d.useState("openai-compatible"),[i,l]=d.useState("https://openrouter.ai/api/v1"),[u,c]=d.useState("google/gemma-4-31b-it"),[h,p]=d.useState(""),[g,y]=d.useState(!1),[x,w]=d.useState(!1),[j,m]=d.useState(!1),[f,v]=d.useState(null),S=d.useCallback(C=>{t(C),setTimeout(()=>t(""),3e3)},[]),b=d.useCallback(async()=>{try{const C=await O.getCredential("ai-config");if(y(C.configured),C.configured&&C.fields){C.fields.provider&&a(C.fields.provider),C.fields.endpoint&&l(C.fields.endpoint),C.fields.model&&c(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(()=>{b()},[b]);const T=C=>{r(C);const I=_u[C];I&&(a(I.provider),l(I.endpoint),c(I.models[0]))},k=async()=>{w(!0);try{await O.setCredential("ai-config",{provider:o,endpoint:i,model:u,...h?{apiKey:h}:{}}),y(!0),S("AI configuration saved!")}catch{S("Failed to save AI config")}finally{w(!1)}},N=async()=>{m(!0),v(null);try{const C=await O.aiTest(h?{provider:o,endpoint:i,model:u,apiKey:h}:{});v(C.ok?`OK: ${C.message}`:`Failed: ${C.message}`)}catch(C){v(`Error: ${C instanceof Error?C.message:"Unknown"}`)}finally{m(!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."}),g&&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 M;const C=((M=_u[n])==null?void 0:M.models)??[],I=C.includes(u);return s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"form-input",value:I?u:"__custom__",onChange:B=>{B.target.value==="__custom__"?c(""):c(B.target.value)},style:{marginBottom:I?void 0:"0.375rem"},children:[C.map(B=>s.jsx("option",{value:B,children:B},B)),s.jsx("option",{value:"__custom__",children:"Custom model..."})]}),!I&&s.jsx("input",{className:"form-input",value:u,onChange:B=>c(B.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:h,onChange:C=>p(C.target.value),placeholder:g?"••••••••••••••••":"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"}),g&&s.jsx("button",{className:"btn btn-ghost",onClick:N,disabled:j,children:j?"Testing...":"Test Connection"})]}),f&&s.jsx("div",{className:`alert ${f.startsWith("OK")?"alert-success":"alert-error"}`,style:{marginTop:"0.75rem"},children:f})]}),s.jsx(Jv,{}),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 Jv(){const[e,t]=d.useState(null),[n,r]=d.useState({intent:"",context:""}),[o,a]=d.useState(null),[i,l]=d.useState(null),[u,c]=d.useState(null),[h,p]=d.useState(!1),g=d.useCallback(async()=>{if(!h)try{const w=await O.getAIPrompts();t(w),r({intent:w.intent.current,context:w.context.current}),p(!0)}catch(w){l(w instanceof Error?w.message:"Failed to load prompts")}},[h]),y=async w=>{if(e){a(w),l(null);try{const j=n[w],m=j.trim()===e[w].default.trim()?"":j;await O.setAIPrompt(w,m);const f=await O.getAIPrompts();t(f),r({intent:f.intent.current,context:f.context.current}),c(w),setTimeout(()=>c(null),2e3)}catch(j){l(j instanceof Error?j.message:"Save failed")}finally{a(null)}}},x=async w=>{if(confirm(`Revert ${w} prompt to the built-in default?`)){a(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{a(null)}}};return s.jsxs("details",{className:"card",style:{padding:"1.5rem",marginTop:"1rem"},onToggle:w=>{w.currentTarget.open&&g()},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}),!h&&!i&&s.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem"},children:"Loading prompts…"}),e&&s.jsxs(s.Fragment,{children:[s.jsx(zu,{kind:"intent",label:"Intent — per-authorization",description:"Used on the Intent gate when creating a new authorization.",state:e.intent,draft:n.intent,onChange:w=>r(j=>({...j,intent:w})),onSave:()=>y("intent"),onRevert:()=>x("intent"),saving:o==="intent",justSaved:u==="intent"}),s.jsx(zu,{kind:"context",label:"Context — standing-orders brief",description:"Used on the Brief page when refining your context.md.",state:e.context,draft:n.context,onChange:w=>r(j=>({...j,context:w})),onSave:()=>y("context"),onRevert:()=>x("context"),saving:o==="context",justSaved:u==="context"})]})]})}function zu({kind:e,label:t,description:n,state:r,draft:o,onChange:a,onSave:i,onRevert:l,saving:u,justSaved:c}){const h=o!==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:o,onChange:p=>a(p.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:u||!h,children:u?"Saving…":"Save"}),r.overridden&&s.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:l,disabled:u,title:"Discard the override and use the built-in default",children:"Revert to default"}),c&&s.jsx("span",{style:{fontSize:"0.78rem",color:"var(--success)"},children:"Saved"}),h&&!u&&!c&&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 Xv(e){return e.proposalId?"review":"automatic"}function qv(e,t,n={}){const r=n.status??"pending",o=n.includeAutonomous??!1,a=[];for(const i of e)r==="pending"&&i.status!=="pending"||n.profile&&i.profileId!==n.profile||a.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=Xv(i);!o&&l==="automatic"||n.profile&&i.profileId!==n.profile||a.push({kind:"receipt",id:i.id,sortTimestamp:i.timestamp,commitmentMode:l,profileId:i.profileId,receipt:i})}return a.sort((i,l)=>l.sortTimestamp-i.sortTimestamp),typeof n.limit=="number"&&n.limit>0?a.slice(0,n.limit):a}const Zv={pending:"Pending",committed:"Approved",executed:"Executed",rejected:"Rejected",expired:"Expired"},ey={pending:"status-pending",committed:"status-active",executed:"status-active",rejected:"status-revoked",expired:"status-expired"};function ty(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 ny(e){return e.split("__").pop()??e}function ry(e){const t=e.toLowerCase();return t.includes("delete")||t.includes("refund")||t.includes("cancel")||t.includes("revoke")}const oy=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]),ay=/^(image|img|photo|picture|thumbnail)(_?url)?$/i;function sy(e,t){return typeof t!="string"?!1:/^data:image\//i.test(t)?!0:ay.test(e)?/^https?:\/\//.test(t):/^https?:\/\/.+\.(jpe?g|png|gif|webp|svg|avif)(\?|$)/i.test(t)}function ni(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=>ni(t)).join(", ");try{const t=JSON.stringify(e);return t.length>160?t.slice(0,157)+"…":t}catch{return String(e)}}function iy({item:e,onApprove:t,onReject:n,resolving:r}){const o=e.kind==="proposal",a=o?e.proposal.status:"executed",i=o?e.proposal.tool:e.receipt.action,l=ny(i),u=ry(i),c=o?e.proposal.toolArgs:null,h=o?e.proposal.executionContext:e.receipt.executionContext,p=o?null:e.receipt.cumulativeState,g=c?Object.entries(c).filter(([x])=>!oy.has(x)):[],y=Object.entries(h??{});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(Nf,{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 ${ey[a]}`,children:Zv[a]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:ty(e.sortTimestamp)})]})]}),u&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",fontSize:"0.8rem",color:"var(--warning)",background:"var(--bg-main)",border:"1px solid var(--border)",borderRadius:"0.375rem",padding:"0.4rem 0.6rem",marginBottom:"0.75rem"},children:[s.jsx("span",{children:"⚠"}),s.jsx("span",{children:"Irreversible action"})]}),o&&typeof(c==null?void 0:c._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:c._imagePreview,alt:typeof(c==null?void 0:c.altText)=="string"?c.altText:"local image preview",style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"}})]}),o&&g.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:g.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:sy(x,w)?s.jsx("img",{src:w,alt:typeof(c==null?void 0:c.altText)=="string"?c.altText:x,style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"},onError:j=>{const m=j.currentTarget,f=m.parentElement;if(!f)return;m.style.display="none";const v=document.createElement("span");v.textContent=w,v.style.color="var(--text-tertiary)",f.appendChild(v)}}):ni(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}=${ni(w)}`).join(" · ")}),p&&s.jsxs("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:["After this action · today: ",p.daily.count," action",p.daily.count===1?"":"s",p.daily.amount>0?`, ${p.daily.amount}`:""," · ","this month: ",p.monthly.count,p.monthly.amount>0?`, ${p.monthly.amount}`:""]}),o&&a==="pending"&&s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{className:"btn btn-primary",onClick:()=>t==null?void 0:t(e.id),disabled:r,children:r?"Approving…":"Approve"}),s.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:()=>n==null?void 0:n(e.id),disabled:r,children:"Reject"})]}),s.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:[o?"Proposal":"Receipt",": ",e.id]})]})}const ly=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]);function ri(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=>ri(t)).join(", ");try{const t=JSON.stringify(e);return t.length>200?t.slice(0,197)+"...":t}catch{return String(e)}}function uy(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 cy({proposal:e,currentUserId:t,onAction:n,onMessage:r}){const[o,a]=d.useState(!1),[i,l]=d.useState(!1),[u,c]=d.useState(null),[h,p]=d.useState(!1),[g,y]=d.useState(null),[x,w]=d.useState(!1),j=e.tool.split("__").pop()??e.tool,m=Object.entries(e.toolArgs).filter(([A])=>!ly.has(A)),f=Object.entries(e.executionContext),v=e.pendingApprovers??[],S=e.approvedBy??{},b=Object.keys(S).length,T=v.filter(A=>!(A in S)).length,k=t in S,N=async()=>{if(u===null){p(!0),y(null);try{const A=await O.getAttestationIntent(e.frameHash);if(!A){y("Intent not available or you are not an authorized approver.");return}const z=await O.decryptIntent({intentCiphertext:A.intentCiphertext,encryptedKey:A.encryptedKey,approverId:t});c(z)}catch(A){y(A instanceof Error?A.message:"Failed to decrypt intent")}finally{p(!1)}}},C=async()=>{x?w(!1):(w(!0),await N())},I=async()=>{a(!0),r("");try{await O.approveProposal(e.id);try{if(u===null){const A=await O.getAttestationIntent(e.frameHash);if(A){const z=await O.decryptIntent({intentCiphertext:A.intentCiphertext,encryptedKey:A.encryptedKey,approverId:t});c(z),await O.storeApprovedIntent(e.frameHash,z)}}else await O.storeApprovedIntent(e.frameHash,u)}catch{}r(`Approved. ${T-1>0?`${T-1} more approver(s) still needed.`:"All approvers signed off — action is ready to execute."}`),n()}catch(A){r(A instanceof Error?A.message:"Approval failed")}finally{a(!1)}},M=async()=>{const A=prompt("Rejection reason (optional):");if(A!==null){l(!0),r("");try{await O.rejectProposal(e.id,A||void 0),r("Action rejected."),n()}catch(z){r(z instanceof Error?z.message:"Rejection failed")}finally{l(!1)}}},B=o||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:_e(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:uy(e.createdAt)})]}),s.jsxs("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:[b," of ",v.length," approver",v.length===1?"":"s"," signed off",v.map(A=>{const z=A in S;return s.jsxs("span",{style:{marginLeft:"0.5rem",color:z?"var(--success, green)":"var(--text-tertiary)"},children:[z?"✓":"○"," ",A===t?"You":A]},A)})]}),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})]}),m.length>0&&s.jsxs("div",{style:{marginBottom:"0.75rem"},children:[s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Arguments"}),s.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:m.map(([A,z])=>s.jsxs(d.Fragment,{children:[s.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:A}),s.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word"},children:ri(z)})]},A))})]}),f.length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:f.map(([A,z])=>`${A}=${ri(z)}`).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:h,children:[x?"▲ Hide intent":"▼ Show intent",h&&" (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:g?s.jsx("p",{style:{color:"var(--danger)",fontSize:"0.8rem",margin:0},children:g}):u!==null?s.jsx("p",{style:{fontSize:"0.85rem",margin:0,whiteSpace:"pre-wrap",color:"var(--text-primary)"},children:u}):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:B,children:o?"Approving...":"Approve"}),s.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:M,disabled:B,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 dy(){const{domain:e,user:t}=ke(),n=(t==null?void 0:t.id)??"",[r,o]=d.useState("awaiting-me"),[a,i]=d.useState([]),[l,u]=d.useState(!0),[c,h]=d.useState(""),p=d.useCallback(async()=>{try{const H=await O.getProposalsForApprover();i(H)}catch{}finally{u(!1)}},[]);ue("proposal-added",p),ue("proposal-approved",p),ue("proposal-rejected",p),ue("proposal-resolved",p),At(p,3e4);const[g,y]=d.useState([]),x=d.useCallback(async()=>{try{const H=await O.getProposals(e||"owner");y(H)}catch{}},[e]);ue("proposal-added",x),ue("proposal-approved",x),ue("proposal-rejected",x),ue("proposal-resolved",x),At(x,3e4,e);const w=d.useMemo(()=>{const H=[];for(const X of g)X.status==="pending"&&H.push(X);for(const X of a);return H},[g,a]),[j,m]=d.useState([]),f=d.useCallback(async()=>{if(n)try{const X=(await O.getProposals(e||"owner")).filter(le=>le.status==="pending"&&le.pendingApprovers&&le.pendingApprovers.includes(n)&&le.approvedBy&&n in le.approvedBy);m(X)}catch{}},[n,e]);ue("proposal-approved",f),ue("proposal-rejected",f),At(f,3e4,`${n}:${e}`),d.useEffect(()=>{p(),x(),f()},[]);const[v,S]=d.useState([]),[b,T]=d.useState([]),[k,N]=d.useState(!0),[C,I]=d.useState(null),[M,B]=d.useState(""),[A,z]=d.useState("pending"),[R,V]=d.useState(null),[_,E]=d.useState(!1),P=d.useCallback(async()=>{try{const{proposals:H,receipts:X}=await O.getThread({domain:e,status:A,sinceDays:7});S(H),T(X)}catch{}finally{N(!1)}},[e,A]);At(P,3e4,`${e}:${A}`);const $=async(H,X)=>{I(H),B("");try{const le=e||"owner",K=await O.resolveProposal(H,X,le);B(X==="commit"?`Action approved. Status: ${K.status}`:"Action rejected."),await P()}catch(le){B(le instanceof Error?le.message:"Failed")}finally{I(null)}},F=d.useMemo(()=>{const H=new Set;for(const X of v)H.add(X.profileId);for(const X of b)H.add(X.profileId);return Array.from(H).sort()},[v,b]),W=d.useMemo(()=>qv(v,b,{status:A,profile:R??void 0,includeAutonomous:_}),[v,b,A,R,_]),ne=d.useCallback(()=>{p(),f()},[p,f]),Q=d.useMemo(()=>{const H=new Set,X=[];for(const le of[...j,...w])H.has(le.id)||(H.add(le.id),X.push(le));return X.sort((le,K)=>K.createdAt-le.createdAt)},[j,w]),Pe=a.length,G=Q.length;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"page-header",children:[s.jsx("h1",{className:"page-title",children:"Pending Approvals"}),s.jsx("p",{className:"page-subtitle",children:"Actions awaiting approval, plus recent activity from the last 7 days."})]}),s.jsxs("div",{className:"nav-tabs",style:{marginBottom:"1rem"},children:[s.jsxs("button",{className:`nav-tab${r==="awaiting-me"?" active":""}`,onClick:()=>o("awaiting-me"),children:["Awaiting me ",Pe>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:Pe})]}),s.jsxs("button",{className:`nav-tab${r==="awaiting-others"?" active":""}`,onClick:()=>o("awaiting-others"),children:["Awaiting others ",G>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:G})]}),s.jsx("button",{className:`nav-tab${r==="all"?" active":""}`,onClick:()=>{o("all"),P()},children:"All"})]}),r==="awaiting-me"&&s.jsx(s.Fragment,{children:l&&a.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):a.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 awaiting your approval."}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Above-cap actions under authorities you are an approver for will appear here."})]}):s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[c&&s.jsx("div",{className:"alert alert-success",children:c}),a.map(H=>s.jsx(cy,{proposal:H,currentUserId:n,onAction:ne,onMessage:h},H.id))]})}),r==="awaiting-others"&&s.jsx(s.Fragment,{children:Q.length===0?s.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[s.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions waiting on others."}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Actions you proposed or approved that are pending other approvers will appear here."})]}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:Q.map(H=>s.jsx(py,{proposal:H,currentUserId:n,onCancel:async()=>{try{await O.rejectProposal(H.id,"cancelled by creator"),f(),x()}catch(X){alert(X instanceof Error?X.message:"Cancel failed")}}},H.id))})}),r==="all"&&s.jsxs(s.Fragment,{children:[M&&s.jsx("div",{className:"alert alert-success",style:{marginBottom:"1rem"},children:M}),s.jsxs("div",{className:"filter-chips",style:{marginBottom:"1rem"},children:[s.jsx("button",{className:`filter-chip ${A==="pending"?"selected":""}`,onClick:()=>z("pending"),children:"Pending"}),s.jsx("button",{className:`filter-chip ${A==="all"?"selected":""}`,onClick:()=>z("all"),children:"All"}),F.length>0&&s.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),F.map(H=>s.jsx("button",{className:`filter-chip ${R===H?"selected":""}`,onClick:()=>V(R===H?null:H),children:_e(H)},H)),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 ${_?"selected":""}`,onClick:()=>E(!_),title:"Include actions executed without human review (automatic commitment mode)",children:[_?"✓ ":"","Autonomous actions"]})]})]}),k&&W.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):W.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:A==="pending"?"No actions awaiting your approval.":"Nothing here yet."}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:A==="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:W.map(H=>s.jsx(iy,{item:H,onApprove:X=>$(X,"commit"),onReject:X=>$(X,"reject"),resolving:C===H.id},H.id))})]})]})}function fy(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 py({proposal:e,currentUserId:t,onCancel:n}){var c;const[r,o]=d.useState(!1),a=Object.keys(e.approvedBy??{}),i=(e.pendingApprovers??[]).filter(h=>!(h in(e.approvedBy??{}))),l=(((c=e.pendingApprovers)==null?void 0:c.length)??0)>0,u=async()=>{if(confirm("Cancel this action? All approvers will be notified.")){o(!0);try{await n()}finally{o(!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:_e(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:fy(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:[a.map(h=>s.jsx("span",{style:{marginRight:"0.75rem",color:"var(--success, green)"},children:h===t?"You approved":`${h} approved`},h)),i.map(h=>s.jsxs("span",{style:{marginRight:"0.75rem",color:"var(--text-tertiary)"},children:["Waiting on ",h===t?"you":h]},h))]}),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:u,disabled:r,children:r?"Cancelling...":"Cancel"})})]})}const my=`# Agent Brief
66
+ `}),f?s.jsx("p",{style:{color:"var(--text-tertiary)",fontSize:"0.9rem"},children:"Loading..."}):v.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(nt,{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:v.map(k=>{const N=S(k.id),C=k.id.replace(/@.*$/,"").split("/").pop()??k.id,I=m.get(C),M=p.get(C),B=(M==null?void 0:M.running)===!0;return s.jsxs("div",{className:"card",style:B?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:Re(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}),B?s.jsx("button",{className:"btn btn-primary btn-sm",onClick:()=>T(k.id),children:"Authorize"}):s.jsxs(nt,{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 Mv={active:"Active",pending:"Pending",expired:"Expired",revoked:"Revoked"};function Fv({status:e,label:t}){return s.jsx("span",{className:`status-badge status-${e}`,children:t||Mv[e]})}function Ov({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 pn=86400,yr=3600,So=60,Bv=30*pn;function Dv(e){if(e<=0)return"Expired";if(e>90*pn){const t=Math.floor(e/Bv);return`${t} ${t===1?"month":"months"} remaining`}if(e>7*pn){const t=Math.floor(e/pn);return`${t} ${t===1?"day":"days"} remaining`}if(e>=2*pn){const t=Math.floor(e/pn),n=Math.floor(e%pn/yr);return`${t} ${t===1?"day":"days"} ${n}h remaining`}if(e>=2*yr){const t=Math.floor(e/yr),n=Math.floor(e%yr/So);return`${t}h ${String(n).padStart(2,"0")}m remaining`}if(e>=So){const t=Math.floor(e/So),n=Math.floor(e%So);return`${t}m ${String(n).padStart(2,"0")}s remaining`}return`${Math.floor(e)}s remaining`}function Uv({expiresAt:e}){const[t,n]=d.useState(()=>e-Date.now()/1e3),r=t<2*yr;d.useEffect(()=>{const a=setInterval(()=>n(e-Date.now()/1e3),r?1e3:6e4);return()=>clearInterval(a)},[e,r]);const o=t<300;return s.jsx("span",{className:`ttl-badge ${o?"ttl-warn":"ttl-ok"}`,children:Dv(t)})}function Ef({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 Wv(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 Hv=[{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 Vv({item:e,onClose:t,onSuccess:n}){var m;const{user:r,activeDomain:o,groupId:a}=ke(),i=e.remaining_seconds??0,l=Hv.filter(p=>p.seconds>i),u=((m=l[0])==null?void 0:m.seconds)??2592e3,[c,h]=d.useState(u),[f,g]=d.useState(!1),[y,x]=d.useState(""),w=Object.entries(e.frame).filter(([p])=>p!=="profile"&&p!=="path"),j=async()=>{var p;if(r){g(!0),x("");try{const v=e.frame_hash||e.profile_id||e.path,S=await O.getGateContent(v);if(!S)throw new Error("Gate content not found locally. The MCP server may have restarted. Please re-authorize through the full wizard instead.");const b=await O.getProfile(e.profile_id),T=e.frame,k=S.context??{},N=e.attested_domains[0]||o||"owner",C=await Cf(T,b),I=await Nf(k,b),[M,B]=await Promise.all([ua(S.gateContent.intent),ua(JSON.stringify({profile:e.profile_id,path:e.path,domain:N}))]);if(!a)throw new Error("No active group; cannot extend authorization.");const A=(((p=e.deferred_commitment_domains)==null?void 0:p.length)??0)>0?"review":"automatic",z=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:M},execution_context_hash:B,group_id:a,commitment_mode:A,ttl:c});await O.pushGateContent({boundsHash:z.bounds_hash??C,contextHash:I,context:k,path:e.path,gateContent:S.gateContent}),n()}catch(v){x(v instanceof Error?v.message:"Extension failed")}finally{g(!1)}}};return s.jsx("div",{className:"modal-backdrop",onClick:p=>p.target===p.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:[Re(e.profile_id)," / ",e.path]}),w.length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:w.map(([p,v])=>`${p}=${v}`).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 ",Wv(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(p=>s.jsx("button",{className:`btn ${c===p.seconds?"btn-primary":"btn-secondary"}`,onClick:()=>h(p.seconds),style:{minWidth:"3.5rem"},children:p.label},p.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 Kv(e,t,n){return[...e].sort((r,o)=>{if(n){if(r.frame_hash===n&&o.frame_hash!==n)return-1;if(o.frame_hash===n&&r.frame_hash!==n)return 1}const a=jt(r,{revokedSet:t}),i=jt(o,{revokedSet:t}),l={active:0,pending:1,expired:2,revoked:3};return l[a]!==l[i]?l[a]-l[i]:new Date(o.created_at).getTime()-new Date(r.created_at).getTime()})}function Gv({item:e,revokedSet:t,expandedHash:n,gateCache:r,gateLoading:o,copiedHash:a,revokingHash:i,copyingHash:l,profileConfigCache:u,mode:c,ownerLabel:h,isAdmin:f,onExpand:g,onCopyHash:y,onCopy:x,onRevoke:w,onExtend:j,highlightHash:m}){var $;const p=jt(e,{revokedSet:t}),v=n===e.frame_hash,S=r[e.frame_hash||e.profile_id||e.path],b=p==="active"||p==="pending"||p==="expired",T=Object.entries(e.frame).filter(([F])=>F!=="profile"&&F!=="path"),k=u.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&&c==="team")for(const[F,W]of T){const ne=k.caps[F];ne!==void 0&&Number(W)>ne&&C.set(F,{authorized:Number(W),cap:ne})}const I=C.size>0,M=e.approvers_frozen??[],B=(k==null?void 0:k.approvers)??[],A=c==="team"&&M.length>0&&B.length>0&&(M.length!==B.length||M.some(F=>!B.includes(F))||B.some(F=>!M.includes(F))),z=Array.from(C.entries()).map(([F,W])=>`${F}: ${W.authorized} (cap ${W.cap})`).join(", "),_=Array.from(C.entries()).map(([F,W])=>`${F}: ${W.authorized} → ${W.cap}`).join(", "),V=I?N?C.size===1?`Above team cap: ${z} — actions require approval`:`Above team cap (${C.size}): ${z} — actions require approval`:C.size===1?`Reduced by hard cap: ${_}`:`Reduced by hard cap (${C.size}): ${_}`:"",R=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,E=Re(e.profile_id),P=m!=null&&e.frame_hash===m;return s.jsxs("div",{className:`card${P?" card-highlight":""}`,style:{marginBottom:0},children:[h&&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:h})]}),s.jsxs("div",{className:"auth-card-header",children:[s.jsx("span",{style:{fontWeight:700,fontSize:"1rem",color:"var(--text-primary)",letterSpacing:"0.01em"},children:E}),e.title&&s.jsx("span",{style:{fontWeight:500,fontSize:"0.85rem",color:"var(--text-secondary)"},children:e.title}),s.jsx(Fv,{status:p}),p==="active"&&e.earliest_expiry&&s.jsx(Uv,{expiresAt:new Date(e.earliest_expiry).getTime()/1e3}),p==="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(F=>s.jsx(Ov,{domain:F,attested:e.attested_domains.includes(F)},F)),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:R,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:V}),A&&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(([F,W],ne)=>{const Q=C.get(F);return s.jsxs("span",{children:[ne>0&&" · ",Q?N?s.jsxs("span",{title:`Team cap on ${F} is ${Q.cap}. Actions exceeding the cap require per-action approval. Bound remains authorized at ${Q.authorized}.`,children:[s.jsxs("span",{style:{color:"var(--text-tertiary)"},children:[F,"=",String(W)]}),s.jsxs("span",{style:{color:"var(--accent)",marginLeft:"0.25rem",fontWeight:600},children:["↑ approval at ",Q.cap]})]}):s.jsxs("span",{title:`Team cap on ${F} is ${Q.cap} with no approvers configured (hard cap). Authorized for ${Q.authorized}; effective ${Q.cap}.`,children:[s.jsxs("span",{style:{textDecoration:"line-through",color:"var(--text-tertiary)"},children:[F,"=",String(W)]}),s.jsxs("span",{style:{color:"var(--danger)",marginLeft:"0.25rem",fontWeight:600},children:["→"," ",Q.cap]})]}):s.jsxs("span",{children:[F,"=",String(W)]})]},F)})}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.5rem"},children:s.jsx("button",{className:"btn btn-ghost btn-sm",onClick:()=>g(e),children:v?"▲ Hide Details":"▼ Details"})}),v&&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(([F,W])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:F}),s.jsx("dd",{children:String(W)})]},F))})]}),(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(([F,W])=>s.jsxs("span",{style:{display:"contents"},children:[s.jsx("dt",{children:F}),s.jsx("dd",{children:String(W)})]},F))})]}),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"}),o===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:a===e.frame_hash?"copied":"copy"})]}),s.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem",marginTop:"0.75rem"},children:[!h&&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"}),!h&&b&&s.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>j(e),children:"↻ Extend"}),h&&f&&p!=="revoked"?s.jsx("button",{className:"btn btn-danger btn-sm",onClick:()=>w(e.frame_hash,h,E),disabled:i===e.frame_hash,children:i===e.frame_hash?"Revoking…":"Revoke"}):!h&&(p==="active"||p==="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 Qv(){const[e,t]=d.useState([]),[n,r]=d.useState(!0),[o,a]=d.useState([]),[i,l]=d.useState(!1),[u,c]=d.useState("mine"),[h,f]=d.useState("active"),[g,y]=d.useState(null),[x,w]=d.useState(null),[j,m]=mf(),[p,v]=d.useState(()=>j.get("new")==="1"),[S,b]=d.useState(()=>j.get("highlight")),[T,k]=d.useState(null),[N,C]=d.useState({}),[I,M]=d.useState(null),[B,A]=d.useState(null),[z,_]=d.useState(null),[V,R]=d.useState(new Set),[E,P]=d.useState(null),[$,F]=d.useState(null),W=Dt(),{group:ne,groupId:Q,domain:Pe,mode:G,activeTeam:H}=ke(),X=(H==null?void 0:H.isAdmin)===!0,[le,K]=d.useState(()=>new Map),pe=d.useCallback(()=>{r(!0),O.getMyAttestations().then(t).catch(()=>{}).finally(()=>r(!1))},[]),ve=d.useCallback(()=>{Q&&(l(!0),O.listTeamAuthorizations(Q).then(a).catch(()=>{}).finally(()=>l(!1)))},[Q]);ue("attestation-changed",()=>{pe(),X&&Q&&ve()}),d.useEffect(()=>{if(!S)return;j.get("highlight")&&(j.delete("highlight"),m(j,{replace:!0}));const D=window.setTimeout(()=>b(null),3e3);return()=>window.clearTimeout(D)},[]),zt(pe,3e5),d.useEffect(()=>{u==="team"&&X&&Q&&o.length===0&&!i&&ve()},[u,X,Q,o.length,i,ve]),d.useEffect(()=>{if(G!=="team"||!Q)return;const D=u==="mine"?e:o;if(D.length===0)return;const Y=[...new Set(D.map(q=>q.profile_id))].filter(q=>!le.has(q));if(Y.length!==0){K(q=>{const Ce=new Map(q);for(const xt of Y)Ce.set(xt,null);return Ce});for(const q of Y)O.getTeamProfileConfig(Q,q).then(Ce=>{K(xt=>new Map(xt).set(q,Ce))}).catch(()=>{})}},[e,o,u,Q,G,le]);const yt=async D=>{if(T===D.frame_hash){k(null);return}k(D.frame_hash);const Y=D.frame_hash||D.profile_id||D.path;if(!(Y in N)){M(D.frame_hash);try{const q=await O.getGateContent(Y);C(Ce=>({...Ce,[Y]:q}))}catch{C(q=>({...q,[Y]:null}))}finally{M(null)}}},cn=D=>{navigator.clipboard.writeText(D).then(()=>{_(D),setTimeout(()=>_(null),2e3)})},He=async D=>{var Y;if(!Q){alert("No active group; cannot copy authorization.");return}F(D.frame_hash);try{const q=D.frame_hash||D.profile_id||D.path;let Ce=N[q]??null;q in N||(Ce=await O.getGateContent(q),C(eo=>({...eo,[q]:Ce})));const xt=Object.fromEntries(Object.entries(D.frame).filter(([eo])=>eo!=="profile"&&eo!=="path")),Pf=(Ce==null?void 0:Ce.context)??{},Tf=((Y=Ce==null?void 0:Ce.gateContent)==null?void 0:Y.intent)??"",If=D.deferred_commitment_domains.length>0?"review":"automatic",_f=D.attested_domains[0]||Pe||"owner";sessionStorage.setItem("agentAuth",JSON.stringify({profileId:D.profile_id,groupId:Q,groupName:(ne==null?void 0:ne.name)??null,domain:_f})),sessionStorage.setItem("agentGate",JSON.stringify({bounds:xt,context:Pf,gateContent:{intent:Tf},templateMode:If})),W("/agent/gate")}catch(q){alert(q instanceof Error?q.message:"Failed to copy authorization")}finally{F(null)}},ut=async(D,Y,q)=>{const Ce=Y&&q?`Revoke ${Y}'s ${q} authorization? This cannot be undone.`:"Revoke this authorization? The agent will no longer be able to execute actions under this attestation.";if(confirm(Ce)){P(D);try{await O.revokeAttestation(D),R(xt=>new Set(xt).add(D)),Y&&Q&&ve()}catch(xt){alert(xt instanceof Error?xt.message:"Failed to revoke authorization")}finally{P(null)}}},Ae=u==="mine"?e:o,Ve=u==="mine"?n:i,bt={active:Ae.filter(D=>jt(D,{revokedSet:V})==="active").length,pending:Ae.filter(D=>jt(D,{revokedSet:V})==="pending").length,expired:Ae.filter(D=>jt(D,{revokedSet:V})==="expired").length,revoked:Ae.filter(D=>jt(D,{revokedSet:V})==="revoked").length},Ze=(()=>{const D=new Map;for(const Y of Ae){if(jt(Y,{revokedSet:V})!==h)continue;const q=D.get(Y.profile_id)??{count:0,review:!1};q.count+=1,Y.deferred_commitment_domains.length>0&&(q.review=!0),D.set(Y.profile_id,q)}return Array.from(D.entries()).map(([Y,q])=>({profileId:Y,...q})).sort((Y,q)=>Re(Y.profileId).localeCompare(Re(q.profileId)))})(),ee=Kv(Ae.filter(D=>{if(jt(D,{revokedSet:V})!==h||g!==null&&D.profile_id!==g)return!1;if(x!==null){const Y=D.deferred_commitment_domains.length>0;if(x==="review"&&!Y||x==="auto"&&Y)return!1}return!0}),V,S),Pt={revokedSet:V,expandedHash:T,gateCache:N,gateLoading:I,copiedHash:z,revokingHash:E,copyingHash:$,profileConfigCache:le,mode:G,activeDomain:Pe,group:ne,groupId:Q,onExpand:yt,onCopyHash:cn,onCopy:He,onRevoke:ut,onExtend:A,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:()=>v(!0),children:"+ New authorization"})]}),p&&s.jsx("div",{className:"modal-backdrop",onClick:()=>{v(!1),j.get("new")&&(j.delete("new"),m(j,{replace:!0}))},children:s.jsxs("div",{className:"modal",onClick:D=>D.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:()=>{v(!1),j.get("new")&&(j.delete("new"),m(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(Lv,{onDismiss:()=>v(!1)})]})]})}),X&&s.jsxs("div",{className:"nav-tabs",style:{marginBottom:"0.5rem"},children:[s.jsx("button",{className:`nav-tab${u==="mine"?" active":""}`,onClick:()=>{c("mine"),f("active"),y(null),w(null),k(null)},children:"Mine"}),s.jsx("button",{className:`nav-tab${u==="team"?" active":""}`,onClick:()=>{c("team"),f("active"),y(null),w(null),k(null)},children:"Team"})]}),s.jsx("div",{className:"nav-tabs",children:["active","pending","expired","revoked"].map(D=>s.jsxs("button",{className:`nav-tab${h===D?" active":""}`,onClick:()=>{f(D),y(null),w(null)},children:[D.charAt(0).toUpperCase()+D.slice(1)," (",bt[D],")"]},D))}),Ze.length>0&&s.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap",alignItems:"center",marginTop:"-0.25rem",marginBottom:"1rem"},children:[Ze.map(D=>{const Y=g===D.profileId;return s.jsx("button",{className:`btn btn-sm ${Y?"btn-primary":"btn-secondary"}`,onClick:()=>y(Y?null:D.profileId),children:Re(D.profileId)},D.profileId)}),s.jsx("span",{"aria-hidden":"true",style:{color:"var(--border)",fontSize:"1.1rem",padding:"0 0.25rem",userSelect:"none"},children:"|"}),["auto","review"].map(D=>{const Y=x===D;return s.jsx("button",{className:`btn btn-sm ${Y?"btn-primary":"btn-secondary"}`,onClick:()=>w(Y?null:D),children:D==="auto"?"Auto":"Review"},D)})]}),Ve&&Ae.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):ee.length===0?s.jsx(Ef,{icon:"☰",title:"No authorizations",text:`No ${h} authorizations found.`}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:ee.map(D=>{const Y=u==="team"?D:null,q=Y!=null&&Y.owner?Y.owner.name??Y.owner.email??Y.owner.userId:void 0;return s.jsx(Gv,{item:D,ownerLabel:q,isAdmin:X,...Pt},D.frame_hash)})}),B&&s.jsx(Vv,{item:B,onClose:()=>A(null),onSuccess:()=>{A(null),pe()}})]})}function bf({profileId:e}){return s.jsx("span",{className:"profile-badge",children:Re(e)})}function Yv(e){return new Date(e*1e3).toLocaleString()}function Jv(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 Xv(e,t){if(!t)return!0;const n=t.toLowerCase();return e.profileId.toLowerCase().includes(n)||Re(e.profileId).toLowerCase().includes(n)||e.path.toLowerCase().includes(n)||e.action.toLowerCase().includes(n)||e.attestationHash.toLowerCase().includes(n)||e.id.toLowerCase().includes(n)||JSON.stringify(e.executionContext).toLowerCase().includes(n)}function qv(){const{activeTeam:e,groupId:t}=ke(),n=(e==null?void 0:e.isAdmin)===!0,[r,o]=d.useState("mine"),[a,i]=d.useState([]),[l,u]=d.useState(!0),[c,h]=d.useState({}),[f,g]=d.useState(new Set),[y,x]=d.useState(""),[w,j]=d.useState(new Set),[m,p]=d.useState(new Set),[v,S]=d.useState("all"),[b,T]=d.useState(!1),k=d.useCallback(()=>{u(!0),r==="team"&&n&&t?O.listTeamReceipts(t).then(i).catch(()=>i([])).finally(()=>u(!1)):O.getMyReceipts({limit:200}).then(i).catch(()=>{}).finally(()=>u(!1))},[r,n,t]);zt(k,12e4),d.useEffect(()=>{r!=="team"||Object.keys(c).length>0||O.listUsers().then(R=>{const E={};for(const P of R)E[P.id]={name:P.name,email:P.email};h(E)}).catch(()=>{})},[r,c]);const N=d.useMemo(()=>{const R=new Set;for(const E of a)R.add(Re(E.profileId));return[...R].sort()},[a]),C=d.useMemo(()=>{const R=new Set;for(const E of a)R.add(E.action);return[...R].sort()},[a]),I=d.useMemo(()=>{if(r!=="team")return[];const R=new Set;for(const E of a)E.userId&&R.add(E.userId);return[...R].map(E=>{var P;return{id:E,label:(P=c[E])!=null&&P.name?`${c[E].name} (${c[E].email})`:E}}).sort((E,P)=>E.label.localeCompare(P.label))},[r,a,c]),M=d.useMemo(()=>a.filter(R=>!(!Xv(R,y)||w.size>0&&!w.has(Re(R.profileId))||m.size>0&&!m.has(R.action)||f.size>0&&R.userId&&!f.has(R.userId)||!Jv(R,v))),[a,y,w,m,f,v]),B=w.size>0||m.size>0||f.size>0||v!=="all";function A(R){j(E=>{const P=new Set(E);return P.has(R)?P.delete(R):P.add(R),P})}function z(R){p(E=>{const P=new Set(E);return P.has(R)?P.delete(R):P.add(R),P})}function _(R){g(E=>{const P=new Set(E);return P.has(R)?P.delete(R):P.add(R),P})}function V(){j(new Set),p(new Set),g(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(R=>s.jsx("button",{onClick:()=>o(R),className:"btn btn-ghost",style:{borderRadius:0,padding:"0.5rem 0.875rem",borderBottom:r===R?"2px solid var(--accent)":"2px solid transparent",color:r===R?"var(--text-primary)":"var(--text-tertiary)",fontWeight:r===R?600:500},children:R==="mine"?"Mine":"Team"},R))}),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:R=>x(R.target.value)}),y&&s.jsx("button",{className:"search-clear",onClick:()=>x(""),children:"×"})]}),s.jsxs("button",{className:`btn btn-sm btn-secondary${b?" active":""}`,onClick:()=>T(!b),children:["Filters",B?` (${w.size+m.size+(v!=="all"?1:0)})`:""]})]}),b&&s.jsxs("div",{className:"filter-panel",children:[N.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Profile"}),s.jsx("div",{className:"filter-chips",children:N.map(R=>s.jsx("button",{className:`filter-chip${w.has(R)?" selected":""}`,onClick:()=>A(R),children:R},R))})]}),C.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Action"}),s.jsx("div",{className:"filter-chips",children:C.map(R=>s.jsx("button",{className:`filter-chip${m.has(R)?" selected":""}`,onClick:()=>z(R),children:R},R))})]}),r==="team"&&I.length>1&&s.jsxs("div",{className:"filter-section",children:[s.jsx("div",{className:"filter-label",children:"Owner"}),s.jsx("div",{className:"filter-chips",children:I.map(R=>s.jsx("button",{className:`filter-chip${f.has(R.id)?" selected":""}`,onClick:()=>_(R.id),children:R.label},R.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(([R,E])=>s.jsx("button",{className:`filter-chip${v===R?" selected":""}`,onClick:()=>S(R),children:E},R))})]})]}),B&&s.jsxs("div",{className:"active-filters",children:[[...w].map(R=>s.jsxs("span",{className:"active-chip",onClick:()=>A(R),children:[R," ",s.jsx("span",{className:"chip-remove",children:"×"})]},R)),[...m].map(R=>s.jsxs("span",{className:"active-chip",onClick:()=>z(R),children:[R," ",s.jsx("span",{className:"chip-remove",children:"×"})]},R)),[...f].map(R=>{const E=c[R],P=E?E.name:R;return s.jsxs("span",{className:"active-chip",onClick:()=>_(R),children:[P," ",s.jsx("span",{className:"chip-remove",children:"×"})]},R)}),v!=="all"&&s.jsxs("span",{className:"active-chip",onClick:()=>S("all"),children:[v==="1d"?"Today":v==="7d"?"7 days":"30 days"," ",s.jsx("span",{className:"chip-remove",children:"×"})]}),s.jsx("button",{className:"clear-filters",onClick:V,children:"Clear all"})]}),l&&a.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):M.length===0?s.jsx(Ef,{icon:"⌕",title:a.length===0?"No receipts yet":"No matching receipts",text:a.length===0?"Execution receipts will appear here after an agent uses an authorized tool.":"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:M.length===a.length?`${a.length} receipt${a.length!==1?"s":""}`:`${M.length} of ${a.length} receipts`}),s.jsx("div",{className:"timeline",children:M.map(R=>{var E;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(bf,{profileId:R.profileId}),s.jsx("span",{className:"auth-card-path",children:R.path}),s.jsx("span",{className:"receipt-action",children:R.action}),s.jsx("span",{className:"auth-card-time",children:Yv(R.timestamp)})]}),r==="team"&&R.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:(E=c[R.userId])!=null&&E.name?`${c[R.userId].name} (${c[R.userId].email})`:R.userId})]}),Object.keys(R.executionContext).length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)",marginBottom:"0.375rem"},children:Object.entries(R.executionContext).map(([P,$])=>`${P}=${$}`).join(" · ")}),s.jsxs("div",{style:{display:"flex",gap:"1rem",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:[s.jsxs("span",{children:["Daily: ",R.cumulativeState.daily.count," calls, $",R.cumulativeState.daily.amount]}),s.jsxs("span",{children:["Monthly: ",R.cumulativeState.monthly.count," calls, $",R.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:R.attestationHash})]})},R.id)})})]})]})}const Au={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 Zv(){const[e,t]=d.useState(""),[n,r]=d.useState("openrouter"),[o,a]=d.useState("openai-compatible"),[i,l]=d.useState("https://openrouter.ai/api/v1"),[u,c]=d.useState("google/gemma-4-31b-it"),[h,f]=d.useState(""),[g,y]=d.useState(!1),[x,w]=d.useState(!1),[j,m]=d.useState(!1),[p,v]=d.useState(null),S=d.useCallback(C=>{t(C),setTimeout(()=>t(""),3e3)},[]),b=d.useCallback(async()=>{try{const C=await O.getCredential("ai-config");if(y(C.configured),C.configured&&C.fields){C.fields.provider&&a(C.fields.provider),C.fields.endpoint&&l(C.fields.endpoint),C.fields.model&&c(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(()=>{b()},[b]);const T=C=>{r(C);const I=Au[C];I&&(a(I.provider),l(I.endpoint),c(I.models[0]))},k=async()=>{w(!0);try{await O.setCredential("ai-config",{provider:o,endpoint:i,model:u,...h?{apiKey:h}:{}}),y(!0),S("AI configuration saved!")}catch{S("Failed to save AI config")}finally{w(!1)}},N=async()=>{m(!0),v(null);try{const C=await O.aiTest(h?{provider:o,endpoint:i,model:u,apiKey:h}:{});v(C.ok?`OK: ${C.message}`:`Failed: ${C.message}`)}catch(C){v(`Error: ${C instanceof Error?C.message:"Unknown"}`)}finally{m(!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."}),g&&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 M;const C=((M=Au[n])==null?void 0:M.models)??[],I=C.includes(u);return s.jsxs(s.Fragment,{children:[s.jsxs("select",{className:"form-input",value:I?u:"__custom__",onChange:B=>{B.target.value==="__custom__"?c(""):c(B.target.value)},style:{marginBottom:I?void 0:"0.375rem"},children:[C.map(B=>s.jsx("option",{value:B,children:B},B)),s.jsx("option",{value:"__custom__",children:"Custom model..."})]}),!I&&s.jsx("input",{className:"form-input",value:u,onChange:B=>c(B.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:h,onChange:C=>f(C.target.value),placeholder:g?"••••••••••••••••":"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"}),g&&s.jsx("button",{className:"btn btn-ghost",onClick:N,disabled:j,children:j?"Testing...":"Test Connection"})]}),p&&s.jsx("div",{className:`alert ${p.startsWith("OK")?"alert-success":"alert-error"}`,style:{marginTop:"0.75rem"},children:p})]}),s.jsx(ey,{}),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 ey(){const[e,t]=d.useState(null),[n,r]=d.useState({intent:"",context:""}),[o,a]=d.useState(null),[i,l]=d.useState(null),[u,c]=d.useState(null),[h,f]=d.useState(!1),g=d.useCallback(async()=>{if(!h)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")}},[h]),y=async w=>{if(e){a(w),l(null);try{const j=n[w],m=j.trim()===e[w].default.trim()?"":j;await O.setAIPrompt(w,m);const p=await O.getAIPrompts();t(p),r({intent:p.intent.current,context:p.context.current}),c(w),setTimeout(()=>c(null),2e3)}catch(j){l(j instanceof Error?j.message:"Save failed")}finally{a(null)}}},x=async w=>{if(confirm(`Revert ${w} prompt to the built-in default?`)){a(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{a(null)}}};return s.jsxs("details",{className:"card",style:{padding:"1.5rem",marginTop:"1rem"},onToggle:w=>{w.currentTarget.open&&g()},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}),!h&&!i&&s.jsx("p",{style:{color:"var(--text-muted)",fontSize:"0.85rem"},children:"Loading prompts…"}),e&&s.jsxs(s.Fragment,{children:[s.jsx($u,{kind:"intent",label:"Intent — per-authorization",description:"Used on the Intent gate when creating a new authorization.",state:e.intent,draft:n.intent,onChange:w=>r(j=>({...j,intent:w})),onSave:()=>y("intent"),onRevert:()=>x("intent"),saving:o==="intent",justSaved:u==="intent"}),s.jsx($u,{kind:"context",label:"Context — standing-orders brief",description:"Used on the Brief page when refining your context.md.",state:e.context,draft:n.context,onChange:w=>r(j=>({...j,context:w})),onSave:()=>y("context"),onRevert:()=>x("context"),saving:o==="context",justSaved:u==="context"})]})]})}function $u({kind:e,label:t,description:n,state:r,draft:o,onChange:a,onSave:i,onRevert:l,saving:u,justSaved:c}){const h=o!==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:o,onChange:f=>a(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:u||!h,children:u?"Saving…":"Save"}),r.overridden&&s.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:l,disabled:u,title:"Discard the override and use the built-in default",children:"Revert to default"}),c&&s.jsx("span",{style:{fontSize:"0.78rem",color:"var(--success)"},children:"Saved"}),h&&!u&&!c&&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 ty(e){return e.proposalId?"review":"automatic"}function ny(e,t,n={}){const r=n.status??"pending",o=n.includeAutonomous??!1,a=[];for(const i of e)r==="pending"&&i.status!=="pending"||n.profile&&i.profileId!==n.profile||a.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=ty(i);!o&&l==="automatic"||n.profile&&i.profileId!==n.profile||a.push({kind:"receipt",id:i.id,sortTimestamp:i.timestamp,commitmentMode:l,profileId:i.profileId,receipt:i})}return a.sort((i,l)=>l.sortTimestamp-i.sortTimestamp),typeof n.limit=="number"&&n.limit>0?a.slice(0,n.limit):a}const ry={pending:"Pending",committed:"Approved",executed:"Executed",rejected:"Rejected",expired:"Expired"},oy={pending:"status-pending",committed:"status-active",executed:"status-active",rejected:"status-revoked",expired:"status-expired"};function ay(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 sy(e){return e.split("__").pop()??e}function iy(e){const t=e.toLowerCase();return t.includes("delete")||t.includes("refund")||t.includes("cancel")||t.includes("revoke")}const ly=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]),uy=/^(image|img|photo|picture|thumbnail)(_?url)?$/i;function cy(e,t){return typeof t!="string"?!1:/^data:image\//i.test(t)?!0:uy.test(e)?/^https?:\/\//.test(t):/^https?:\/\/.+\.(jpe?g|png|gif|webp|svg|avif)(\?|$)/i.test(t)}function si(e){if(e==null)return"—";if(typeof e=="string")return e.length>160?e.slice(0,157)+"…":e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>si(t)).join(", ");try{const t=JSON.stringify(e);return t.length>160?t.slice(0,157)+"…":t}catch{return String(e)}}function dy({item:e,onApprove:t,onReject:n,resolving:r}){const o=e.kind==="proposal",a=o?e.proposal.status:"executed",i=o?e.proposal.tool:e.receipt.action,l=sy(i),u=iy(i),c=o?e.proposal.toolArgs:null,h=o?e.proposal.executionContext:e.receipt.executionContext,f=o?null:e.receipt.cumulativeState,g=c?Object.entries(c).filter(([x])=>!ly.has(x)):[],y=Object.entries(h??{});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(bf,{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 ${oy[a]}`,children:ry[a]}),s.jsx("span",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:ay(e.sortTimestamp)})]})]}),u&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",fontSize:"0.8rem",color:"var(--warning)",background:"var(--bg-main)",border:"1px solid var(--border)",borderRadius:"0.375rem",padding:"0.4rem 0.6rem",marginBottom:"0.75rem"},children:[s.jsx("span",{children:"⚠"}),s.jsx("span",{children:"Irreversible action"})]}),o&&typeof(c==null?void 0:c._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:c._imagePreview,alt:typeof(c==null?void 0:c.altText)=="string"?c.altText:"local image preview",style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"}})]}),o&&g.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:g.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:cy(x,w)?s.jsx("img",{src:w,alt:typeof(c==null?void 0:c.altText)=="string"?c.altText:x,style:{display:"block",maxWidth:"100%",maxHeight:"240px",borderRadius:"0.375rem",border:"1px solid var(--border)"},onError:j=>{const m=j.currentTarget,p=m.parentElement;if(!p)return;m.style.display="none";const v=document.createElement("span");v.textContent=w,v.style.color="var(--text-tertiary)",p.appendChild(v)}}):si(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}=${si(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}`:""]}),o&&a==="pending"&&s.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[s.jsx("button",{className:"btn btn-primary",onClick:()=>t==null?void 0:t(e.id),disabled:r,children:r?"Approving…":"Approve"}),s.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:()=>n==null?void 0:n(e.id),disabled:r,children:"Reject"})]}),s.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",color:"var(--text-tertiary)"},children:[o?"Proposal":"Receipt",": ",e.id]})]})}const fy=new Set(["apiKey","api_key","accessToken","access_token","password","secret","signature","_imagePreview"]);function ii(e){if(e==null)return"—";if(typeof e=="string")return e.length>200?e.slice(0,197)+"...":e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return e.map(t=>ii(t)).join(", ");try{const t=JSON.stringify(e);return t.length>200?t.slice(0,197)+"...":t}catch{return String(e)}}function 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 my({proposal:e,currentUserId:t,onAction:n,onMessage:r}){const[o,a]=d.useState(!1),[i,l]=d.useState(!1),[u,c]=d.useState(null),[h,f]=d.useState(!1),[g,y]=d.useState(null),[x,w]=d.useState(!1),j=e.tool.split("__").pop()??e.tool,m=Object.entries(e.toolArgs).filter(([A])=>!fy.has(A)),p=Object.entries(e.executionContext),v=e.pendingApprovers??[],S=e.approvedBy??{},b=Object.keys(S).length,T=v.filter(A=>!(A in S)).length,k=t in S,N=async()=>{if(u===null){f(!0),y(null);try{const A=await O.getAttestationIntent(e.frameHash);if(!A){y("Intent not available or you are not an authorized approver.");return}const z=await O.decryptIntent({intentCiphertext:A.intentCiphertext,encryptedKey:A.encryptedKey,approverId:t});c(z)}catch(A){y(A instanceof Error?A.message:"Failed to decrypt intent")}finally{f(!1)}}},C=async()=>{x?w(!1):(w(!0),await N())},I=async()=>{a(!0),r("");try{await O.approveProposal(e.id);try{if(u===null){const A=await O.getAttestationIntent(e.frameHash);if(A){const z=await O.decryptIntent({intentCiphertext:A.intentCiphertext,encryptedKey:A.encryptedKey,approverId:t});c(z),await O.storeApprovedIntent(e.frameHash,z)}}else await O.storeApprovedIntent(e.frameHash,u)}catch{}r(`Approved. ${T-1>0?`${T-1} more approver(s) still needed.`:"All approvers signed off — action is ready to execute."}`),n()}catch(A){r(A instanceof Error?A.message:"Approval failed")}finally{a(!1)}},M=async()=>{const A=prompt("Rejection reason (optional):");if(A!==null){l(!0),r("");try{await O.rejectProposal(e.id,A||void 0),r("Action rejected."),n()}catch(z){r(z instanceof Error?z.message:"Rejection failed")}finally{l(!1)}}},B=o||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:Re(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:[b," of ",v.length," approver",v.length===1?"":"s"," signed off",v.map(A=>{const z=A in S;return s.jsxs("span",{style:{marginLeft:"0.5rem",color:z?"var(--success, green)":"var(--text-tertiary)"},children:[z?"✓":"○"," ",A===t?"You":A]},A)})]}),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})]}),m.length>0&&s.jsxs("div",{style:{marginBottom:"0.75rem"},children:[s.jsx("div",{style:{fontSize:"0.7rem",fontWeight:600,color:"var(--text-tertiary)",textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.25rem"},children:"Arguments"}),s.jsx("dl",{style:{display:"grid",gridTemplateColumns:"max-content 1fr",gap:"0.2rem 0.75rem",fontSize:"0.85rem",margin:0},children:m.map(([A,z])=>s.jsxs(d.Fragment,{children:[s.jsx("dt",{style:{color:"var(--text-tertiary)",whiteSpace:"nowrap",alignSelf:"start"},children:A}),s.jsx("dd",{style:{color:"var(--text-primary)",margin:0,wordBreak:"break-word"},children:ii(z)})]},A))})]}),p.length>0&&s.jsx("div",{style:{fontSize:"0.8rem",color:"var(--text-secondary)",marginBottom:"0.5rem"},children:p.map(([A,z])=>`${A}=${ii(z)}`).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:h,children:[x?"▲ Hide intent":"▼ Show intent",h&&" (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:g?s.jsx("p",{style:{color:"var(--danger)",fontSize:"0.8rem",margin:0},children:g}):u!==null?s.jsx("p",{style:{fontSize:"0.85rem",margin:0,whiteSpace:"pre-wrap",color:"var(--text-primary)"},children:u}):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:B,children:o?"Approving...":"Approve"}),s.jsx("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:M,disabled:B,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 hy(){const{domain:e,user:t}=ke(),n=(t==null?void 0:t.id)??"",[r,o]=d.useState("awaiting-me"),[a,i]=d.useState([]),[l,u]=d.useState(!0),[c,h]=d.useState(""),f=d.useCallback(async()=>{try{const H=await O.getProposalsForApprover();i(H)}catch{}finally{u(!1)}},[]);ue("proposal-added",f),ue("proposal-approved",f),ue("proposal-rejected",f),ue("proposal-resolved",f),zt(f,3e4);const[g,y]=d.useState([]),x=d.useCallback(async()=>{try{const H=await O.getProposals(e||"owner");y(H)}catch{}},[e]);ue("proposal-added",x),ue("proposal-approved",x),ue("proposal-rejected",x),ue("proposal-resolved",x),zt(x,3e4,e);const w=d.useMemo(()=>{const H=[];for(const X of g)X.status==="pending"&&H.push(X);for(const X of a);return H},[g,a]),[j,m]=d.useState([]),p=d.useCallback(async()=>{if(n)try{const X=(await O.getProposals(e||"owner")).filter(le=>le.status==="pending"&&le.pendingApprovers&&le.pendingApprovers.includes(n)&&le.approvedBy&&n in le.approvedBy);m(X)}catch{}},[n,e]);ue("proposal-approved",p),ue("proposal-rejected",p),zt(p,3e4,`${n}:${e}`),d.useEffect(()=>{f(),x(),p()},[]);const[v,S]=d.useState([]),[b,T]=d.useState([]),[k,N]=d.useState(!0),[C,I]=d.useState(null),[M,B]=d.useState(""),[A,z]=d.useState("pending"),[_,V]=d.useState(null),[R,E]=d.useState(!1),P=d.useCallback(async()=>{try{const{proposals:H,receipts:X}=await O.getThread({domain:e,status:A,sinceDays:7});S(H),T(X)}catch{}finally{N(!1)}},[e,A]);zt(P,3e4,`${e}:${A}`);const $=async(H,X)=>{I(H),B("");try{const le=e||"owner",K=await O.resolveProposal(H,X,le);B(X==="commit"?`Action approved. Status: ${K.status}`:"Action rejected."),await P()}catch(le){B(le instanceof Error?le.message:"Failed")}finally{I(null)}},F=d.useMemo(()=>{const H=new Set;for(const X of v)H.add(X.profileId);for(const X of b)H.add(X.profileId);return Array.from(H).sort()},[v,b]),W=d.useMemo(()=>ny(v,b,{status:A,profile:_??void 0,includeAutonomous:R}),[v,b,A,_,R]),ne=d.useCallback(()=>{f(),p()},[f,p]),Q=d.useMemo(()=>{const H=new Set,X=[];for(const le of[...j,...w])H.has(le.id)||(H.add(le.id),X.push(le));return X.sort((le,K)=>K.createdAt-le.createdAt)},[j,w]),Pe=a.length,G=Q.length;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"page-header",children:[s.jsx("h1",{className:"page-title",children:"Pending Approvals"}),s.jsx("p",{className:"page-subtitle",children:"Actions awaiting approval, plus recent activity from the last 7 days."})]}),s.jsxs("div",{className:"nav-tabs",style:{marginBottom:"1rem"},children:[s.jsxs("button",{className:`nav-tab${r==="awaiting-me"?" active":""}`,onClick:()=>o("awaiting-me"),children:["Awaiting me ",Pe>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:Pe})]}),s.jsxs("button",{className:`nav-tab${r==="awaiting-others"?" active":""}`,onClick:()=>o("awaiting-others"),children:["Awaiting others ",G>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:G})]}),s.jsx("button",{className:`nav-tab${r==="all"?" active":""}`,onClick:()=>{o("all"),P()},children:"All"})]}),r==="awaiting-me"&&s.jsx(s.Fragment,{children:l&&a.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):a.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 awaiting your approval."}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Above-cap actions under authorities you are an approver for will appear here."})]}):s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[c&&s.jsx("div",{className:"alert alert-success",children:c}),a.map(H=>s.jsx(my,{proposal:H,currentUserId:n,onAction:ne,onMessage:h},H.id))]})}),r==="awaiting-others"&&s.jsx(s.Fragment,{children:Q.length===0?s.jsxs("div",{className:"card",style:{textAlign:"center",padding:"2rem"},children:[s.jsx("p",{style:{color:"var(--text-tertiary)",marginBottom:"0.5rem"},children:"No actions waiting on others."}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:"Actions you proposed or approved that are pending other approvers will appear here."})]}):s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:Q.map(H=>s.jsx(vy,{proposal:H,currentUserId:n,onCancel:async()=>{try{await O.rejectProposal(H.id,"cancelled by creator"),p(),x()}catch(X){alert(X instanceof Error?X.message:"Cancel failed")}}},H.id))})}),r==="all"&&s.jsxs(s.Fragment,{children:[M&&s.jsx("div",{className:"alert alert-success",style:{marginBottom:"1rem"},children:M}),s.jsxs("div",{className:"filter-chips",style:{marginBottom:"1rem"},children:[s.jsx("button",{className:`filter-chip ${A==="pending"?"selected":""}`,onClick:()=>z("pending"),children:"Pending"}),s.jsx("button",{className:`filter-chip ${A==="all"?"selected":""}`,onClick:()=>z("all"),children:"All"}),F.length>0&&s.jsx("span",{style:{width:1,background:"var(--border)",alignSelf:"stretch",margin:"0 0.25rem"}}),F.map(H=>s.jsx("button",{className:`filter-chip ${_===H?"selected":""}`,onClick:()=>V(_===H?null:H),children:Re(H)},H)),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 ${R?"selected":""}`,onClick:()=>E(!R),title:"Include actions executed without human review (automatic commitment mode)",children:[R?"✓ ":"","Autonomous actions"]})]})]}),k&&W.length===0?s.jsx("p",{style:{color:"var(--text-tertiary)"},children:"Loading..."}):W.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:A==="pending"?"No actions awaiting your approval.":"Nothing here yet."}),s.jsx("p",{style:{fontSize:"0.8rem",color:"var(--text-tertiary)"},children:A==="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:W.map(H=>s.jsx(dy,{item:H,onApprove:X=>$(X,"commit"),onReject:X=>$(X,"reject"),resolving:C===H.id},H.id))})]})]})}function gy(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 vy({proposal:e,currentUserId:t,onCancel:n}){var c;const[r,o]=d.useState(!1),a=Object.keys(e.approvedBy??{}),i=(e.pendingApprovers??[]).filter(h=>!(h in(e.approvedBy??{}))),l=(((c=e.pendingApprovers)==null?void 0:c.length)??0)>0,u=async()=>{if(confirm("Cancel this action? All approvers will be notified.")){o(!0);try{await n()}finally{o(!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:Re(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:gy(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:[a.map(h=>s.jsx("span",{style:{marginRight:"0.75rem",color:"var(--success, green)"},children:h===t?"You approved":`${h} approved`},h)),i.map(h=>s.jsxs("span",{style:{marginRight:"0.75rem",color:"var(--text-tertiary)"},children:["Waiting on ",h===t?"you":h]},h))]}),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:u,disabled:r,children:r?"Cancelling...":"Cancel"})})]})}const yy=`# Agent Brief
67
67
 
68
- You act on my behalf under the Human Agency Protocol (HAP). You have
69
- bounded authorities each one describes an area of authority, a set of
70
- numeric limits, and a scope. Operate inside those bounds or the
71
- Gatekeeper will reject your action.
68
+ You act on my behalf through Suveren the gateway that gates every
69
+ privileged tool call you make. Suveren implements the bounded-authority
70
+ model from the open Human Agency Protocol (HAP): each authorization
71
+ describes an area of authority, a set of numeric limits, and a scope.
72
+ Operate inside those bounds or the Gatekeeper will reject your action.
72
73
 
73
74
  ## Before you act in a domain
74
75
 
@@ -98,4 +99,4 @@ executes. When you propose an action:
98
99
  next.
99
100
  - Never email anyone outside the company without asking first.
100
101
  - When drafting posts, prefer plain language over marketing copy.
101
- `;function hy(){const[e,t]=d.useState(""),[n,r]=d.useState(""),[o,a]=d.useState(!0),[i,l]=d.useState(!1),[u,c]=d.useState(null),[h,p]=d.useState(!1),g=e!==n,y=new Blob([e]).size,x=16*1024;d.useEffect(()=>{if(!g)return;const f=S=>{S.preventDefault(),S.returnValue=""},v=S=>{var k,N;if(S.defaultPrevented||S.button!==0||S.metaKey||S.ctrlKey||S.shiftKey||S.altKey)return;const b=(N=(k=S.target)==null?void 0:k.closest)==null?void 0:N.call(k,"a");if(!b||!b.href)return;let T;try{T=new URL(b.href)}catch{return}T.origin===window.location.origin&&T.pathname!==window.location.pathname&&(confirm("You have unsaved changes to your agent brief. Leave anyway?")||(S.preventDefault(),S.stopPropagation()))};return window.addEventListener("beforeunload",f),document.addEventListener("click",v,!0),()=>{window.removeEventListener("beforeunload",f),document.removeEventListener("click",v,!0)}},[g]),d.useEffect(()=>{let f=!1;return O.getAgentContext().then(v=>{f||(t(v),r(v))}).catch(v=>{f||c({kind:"error",text:v instanceof Error?v.message:"Failed to load context"})}).finally(()=>{f||a(!1)}),()=>{f=!0}},[]);const w=async()=>{l(!0),c(null);try{await O.saveAgentContext(e),r(e),c({kind:"ok",text:"Saved. New MCP sessions will pick this up on next connect."})}catch(f){c({kind:"error",text:f instanceof Error?f.message:"Save failed"})}finally{l(!1)}},j=()=>{t(n),c(null)},m=()=>{e.trim()&&!confirm("Replace current context with the starter template?")||t(my)};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()&&!o&&s.jsx("button",{className:"btn btn-primary btn-sm",onClick:m,disabled:i,title:"Insert a starter brief covering Suveren basics and example standing orders",style:{marginTop:"0.5rem"},children:"Insert starter template"})]}),u&&s.jsx("div",{className:u.kind==="ok"?"alert alert-success":"error-message",style:{marginBottom:"1rem"},children:u.text}),s.jsxs("div",{className:"intent-layout",style:{marginBottom:"1rem"},children:[s.jsx("div",{className:"card intent-pane chat",children:s.jsx(sa,{target:{kind:"context"},currentText:e,onApply:f=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||t(f)},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:f=>t(f.target.value),placeholder:o?"Loading…":'Type your standing orders here, or click "Insert starter template" below.',disabled:o,rows:18,style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem",lineHeight:1.5,minHeight:"22rem"}}),s.jsxs("div",{className:"intent-footer",style:{marginTop:"0.75rem"},children:[s.jsx("button",{className:"btn btn-ghost",onClick:j,disabled:i||!g,children:"Revert"}),s.jsx("button",{className:"btn btn-primary",style:{flex:1},onClick:w,disabled:i||!g||y>x||o,children:i?"Saving…":"Save"})]})]}),s.jsx("button",{type:"button",className:"floating-help",onClick:()=>p(!0),"aria-label":"Open brief assistant",children:"Get help with brief"}),s.jsx(Sf,{open:h,onClose:()=>p(!1),ariaLabel:"Brief assistant",children:s.jsx(sa,{target:{kind:"context"},currentText:e,onApply:f=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||(t(f),p(!1))},greeting:"Tell me what your agent should know — I'll help shape your standing orders.",placeholder:"Ask for help with your brief…"})})]})]})}function gy({children:e}){const{user:t,mode:n,domain:r}=ke();return t?n==="team"&&!r?s.jsx(Vt,{to:"/onboarding",replace:!0}):s.jsx(s.Fragment,{children:e}):s.jsx(Vt,{to:"/login",replace:!0})}function vy(){const{user:e}=ke();return s.jsxs(ng,{children:[s.jsx(we,{path:"/login",element:e?s.jsx(Vt,{to:"/",replace:!0}):s.jsx(tv,{})}),s.jsx(we,{path:"/onboarding",element:e?s.jsx(nv,{}):s.jsx(Vt,{to:"/login",replace:!0})}),s.jsxs(we,{element:s.jsx(gy,{children:s.jsx(ev,{})}),children:[s.jsx(we,{path:"/",element:s.jsx(av,{})}),s.jsx(we,{path:"/agent/new",element:s.jsx(Vt,{to:"/authorizations?new=1",replace:!0})}),s.jsx(we,{path:"/agent/gate",element:s.jsx(Ev,{})}),s.jsx(we,{path:"/agent/review",element:s.jsx(bv,{})}),s.jsx(we,{path:"/integrations",element:s.jsx(Iv,{})}),s.jsx(we,{path:"/groups",element:s.jsx(Rv,{})}),s.jsx(we,{path:"/authorizations",element:s.jsx(Hv,{})}),s.jsx(we,{path:"/audit",element:s.jsx(Qv,{})}),s.jsx(we,{path:"/proposals",element:s.jsx(dy,{})}),s.jsx(we,{path:"/agent-brief",element:s.jsx(hy,{})}),s.jsx(we,{path:"/settings",element:s.jsx(Yv,{})}),s.jsx(we,{path:"/settings/services",element:s.jsx(Vt,{to:"/settings",replace:!0})}),s.jsx(we,{path:"/deploy",element:s.jsx(Vt,{to:"/integrations",replace:!0})})]}),s.jsx(we,{path:"*",element:s.jsx(Vt,{to:"/",replace:!0})})]})}function yy(){return s.jsx(bg,{children:s.jsx(Mg,{children:s.jsx(Fg,{children:s.jsx(vy,{})})})})}Gd(document.getElementById("root")).render(s.jsx(d.StrictMode,{children:s.jsx(yy,{})}));
102
+ `;function xy(){const[e,t]=d.useState(""),[n,r]=d.useState(""),[o,a]=d.useState(!0),[i,l]=d.useState(!1),[u,c]=d.useState(null),[h,f]=d.useState(!1),g=e!==n,y=new Blob([e]).size,x=16*1024;d.useEffect(()=>{if(!g)return;const p=S=>{S.preventDefault(),S.returnValue=""},v=S=>{var k,N;if(S.defaultPrevented||S.button!==0||S.metaKey||S.ctrlKey||S.shiftKey||S.altKey)return;const b=(N=(k=S.target)==null?void 0:k.closest)==null?void 0:N.call(k,"a");if(!b||!b.href)return;let T;try{T=new URL(b.href)}catch{return}T.origin===window.location.origin&&T.pathname!==window.location.pathname&&(confirm("You have unsaved changes to your agent brief. Leave anyway?")||(S.preventDefault(),S.stopPropagation()))};return window.addEventListener("beforeunload",p),document.addEventListener("click",v,!0),()=>{window.removeEventListener("beforeunload",p),document.removeEventListener("click",v,!0)}},[g]),d.useEffect(()=>{let p=!1;return O.getAgentContext().then(v=>{p||(t(v),r(v))}).catch(v=>{p||c({kind:"error",text:v instanceof Error?v.message:"Failed to load context"})}).finally(()=>{p||a(!1)}),()=>{p=!0}},[]);const w=async()=>{l(!0),c(null);try{await O.saveAgentContext(e),r(e),c({kind:"ok",text:"Saved. New MCP sessions will pick this up on next connect."})}catch(p){c({kind:"error",text:p instanceof Error?p.message:"Save failed"})}finally{l(!1)}},j=()=>{t(n),c(null)},m=()=>{e.trim()&&!confirm("Replace current context with the starter template?")||t(yy)};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()&&!o&&s.jsx("button",{className:"btn btn-primary btn-sm",onClick:m,disabled:i,title:"Insert a starter brief covering Suveren basics and example standing orders",style:{marginTop:"0.5rem"},children:"Insert starter template"})]}),u&&s.jsx("div",{className:u.kind==="ok"?"alert alert-success":"error-message",style:{marginBottom:"1rem"},children:u.text}),s.jsxs("div",{className:"intent-layout",style:{marginBottom:"1rem"},children:[s.jsx("div",{className:"card intent-pane chat",children:s.jsx(ia,{target:{kind:"context"},currentText:e,onApply:p=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||t(p)},greeting:"Tell me what your agent should know — I'll help shape your standing orders. Or ask me to draft a full brief and we'll iterate.",placeholder:"Ask for help with your brief…"})}),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:p=>t(p.target.value),placeholder:o?"Loading…":'Type your standing orders here, or click "Insert starter template" below.',disabled:o,rows:18,style:{fontFamily:"'SF Mono', Monaco, monospace",fontSize:"0.85rem",lineHeight:1.5,minHeight:"22rem"}}),s.jsxs("div",{className:"intent-footer",style:{marginTop:"0.75rem"},children:[s.jsx("button",{className:"btn btn-ghost",onClick:j,disabled:i||!g,children:"Revert"}),s.jsx("button",{className:"btn btn-primary",style:{flex:1},onClick:w,disabled:i||!g||y>x||o,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(kf,{open:h,onClose:()=>f(!1),ariaLabel:"Brief assistant",children:s.jsx(ia,{target:{kind:"context"},currentText:e,onApply:p=>{e.trim()&&!confirm("Replace the current context with the applied draft?")||(t(p),f(!1))},greeting:"Tell me what your agent should know — I'll help shape your standing orders.",placeholder:"Ask for help with your brief…"})})]})]})}function wy({children:e}){const{user:t,mode:n,domain:r}=ke();return t?n==="team"&&!r?s.jsx(Vt,{to:"/onboarding",replace:!0}):s.jsx(s.Fragment,{children:e}):s.jsx(Vt,{to:"/login",replace:!0})}function Sy(){const{user:e}=ke();return s.jsxs(og,{children:[s.jsx(we,{path:"/login",element:e?s.jsx(Vt,{to:"/",replace:!0}):s.jsx(rv,{})}),s.jsx(we,{path:"/onboarding",element:e?s.jsx(ov,{}):s.jsx(Vt,{to:"/login",replace:!0})}),s.jsxs(we,{element:s.jsx(wy,{children:s.jsx(nv,{})}),children:[s.jsx(we,{path:"/",element:s.jsx(uv,{})}),s.jsx(we,{path:"/agent/new",element:s.jsx(Vt,{to:"/authorizations?new=1",replace:!0})}),s.jsx(we,{path:"/agent/gate",element:s.jsx(Iv,{})}),s.jsx(we,{path:"/agent/review",element:s.jsx(_v,{})}),s.jsx(we,{path:"/integrations",element:s.jsx(Av,{})}),s.jsx(we,{path:"/groups",element:s.jsx($v,{})}),s.jsx(we,{path:"/authorizations",element:s.jsx(Qv,{})}),s.jsx(we,{path:"/audit",element:s.jsx(qv,{})}),s.jsx(we,{path:"/proposals",element:s.jsx(hy,{})}),s.jsx(we,{path:"/agent-brief",element:s.jsx(xy,{})}),s.jsx(we,{path:"/settings",element:s.jsx(Zv,{})}),s.jsx(we,{path:"/settings/services",element:s.jsx(Vt,{to:"/settings",replace:!0})}),s.jsx(we,{path:"/deploy",element:s.jsx(Vt,{to:"/integrations",replace:!0})})]}),s.jsx(we,{path:"*",element:s.jsx(Vt,{to:"/",replace:!0})})]})}function jy(){return s.jsx(Tg,{children:s.jsx(Og,{children:s.jsx(Bg,{children:s.jsx(Sy,{})})})})}Yd(document.getElementById("root")).render(s.jsx(d.StrictMode,{children:s.jsx(jy,{})}));