openrod 0.1.1 → 0.1.2-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,545 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-view-Bqw3jQjI.js","assets/terminal-view-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
- var Bz=Object.defineProperty;var $z=(e,t,r)=>t in e?Bz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var tn=(e,t,r)=>$z(e,typeof t!="symbol"?t+"":t,r);function Vz(e,t){for(var r=0;r<t.length;r++){const a=t[r];if(typeof a!="string"&&!Array.isArray(a)){for(const l in a)if(l!=="default"&&!(l in e)){const c=Object.getOwnPropertyDescriptor(a,l);c&&Object.defineProperty(e,l,c.get?c:{enumerable:!0,get:()=>a[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))a(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function r(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(l){if(l.ep)return;l.ep=!0;const c=r(l);fetch(l.href,c)}})();function pR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var v0={exports:{}},bd={};/**
3
- * @license React
4
- * react-jsx-runtime.production.js
5
- *
6
- * Copyright (c) Meta Platforms, Inc. and affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var HN;function Uz(){if(HN)return bd;HN=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(a,l,c){var u=null;if(c!==void 0&&(u=""+c),l.key!==void 0&&(u=""+l.key),"key"in l){c={};for(var f in l)f!=="key"&&(c[f]=l[f])}else c=l;return l=c.ref,{$$typeof:e,type:a,key:u,ref:l!==void 0?l:null,props:c}}return bd.Fragment=t,bd.jsx=r,bd.jsxs=r,bd}var FN;function Hz(){return FN||(FN=1,v0.exports=Uz()),v0.exports}var s=Hz(),w0={exports:{}},Et={};/**
11
- * @license React
12
- * react.production.js
13
- *
14
- * Copyright (c) Meta Platforms, Inc. and affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var GN;function Fz(){if(GN)return Et;GN=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),v=Symbol.iterator;function j(I){return I===null||typeof I!="object"?null:(I=v&&I[v]||I["@@iterator"],typeof I=="function"?I:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,N={};function E(I,U,Q){this.props=I,this.context=U,this.refs=N,this.updater=Q||S}E.prototype.isReactComponent={},E.prototype.setState=function(I,U){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,U,"setState")},E.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function T(){}T.prototype=E.prototype;function A(I,U,Q){this.props=I,this.context=U,this.refs=N,this.updater=Q||S}var k=A.prototype=new T;k.constructor=A,C(k,E.prototype),k.isPureReactComponent=!0;var M=Array.isArray;function R(){}var O={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function _(I,U,Q){var te=Q.ref;return{$$typeof:e,type:I,key:U,ref:te!==void 0?te:null,props:Q}}function L(I,U){return _(I.type,U,I.props)}function q(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function P(I){var U={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(Q){return U[Q]})}var $=/\/+/g;function H(I,U){return typeof I=="object"&&I!==null&&I.key!=null?P(""+I.key):U.toString(36)}function F(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(R,R):(I.status="pending",I.then(function(U){I.status==="pending"&&(I.status="fulfilled",I.value=U)},function(U){I.status==="pending"&&(I.status="rejected",I.reason=U)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function V(I,U,Q,te,le){var J=typeof I;(J==="undefined"||J==="boolean")&&(I=null);var ne=!1;if(I===null)ne=!0;else switch(J){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(I.$$typeof){case e:case t:ne=!0;break;case g:return ne=I._init,V(ne(I._payload),U,Q,te,le)}}if(ne)return le=le(I),ne=te===""?"."+H(I,0):te,M(le)?(Q="",ne!=null&&(Q=ne.replace($,"$&/")+"/"),V(le,U,Q,"",function(W){return W})):le!=null&&(q(le)&&(le=L(le,Q+(le.key==null||I&&I.key===le.key?"":(""+le.key).replace($,"$&/")+"/")+ne)),U.push(le)),1;ne=0;var ce=te===""?".":te+":";if(M(I))for(var oe=0;oe<I.length;oe++)te=I[oe],J=ce+H(te,oe),ne+=V(te,U,Q,J,le);else if(oe=j(I),typeof oe=="function")for(I=oe.call(I),oe=0;!(te=I.next()).done;)te=te.value,J=ce+H(te,oe++),ne+=V(te,U,Q,J,le);else if(J==="object"){if(typeof I.then=="function")return V(F(I),U,Q,te,le);throw U=String(I),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return ne}function G(I,U,Q){if(I==null)return I;var te=[],le=0;return V(I,te,"","",function(J){return U.call(Q,J,le++)}),te}function X(I){if(I._status===-1){var U=I._result,Q=U();Q.then(function(te){(I._status===0||I._status===-1)&&(I._status=1,I._result=te,Q.status===void 0&&(Q.status="fulfilled",Q.value=te))},function(te){(I._status===0||I._status===-1)&&(I._status=2,I._result=te,Q.status===void 0&&(Q.status="rejected",Q.reason=te))}),I._status===-1&&(I._status=0,I._result=Q)}if(I._status===1)return I._result.default;throw I._result}var B=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)};function Z(I){var U=O.T,Q={};Q.types=U!==null?U.types:null,O.T=Q;try{var te=I(),le=O.S;le!==null&&le(Q,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(R,B)}catch(J){B(J)}finally{U!==null&&Q.types!==null&&(U.types=Q.types),O.T=U}}function K(I){var U=O.T;if(U!==null){var Q=U.types;Q===null?U.types=[I]:Q.indexOf(I)===-1&&Q.push(I)}else Z(K.bind(null,I))}var se={map:G,forEach:function(I,U,Q){G(I,function(){U.apply(this,arguments)},Q)},count:function(I){var U=0;return G(I,function(){U++}),U},toArray:function(I){return G(I,function(U){return U})||[]},only:function(I){if(!q(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return Et.Activity=p,Et.Children=se,Et.Component=E,Et.Fragment=r,Et.Profiler=l,Et.PureComponent=A,Et.StrictMode=a,Et.Suspense=m,Et.ViewTransition=b,Et.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Et.__COMPILER_RUNTIME={__proto__:null,c:function(I){return O.H.useMemoCache(I)}},Et.addTransitionType=K,Et.cache=function(I){return function(){return I.apply(null,arguments)}},Et.cacheSignal=function(){return null},Et.cloneElement=function(I,U,Q){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var te=C({},I.props),le=I.key;if(U!=null)for(J in U.key!==void 0&&(le=""+U.key),U)!D.call(U,J)||J==="key"||J==="__self"||J==="__source"||J==="ref"&&U.ref===void 0||(te[J]=U[J]);var J=arguments.length-2;if(J===1)te.children=Q;else if(1<J){for(var ne=Array(J),ce=0;ce<J;ce++)ne[ce]=arguments[ce+2];te.children=ne}return _(I.type,le,te)},Et.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:c,_context:I},I},Et.createElement=function(I,U,Q){var te,le={},J=null;if(U!=null)for(te in U.key!==void 0&&(J=""+U.key),U)D.call(U,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(le[te]=U[te]);var ne=arguments.length-2;if(ne===1)le.children=Q;else if(1<ne){for(var ce=Array(ne),oe=0;oe<ne;oe++)ce[oe]=arguments[oe+2];le.children=ce}if(I&&I.defaultProps)for(te in ne=I.defaultProps,ne)le[te]===void 0&&(le[te]=ne[te]);return _(I,J,le)},Et.createRef=function(){return{current:null}},Et.forwardRef=function(I){return{$$typeof:f,render:I}},Et.isValidElement=q,Et.lazy=function(I){return{$$typeof:g,_payload:{_status:-1,_result:I},_init:X}},Et.memo=function(I,U){return{$$typeof:h,type:I,compare:U===void 0?null:U}},Et.startTransition=Z,Et.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Et.use=function(I){return O.H.use(I)},Et.useActionState=function(I,U,Q){return O.H.useActionState(I,U,Q)},Et.useCallback=function(I,U){return O.H.useCallback(I,U)},Et.useContext=function(I){return O.H.useContext(I)},Et.useDebugValue=function(){},Et.useDeferredValue=function(I,U){return O.H.useDeferredValue(I,U)},Et.useEffect=function(I,U){return O.H.useEffect(I,U)},Et.useEffectEvent=function(I){return O.H.useEffectEvent(I)},Et.useId=function(){return O.H.useId()},Et.useImperativeHandle=function(I,U,Q){return O.H.useImperativeHandle(I,U,Q)},Et.useInsertionEffect=function(I,U){return O.H.useInsertionEffect(I,U)},Et.useLayoutEffect=function(I,U){return O.H.useLayoutEffect(I,U)},Et.useMemo=function(I,U){return O.H.useMemo(I,U)},Et.useOptimistic=function(I,U){return O.H.useOptimistic(I,U)},Et.useReducer=function(I,U,Q){return O.H.useReducer(I,U,Q)},Et.useRef=function(I){return O.H.useRef(I)},Et.useState=function(I){return O.H.useState(I)},Et.useSyncExternalStore=function(I,U,Q){return O.H.useSyncExternalStore(I,U,Q)},Et.useTransition=function(){return O.H.useTransition()},Et.version="19.3.0",Et}var qN;function of(){return qN||(qN=1,w0.exports=Fz()),w0.exports}var x=of();const Je=pR(x),Gz=Vz({__proto__:null,default:Je},[x]);var qz=(e,t,r,a,l,c,u,f)=>{let m=document.documentElement,h=["light","dark"];function g(v){(Array.isArray(e)?e:[e]).forEach(j=>{let S=j==="class",C=S&&c?l.map(N=>c[N]||N):l;S?(m.classList.remove(...C),m.classList.add(c&&c[v]?c[v]:v)):m.setAttribute(j,v)}),p(v)}function p(v){f&&h.includes(v)&&(m.style.colorScheme=v)}function b(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(a)g(a);else try{let v=localStorage.getItem(t)||r,j=u&&v==="system"?b():v;g(j)}catch{}},YN=["light","dark"],gR="(prefers-color-scheme: dark)",Yz=typeof window>"u",$v=x.createContext(void 0),Kz={setTheme:e=>{},themes:[]},xR=()=>{var e;return(e=x.useContext($v))!=null?e:Kz},Xz=e=>x.useContext($v)?x.createElement(x.Fragment,null,e.children):x.createElement(Qz,{...e}),Wz=["light","dark"],Qz=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:a=!0,storageKey:l="theme",themes:c=Wz,defaultTheme:u=r?"system":"light",attribute:f="data-theme",value:m,children:h,nonce:g,scriptProps:p})=>{let[b,v]=x.useState(()=>Jz(l,u)),[j,S]=x.useState(()=>b==="system"?j0():b),C=m?Object.values(m):c,N=x.useCallback(k=>{let M=k;if(!M)return;k==="system"&&r&&(M=j0());let R=m?m[M]:M,O=t?eP(g):null,D=document.documentElement,_=L=>{L==="class"?(D.classList.remove(...C),R&&D.classList.add(R)):L.startsWith("data-")&&(R?D.setAttribute(L,R):D.removeAttribute(L))};if(Array.isArray(f)?f.forEach(_):_(f),a){let L=YN.includes(u)?u:null,q=YN.includes(M)?M:L;D.style.colorScheme=q}O==null||O()},[g]),E=x.useCallback(k=>{let M=typeof k=="function"?k(b):k;v(M);try{localStorage.setItem(l,M)}catch{}},[b]),T=x.useCallback(k=>{let M=j0(k);S(M),b==="system"&&r&&!e&&N("system")},[b,e]);x.useEffect(()=>{let k=window.matchMedia(gR);return k.addListener(T),T(k),()=>k.removeListener(T)},[T]),x.useEffect(()=>{let k=M=>{M.key===l&&(M.newValue?v(M.newValue):E(u))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[E]),x.useEffect(()=>{N(e??b)},[e,b]);let A=x.useMemo(()=>({theme:b,setTheme:E,forcedTheme:e,resolvedTheme:b==="system"?j:b,themes:r?[...c,"system"]:c,systemTheme:r?j:void 0}),[b,E,e,j,r,c]);return x.createElement($v.Provider,{value:A},x.createElement(Zz,{forcedTheme:e,storageKey:l,attribute:f,enableSystem:r,enableColorScheme:a,defaultTheme:u,value:m,themes:c,nonce:g,scriptProps:p}),h)},Zz=x.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:a,enableColorScheme:l,defaultTheme:c,value:u,themes:f,nonce:m,scriptProps:h})=>{let g=JSON.stringify([r,t,c,e,f,u,a,l]).slice(1,-1);return x.createElement("script",{...h,suppressHydrationWarning:!0,nonce:typeof window>"u"?m:"",dangerouslySetInnerHTML:{__html:`(${qz.toString()})(${g})`}})}),Jz=(e,t)=>{if(Yz)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},eP=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},j0=e=>(e||(e=window.matchMedia(gR)),e.matches?"dark":"light"),S0={exports:{}},yd={},N0={exports:{}},C0={};/**
19
- * @license React
20
- * scheduler.production.js
21
- *
22
- * Copyright (c) Meta Platforms, Inc. and affiliates.
23
- *
24
- * This source code is licensed under the MIT license found in the
25
- * LICENSE file in the root directory of this source tree.
26
- */var KN;function tP(){return KN||(KN=1,(function(e){function t(F,V){var G=F.length;F.push(V);e:for(;0<G;){var X=G-1>>>1,B=F[X];if(0<l(B,V))F[X]=V,F[G]=B,G=X;else break e}}function r(F){return F.length===0?null:F[0]}function a(F){if(F.length===0)return null;var V=F[0],G=F.pop();if(G!==V){F[0]=G;e:for(var X=0,B=F.length,Z=B>>>1;X<Z;){var K=2*(X+1)-1,se=F[K],I=K+1,U=F[I];if(0>l(se,G))I<B&&0>l(U,se)?(F[X]=U,F[I]=G,X=I):(F[X]=se,F[K]=G,X=K);else if(I<B&&0>l(U,G))F[X]=U,F[I]=G,X=I;else break e}}return V}function l(F,V){var G=F.sortIndex-V.sortIndex;return G!==0?G:F.id-V.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var m=[],h=[],g=1,p=null,b=3,v=!1,j=!1,S=!1,C=!1,N=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function A(F){for(var V=r(h);V!==null;){if(V.callback===null)a(h);else if(V.startTime<=F)a(h),V.sortIndex=V.expirationTime,t(m,V);else break;V=r(h)}}function k(F){if(S=!1,A(F),!j)if(r(m)!==null)j=!0,M||(M=!0,q());else{var V=r(h);V!==null&&H(k,V.startTime-F)}}var M=!1,R=-1,O=5,D=-1;function _(){return C?!0:!(e.unstable_now()-D<O)}function L(){if(C=!1,M){var F=e.unstable_now();D=F;var V=!0;try{e:{j=!1,S&&(S=!1,E(R),R=-1),v=!0;var G=b;try{t:{for(A(F),p=r(m);p!==null&&!(p.expirationTime>F&&_());){var X=p.callback;if(typeof X=="function"){p.callback=null,b=p.priorityLevel;var B=X(p.expirationTime<=F);if(F=e.unstable_now(),typeof B=="function"){p.callback=B,A(F),V=!0;break t}p===r(m)&&a(m),A(F)}else a(m);p=r(m)}if(p!==null)V=!0;else{var Z=r(h);Z!==null&&H(k,Z.startTime-F),V=!1}}break e}finally{p=null,b=G,v=!1}V=void 0}}finally{V?q():M=!1}}}var q;if(typeof T=="function")q=function(){T(L)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,$=P.port2;P.port1.onmessage=L,q=function(){$.postMessage(null)}}else q=function(){N(L,0)};function H(F,V){R=N(function(){F(e.unstable_now())},V)}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(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(F){switch(b){case 1:case 2:case 3:var V=3;break;default:V=b}var G=b;b=V;try{return F()}finally{b=G}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(F,V){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var G=b;b=F;try{return V()}finally{b=G}},e.unstable_scheduleCallback=function(F,V,G){var X=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?X+G:X):G=X,F){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=G+B,F={id:g++,callback:V,priorityLevel:F,startTime:G,expirationTime:B,sortIndex:-1},G>X?(F.sortIndex=G,t(h,F),r(m)===null&&F===r(h)&&(S?(E(R),R=-1):S=!0,H(k,G-X))):(F.sortIndex=B,t(m,F),j||v||(j=!0,M||(M=!0,q()))),F},e.unstable_shouldYield=_,e.unstable_wrapCallback=function(F){var V=b;return function(){var G=b;b=V;try{return F.apply(this,arguments)}finally{b=G}}}})(C0)),C0}var XN;function nP(){return XN||(XN=1,N0.exports=tP()),N0.exports}var k0={exports:{}},Rs={};/**
27
- * @license React
28
- * react-dom.production.js
29
- *
30
- * Copyright (c) Meta Platforms, Inc. and affiliates.
31
- *
32
- * This source code is licensed under the MIT license found in the
33
- * LICENSE file in the root directory of this source tree.
34
- */var WN;function sP(){if(WN)return Rs;WN=1;var e=of();function t(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},l=Symbol.for("react.portal"),c=Symbol.for("react.recoverable"),u=Symbol.for("react.optimistic_key");function f(g,p,b){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:v==null?null:v===u?u:""+v,children:g,containerInfo:p,implementation:b}}var m=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Rs.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Rs.browser=function(g){return{$$typeof:c,_reason:g}},Rs.createPortal=function(g,p){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return f(g,p,null,b)},Rs.flushSync=function(g){var p=m.T,b=a.p;try{if(m.T=null,a.p=2,g)return g()}finally{m.T=p,a.p=b,a.d.f()}},Rs.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(g,p))},Rs.prefetchDNS=function(g){typeof g=="string"&&a.d.D(g)},Rs.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var b=p.as,v=h(b,p.crossOrigin),j=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;b==="style"?a.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:j,fetchPriority:S}):b==="script"&&a.d.X(g,{crossOrigin:v,integrity:j,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Rs.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var b=h(p.as,p.crossOrigin);a.d.M(g,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0})}}else p==null&&a.d.M(g)},Rs.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var b=p.as,v=h(b,p.crossOrigin);a.d.L(g,b,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Rs.preloadModule=function(g,p){if(typeof g=="string")if(p){var b=h(p.as,p.crossOrigin);a.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0})}else a.d.m(g)},Rs.requestFormReset=function(g){a.d.r(g)},Rs.unstable_batchedUpdates=function(g,p){return g(p)},Rs.useFormState=function(g,p,b){return m.H.useFormState(g,p,b)},Rs.useFormStatus=function(){return m.H.useHostTransitionStatus()},Rs.version="19.3.0",Rs}var QN;function bR(){if(QN)return k0.exports;QN=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),k0.exports=sP(),k0.exports}/**
35
- * @license React
36
- * react-dom-client.production.js
37
- *
38
- * Copyright (c) Meta Platforms, Inc. and affiliates.
39
- *
40
- * This source code is licensed under the MIT license found in the
41
- * LICENSE file in the root directory of this source tree.
42
- */var ZN;function rP(){if(ZN)return yd;ZN=1;var e=nP(),t=of(),r=bR();function a(n){var o="https://react.dev/errors/"+n;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)o+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+n+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function c(n){for(var o=n,i=o;i&&!i.alternate;)o=i,(o.flags&4098)!==0&&(n=o.return),i=o.return;for(;o.return;)o=o.return;return o.tag===3?n:null}function u(n){if(n.tag===13){var o=n.memoizedState;if(o===null&&(n=n.alternate,n!==null&&(o=n.memoizedState)),o!==null)return o.dehydrated}return null}function f(n){if(n.tag===31){var o=n.memoizedState;if(o===null&&(n=n.alternate,n!==null&&(o=n.memoizedState)),o!==null)return o.dehydrated}return null}function m(n){if(c(n)!==n)throw Error(a(188))}function h(n){var o=n.alternate;if(!o){if(o=c(n),o===null)throw Error(a(188));return o!==n?null:n}for(var i=n,d=o;;){var y=i.return;if(y===null)break;var w=y.alternate;if(w===null){if(d=y.return,d!==null){i=d;continue}break}if(y.child===w.child){for(w=y.child;w;){if(w===i)return m(y),n;if(w===d)return m(y),o;w=w.sibling}throw Error(a(188))}if(i.return!==d.return)i=y,d=w;else{for(var z=!1,Y=y.child;Y;){if(Y===i){z=!0,i=y,d=w;break}if(Y===d){z=!0,d=y,i=w;break}Y=Y.sibling}if(!z){for(Y=w.child;Y;){if(Y===i){z=!0,i=w,d=y;break}if(Y===d){z=!0,d=w,i=y;break}Y=Y.sibling}if(!z)throw Error(a(189))}}if(i.alternate!==d)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?n:o}function g(n){var o=n.tag;if(o===5||o===26||o===27||o===6)return n;for(n=n.child;n!==null;){if(o=g(n),o!==null)return o;n=n.sibling}return null}function p(n,o,i,d,y,w){for(;n!==null;){if((n.tag===5||n.tag===27||n.tag===6)&&i(n,d,y,w)||(n.tag!==22||n.memoizedState===null)&&(o||n.tag!==5&&n.tag!==27)&&p(n.child,o,i,d,y,w))return!0;n=n.sibling}return!1}function b(n){for(n=n.return;n!==null;){if(n.tag===3||n.tag===5||n.tag===27)return n;n=n.return}return null}function v(n){var o=!1;for(n=n.return;n!==null&&(n.tag===4&&(o=!0),!(n.tag===3||n.tag===5||n.tag===27));)n=n.return;return o}function j(n){var o=[null,null],i=b(n);return i===null||S(o,n,i.child,{foundSelf:!1}),o}function S(n,o,i,d){for(;i!==null;){if(i===o)d.foundSelf=!0;else if(i.tag===5||i.tag===27||i.tag===6){if(d.foundSelf)return n[1]=i,!0;n[0]=i}else if((i.tag!==22||i.memoizedState===null)&&S(n,o,i.child,d))return!0;i=i.sibling}return!1}function C(n){switch(n.tag){case 5:case 27:case 6:return n.stateNode;case 3:return n.stateNode.containerInfo;default:throw Error(a(559))}}var N=null,E=null;function T(n,o,i){return n===i?!0:n===o?(N=n,!0):!1}function A(n,o,i){return n===i?(E=n,!1):n===o?(E!==null&&(N=n),!0):!1}function k(n){if(n===null)return null;do n=n===null?null:n.return;while(n&&n.tag!==5&&n.tag!==27&&n.tag!==3);return n||null}function M(n,o,i){for(var d=0,y=n;y;y=i(y))d++;y=0;for(var w=o;w;w=i(w))y++;for(;0<d-y;)n=i(n),d--;for(;0<y-d;)o=i(o),y--;for(;d--;){if(n===o||o!==null&&n===o.alternate)return n;n=i(n),o=i(o)}return null}var R=Object.assign,O=Symbol.for("react.element"),D=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),H=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),K=Symbol.for("react.legacy_hidden"),se=Symbol.for("react.memo_cache_sentinel"),I=Symbol.for("react.view_transition"),U=Symbol.for("react.recoverable"),Q=Symbol.iterator;function te(n){return n===null||typeof n!="object"?null:(n=Q&&n[Q]||n["@@iterator"],typeof n=="function"?n:null)}var le=Symbol.for("react.client.reference");function J(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===le?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case L:return"Fragment";case P:return"Profiler";case q:return"StrictMode";case V:return"Suspense";case G:return"SuspenseList";case Z:return"Activity";case I:return"ViewTransition"}if(typeof n=="object")switch(n.$$typeof){case _:return"Portal";case H:return n.displayName||"Context";case $:return(n._context.displayName||"Context")+".Consumer";case F:var o=n.render;return n=n.displayName,n||(n=o.displayName||o.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case X:return o=n.displayName||null,o!==null?o:J(n.type)||"Memo";case B:o=n._payload,n=n._init;try{return J(n(o))}catch{}}return null}var ne=Array.isArray,ce=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},de=[],Ee=-1;function Be(n){return{current:n}}function Ne(n){0>Ee||(n.current=de[Ee],de[Ee]=null,Ee--)}function Ae(n,o){Ee++,de[Ee]=n.current,n.current=o}var ee=Be(null),re=Be(null),xe=Be(null),he=Be(null);function $e(n,o){switch(Ae(xe,o),Ae(re,n),Ae(ee,null),o.nodeType){case 9:case 11:n=(n=o.documentElement)&&(n=n.namespaceURI)?ZS(n):0;break;default:if(n=o.tagName,o=o.namespaceURI)o=ZS(o),n=JS(o,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Ne(ee),Ae(ee,n)}function we(){Ne(ee),Ne(re),Ne(xe)}function _e(n){var o=n.memoizedState;o!==null&&(_c._currentValue=o.memoizedState,Ae(he,n)),o=ee.current;var i=JS(o,n.type);o!==i&&(Ae(re,n),Ae(ee,i))}function Re(n){re.current===n&&(Ne(ee),Ne(re)),he.current===n&&(Ne(he),_c._currentValue=W)}var Te,be;function Ue(n){if(Te===void 0)try{throw Error()}catch(i){var o=i.stack.trim().match(/\n( *(at )?)/);Te=o&&o[1]||"",be=-1<i.stack.indexOf(`
43
- at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
44
- `+Te+n+be}var Ze=!1;function ht(n,o){if(!n||Ze)return"";Ze=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(o){var ze=function(){throw Error()};if(Object.defineProperty(ze.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ze,[])}catch(tt){var ge=tt}Reflect.construct(n,[],ze)}else{try{ze.call()}catch(tt){ge=tt}ze=!1;try{var Se=Object.getOwnPropertyDescriptor(n.prototype,"props");Object.defineProperty(n.prototype,"props",{configurable:!0,set:function(){throw Error()}}),ze=!0,new n}finally{ze&&(Se!==void 0?Object.defineProperty(n.prototype,"props",Se):delete n.prototype.props)}}}else{try{throw Error()}catch(tt){ge=tt}(ze=n())&&typeof ze.catch=="function"&&ze.catch(function(){})}}catch(tt){if(tt&&ge&&typeof tt.stack=="string")return[tt.stack,ge.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=d.DetermineComponentFrameRoot(),z=w[0],Y=w[1];if(z&&Y){var ie=z.split(`
45
- `),ve=Y.split(`
46
- `);for(y=d=0;d<ie.length&&!ie[d].includes("DetermineComponentFrameRoot");)d++;for(;y<ve.length&&!ve[y].includes("DetermineComponentFrameRoot");)y++;if(d===ie.length||y===ve.length)for(d=ie.length-1,y=ve.length-1;1<=d&&0<=y&&ie[d]!==ve[y];)y--;for(;1<=d&&0<=y;d--,y--)if(ie[d]!==ve[y]){if(d!==1||y!==1)do if(d--,y--,0>y||ie[d]!==ve[y]){var ke=`
47
- `+ie[d].replace(" at new "," at ");return n.displayName&&ke.includes("<anonymous>")&&(ke=ke.replace("<anonymous>",n.displayName)),ke}while(1<=d&&0<=y);break}}}finally{Ze=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?Ue(i):""}function at(n,o){switch(n.tag){case 26:case 27:case 5:return Ue(n.type);case 16:return Ue("Lazy");case 13:return n.child!==o&&o!==null?Ue("Suspense Fallback"):Ue("Suspense");case 19:return Ue("SuspenseList");case 0:case 15:return ht(n.type,!1);case 11:return ht(n.type.render,!1);case 1:return ht(n.type,!0);case 31:return Ue("Activity");case 30:return Ue("ViewTransition");default:return""}}function Pe(n){try{var o="",i=null;do o+=at(n,i),i=n,n=n.return;while(n);return o}catch(d){return`
48
- Error generating stack: `+d.message+`
49
- `+d.stack}}var ct=Object.prototype.hasOwnProperty,We=e.unstable_scheduleCallback,me=e.unstable_cancelCallback,De=e.unstable_shouldYield,Oe=e.unstable_requestPaint,nt=e.unstable_now,Ge=e.unstable_getCurrentPriorityLevel,Ye=e.unstable_ImmediatePriority,pe=e.unstable_UserBlockingPriority,He=e.unstable_NormalPriority,Ie=e.unstable_LowPriority,ut=e.unstable_IdlePriority,Qe=e.log,kt=e.unstable_setDisableYieldValue,At=null,jt=null;function Ht(n){if(typeof Qe=="function"&&kt(n),jt&&typeof jt.setStrictMode=="function")try{jt.setStrictMode(At,n)}catch{}}var St=Math.clz32?Math.clz32:ae,dt=Math.log,yt=Math.LN2;function ae(n){return n>>>=0,n===0?32:31-(dt(n)/yt|0)|0}var Xe=256,rt=262144,Wt=4194304;function Mn(n){var o=n&42;if(o!==0)return o;switch(n&-n){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&-n;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Pt(n,o,i){var d=n.pendingLanes;if(d===0)return 0;var y=0,w=n.suspendedLanes,z=n.pingedLanes;n=n.warmLanes;var Y=d&134217727;return Y!==0?(d=Y&~w,d!==0?y=Mn(d):(z&=Y,z!==0?y=Mn(z):i||(i=Y&~n,i!==0&&(y=Mn(i))))):(Y=d&~w,Y!==0?y=Mn(Y):z!==0?y=Mn(z):i||(i=d&~n,i!==0&&(y=Mn(i)))),y===0?0:o!==0&&o!==y&&(o&w)===0&&(w=y&-y,i=o&-o,w>=i||w===32&&(i&4194048)!==0)?o:y}function Mt(n,o){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&o)===0}function Dn(n,o){(o&8)!==0&&(o|=o&32);var i=n.entangledLanes;if(i!==0)for(n=n.entanglements,i&=o;0<i;){var d=31-St(i),y=1<<d;o|=n[d],i&=~y}return o}function oo(n,o){switch(n){case 1:case 2:case 4:case 8:case 64:return o+250;case 16:case 32: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 o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ms(){var n=Wt;return Wt<<=1,(Wt&62914560)===0&&(Wt=4194304),n}function Er(n){for(var o=[],i=0;31>i;i++)o.push(n);return o}function hs(n,o){n.pendingLanes|=o,o!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ms(n,o,i,d,y,w){var z=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var Y=n.entanglements,ie=n.expirationTimes,ve=n.hiddenUpdates;for(i=z&~i;0<i;){var ke=31-St(i),ze=1<<ke;Y[ke]=0,ie[ke]=-1;var ge=ve[ke];if(ge!==null)for(ve[ke]=null,ke=0;ke<ge.length;ke++){var Se=ge[ke];Se!==null&&(Se.lane&=-536870913)}i&=~ze}d!==0&&$s(n,d,0),w!==0&&y===0&&n.tag!==0&&(n.suspendedLanes|=w&~(z&~o))}function $s(n,o,i){n.pendingLanes|=o,n.suspendedLanes&=~o;var d=31-St(o);n.entangledLanes|=o,n.entanglements[d]=n.entanglements[d]|1073741824|i&261930}function Wl(n,o){var i=n.entangledLanes|=o;for(n=n.entanglements;i;){var d=31-St(i),y=1<<d;y&o|n[d]&o&&(n[d]|=o),i&=~y}}function Vi(n,o){var i=o&-o;return i=(i&42)!==0?1:Ha(i),(i&(n.suspendedLanes|o))!==0?0:i}function Ha(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Rr(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Ar(){var n=oe.p;return n!==0?n:(n=window.event,n===void 0?32:IN(n.type))}function Ui(n,o){var i=oe.p;try{return oe.p=n,o()}finally{oe.p=i}}var Gn=Math.random().toString(36).slice(2),zn="__reactFiber$"+Gn,ws="__reactProps$"+Gn,cr="__reactContainer$"+Gn,ku="__reactEvents$"+Gn,Ql="__reactListeners$"+Gn,Zl="__reactHandles$"+Gn,Fa="__reactResources$"+Gn,Hi="__reactMarker$"+Gn,Jl="__reactLoad$"+Gn;function ec(n){delete n[zn],delete n[ws],delete n[Ql],delete n[Zl]}function ao(n){var o;if(o=n[zn])return o;for(var i=n.parentNode;i;){if(o=i[cr]||i[zn]){if(i=o.alternate,o.child!==null||i!==null&&i.child!==null)for(n=gN(n);n!==null;){if(i=n[zn])return i;n=gN(n)}return o}n=i,i=n.parentNode}return null}function Fi(n){if(n=n[zn]||n[cr]){var o=n.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return n}return null}function Ce(n){var o=n.tag;if(o===5||o===26||o===27||o===6)return n.stateNode;throw Error(a(33))}function Ve(n){var o=n[Fa];return o||(o=n[Fa]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function Fe(n){n[Hi]=!0}function gt(n){n[Jl]=void 0}var Ot=new Set,Tt={};function Bt(n,o){dn(n,o),dn(n+"Capture",o)}function dn(n,o){for(Tt[n]=o,n=0;n<o.length;n++)Ot.add(o[n])}var sn=RegExp("^[: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]*$"),Nt={},Dt={};function en(n){return ct.call(Dt,n)?!0:ct.call(Nt,n)?!1:sn.test(n)?Dt[n]=!0:(Nt[n]=!0,!1)}var vt=!1;function ts(){var n=vt;return vt=!1,n}function Pn(n,o,i){if(en(o))if(i===null)n.removeAttribute(o);else{switch(typeof i){case"undefined":case"function":case"symbol":n.removeAttribute(o);return;case"boolean":var d=o.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){n.removeAttribute(o);return}}n.setAttribute(o,i)}}function ur(n,o,i){if(i===null)n.removeAttribute(o);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttribute(o,i)}}function Kn(n,o,i,d){if(d===null)n.removeAttribute(i);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttributeNS(o,i,d)}}function Xn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function tc(n){var o=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Tu(n,o,i){var d=Object.getOwnPropertyDescriptor(n.constructor.prototype,o);if(!n.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,w=d.set;return Object.defineProperty(n,o,{configurable:!0,get:function(){return y.call(this)},set:function(z){i=""+z,w.call(this,z)}}),Object.defineProperty(n,o,{enumerable:d.enumerable}),{getValue:function(){return i},setValue:function(z){i=""+z},stopTracking:function(){n._valueTracker=null,delete n[o]}}}}function ta(n){if(!n._valueTracker){var o=tc(n)?"checked":"value";n._valueTracker=Tu(n,o,""+n[o])}}function nc(n){if(!n)return!1;var o=n._valueTracker;if(!o)return!0;var i=o.getValue(),d="";return n&&(d=tc(n)?n.checked?"true":"false":n.value),n=d,n!==i?(o.setValue(n),!0):!1}var Bf=/[\n"\\]/g;function kn(n){return n.replace(Bf,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function Ds(n,o,i,d,y,w,z,Y){n.name="",z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?n.type=z:n.removeAttribute("type"),o!=null?z==="number"?(o===0&&n.value===""||n.value!=o)&&(n.value=""+Xn(o)):n.value!==""+Xn(o)&&(n.value=""+Xn(o)):z!=="submit"&&z!=="reset"||n.removeAttribute("value"),o!=null?z==="number"&&n.value==o?sc(n,Xn(n.value)):sc(n,Xn(o)):i!=null?sc(n,Xn(i)):d!=null&&n.removeAttribute("value"),y==null&&w!=null&&(n.defaultChecked=!!w),y!=null&&(n.checked=y&&typeof y!="function"&&typeof y!="symbol"),Y!=null&&typeof Y!="function"&&typeof Y!="symbol"&&typeof Y!="boolean"?n.name=""+Xn(Y):n.removeAttribute("name")}function Ga(n,o,i,d,y,w,z,Y){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.type=w),o!=null||i!=null){if(!(w!=="submit"&&w!=="reset"||o!=null)){ta(n);return}i=i!=null?""+Xn(i):"",o=o!=null?""+Xn(o):i,Y||o===n.value||(n.value=o),n.defaultValue=o}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,n.checked=Y?n.checked:!!d,n.defaultChecked=!!d,z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"&&(n.name=z),ta(n)}function sc(n,o){n.defaultValue!==""+o&&(n.defaultValue=""+o)}function Ws(n,o,i,d){if(n=n.options,o){o={};for(var y=0;y<i.length;y++)o["$"+i[y]]=!0;for(i=0;i<n.length;i++)y=o.hasOwnProperty("$"+n[i].value),n[i].selected!==y&&(n[i].selected=y),y&&d&&(n[i].defaultSelected=!0)}else{for(i=""+Xn(i),o=null,y=0;y<n.length;y++){if(n[y].value===i){n[y].selected=!0,d&&(n[y].defaultSelected=!0);return}o!==null||n[y].disabled||(o=n[y])}o!==null&&(o.selected=!0)}}function rc(n,o,i){if(o!=null&&(o=""+Xn(o),o!==n.value&&(n.value=o),i==null)){n.defaultValue!==o&&(n.defaultValue=o);return}n.defaultValue=i!=null?""+Xn(i):""}function dr(n,o,i,d){if(o==null){if(d!=null){if(i!=null)throw Error(a(92));if(ne(d)){if(1<d.length)throw Error(a(93));d=d[0]}i=d}i==null&&(i=""),o=i}i=Xn(o),n.defaultValue=i,d=n.textContent,d===i&&d!==""&&d!==null&&(n.value=d),ta(n)}function Vs(n,o){if(o){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=o;return}}n.textContent=o}var qa=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Eu(n,o,i){var d=o.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?d?n.setProperty(o,""):o==="float"?n.cssFloat="":n[o]="":d?n.setProperty(o,i):typeof i!="number"||i===0||qa.has(o)?o==="float"?n.cssFloat=i:n[o]=(""+i).trim():n[o]=i+"px"}function fr(n,o,i){if(o!=null&&typeof o!="object")throw Error(a(62));if(n=n.style,i!=null){for(var d in i)!i.hasOwnProperty(d)||o!=null&&o.hasOwnProperty(d)||(d.indexOf("--")===0?n.setProperty(d,""):d==="float"?n.cssFloat="":n[d]="",vt=!0);for(var y in o)d=o[y],o.hasOwnProperty(y)&&i[y]!==d&&(Eu(n,y,d),vt=!0)}else for(var w in o)o.hasOwnProperty(w)&&Eu(n,w,o[w])}function Gi(n){if(n.indexOf("-")===-1)return!1;switch(n){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 Ru=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Au=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function js(n){return Au.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Us(){}var qi=null;function Yi(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Qt=null,ps=null;function Or(n){var o=Fi(n);if(o&&(n=o.stateNode)){var i=n[ws]||null;e:switch(n=o.stateNode,o.type){case"input":if(Ds(n,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),o=i.name,i.type==="radio"&&o!=null){for(i=n;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+kn(""+o)+'"][type="radio"]'),o=0;o<i.length;o++){var d=i[o];if(d!==n&&d.form===n.form){var y=d[ws]||null;if(!y)throw Error(a(90));Ds(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(o=0;o<i.length;o++)d=i[o],d.form===n.form&&nc(d)}break e;case"textarea":rc(n,i.value,i.defaultValue);break e;case"select":o=i.value,o!=null&&Ws(n,!!i.multiple,o,!1)}}}var mr=!1;function Ki(n,o,i){if(mr)return n(o,i);mr=!0;try{var d=n(o);return d}finally{if(mr=!1,(Qt!==null||ps!==null)&&(Bm(),Qt&&(o=Qt,n=ps,ps=Qt=null,Or(o),n)))for(o=0;o<n.length;o++)Or(n[o])}}function na(n,o){var i=n.stateNode;if(i===null)return null;var d=i[ws]||null;if(d===null)return null;i=d[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(n=n.type,d=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!d;break e;default:n=!1}if(n)return null;if(i&&typeof i!="function")throw Error(a(231,o,typeof i));return i}var Ss=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xi=!1;if(Ss)try{var Ou={};Object.defineProperty(Ou,"passive",{get:function(){Xi=!0}}),window.addEventListener("test",Ou,Ou),window.removeEventListener("test",Ou,Ou)}catch{Xi=!1}var Ya=null,rx=null,$f=null;function Kw(){if($f)return $f;var n,o=rx,i=o.length,d,y="value"in Ya?Ya.value:Ya.textContent,w=y.length;for(n=0;n<i&&o[n]===y[n];n++);var z=i-n;for(d=1;d<=z&&o[i-d]===y[w-d];d++);return $f=y.slice(n,1<d?1-d:void 0)}function Vf(n){var o=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&o===13&&(n=13)):n=o,n===10&&(n=13),32<=n||n===13?n:0}function Uf(){return!0}function Xw(){return!1}function Hs(n){function o(i,d,y,w,z){this._reactName=i,this._targetInst=y,this.type=d,this.nativeEvent=w,this.target=z,this.currentTarget=null;for(var Y in n)n.hasOwnProperty(Y)&&(i=n[Y],this[Y]=i?i(w):w[Y]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?Uf:Xw,this.isPropagationStopped=Xw,this}return R(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Uf)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Uf)},persist:function(){},isPersistent:Uf}),o}var Ka={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hf=Hs(Ka),Mu=R({},Ka,{view:0,detail:0}),u4=Hs(Mu),ox,ax,Du,Ff=R({},Mu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lx,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Du&&(Du&&n.type==="mousemove"?(ox=n.screenX-Du.screenX,ax=n.screenY-Du.screenY):ax=ox=0,Du=n),ox)},movementY:function(n){return"movementY"in n?n.movementY:ax}}),Ww=Hs(Ff),d4=R({},Ff,{dataTransfer:0}),f4=Hs(d4),m4=R({},Mu,{relatedTarget:0}),ix=Hs(m4),h4=R({},Ka,{animationName:0,elapsedTime:0,pseudoElement:0}),p4=Hs(h4),g4=R({},Ka,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),x4=Hs(g4),b4=R({},Ka,{data:0}),Qw=Hs(b4),y4={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},v4={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"},w4={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function j4(n){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(n):(n=w4[n])?!!o[n]:!1}function lx(){return j4}var S4=R({},Mu,{key:function(n){if(n.key){var o=y4[n.key]||n.key;if(o!=="Unidentified")return o}return n.type==="keypress"?(n=Vf(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?v4[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lx,charCode:function(n){return n.type==="keypress"?Vf(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Vf(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),N4=Hs(S4),C4=R({},Ff,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Zw=Hs(C4),k4=R({},Ka,{submitter:0}),T4=Hs(k4),E4=R({},Mu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lx}),R4=Hs(E4),A4=R({},Ka,{propertyName:0,elapsedTime:0,pseudoElement:0}),O4=Hs(A4),M4=R({},Ff,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),D4=Hs(M4),z4=R({},Ka,{newState:0,oldState:0,source:0}),P4=Hs(z4),I4=[9,13,27,32],cx=Ss&&"CompositionEvent"in window,zu=null;Ss&&"documentMode"in document&&(zu=document.documentMode);var _4=Ss&&"TextEvent"in window&&!zu,Jw=Ss&&(!cx||zu&&8<zu&&11>=zu),e2=" ",t2=!1;function n2(n,o){switch(n){case"keyup":return I4.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function s2(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var oc=!1;function L4(n,o){switch(n){case"compositionend":return s2(o);case"keypress":return o.which!==32?null:(t2=!0,e2);case"textInput":return n=o.data,n===e2&&t2?null:n;default:return null}}function B4(n,o){if(oc)return n==="compositionend"||!cx&&n2(n,o)?(n=Kw(),$f=rx=Ya=null,oc=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return Jw&&o.locale!=="ko"?null:o.data;default:return null}}var $4={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 r2(n){var o=n&&n.nodeName&&n.nodeName.toLowerCase();return o==="input"?!!$4[n.type]:o==="textarea"}function o2(n,o,i,d){Qt?ps?ps.push(d):ps=[d]:Qt=d,o=Gm(o,"onChange"),0<o.length&&(i=new Hf("onChange","change",null,i,d),n.push({event:i,listeners:o}))}var Pu=null,Iu=null;function V4(n){qS(n,0)}function Gf(n){var o=Ce(n);if(nc(o))return n}function a2(n,o){if(n==="change")return o}var i2=!1;if(Ss){var ux;if(Ss){var dx="oninput"in document;if(!dx){var l2=document.createElement("div");l2.setAttribute("oninput","return;"),dx=typeof l2.oninput=="function"}ux=dx}else ux=!1;i2=ux&&(!document.documentMode||9<document.documentMode)}function c2(){Pu&&(Pu.detachEvent("onpropertychange",u2),Iu=Pu=null)}function u2(n){if(n.propertyName==="value"&&Gf(Iu)){var o=[];o2(o,Iu,n,Yi(n)),Ki(V4,o)}}function U4(n,o,i){n==="focusin"?(c2(),Pu=o,Iu=i,Pu.attachEvent("onpropertychange",u2)):n==="focusout"&&c2()}function H4(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Gf(Iu)}function F4(n,o){if(n==="click")return Gf(o)}function G4(n,o){if(n==="input"||n==="change")return Gf(o)}function q4(n,o){return n===o&&(n!==0||1/n===1/o)||n!==n&&o!==o}var hr=typeof Object.is=="function"?Object.is:q4;function _u(n,o){if(hr(n,o))return!0;if(typeof n!="object"||n===null||typeof o!="object"||o===null)return!1;var i=Object.keys(n),d=Object.keys(o);if(i.length!==d.length)return!1;for(d=0;d<i.length;d++){var y=i[d];if(!ct.call(o,y)||!hr(n[y],o[y]))return!1}return!0}function fx(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function d2(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function f2(n,o){var i=d2(n);n=0;for(var d;i;){if(i.nodeType===3){if(d=n+i.textContent.length,n<=o&&d>=o)return{node:i,offset:o-n};n=d}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=d2(i)}}function m2(n,o){return n&&o?n===o?!0:n&&n.nodeType===3?!1:o&&o.nodeType===3?m2(n,o.parentNode):"contains"in n?n.contains(o):n.compareDocumentPosition?!!(n.compareDocumentPosition(o)&16):!1:!1}function h2(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var o=fx(n.document);o instanceof n.HTMLIFrameElement;){try{var i=typeof o.contentWindow.location.href=="string"}catch{i=!1}if(i)n=o.contentWindow;else break;o=fx(n.document)}return o}function mx(n){var o=n&&n.nodeName&&n.nodeName.toLowerCase();return o&&(o==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||o==="textarea"||n.contentEditable==="true")}var Y4=Ss&&"documentMode"in document&&11>=document.documentMode,ac=null,hx=null,Lu=null,px=!1;function p2(n,o,i){var d=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;px||ac==null||ac!==fx(d)||(d=ac,"selectionStart"in d&&mx(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Lu&&_u(Lu,d)||(Lu=d,d=Gm(hx,"onSelect"),0<d.length&&(o=new Hf("onSelect","select",null,o,i),n.push({event:o,listeners:d}),o.target=ac)))}function Wi(n,o){var i={};return i[n.toLowerCase()]=o.toLowerCase(),i["Webkit"+n]="webkit"+o,i["Moz"+n]="moz"+o,i}var ic={animationend:Wi("Animation","AnimationEnd"),animationiteration:Wi("Animation","AnimationIteration"),animationstart:Wi("Animation","AnimationStart"),transitionrun:Wi("Transition","TransitionRun"),transitionstart:Wi("Transition","TransitionStart"),transitioncancel:Wi("Transition","TransitionCancel"),transitionend:Wi("Transition","TransitionEnd")},gx={},g2={};Ss&&(g2=document.createElement("div").style,"AnimationEvent"in window||(delete ic.animationend.animation,delete ic.animationiteration.animation,delete ic.animationstart.animation),"TransitionEvent"in window||delete ic.transitionend.transition);function Qi(n){if(gx[n])return gx[n];if(!ic[n])return n;var o=ic[n],i;for(i in o)if(o.hasOwnProperty(i)&&i in g2)return gx[n]=o[i];return n}var x2=Qi("animationend"),b2=Qi("animationiteration"),y2=Qi("animationstart"),K4=Qi("transitionrun"),X4=Qi("transitionstart"),W4=Qi("transitioncancel"),v2=Qi("transitionend"),w2=new Map,xx="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(" ");xx.push("scrollEnd");function io(n,o){w2.set(n,o),Bt(o,[n])}var Q4=0;function sa(n,o){if(n.name!=null&&n.name!=="auto")return n.name;if(o.autoName!==null)return o.autoName;n=fo.identifierPrefix;var i=Q4++;return n="_"+n+"t_"+i.toString(32)+"_",o.autoName=n}function j2(n){if(n==null||typeof n=="string")return n;var o=null,i=Tc;if(i!==null)for(var d=0;d<i.length;d++){var y=n[i[d]];if(y!=null){if(y==="none")return"none";o=o==null?y:o+(" "+y)}}return o??n.default}function ra(n,o){return n=j2(n),o=j2(o),o==null?n==="auto"?null:n:o==="auto"?null:o}var qf=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Mr=[],lc=0,bx=0;function Yf(){for(var n=lc,o=bx=lc=0;o<n;){var i=Mr[o];Mr[o++]=null;var d=Mr[o];Mr[o++]=null;var y=Mr[o];Mr[o++]=null;var w=Mr[o];if(Mr[o++]=null,d!==null&&y!==null){var z=d.pending;z===null?y.next=y:(y.next=z.next,z.next=y),d.pending=y}w!==0&&S2(i,y,w)}}function Kf(n,o,i,d){Mr[lc++]=n,Mr[lc++]=o,Mr[lc++]=i,Mr[lc++]=d,bx|=d,n.lanes|=d,n=n.alternate,n!==null&&(n.lanes|=d)}function yx(n,o,i,d){return Kf(n,o,i,d),Xf(n)}function Zi(n,o){return Kf(n,null,null,o),Xf(n)}function S2(n,o,i){n.lanes|=i;var d=n.alternate;d!==null&&(d.lanes|=i);for(var y=!1,w=n.return;w!==null;)w.childLanes|=i,d=w.alternate,d!==null&&(d.childLanes|=i),w.tag===22&&(n=w.stateNode,n===null||n._visibility&1||(y=!0)),n=w,w=w.return;return n.tag===3?(w=n.stateNode,y&&o!==null&&(y=31-St(i),n=w.hiddenUpdates,d=n[y],d===null?n[y]=[o]:d.push(o),o.lane=i|536870912),w):null}function Xf(n){if(50<ad)throw ad=0,Lm=null,Error(a(185));for(var o=n.return;o!==null;)n=o,o=n.return;return n.tag===3?n.stateNode:null}var cc={};function Z4(n,o,i,d){this.tag=n,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qs(n,o,i,d){return new Z4(n,o,i,d)}function vx(n){return n=n.prototype,!(!n||!n.isReactComponent)}function oa(n,o){var i=n.alternate;return i===null?(i=Qs(n.tag,o,n.key,n.mode),i.elementType=n.elementType,i.type=n.type,i.stateNode=n.stateNode,i.alternate=n,n.alternate=i):(i.pendingProps=o,i.type=n.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=n.flags&1206910976,i.childLanes=n.childLanes,i.lanes=n.lanes,i.child=n.child,i.memoizedProps=n.memoizedProps,i.memoizedState=n.memoizedState,i.updateQueue=n.updateQueue,o=n.dependencies,i.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},i.sibling=n.sibling,i.index=n.index,i.ref=n.ref,i.refCleanup=n.refCleanup,i}function N2(n,o){n.flags&=1206910978;var i=n.alternate;return i===null?(n.childLanes=0,n.lanes=o,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=i.childLanes,n.lanes=i.lanes,n.child=i.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=i.memoizedProps,n.memoizedState=i.memoizedState,n.updateQueue=i.updateQueue,n.type=i.type,o=i.dependencies,n.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),n}function Wf(n,o,i,d,y,w){var z=0;if(d=n,typeof d=="function")vx(d)&&(z=1);else if(typeof d=="string")z=kz(n,i,ee.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(d){case Z:return n=Qs(31,i,o,y),n.elementType=Z,n.lanes=w,n;case L:return Ji(i.children,y,w,o);case q:z=8,y|=24;break;case P:return n=Qs(12,i,o,y|2),n.elementType=P,n.lanes=w,n;case V:return n=Qs(13,i,o,y),n.elementType=V,n.lanes=w,n;case G:return n=Qs(19,i,o,y),n.elementType=G,n.lanes=w,n;case K:case I:return n=y|32,n=Qs(30,i,o,n),n.elementType=I,n.lanes=w,n.stateNode={autoName:null,paired:null,clones:null,ref:null},n;default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case H:z=10;break e;case $:z=9;break e;case F:z=11;break e;case X:z=14;break e;case B:z=16,d=null;break e}z=29,i=Error(a(130,n===null?"null":typeof n,"")),d=null}return o=Qs(z,i,o,y),o.elementType=n,o.type=d,o.lanes=w,o}function Ji(n,o,i,d){return n=Qs(7,n,d,o),n.lanes=i,n}function wx(n,o,i){return n=Qs(6,n,null,o),n.lanes=i,n}function C2(n){var o=Qs(18,null,null,0);return o.stateNode=n,o}function jx(n,o,i){return o=Qs(4,n.children!==null?n.children:[],n.key,o),o.lanes=i,o.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},o}var k2=new WeakMap;function Dr(n,o){if(typeof n=="object"&&n!==null){var i=k2.get(n);return i!==void 0?i:(o={value:n,source:o,stack:Pe(o)},k2.set(n,o),o)}return{value:n,source:o,stack:Pe(o)}}var uc=[],dc=0,Qf=null,Bu=0,zr=[],Pr=0,Xa=null,ko=1,To="";function aa(n,o){uc[dc++]=Bu,uc[dc++]=Qf,Qf=n,Bu=o}function T2(n,o,i){zr[Pr++]=ko,zr[Pr++]=To,zr[Pr++]=Xa,Xa=n;var d=ko;n=To;var y=32-St(d)-1;d&=~(1<<y),i+=1;var w=32-St(o)+y;if(30<w){var z=y-y%5;w=(d&(1<<z)-1).toString(32),d>>=z,y-=z,ko=1<<32-St(o)+y|i<<y|d,To=w+n}else ko=1<<w|i<<y|d,To=n}function Zf(n){n.return!==null&&(aa(n,1),T2(n,1,0))}function Sx(n){for(;n===Qf;)Qf=uc[--dc],uc[dc]=null,Bu=uc[--dc],uc[dc]=null;for(;n===Xa;)Xa=zr[--Pr],zr[Pr]=null,To=zr[--Pr],zr[Pr]=null,ko=zr[--Pr],zr[Pr]=null}function E2(n,o){zr[Pr++]=ko,zr[Pr++]=To,zr[Pr++]=Xa,ko=o.id,To=o.overflow,Xa=n}var gs=null,jn=null,Vt=!1,Wa=null,Ir=!1,Nx=Error(a(519));function Qa(n){var o=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw $u(Dr(o,n)),Nx}function R2(n){var o=n.stateNode,i=n.type,d=n.memoizedProps;switch(o[zn]=n,o[ws]=d,i){case"dialog":Yt("cancel",o),Yt("close",o);break;case"iframe":case"object":case"embed":Yt("load",o);break;case"video":case"audio":for(i=0;i<ld.length;i++)Yt(ld[i],o);break;case"source":Yt("error",o);break;case"img":case"image":case"link":Yt("error",o),Yt("load",o);break;case"details":Yt("toggle",o);break;case"input":Yt("invalid",o),Ga(o,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":Yt("invalid",o);break;case"textarea":Yt("invalid",o),dr(o,d.value,d.defaultValue,d.children)}i=d.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||o.textContent===""+i||d.suppressHydrationWarning===!0||WS(o.textContent,i)?(d.popover!=null&&(Yt("beforetoggle",o),Yt("toggle",o)),d.onScroll!=null&&Yt("scroll",o),d.onScrollEnd!=null&&Yt("scrollend",o),d.onClick!=null&&(o.onclick=Us),o=!0):o=!1,o||Qa(n,!0)}function Jf(n){for(gs=n.return;gs;)switch(gs.tag){case 5:case 31:case 13:Ir=!1;return;case 27:case 3:Ir=!0;return;default:gs=gs.return}}function fc(n){if(n!==gs)return!1;if(!Vt)return Jf(n),Vt=!0,!1;var o=n.tag,i;if((i=o!==3&&o!==27)&&((i=o===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||e0(n.type,n.memoizedProps)),i=!i),i&&jn&&Qa(n),Jf(n),o===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));jn=pN(n)}else if(o===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(317));jn=pN(n)}else o===27?(o=jn,mi(n.type)?(n=c0,c0=null,jn=n):jn=o):jn=gs?Lr(n.stateNode.nextSibling):null;return!0}function el(){jn=gs=null,Vt=!1}function Cx(){var n=Wa;return n!==null&&(er===null?er=n:er.push.apply(er,n),Wa=null),n}function $u(n){Wa===null?Wa=[n]:Wa.push(n)}var kx=Be(null),tl=null,ia=null;function Za(n,o,i){Ae(kx,o._currentValue),o._currentValue=i}function la(n){n._currentValue=kx.current,Ne(kx)}function em(n,o,i){for(;n!==null;){var d=n.alternate;if((n.childLanes&o)!==o?(n.childLanes|=o,d!==null&&(d.childLanes|=o)):d!==null&&(d.childLanes&o)!==o&&(d.childLanes|=o),n===i)break;n=n.return}}function Tx(n,o,i,d){var y=n.child;for(y!==null&&(y.return=n);y!==null;){var w=y.dependencies;if(w!==null){var z=y.child;w=w.firstContext;e:for(;w!==null;){var Y=w;w=y;for(var ie=0;ie<o.length;ie++)if(Y.context===o[ie]){w.lanes|=i,Y=w.alternate,Y!==null&&(Y.lanes|=i),em(w.return,i,n),d||(z=null);break e}w=Y.next}}else if(y.tag===18){if(z=y.return,z===null)throw Error(a(341));z.lanes|=i,w=z.alternate,w!==null&&(w.lanes|=i),em(z,i,n),z=null}else y.tag===13&&y.memoizedState!==null&&y.memoizedState.dehydrated===null?(y.lanes|=i,z=y.alternate,z!==null&&(z.lanes|=i),em(y.return,i,n),z=y.child,z=z!==null?z.sibling:null):z=y.child;if(z!==null)z.return=y;else for(z=y;z!==null;){if(z===n){z=null;break}if(y=z.sibling,y!==null){y.return=z.return,z=y;break}z=z.return}y=z}}function nl(n,o,i,d){n=null;for(var y=o,w=!1;y!==null;){if(!w){if((y.flags&524288)!==0)w=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var z=y.alternate;if(z===null)throw Error(a(387));if(z=z.memoizedProps,z!==null){var Y=y.type;hr(y.pendingProps.value,z.value)||(n!==null?n.push(Y):n=[Y])}}else if(y===he.current){if(z=y.alternate,z===null)throw Error(a(387));z.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(n!==null?n.push(_c):n=[_c])}y=y.return}return n!==null&&Tx(o,n,i,d),o.flags|=262144,n!==null}function tm(n){for(n=n.firstContext;n!==null;){if(!hr(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function sl(n){tl=n,ia=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Ns(n){return A2(tl,n)}function nm(n,o){return tl===null&&sl(n),A2(n,o)}function A2(n,o){var i=o._currentValue;if(o={context:o,memoizedValue:i,next:null},ia===null){if(n===null)throw Error(a(308));ia=o,n.dependencies={lanes:0,firstContext:o},n.flags|=524288}else ia=ia.next=o;return i}var J4=typeof AbortController<"u"?AbortController:function(){var n=[],o=this.signal={aborted:!1,addEventListener:function(i,d){n.push(d)}};this.abort=function(){o.aborted=!0,n.forEach(function(i){return i()})}},eD=e.unstable_scheduleCallback,tD=e.unstable_NormalPriority,Wn={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ex(){return{controller:new J4,data:new Map,refCount:0}}function Vu(n){n.refCount--,n.refCount===0&&eD(tD,function(){n.controller.abort()})}function O2(n,o){if((n.pendingLanes&4194048)!==0){var i=n.transitionTypes;for(i===null&&(i=n.transitionTypes=[]),n=0;n<o.length;n++){var d=o[n];i.indexOf(d)===-1&&i.push(d)}}}var Uu=null;function nD(n){var o=n.transitionTypes;return n.transitionTypes=null,o}var Hu=null,Rx=0,rl=0,mc=null;function sD(n,o){if(Hu===null){var i=Hu=[];Rx=0,rl=Gb(),mc={status:"pending",value:void 0,then:function(d){i.push(d)}}}return Rx++,o.then(M2,M2),o}function M2(){if(--Rx===0&&(Uu=null,Hu!==null)){mc!==null&&(mc.status="fulfilled");var n=Hu;Hu=null,rl=0,mc=null;for(var o=0;o<n.length;o++)(0,n[o])()}}function rD(n,o){var i=[],d={status:"pending",value:null,reason:null,then:function(y){i.push(y)}};return n.then(function(){d.status="fulfilled",d.value=o;for(var y=0;y<i.length;y++)(0,i[y])(o)},function(y){for(d.status="rejected",d.reason=y,y=0;y<i.length;y++)(0,i[y])(void 0)}),d}var D2=ce.S;ce.S=function(n,o){if(CS=nt(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&sD(n,o),Uu!==null)for(var i=Oc;i!==null;)O2(i,Uu),i=i.next;if(i=n.types,i!==null){for(var d=Oc;d!==null;)O2(d,i),d=d.next;if(rl!==0){d=Uu,d===null&&(d=Uu=[]);for(var y=0;y<i.length;y++){var w=i[y];d.indexOf(w)===-1&&d.push(w)}}}D2!==null&&D2(n,o)};var ol=Be(null);function Ax(){var n=ol.current;return n!==null?n:bn.pooledCache}function sm(n,o){o===null?Ae(ol,ol.current):Ae(ol,o.pool)}function z2(){var n=Ax();return n===null?null:{parent:Wn._currentValue,pool:n}}var hc=Error(a(460)),Ox=Error(a(474)),rm=Error(a(542)),om={then:function(){}};function P2(n){return n=n.status,n==="fulfilled"||n==="rejected"}function I2(n,o,i){switch(i=n[i],i===void 0?n.push(o):i!==o&&(o.then(Us,Us),o=i),o.status){case"fulfilled":return o.value;case"rejected":throw n=o.reason,L2(n),n===void 0&&!("reason"in o)?Error(a(600)):n;default:if(typeof o.status=="string")o.then(Us,Us);else{if(n=bn,n!==null&&100<n.shellSuspendCounter)throw Error(a(482));n=o,n.status="pending",n.then(function(d){if(o.status==="pending"){var y=o;y.status="fulfilled",y.value=d}},function(d){if(o.status==="pending"){var y=o;y.status="rejected",y.reason=d}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw n=o.reason,L2(n),n}throw il=o,hc}}function al(n){try{var o=n._init;return o(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(il=i,hc):i}}var il=null;function _2(){if(il===null)throw Error(a(459));var n=il;return il=null,n}function L2(n){if(n===hc||n===rm)throw Error(a(483))}var pc=null,Fu=0;function am(n){var o=Fu;return Fu+=1,pc===null&&(pc=[]),I2(pc,n,o)}function Ja(n,o){o=o.props.ref,n.ref=o!==void 0?o:null}function im(n,o){throw o.$$typeof===O?Error(a(525)):(n=Object.prototype.toString.call(o),Error(a(31,n==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":n)))}function B2(n){function o(ye,fe){if(n){var je=ye.deletions;je===null?(ye.deletions=[fe],ye.flags|=16):je.push(fe)}}function i(ye,fe){if(!n)return null;for(;fe!==null;)o(ye,fe),fe=fe.sibling;return null}function d(ye){for(var fe=new Map;ye!==null;)ye.key===null?fe.set(ye.index,ye):fe.set(ye.key,ye),ye=ye.sibling;return fe}function y(ye,fe){return ye=oa(ye,fe),ye.index=0,ye.sibling=null,ye}function w(ye,fe,je){return ye.index=je,n?(je=ye.alternate,je!==null?(je=je.index,je<fe?(ye.flags|=2,fe):je):(ye.flags|=134217730,fe)):(ye.flags|=1048576,fe)}function z(ye){return n&&ye.alternate===null&&(ye.flags|=134217730),ye}function Y(ye,fe,je,Me){return fe===null||fe.tag!==6?(fe=wx(je,ye.mode,Me),fe.return=ye,fe):(fe=y(fe,je),fe.return=ye,fe)}function ie(ye,fe,je,Me){var ot=je.type;return ot===L?(ye=ke(ye,fe,je.props.children,Me,je.key),Ja(ye,je),ye):fe!==null&&(fe.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===B&&al(ot)===fe.type)?(fe=y(fe,je.props),Ja(fe,je),fe.return=ye,fe):(fe=Wf(je.type,je.key,je.props,null,ye.mode,Me),Ja(fe,je),fe.return=ye,fe)}function ve(ye,fe,je,Me){return fe===null||fe.tag!==4||fe.stateNode.containerInfo!==je.containerInfo||fe.stateNode.implementation!==je.implementation?(fe=jx(je,ye.mode,Me),fe.return=ye,fe):(fe=y(fe,je.children||[]),fe.return=ye,fe)}function ke(ye,fe,je,Me,ot){return fe===null||fe.tag!==7?(fe=Ji(je,ye.mode,Me,ot),fe.return=ye,fe):(fe=y(fe,je),fe.return=ye,fe)}function ze(ye,fe,je){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return fe=wx(""+fe,ye.mode,je),fe.return=ye,fe;if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case D:return je=Wf(fe.type,fe.key,fe.props,null,ye.mode,je),Ja(je,fe),je.return=ye,je;case _:return fe=jx(fe,ye.mode,je),fe.return=ye,fe;case B:return fe=al(fe),ze(ye,fe,je)}if(ne(fe)||te(fe))return fe=Ji(fe,ye.mode,je,null),fe.return=ye,fe;if(typeof fe.then=="function")return ze(ye,am(fe),je);if(fe.$$typeof===H)return ze(ye,nm(ye,fe),je);im(ye,fe)}return null}function ge(ye,fe,je,Me){var ot=fe!==null?fe.key:null;if(typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint")return ot!==null?null:Y(ye,fe,""+je,Me);if(typeof je=="object"&&je!==null){switch(je.$$typeof){case D:return je.key===ot?ie(ye,fe,je,Me):null;case _:return je.key===ot?ve(ye,fe,je,Me):null;case B:return je=al(je),ge(ye,fe,je,Me)}if(ne(je)||te(je))return ot!==null?null:ke(ye,fe,je,Me,null);if(typeof je.then=="function")return ge(ye,fe,am(je),Me);if(je.$$typeof===H)return ge(ye,fe,nm(ye,je),Me);im(ye,je)}return null}function Se(ye,fe,je,Me,ot){if(typeof Me=="string"&&Me!==""||typeof Me=="number"||typeof Me=="bigint")return ye=ye.get(je)||null,Y(fe,ye,""+Me,ot);if(typeof Me=="object"&&Me!==null){switch(Me.$$typeof){case D:return ye=ye.get(Me.key===null?je:Me.key)||null,ie(fe,ye,Me,ot);case _:return ye=ye.get(Me.key===null?je:Me.key)||null,ve(fe,ye,Me,ot);case B:return Me=al(Me),Se(ye,fe,je,Me,ot)}if(ne(Me)||te(Me))return ye=ye.get(je)||null,ke(fe,ye,Me,ot,null);if(typeof Me.then=="function")return Se(ye,fe,je,am(Me),ot);if(Me.$$typeof===H)return Se(ye,fe,je,nm(fe,Me),ot);im(fe,Me)}return null}function tt(ye,fe,je,Me){for(var ot=null,Xt=null,xt=fe,Ct=fe=0,Jn=null;xt!==null&&Ct<je.length;Ct++){xt.index>Ct?(Jn=xt,xt=null):Jn=xt.sibling;var Zt=ge(ye,xt,je[Ct],Me);if(Zt===null){xt===null&&(xt=Jn);break}n&&xt&&Zt.alternate===null&&o(ye,xt),fe=w(Zt,fe,Ct),Xt===null?ot=Zt:Xt.sibling=Zt,Xt=Zt,xt=Jn}if(Ct===je.length)return i(ye,xt),Vt&&aa(ye,Ct),ot;if(xt===null){for(;Ct<je.length;Ct++)xt=ze(ye,je[Ct],Me),xt!==null&&(fe=w(xt,fe,Ct),Xt===null?ot=xt:Xt.sibling=xt,Xt=xt);return Vt&&aa(ye,Ct),ot}for(xt=d(xt);Ct<je.length;Ct++)Jn=Se(xt,ye,Ct,je[Ct],Me),Jn!==null&&(n&&(Zt=Jn.alternate,Zt!==null&&xt.delete(Zt.key===null?Ct:Zt.key)),fe=w(Jn,fe,Ct),Xt===null?ot=Jn:Xt.sibling=Jn,Xt=Jn);return n&&xt.forEach(function(bi){return o(ye,bi)}),Vt&&aa(ye,Ct),ot}function ft(ye,fe,je,Me){if(je==null)throw Error(a(151));for(var ot=null,Xt=null,xt=fe,Ct=fe=0,Jn=null,Zt=je.next();xt!==null&&!Zt.done;Ct++,Zt=je.next()){xt.index>Ct?(Jn=xt,xt=null):Jn=xt.sibling;var bi=ge(ye,xt,Zt.value,Me);if(bi===null){xt===null&&(xt=Jn);break}n&&xt&&bi.alternate===null&&o(ye,xt),fe=w(bi,fe,Ct),Xt===null?ot=bi:Xt.sibling=bi,Xt=bi,xt=Jn}if(Zt.done)return i(ye,xt),Vt&&aa(ye,Ct),ot;if(xt===null){for(;!Zt.done;Ct++,Zt=je.next())Zt=ze(ye,Zt.value,Me),Zt!==null&&(fe=w(Zt,fe,Ct),Xt===null?ot=Zt:Xt.sibling=Zt,Xt=Zt);return Vt&&aa(ye,Ct),ot}for(xt=d(xt);!Zt.done;Ct++,Zt=je.next())Zt=Se(xt,ye,Ct,Zt.value,Me),Zt!==null&&(n&&(Jn=Zt.alternate,Jn!==null&&xt.delete(Jn.key===null?Ct:Jn.key)),fe=w(Zt,fe,Ct),Xt===null?ot=Zt:Xt.sibling=Zt,Xt=Zt);return n&&xt.forEach(function(Lz){return o(ye,Lz)}),Vt&&aa(ye,Ct),ot}function _t(ye,fe,je,Me){if(typeof je=="object"&&je!==null&&je.type===L&&je.key===null&&je.props.ref===void 0&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case D:e:{for(var ot=je.key;fe!==null;){if(fe.key===ot){if(ot=je.type,ot===L){if(fe.tag===7){i(ye,fe.sibling),Me=y(fe,je.props.children),Ja(Me,je),Me.return=ye,ye=Me;break e}}else if(fe.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===B&&al(ot)===fe.type){i(ye,fe.sibling),Me=y(fe,je.props),Ja(Me,je),Me.return=ye,ye=Me;break e}i(ye,fe);break}else o(ye,fe);fe=fe.sibling}je.type===L?(Me=Ji(je.props.children,ye.mode,Me,je.key),Ja(Me,je),Me.return=ye,ye=Me):(Me=Wf(je.type,je.key,je.props,null,ye.mode,Me),Ja(Me,je),Me.return=ye,ye=Me)}return z(ye);case _:e:{for(ot=je.key;fe!==null;){if(fe.key===ot)if(fe.tag===4&&fe.stateNode.containerInfo===je.containerInfo&&fe.stateNode.implementation===je.implementation){i(ye,fe.sibling),Me=y(fe,je.children||[]),Me.return=ye,ye=Me;break e}else{i(ye,fe);break}else o(ye,fe);fe=fe.sibling}Me=jx(je,ye.mode,Me),Me.return=ye,ye=Me}return z(ye);case B:return je=al(je),_t(ye,fe,je,Me)}if(ne(je))return tt(ye,fe,je,Me);if(te(je)){if(ot=te(je),typeof ot!="function")throw Error(a(150));return je=ot.call(je),ft(ye,fe,je,Me)}if(typeof je.then=="function")return _t(ye,fe,am(je),Me);if(je.$$typeof===H)return _t(ye,fe,nm(ye,je),Me);im(ye,je)}return typeof je=="string"&&je!==""||typeof je=="number"||typeof je=="bigint"?(je=""+je,fe!==null&&fe.tag===6?(i(ye,fe.sibling),Me=y(fe,je),Me.return=ye,ye=Me):(i(ye,fe),Me=wx(je,ye.mode,Me),Me.return=ye,ye=Me),z(ye)):i(ye,fe)}return function(ye,fe,je,Me){try{Fu=0;var ot=_t(ye,fe,je,Me);return pc=null,ot}catch(xt){if(xt===hc||xt===rm)throw xt;var Xt=Qs(29,xt,null,ye.mode);return Xt.lanes=Me,Xt.return=ye,Xt}finally{}}}var ll=B2(!0),$2=B2(!1),ei=!1;function Mx(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Dx(n,o){n=n.updateQueue,o.updateQueue===n&&(o.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ti(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function ni(n,o,i){var d=n.updateQueue;if(d===null)return null;if(d=d.shared,(nn&2)!==0){var y=d.pending;return y===null?o.next=o:(o.next=y.next,y.next=o),d.pending=o,o=Xf(n),S2(n,null,i),o}return Kf(n,d,o,i),Xf(n)}function Gu(n,o,i){if(o=o.updateQueue,o!==null&&(o=o.shared,(i&4194048)!==0)){var d=o.lanes;d&=n.pendingLanes,i|=d,o.lanes=i,Wl(n,i)}}function zx(n,o){var i=n.updateQueue,d=n.alternate;if(d!==null&&(d=d.updateQueue,i===d)){var y=null,w=null;if(i=i.firstBaseUpdate,i!==null){do{var z={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};w===null?y=w=z:w=w.next=z,i=i.next}while(i!==null);w===null?y=w=o:w=w.next=o}else y=w=o;i={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:d.shared,callbacks:d.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=o:n.next=o,i.lastBaseUpdate=o}var Px=!1;function qu(){if(Px){var n=mc;if(n!==null)throw n}}function Yu(n,o,i,d){Px=!1;var y=n.updateQueue;ei=!1;var w=y.firstBaseUpdate,z=y.lastBaseUpdate,Y=y.shared.pending;if(Y!==null){y.shared.pending=null;var ie=Y,ve=ie.next;ie.next=null,z===null?w=ve:z.next=ve,z=ie;var ke=n.alternate;ke!==null&&(ke=ke.updateQueue,Y=ke.lastBaseUpdate,Y!==z&&(Y===null?ke.firstBaseUpdate=ve:Y.next=ve,ke.lastBaseUpdate=ie))}if(w!==null){var ze=y.baseState;z=0,ke=ve=ie=null,Y=w;do{var ge=Y.lane&-536870913,Se=ge!==Y.lane;if(Se?(Kt&ge)===ge:(d&ge)===ge){ge!==0&&ge===rl&&(Px=!0),ke!==null&&(ke=ke.next={lane:0,tag:Y.tag,payload:Y.payload,callback:null,next:null});e:{var tt=n,ft=Y;ge=o;var _t=i;switch(ft.tag){case 1:if(tt=ft.payload,typeof tt=="function"){ze=tt.call(_t,ze,ge);break e}ze=tt;break e;case 3:tt.flags=tt.flags&-65537|128;case 0:if(tt=ft.payload,ge=typeof tt=="function"?tt.call(_t,ze,ge):tt,ge==null)break e;ze=R({},ze,ge);break e;case 2:ei=!0}}ge=Y.callback,ge!==null&&(n.flags|=64,Se&&(n.flags|=8192),Se=y.callbacks,Se===null?y.callbacks=[ge]:Se.push(ge))}else Se={lane:ge,tag:Y.tag,payload:Y.payload,callback:Y.callback,next:null},ke===null?(ve=ke=Se,ie=ze):ke=ke.next=Se,z|=ge;if(Y=Y.next,Y===null){if(Y=y.shared.pending,Y===null)break;Se=Y,Y=Se.next,Se.next=null,y.lastBaseUpdate=Se,y.shared.pending=null}}while(!0);ke===null&&(ie=ze),y.baseState=ie,y.firstBaseUpdate=ve,y.lastBaseUpdate=ke,w===null&&(y.shared.lanes=0),ci|=z,n.lanes=z,n.memoizedState=ze}}function V2(n,o){if(typeof n!="function")throw Error(a(191,n));n.call(o)}function U2(n,o){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)V2(i[n],o)}var si=Be(null),lm=Be(0);function H2(n,o){n=ma,Ae(lm,n),Ae(si,o),ma=n|o.baseLanes}function Ix(){Ae(lm,ma),Ae(si,si.current)}function _x(){ma=lm.current,Ne(si),Ne(lm)}var Cs=Be(null),zs=null;function ri(n){var o=n.alternate;Ae(ks,ks.current&1),Ae(Cs,n),zs===null&&(o===null||si.current!==null||o.memoizedState!==null)&&(zs=n)}function Lx(n){Ae(ks,ks.current),Ae(Cs,n),zs===null&&(zs=n)}function F2(n){n.tag===22?(Ae(ks,ks.current),Ae(Cs,n),zs===null&&(zs=n)):oi()}function oi(){Ae(ks,ks.current),Ae(Cs,Cs.current)}function pr(n){Ne(Cs),zs===n&&(zs=null),Ne(ks)}var ks=Be(0);function Ku(n,o){Ae(Cs,Cs.current),Ae(ks,o)}function Bx(n){Ne(ks),Ne(Cs),zs===n&&(zs=null)}function cm(n){for(var o=n;o!==null;){if(o.tag===13){var i=o.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i0(i)||l0(i)))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!=="independent"){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===n)break;for(;o.sibling===null;){if(o.return===null||o.return===n)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var ca=0,It=null,fn=null,Qn=null,um=!1,gc=!1,cl=!1,dm=0,Xu=0,xc=null,oD=0;function Bn(){throw Error(a(321))}function $x(n,o){if(o===null)return!1;for(var i=0;i<o.length&&i<n.length;i++)if(!hr(n[i],o[i]))return!1;return!0}function Vx(n,o,i,d,y,w){return ca=w,It=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,ce.H=n===null||n.memoizedState===null?Tj:Ej,cl=!1,w=i(d,y),cl=!1,gc&&(w=q2(o,i,d,y)),G2(n),w}function G2(n){ce.H=bm;var o=fn!==null&&fn.next!==null;if(ca=0,Qn=fn=It=null,um=!1,Xu=0,xc=null,o)throw Error(a(300));n===null||Zn||(n=n.dependencies,n!==null&&tm(n)&&(Zn=!0))}function q2(n,o,i,d){It=n;var y=0;do{if(gc&&(xc=null),Xu=0,gc=!1,25<=y)throw Error(a(301));if(y+=1,Qn=fn=null,n.updateQueue!=null){var w=n.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}ce.H=mD,w=o(i,d)}while(gc);return w}function aD(){var n=ce.H,o=n.useState()[0];return o=typeof o.then=="function"?Wu(o):o,n=n.useState()[0],(fn!==null?fn.memoizedState:null)!==n&&(It.flags|=1024),o}function Ux(){var n=dm!==0;return dm=0,n}function Hx(n,o,i){o.updateQueue=n.updateQueue,o.flags&=-2053,n.lanes&=~i}function Fx(n){if(um){for(n=n.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}um=!1}ca=0,Qn=fn=It=null,gc=!1,Xu=dm=0,xc=null}function Fs(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Qn===null?It.memoizedState=Qn=n:Qn=Qn.next=n,Qn}function qn(){if(fn===null){var n=It.alternate;n=n!==null?n.memoizedState:null}else n=fn.next;var o=Qn===null?It.memoizedState:Qn.next;if(o!==null)Qn=o,fn=n;else{if(n===null)throw It.alternate===null?Error(a(467)):Error(a(310));fn=n,n={memoizedState:fn.memoizedState,baseState:fn.baseState,baseQueue:fn.baseQueue,queue:fn.queue,next:null},Qn===null?It.memoizedState=Qn=n:Qn=Qn.next=n}return Qn}function fm(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wu(n){var o=Xu;return Xu+=1,xc===null&&(xc=[]),n=I2(xc,n,o),o=It,(Qn===null?o.memoizedState:Qn.next)===null&&(o=o.alternate,ce.H=o===null||o.memoizedState===null?Tj:Ej),n}function mm(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Wu(n);if(n.$$typeof===U)return;if(n.$$typeof===H)return Ns(n)}throw Error(a(438,String(n)))}function Gx(n){var o=null,i=It.updateQueue;if(i!==null&&(o=i.memoCache),o==null){var d=It.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(o={data:d.data.map(function(y){return y.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),i===null&&(i=fm(),It.updateQueue=i),i.memoCache=o,i=o.data[o.index],i===void 0)for(i=o.data[o.index]=Array(n),d=0;d<n;d++)i[d]=se;return o.index++,i}function ua(n,o){return typeof o=="function"?o(n):o}function hm(n){var o=qn();return qx(o,fn,n)}function qx(n,o,i){var d=n.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=i;var y=n.baseQueue,w=d.pending;if(w!==null){if(y!==null){var z=y.next;y.next=w.next,w.next=z}o.baseQueue=y=w,d.pending=null}if(w=n.baseState,y===null)n.memoizedState=w;else{o=y.next;var Y=z=null,ie=null,ve=o,ke=!1;do{var ze=ve.lane&-536870913;if(ze!==ve.lane?(Kt&ze)===ze:(ca&ze)===ze){var ge=ve.revertLane;if(ge===0)ie!==null&&(ie=ie.next={lane:0,revertLane:0,gesture:null,action:ve.action,hasEagerState:ve.hasEagerState,eagerState:ve.eagerState,next:null}),ze===rl&&(ke=!0);else if((ca&ge)===ge){ve=ve.next,ge===rl&&(ke=!0);continue}else ze={lane:0,revertLane:ve.revertLane,gesture:null,action:ve.action,hasEagerState:ve.hasEagerState,eagerState:ve.eagerState,next:null},ie===null?(Y=ie=ze,z=w):ie=ie.next=ze,It.lanes|=ge,ci|=ge;ze=ve.action,cl&&i(w,ze),w=ve.hasEagerState?ve.eagerState:i(w,ze)}else ge={lane:ze,revertLane:ve.revertLane,gesture:ve.gesture,action:ve.action,hasEagerState:ve.hasEagerState,eagerState:ve.eagerState,next:null},ie===null?(Y=ie=ge,z=w):ie=ie.next=ge,It.lanes|=ze,ci|=ze;ve=ve.next}while(ve!==null&&ve!==o);if(ie===null?z=w:ie.next=Y,!hr(w,n.memoizedState)&&(Zn=!0,ke&&(i=mc,i!==null)))throw i;n.memoizedState=w,n.baseState=z,n.baseQueue=ie,d.lastRenderedState=w}return y===null&&(d.lanes=0),[n.memoizedState,d.dispatch]}function Yx(n){var o=qn(),i=o.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=n;var d=i.dispatch,y=i.pending,w=o.memoizedState;if(y!==null){i.pending=null;var z=y=y.next;do w=n(w,z.action),z=z.next;while(z!==y);hr(w,o.memoizedState)||(Zn=!0),o.memoizedState=w,o.baseQueue===null&&(o.baseState=w),i.lastRenderedState=w}return[w,d]}function Y2(n,o,i){var d=It,y=qn(),w=Vt;if(w){if(i===void 0)throw Error(a(407));i=i()}else i=o();var z=!hr((fn||y).memoizedState,i);if(z&&(y.memoizedState=i,Zn=!0),y=y.queue,Wx(W2.bind(null,d,y,n),[n]),n=y.getSnapshot!==o||z||Qn!==null&&(Qn.memoizedState.tag&1)!==0,bc(n?9:8,{destroy:void 0},X2.bind(null,d,y,i,o),null),n){if(d.flags|=2048,bn===null)throw Error(a(349));w||(ca&127)!==0||K2(d,o,i)}return i}function K2(n,o,i){n.flags|=16384,n={getSnapshot:o,value:i},o=It.updateQueue,o===null?(o=fm(),It.updateQueue=o,o.stores=[n]):(i=o.stores,i===null?o.stores=[n]:i.push(n))}function X2(n,o,i,d){o.value=i,o.getSnapshot=d,Q2(o)&&Z2(n)}function W2(n,o,i){return i(function(){Q2(o)&&Z2(n)})}function Q2(n){var o=n.getSnapshot;n=n.value;try{var i=o();return!hr(n,i)}catch{return!0}}function Z2(n){var o=Zi(n,2);o!==null&&tr(o,n,2)}function Kx(n){var o=Fs();if(typeof n=="function"){var i=n;if(n=i(),cl){Ht(!0);try{i()}finally{Ht(!1)}}}return o.memoizedState=o.baseState=n,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ua,lastRenderedState:n},o}function J2(n,o,i,d){return n.baseState=i,qx(n,fn,typeof d=="function"?d:ua)}function iD(n,o,i,d,y){if(xm(n))throw Error(a(485));if(n=o.action,n!==null){var w={payload:y,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(z){w.listeners.push(z)}};ce.T!==null?i(!0):w.isTransition=!1,d(w),i=o.pending,i===null?(w.next=o.pending=w,ej(o,w)):(w.next=i.next,o.pending=i.next=w)}}function ej(n,o){var i=o.action,d=o.payload,y=n.state;if(o.isTransition){var w=ce.T,z={};z.types=w!==null?w.types:null,ce.T=z;try{var Y=i(y,d),ie=ce.S;ie!==null&&ie(z,Y),tj(n,o,Y)}catch(ve){Xx(n,o,ve)}finally{w!==null&&z.types!==null&&(w.types=z.types),ce.T=w}}else try{w=i(y,d),tj(n,o,w)}catch(ve){Xx(n,o,ve)}}function tj(n,o,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(d){nj(n,o,d)},function(d){return Xx(n,o,d)}):nj(n,o,i)}function nj(n,o,i){o.status="fulfilled",o.value=i,sj(o),n.state=i,o=n.pending,o!==null&&(i=o.next,i===o?n.pending=null:(i=i.next,o.next=i,ej(n,i)))}function Xx(n,o,i){var d=n.pending;if(n.pending=null,d!==null){d=d.next;do o.status="rejected",o.reason=i,sj(o),o=o.next;while(o!==d)}n.action=null}function sj(n){n=n.listeners;for(var o=0;o<n.length;o++)(0,n[o])()}function rj(n,o){return o}function oj(n,o){if(Vt){var i=bn.formState;if(i!==null){e:{var d=It;if(Vt){if(jn){t:{for(var y=jn,w=Ir;y.nodeType!==8;){if(!w){y=null;break t}if(y=Lr(y.nextSibling),y===null){y=null;break t}}w=y.data,y=w==="F!"||w==="F"?y:null}if(y){jn=Lr(y.nextSibling),d=y.data==="F!";break e}}Qa(d)}d=!1}d&&(o=i[0])}}return i=Fs(),i.memoizedState=i.baseState=o,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:rj,lastRenderedState:o},i.queue=d,i=Nj.bind(null,It,d),d.dispatch=i,d=Kx(!1),w=tb.bind(null,It,!1,d.queue),d=Fs(),y={state:o,dispatch:null,action:n,pending:null},d.queue=y,i=iD.bind(null,It,y,w,i),y.dispatch=i,d.memoizedState=n,[o,i,!1]}function aj(n){var o=qn();return ij(o,fn,n)}function ij(n,o,i){if(o=qx(n,o,rj)[0],n=hm(ua)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var d=Wu(o)}catch(z){throw z===hc?rm:z}else d=o;o=qn();var y=o.queue,w=y.dispatch;return i!==o.memoizedState&&(It.flags|=2048,bc(9,{destroy:void 0},lD.bind(null,y,i),null)),[d,w,n]}function lD(n,o){n.action=o}function lj(n){var o=qn(),i=fn;if(i!==null)return ij(o,i,n);qn(),o=o.memoizedState,i=qn();var d=i.queue.dispatch;return i.memoizedState=n,[o,d,!1]}function bc(n,o,i,d){return n={tag:n,create:i,deps:d,inst:o,next:null},o=It.updateQueue,o===null&&(o=fm(),It.updateQueue=o),i=o.lastEffect,i===null?o.lastEffect=n.next=n:(d=i.next,i.next=n,n.next=d,o.lastEffect=n),n}function cj(){return qn().memoizedState}function pm(n,o,i,d){var y=Fs();It.flags|=n,y.memoizedState=bc(1|o,{destroy:void 0},i,d===void 0?null:d)}function gm(n,o,i,d){var y=qn();d=d===void 0?null:d;var w=y.memoizedState.inst;fn!==null&&d!==null&&$x(d,fn.memoizedState.deps)?y.memoizedState=bc(o,w,i,d):(It.flags|=n,y.memoizedState=bc(1|o,w,i,d))}function uj(n,o){pm(8390656,8,n,o)}function Wx(n,o){gm(2048,8,n,o)}function cD(n){It.flags|=4;var o=It.updateQueue;if(o===null)o=fm(),It.updateQueue=o,o.events=[n];else{var i=o.events;i===null?o.events=[n]:i.push(n)}}function dj(n){var o=qn().memoizedState;return cD({ref:o,nextImpl:n}),function(){if((nn&2)!==0)throw Error(a(440));return o.impl.apply(void 0,arguments)}}function fj(n,o){return gm(4,2,n,o)}function mj(n,o){return gm(4,4,n,o)}function hj(n,o){if(typeof o=="function"){n=n();var i=o(n);return function(){typeof i=="function"?i():o(null)}}if(o!=null)return n=n(),o.current=n,function(){o.current=null}}function pj(n,o,i){i=i!=null?i.concat([n]):null,gm(4,4,hj.bind(null,o,n),i)}function Qx(){}function gj(n,o){var i=qn();o=o===void 0?null:o;var d=i.memoizedState;return o!==null&&$x(o,d[1])?d[0]:(i.memoizedState=[n,o],n)}function xj(n,o){var i=qn();o=o===void 0?null:o;var d=i.memoizedState;if(o!==null&&$x(o,d[1]))return d[0];if(d=n(),cl){Ht(!0);try{n()}finally{Ht(!1)}}return i.memoizedState=[d,o],d}function Zx(n,o,i){return i===void 0||(ca&1073741824)!==0&&(Kt&261930)===0?n.memoizedState=o:(n.memoizedState=i,n=TS(),It.lanes|=n,ci|=n,i)}function bj(n,o,i,d){return hr(i,o)?i:si.current!==null?(n=Zx(n,i,d),hr(n,o)||(Zn=!0),n):(ca&106)===0||(ca&1073741824)!==0&&(Kt&261930)===0?(Zn=!0,n.memoizedState=i):(n=TS(),It.lanes|=n,ci|=n,o)}function yj(n,o,i,d,y){var w=oe.p;oe.p=w!==0&&8>w?w:8;var z=ce.T,Y={};Y.types=z!==null?z.types:null,ce.T=Y,tb(n,!1,o,i);try{var ie=y(),ve=ce.S;if(ve!==null&&ve(Y,ie),ie!==null&&typeof ie=="object"&&typeof ie.then=="function"){var ke=rD(ie,d);Qu(n,o,ke,yr(n))}else Qu(n,o,d,yr(n))}catch(ze){Qu(n,o,{then:function(){},status:"rejected",reason:ze},yr())}finally{oe.p=w,z!==null&&Y.types!==null&&(z.types=Y.types),ce.T=z}}function uD(){}function Jx(n,o,i,d){if(n.tag!==5)throw Error(a(476));var y=vj(n).queue;yj(n,y,o,W,i===null?uD:function(){return wj(n),i(d)})}function vj(n){var o=n.memoizedState;if(o!==null)return o;o={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ua,lastRenderedState:W},next:null};var i={};return o.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ua,lastRenderedState:i},next:null},n.memoizedState=o,n=n.alternate,n!==null&&(n.memoizedState=o),o}function wj(n){var o=vj(n);o.next===null&&(o=n.alternate.memoizedState),Qu(n,o.next.queue,{},yr())}function eb(){return Ns(_c)}function jj(){return qn().memoizedState}function Sj(){return qn().memoizedState}function dD(n){for(var o=n.return;o!==null;){switch(o.tag){case 24:case 3:var i=yr();n=ti(i);var d=ni(o,n,i);d!==null&&(tr(d,o,i),Gu(d,o,i)),o={cache:Ex()},n.payload=o;return}o=o.return}}function fD(n,o,i){var d=yr();i={lane:d,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},xm(n)?Cj(o,i):(i=yx(n,o,i,d),i!==null&&(tr(i,n,d),kj(i,o,d)))}function Nj(n,o,i){var d=yr();Qu(n,o,i,d)}function Qu(n,o,i,d){var y={lane:d,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(xm(n))Cj(o,y);else{var w=n.alternate;if(n.lanes===0&&(w===null||w.lanes===0)&&(w=o.lastRenderedReducer,w!==null))try{var z=o.lastRenderedState,Y=w(z,i);if(y.hasEagerState=!0,y.eagerState=Y,hr(Y,z))return Kf(n,o,y,0),bn===null&&Yf(),!1}catch{}finally{}if(i=yx(n,o,y,d),i!==null)return tr(i,n,d),kj(i,o,d),!0}return!1}function tb(n,o,i,d){if(d={lane:2,revertLane:Gb(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},xm(n)){if(o)throw Error(a(479))}else o=yx(n,i,d,2),o!==null&&tr(o,n,2)}function xm(n){var o=n.alternate;return n===It||o!==null&&o===It}function Cj(n,o){gc=um=!0;var i=n.pending;i===null?o.next=o:(o.next=i.next,i.next=o),n.pending=o}function kj(n,o,i){if((i&4194048)!==0){var d=o.lanes;d&=n.pendingLanes,i|=d,o.lanes=i,Wl(n,i)}}var bm={readContext:Ns,use:mm,useCallback:Bn,useContext:Bn,useEffect:Bn,useImperativeHandle:Bn,useLayoutEffect:Bn,useInsertionEffect:Bn,useMemo:Bn,useReducer:Bn,useRef:Bn,useState:Bn,useDebugValue:Bn,useDeferredValue:Bn,useTransition:Bn,useSyncExternalStore:Bn,useId:Bn,useHostTransitionStatus:Bn,useFormState:Bn,useActionState:Bn,useOptimistic:Bn,useMemoCache:Bn,useCacheRefresh:Bn,useEffectEvent:Bn},Tj={readContext:Ns,use:mm,useCallback:function(n,o){return Fs().memoizedState=[n,o===void 0?null:o],n},useContext:Ns,useEffect:uj,useImperativeHandle:function(n,o,i){i=i!=null?i.concat([n]):null,pm(4194308,4,hj.bind(null,o,n),i)},useLayoutEffect:function(n,o){return pm(4194308,4,n,o)},useInsertionEffect:function(n,o){pm(4,2,n,o)},useMemo:function(n,o){var i=Fs();o=o===void 0?null:o;var d=n();if(cl){Ht(!0);try{n()}finally{Ht(!1)}}return i.memoizedState=[d,o],d},useReducer:function(n,o,i){var d=Fs();if(i!==void 0){var y=i(o);if(cl){Ht(!0);try{i(o)}finally{Ht(!1)}}}else y=o;return d.memoizedState=d.baseState=y,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:y},d.queue=n,n=n.dispatch=fD.bind(null,It,n),[d.memoizedState,n]},useRef:function(n){var o=Fs();return n={current:n},o.memoizedState=n},useState:function(n){n=Kx(n);var o=n.queue,i=Nj.bind(null,It,o);return o.dispatch=i,[n.memoizedState,i]},useDebugValue:Qx,useDeferredValue:function(n,o){var i=Fs();return Zx(i,n,o)},useTransition:function(){var n=Kx(!1);return n=yj.bind(null,It,n.queue,!0,!1),Fs().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,o,i){var d=It,y=Fs();if(Vt){if(i===void 0)throw Error(a(407));i=i()}else{if(i=o(),bn===null)throw Error(a(349));(Kt&127)!==0||K2(d,o,i)}y.memoizedState=i;var w={value:i,getSnapshot:o};return y.queue=w,uj(W2.bind(null,d,w,n),[n]),d.flags|=2048,bc(9,{destroy:void 0},X2.bind(null,d,w,i,o),null),i},useId:function(){var n=Fs(),o=bn.identifierPrefix;if(Vt){var i=To,d=ko;i=(d&~(1<<32-St(d)-1)).toString(32)+i,o="_"+o+"R_"+i,i=dm++,0<i&&(o+="H"+i.toString(32)),o+="_"}else i=oD++,o="_"+o+"r_"+i.toString(32)+"_";return n.memoizedState=o},useHostTransitionStatus:eb,useFormState:oj,useActionState:oj,useOptimistic:function(n){var o=Fs();o.memoizedState=o.baseState=n;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=i,o=tb.bind(null,It,!0,i),i.dispatch=o,[n,o]},useMemoCache:Gx,useCacheRefresh:function(){return Fs().memoizedState=dD.bind(null,It)},useEffectEvent:function(n){var o=Fs(),i={impl:n};return o.memoizedState=i,function(){if((nn&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},Ej={readContext:Ns,use:mm,useCallback:gj,useContext:Ns,useEffect:Wx,useImperativeHandle:pj,useInsertionEffect:fj,useLayoutEffect:mj,useMemo:xj,useReducer:hm,useRef:cj,useState:function(){return hm(ua)},useDebugValue:Qx,useDeferredValue:function(n,o){var i=qn();return bj(i,fn.memoizedState,n,o)},useTransition:function(){var n=hm(ua)[0],o=qn().memoizedState;return[typeof n=="boolean"?n:Wu(n),o]},useSyncExternalStore:Y2,useId:jj,useHostTransitionStatus:eb,useFormState:aj,useActionState:aj,useOptimistic:function(n,o){var i=qn();return J2(i,fn,n,o)},useMemoCache:Gx,useCacheRefresh:Sj,useEffectEvent:dj},mD={readContext:Ns,use:mm,useCallback:gj,useContext:Ns,useEffect:Wx,useImperativeHandle:pj,useInsertionEffect:fj,useLayoutEffect:mj,useMemo:xj,useReducer:Yx,useRef:cj,useState:function(){return Yx(ua)},useDebugValue:Qx,useDeferredValue:function(n,o){var i=qn();return fn===null?Zx(i,n,o):bj(i,fn.memoizedState,n,o)},useTransition:function(){var n=Yx(ua)[0],o=qn().memoizedState;return[typeof n=="boolean"?n:Wu(n),o]},useSyncExternalStore:Y2,useId:jj,useHostTransitionStatus:eb,useFormState:lj,useActionState:lj,useOptimistic:function(n,o){var i=qn();return fn!==null?J2(i,fn,n,o):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:Gx,useCacheRefresh:Sj,useEffectEvent:dj};function nb(n,o,i,d){o=n.memoizedState,i=i(d,o),i=i==null?o:R({},o,i),n.memoizedState=i,n.lanes===0&&(n.updateQueue.baseState=i)}var sb={enqueueSetState:function(n,o,i){n=n._reactInternals;var d=yr(),y=ti(d);y.payload=o,i!=null&&(y.callback=i),o=ni(n,y,d),o!==null&&(tr(o,n,d),Gu(o,n,d))},enqueueReplaceState:function(n,o,i){n=n._reactInternals;var d=yr(),y=ti(d);y.tag=1,y.payload=o,i!=null&&(y.callback=i),o=ni(n,y,d),o!==null&&(tr(o,n,d),Gu(o,n,d))},enqueueForceUpdate:function(n,o){n=n._reactInternals;var i=yr(),d=ti(i);d.tag=2,o!=null&&(d.callback=o),o=ni(n,d,i),o!==null&&(tr(o,n,i),Gu(o,n,i))}};function Rj(n,o,i,d,y,w,z){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(d,w,z):o.prototype&&o.prototype.isPureReactComponent?!_u(i,d)||!_u(y,w):!0}function Aj(n,o,i,d){n=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(i,d),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(i,d),o.state!==n&&sb.enqueueReplaceState(o,o.state,null)}function ul(n,o){var i=o;if("ref"in o){i={};for(var d in o)d!=="ref"&&(i[d]=o[d])}if(n=n.defaultProps){i===o&&(i=R({},i));for(var y in n)i[y]===void 0&&(i[y]=n[y])}return i}function Oj(n){qf(n)}function Mj(n){console.error(n)}function Dj(n){qf(n)}function ym(n,o){try{var i=n.onUncaughtError;i(o.value,{componentStack:o.stack})}catch(d){setTimeout(function(){throw d})}}function zj(n,o,i){try{var d=n.onCaughtError;d(i.value,{componentStack:i.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function rb(n,o,i){return i=ti(i),i.tag=3,i.payload={element:null},i.callback=function(){ym(n,o)},i}function Pj(n){return n=ti(n),n.tag=3,n}function Ij(n,o,i,d){var y=i.type.getDerivedStateFromError;if(typeof y=="function"){var w=d.value;n.payload=function(){return y(w)},n.callback=function(){zj(o,i,d)}}var z=i.stateNode;z!==null&&typeof z.componentDidCatch=="function"&&(n.callback=function(){zj(o,i,d),typeof y!="function"&&(ui===null?ui=new Set([this]):ui.add(this));var Y=d.stack;this.componentDidCatch(d.value,{componentStack:Y!==null?Y:""})})}function hD(n,o,i,d,y){if(i.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(o=i.alternate,o!==null&&nl(o,i,y,!0),i=Cs.current,i!==null){switch(i.tag){case 31:case 13:case 19:return zs===null?$m():i.alternate===null&&$n===0&&($n=3),i.flags&=-257,i.flags|=65536,i.lanes=y,d===om?i.flags|=16384:(o=i.updateQueue,o===null?i.updateQueue=new Set([d]):o.add(d),Ub(n,d,y)),!1;case 22:return i.flags|=65536,d===om?i.flags|=16384:(o=i.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([d])},i.updateQueue=o):(i=o.retryQueue,i===null?o.retryQueue=new Set([d]):i.add(d)),Ub(n,d,y)),!1}throw Error(a(435,i.tag))}return Ub(n,d,y),$m(),!1}if(Vt)return o=Cs.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=y,d!==Nx&&(n=Error(a(422),{cause:d}),$u(Dr(n,i)))):(d!==Nx&&(o=Error(a(423),{cause:d}),$u(Dr(o,i))),n=n.current.alternate,n.flags|=65536,y&=-y,n.lanes|=y,d=Dr(d,i),y=rb(n.stateNode,d,y),zx(n,y),$n!==4&&($n=2)),!1;var w=Error(a(520),{cause:d});if(w=Dr(w,i),od===null?od=[w]:od.push(w),$n!==4&&($n=2),o===null)return!0;d=Dr(d,i),i=o;do{switch(i.tag){case 3:return i.flags|=65536,n=y&-y,i.lanes|=n,n=rb(i.stateNode,d,n),zx(i,n),!1;case 1:if(o=i.type,w=i.stateNode,(i.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(ui===null||!ui.has(w))))return i.flags|=65536,y&=-y,i.lanes|=y,y=Pj(y),Ij(y,n,i,d),zx(i,y),!1;break;case 22:if(i.memoizedState!==null)return i.flags|=65536,!1}i=i.return}while(i!==null);return!1}var ob=Error(a(461)),Zn=!1;function ns(n,o,i,d){o.child=n===null?$2(o,null,i,d):ll(o,n.child,i,d)}function _j(n,o,i,d,y){i=i.render;var w=o.ref;if("ref"in d){var z={};for(var Y in d)Y!=="ref"&&(z[Y]=d[Y])}else z=d;return sl(o),d=Vx(n,o,i,z,w,y),Y=Ux(),n!==null&&!Zn?(Hx(n,o,y),da(n,o,y)):(Vt&&Y&&Zf(o),o.flags|=1,ns(n,o,d,y),o.child)}function Lj(n,o,i,d,y){if(n===null){var w=i.type;return typeof w=="function"&&!vx(w)&&w.defaultProps===void 0&&i.compare===null?(o.tag=15,o.type=w,Bj(n,o,w,d,y)):(n=Wf(i.type,null,d,o,o.mode,y),n.ref=o.ref,n.return=o,o.child=n)}if(w=n.child,!mb(n,y)){var z=w.memoizedProps;if(i=i.compare,i=i!==null?i:_u,i(z,d)&&n.ref===o.ref)return da(n,o,y)}return o.flags|=1,n=oa(w,d),n.ref=o.ref,n.return=o,o.child=n}function Bj(n,o,i,d,y){if(n!==null){var w=n.memoizedProps;if(_u(w,d)&&n.ref===o.ref)if(Zn=!1,o.pendingProps=d=w,mb(n,y))(n.flags&131072)!==0&&(Zn=!0);else return o.lanes=n.lanes,da(n,o,y)}return ab(n,o,i,d,y)}function $j(n,o,i,d){var y=d.children,w=n!==null?n.memoizedState:null;if(n===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((o.flags&128)!==0){if(w=w!==null?w.baseLanes|i:i,n!==null){for(d=o.child=n.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~w}else d=0,o.child=null;return Vj(n,o,w,i,d)}if((i&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},n!==null&&sm(o,w!==null?w.cachePool:null),w!==null?H2(o,w):Ix(),F2(o);else return d=o.lanes=536870912,Vj(n,o,w!==null?w.baseLanes|i:i,i,d)}else w!==null?(sm(o,w.cachePool),H2(o,w),oi(),o.memoizedState=null):(n!==null&&sm(o,null),Ix(),oi());return ns(n,o,y,i),o.child}function Zu(n,o){return n!==null&&n.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function Vj(n,o,i,d,y){var w=Ax();return w=w===null?null:{parent:Wn._currentValue,pool:w},o.memoizedState={baseLanes:i,cachePool:w},n!==null&&sm(o,null),Ix(),F2(o),n!==null&&nl(n,o,d,!0),o.childLanes=y,null}function vm(n,o){return o=wm({mode:o.mode,children:o.children},n.mode),o.ref=n.ref,n.child=o,o.return=n,o}function Uj(n,o,i){return ll(o,n.child,null,i),n=vm(o,o.pendingProps),n.flags|=2,pr(o),o.memoizedState=null,n}function pD(n,o,i){var d=o.pendingProps,y=(o.flags&128)!==0;if(o.flags&=-129,n===null){if(Vt){if(d.mode==="hidden")return n=vm(o,d),o.lanes=536870912,n.memoizedState={baseLanes:0,cachePool:null},Zu(null,n);if(Lx(o),(n=jn)?(n=hN(n,Ir),n=n!==null&&n.data==="&"?n:null,n!==null&&(o.memoizedState={dehydrated:n,treeContext:Xa!==null?{id:ko,overflow:To}:null,retryLane:536870912,hydrationErrors:null},i=C2(n),i.return=o,o.child=i,gs=o,jn=null)):n=null,n===null)throw Qa(o);return o.lanes=536870912,null}return vm(o,d)}var w=n.memoizedState;if(w!==null){var z=w.dehydrated;if(Lx(o),y)if(o.flags&256)o.flags&=-257,o=Uj(n,o,i);else if(o.memoizedState!==null)o.child=n.child,o.flags|=128,o=null;else throw Error(a(558));else if(Zn||nl(n,o,i,!1),y=(i&n.childLanes)!==0,Zn||y){if(si.current===null){if(d=bn,d!==null&&(z=Vi(d,i),z!==0&&z!==w.retryLane))throw w.retryLane=z,Zi(n,z),tr(d,n,z),ob;$m()}o=Uj(n,o,i)}else n=w.treeContext,jn=Lr(z.nextSibling),gs=o,Vt=!0,Wa=null,Ir=!1,n!==null&&E2(o,n),o=vm(o,d),o.flags|=134221824;return o}return n=oa(n.child,{mode:d.mode,children:d.children}),n.ref=o.ref,o.child=n,n.return=o,n}function yc(n,o){var i=o.ref;if(i===null)n!==null&&n.ref!==null&&(o.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(n===null||n.ref!==i)&&(o.flags|=4194816)}}function ab(n,o,i,d,y){return sl(o),i=Vx(n,o,i,d,void 0,y),d=Ux(),n!==null&&!Zn?(Hx(n,o,y),da(n,o,y)):(Vt&&d&&Zf(o),o.flags|=1,ns(n,o,i,y),o.child)}function Hj(n,o,i,d,y,w){return sl(o),o.updateQueue=null,i=q2(o,d,i,y),G2(n),d=Ux(),n!==null&&!Zn?(Hx(n,o,w),da(n,o,w)):(Vt&&d&&Zf(o),o.flags|=1,ns(n,o,i,w),o.child)}function Fj(n,o,i,d,y){if(sl(o),o.stateNode===null){var w=cc,z=i.contextType;typeof z=="object"&&z!==null&&(w=Ns(z)),w=new i(d,w),o.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=sb,o.stateNode=w,w._reactInternals=o,w=o.stateNode,w.props=d,w.state=o.memoizedState,w.refs={},Mx(o),z=i.contextType,w.context=typeof z=="object"&&z!==null?Ns(z):cc,w.state=o.memoizedState,z=i.getDerivedStateFromProps,typeof z=="function"&&(nb(o,i,z,d),w.state=o.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(z=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),z!==w.state&&sb.enqueueReplaceState(w,w.state,null),Yu(o,d,w,y),qu(),w.state=o.memoizedState),typeof w.componentDidMount=="function"&&(o.flags|=4194308),d=!0}else if(n===null){w=o.stateNode;var Y=o.memoizedProps,ie=ul(i,Y);w.props=ie;var ve=w.context,ke=i.contextType;z=cc,typeof ke=="object"&&ke!==null&&(z=Ns(ke));var ze=i.getDerivedStateFromProps;ke=typeof ze=="function"||typeof w.getSnapshotBeforeUpdate=="function",Y=o.pendingProps!==Y,ke||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(Y||ve!==z)&&Aj(o,w,d,z),ei=!1;var ge=o.memoizedState;w.state=ge,Yu(o,d,w,y),qu(),ve=o.memoizedState,Y||ge!==ve||ei?(typeof ze=="function"&&(nb(o,i,ze,d),ve=o.memoizedState),(ie=ei||Rj(o,i,ie,d,ge,ve,z))?(ke||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(o.flags|=4194308)):(typeof w.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=d,o.memoizedState=ve),w.props=d,w.state=ve,w.context=z,d=ie):(typeof w.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{w=o.stateNode,Dx(n,o),z=o.memoizedProps,ke=ul(i,z),w.props=ke,ze=o.pendingProps,ge=w.context,ve=i.contextType,ie=cc,typeof ve=="object"&&ve!==null&&(ie=Ns(ve)),Y=i.getDerivedStateFromProps,(ve=typeof Y=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(z!==ze||ge!==ie)&&Aj(o,w,d,ie),ei=!1,ge=o.memoizedState,w.state=ge,Yu(o,d,w,y),qu();var Se=o.memoizedState;z!==ze||ge!==Se||ei||n!==null&&n.dependencies!==null&&tm(n.dependencies)?(typeof Y=="function"&&(nb(o,i,Y,d),Se=o.memoizedState),(ke=ei||Rj(o,i,ke,d,ge,Se,ie)||n!==null&&n.dependencies!==null&&tm(n.dependencies))?(ve||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(d,Se,ie),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(d,Se,ie)),typeof w.componentDidUpdate=="function"&&(o.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof w.componentDidUpdate!="function"||z===n.memoizedProps&&ge===n.memoizedState||(o.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||z===n.memoizedProps&&ge===n.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=Se),w.props=d,w.state=Se,w.context=ie,d=ke):(typeof w.componentDidUpdate!="function"||z===n.memoizedProps&&ge===n.memoizedState||(o.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||z===n.memoizedProps&&ge===n.memoizedState||(o.flags|=1024),d=!1)}return w=d,yc(n,o),d=(o.flags&128)!==0,w||d?(w=o.stateNode,i=d&&typeof i.getDerivedStateFromError!="function"?null:w.render(),o.flags|=1,n!==null&&d?(o.child=ll(o,n.child,null,y),o.child=ll(o,null,i,y)):ns(n,o,i,y),o.memoizedState=w.state,n=o.child):n=da(n,o,y),n}function Gj(n,o,i,d){return el(),o.flags|=256,ns(n,o,i,d),o.child}var ib={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function lb(n){return{baseLanes:n,cachePool:z2()}}function cb(n,o,i){return n=n!==null?n.childLanes&~i:0,o&&(n|=br),n}function qj(n,o,i){var d=o.pendingProps,y=!1,w=(o.flags&128)!==0,z;if((z=w)||(z=n!==null&&n.memoizedState===null?!1:(ks.current&2)!==0),z&&(y=!0,o.flags&=-129),z=(o.flags&32)!==0,o.flags&=-33,n===null){if(Vt){if(y?ri(o):oi(),(n=jn)?(n=hN(n,Ir),n=n!==null&&n.data!=="&"?n:null,n!==null&&(o.memoizedState={dehydrated:n,treeContext:Xa!==null?{id:ko,overflow:To}:null,retryLane:536870912,hydrationErrors:null},i=C2(n),i.return=o,o.child=i,gs=o,jn=null)):n=null,n===null)throw Qa(o);return l0(n)?o.lanes=32:o.lanes=536870912,null}return w=d.children,d=d.fallback,y?(oi(),y=o.mode,w=wm({mode:"hidden",children:w},y),d=Ji(d,y,i,null),w.return=o,d.return=o,w.sibling=d,o.child=w,d=o.child,d.memoizedState=lb(i),d.childLanes=cb(n,z,i),o.memoizedState=ib,Zu(null,d)):(ri(o),ub(o,w))}var Y=n.memoizedState;if(Y!==null){var ie=Y.dehydrated;if(ie!==null)return gD(n,o,w,z,d,ie,Y,i)}return y?(oi(),y=d.fallback,w=o.mode,Y=n.child,ie=Y.sibling,d=oa(Y,{mode:"hidden",children:d.children}),d.subtreeFlags=Y.subtreeFlags&1206910976,ie!==null?y=oa(ie,y):(y=Ji(y,w,i,null),y.flags|=2),y.return=o,d.return=o,d.sibling=y,o.child=d,Zu(null,d),d=o.child,y=n.child.memoizedState,y===null?y=lb(i):(w=y.cachePool,w!==null?(Y=Wn._currentValue,w=w.parent!==Y?{parent:Y,pool:Y}:w):w=z2(),y={baseLanes:y.baseLanes|i,cachePool:w}),d.memoizedState=y,d.childLanes=cb(n,z,i),o.memoizedState=ib,Zu(n.child,d)):(ri(o),i=n.child,n=i.sibling,i=oa(i,{mode:"visible",children:d.children}),i.return=o,i.sibling=null,n!==null&&(z=o.deletions,z===null?(o.deletions=[n],o.flags|=16):z.push(n)),o.child=i,o.memoizedState=null,i)}function ub(n,o){return o=wm({mode:"visible",children:o},n.mode),o.return=n,n.child=o}function wm(n,o){return n=Qs(22,n,null,o),n.lanes=0,n}function jm(n,o,i){return ll(o,n.child,null,i),n=ub(o,o.pendingProps.children),n.flags|=2,o.memoizedState=null,n}function gD(n,o,i,d,y,w,z,Y){if(i)return o.flags&256?(ri(o),o.flags&=-257,jm(n,o,Y)):o.memoizedState!==null?(oi(),o.child=n.child,o.flags|=128,null):(oi(),w=y.fallback,z=o.mode,y=wm({mode:"visible",children:y.children},z),w=Ji(w,z,Y,null),w.flags|=2,y.return=o,w.return=o,y.sibling=w,o.child=y,ll(o,n.child,null,Y),y=o.child,y.memoizedState=lb(Y),y.childLanes=cb(n,d,Y),o.memoizedState=ib,Zu(null,y));if(ri(o),l0(w)){if(d=w.nextSibling&&w.nextSibling.dataset,d)var ie=d.dgst;return d=ie,d!==""&&(y=Error(a(419)),y.stack="",y.digest=d,$u({value:y,source:null,stack:null})),jm(n,o,Y)}if(Zn||nl(n,o,Y,!1),d=(Y&n.childLanes)!==0,Zn||d){if(si.current!==null)return jm(n,o,Y);if(d=bn,d!==null&&(y=Vi(d,Y),y!==0&&y!==z.retryLane))throw z.retryLane=y,Zi(n,y),tr(d,n,y),ob;return i0(w)||$m(),jm(n,o,Y)}return i0(w)?(o.flags|=192,o.child=n.child,null):(n=z.treeContext,jn=Lr(w.nextSibling),gs=o,Vt=!0,Wa=null,Ir=!1,n!==null&&E2(o,n),o=ub(o,y.children),o.flags|=134221824,o)}function Yj(n,o,i){n.lanes|=o;var d=n.alternate;d!==null&&(d.lanes|=o),em(n.return,o,i)}function Kj(n){for(var o=null;n!==null;){var i=n.alternate;i!==null&&cm(i)===null&&(o=n),n=n.sibling}return o}function Sm(n,o,i,d,y,w){var z=n.memoizedState;z===null?n.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:i,tailMode:y,treeForkCount:w}:(z.isBackwards=o,z.rendering=null,z.renderingStartTime=0,z.last=d,z.tail=i,z.tailMode=y,z.treeForkCount=w)}function db(n){var o=n.child;for(n.child=null;o!==null;){var i=o.sibling;o.sibling=n.child,n.child=o,o=i}}function fb(n,o,i){var d=o.pendingProps,y=d.revealOrder,w=d.tail;d=d.children;var z=ks.current;if(o.flags&128)return Ku(o,z),null;var Y=(z&2)!==0;if(Y?(z=z&1|2,o.flags|=128):z&=1,Ku(o,z),y==="backwards"&&n!==null?(db(n),ns(n,o,d,i),db(n)):ns(n,o,d,i),d=Vt?Bu:0,!Y&&n!==null&&(n.flags&128)!==0)e:for(n=o.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Yj(n,i,o);else if(n.tag===19)Yj(n,i,o);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===o)break e;for(;n.sibling===null;){if(n.return===null||n.return===o)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(y){case"backwards":i=Kj(o.child),i===null?(y=o.child,o.child=null):(y=i.sibling,i.sibling=null,db(o)),Sm(o,!0,y,null,w,d);break;case"unstable_legacy-backwards":for(i=null,y=o.child,o.child=null;y!==null;){if(n=y.alternate,n!==null&&cm(n)===null){o.child=y;break}n=y.sibling,y.sibling=i,i=y,y=n}Sm(o,!0,i,null,w,d);break;case"together":Sm(o,!1,null,null,void 0,d);break;case"independent":o.memoizedState=null;break;default:i=Kj(o.child),i===null?(y=o.child,o.child=null):(y=i.sibling,i.sibling=null),Sm(o,!1,y,i,w,d)}return o.child}function Xj(n,o,i){var d=o.pendingProps;return Za(o,o.type,d.value),ns(n,o,d.children,i),o.child}function da(n,o,i){if(n!==null&&(o.dependencies=n.dependencies),ci|=o.lanes,(i&o.childLanes)===0)if(n!==null){if(nl(n,o,i,!1),(i&o.childLanes)===0)return null}else return null;if(n!==null&&o.child!==n.child)throw Error(a(153));if(o.child!==null){for(n=o.child,i=oa(n,n.pendingProps),o.child=i,i.return=o;n.sibling!==null;)n=n.sibling,i=i.sibling=oa(n,n.pendingProps),i.return=o;i.sibling=null}return o.child}function mb(n,o){return(n.lanes&o)!==0?!0:(n=n.dependencies,!!(n!==null&&tm(n)))}function xD(n,o,i){switch(o.tag){case 3:$e(o,o.stateNode.containerInfo),Za(o,Wn,n.memoizedState.cache),el();break;case 27:case 5:_e(o);break;case 4:$e(o,o.stateNode.containerInfo);break;case 10:Za(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,Lx(o),null;break;case 13:var d=o.memoizedState;if(d!==null){if(d.dehydrated!==null)return ri(o),o.flags|=128,null;d=nl(n,o,i,!1);var y=o.child.childLanes;return d||(i&y)!==0?qj(n,o,i):(ri(o),n=da(n,o,i),n!==null?n.sibling:null)}ri(o);break;case 19:if(o.flags&128)return fb(n,o,i);if(y=(n.flags&128)!==0,d=(i&o.childLanes)!==0,d||(nl(n,o,i,!1),d=(i&o.childLanes)!==0),y){if(d)return fb(n,o,i);o.flags|=128}if(y=o.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),Ku(o,ks.current),d)break;return null;case 22:return o.lanes=0,$j(n,o,i,o.pendingProps);case 24:Za(o,Wn,n.memoizedState.cache)}return da(n,o,i)}function Wj(n,o,i){if(n!==null)if(n.memoizedProps!==o.pendingProps)Zn=!0;else{if(!mb(n,i)&&(o.flags&128)===0)return Zn=!1,xD(n,o,i);Zn=(n.flags&131072)!==0}else Zn=!1,Vt&&(o.flags&1048576)!==0&&T2(o,Bu,o.index);switch(o.lanes=0,o.tag){case 16:e:{var d=o.pendingProps;if(n=al(o.elementType),o.type=n,typeof n=="function")vx(n)?(d=ul(n,d),o.tag=1,o=Fj(null,o,n,d,i)):(o.tag=0,o=ab(null,o,n,d,i));else{if(n!=null){var y=n.$$typeof;if(y===F){o.tag=11,o=_j(null,o,n,d,i);break e}else if(y===X){o.tag=14,o=Lj(null,o,n,d,i);break e}else if(y===H){o.tag=10,o.type=n,o=Xj(null,o,i);break e}}throw o=J(n)||n,Error(a(306,o,""))}}return o;case 0:return ab(n,o,o.type,o.pendingProps,i);case 1:return d=o.type,y=ul(d,o.pendingProps),Fj(n,o,d,y,i);case 3:e:{if($e(o,o.stateNode.containerInfo),n===null)throw Error(a(387));d=o.pendingProps;var w=o.memoizedState;y=w.element,Dx(n,o),Yu(o,d,null,i);var z=o.memoizedState;if(d=z.cache,Za(o,Wn,d),d!==w.cache&&Tx(o,[Wn],i,!0),qu(),d=z.element,w.isDehydrated)if(w={element:d,isDehydrated:!1,cache:z.cache},o.updateQueue.baseState=w,o.memoizedState=w,o.flags&256){o=Gj(n,o,d,i);break e}else if(d!==y){y=Dr(Error(a(424)),o),$u(y),o=Gj(n,o,d,i);break e}else{switch(n=o.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(jn=Lr(n.firstChild),gs=o,Vt=!0,Wa=null,Ir=!0,i=$2(o,null,d,i),o.child=i;i;)i.flags=i.flags&-3|134221824,i=i.sibling}else{if(el(),d===y){o=da(n,o,i);break e}ns(n,o,d,i)}o=o.child}return o;case 26:return yc(n,o),n===null?(i=wN(o.type,null,o.pendingProps,null))?o.memoizedState=i:Vt||(o.stateNode=eN(o.type,o.pendingProps,xe.current,o)):o.memoizedState=wN(o.type,n.memoizedProps,o.pendingProps,n.memoizedState),null;case 27:return _e(o),n===null&&Vt&&(d=o.stateNode=xN(o.type,o.pendingProps,xe.current),gs=o,Ir=!0,y=jn,mi(o.type)?(c0=y,jn=Lr(d.firstChild)):jn=y),ns(n,o,o.pendingProps.children,i),yc(n,o),n===null&&(o.flags|=4194304),o.child;case 5:return n===null&&Vt&&((y=d=jn)&&(d=dz(d,o.type,o.pendingProps,Ir),d!==null?(o.stateNode=d,gs=o,jn=Lr(d.firstChild),Ir=!1,y=!0):y=!1),y||Qa(o)),_e(o),y=o.type,w=o.pendingProps,z=n!==null?n.memoizedProps:null,d=w.children,e0(y,w)?d=null:z!==null&&e0(y,z)&&(o.flags|=32),o.memoizedState!==null&&(y=Vx(n,o,aD,null,null,i),_c._currentValue=y),yc(n,o),ns(n,o,d,i),o.child;case 6:return n===null&&Vt&&((n=i=jn)&&(i=fz(i,o.pendingProps,Ir),i!==null?(o.stateNode=i,gs=o,jn=null,n=!0):n=!1),n||Qa(o)),null;case 13:return qj(n,o,i);case 4:return $e(o,o.stateNode.containerInfo),d=o.pendingProps,n===null?o.child=ll(o,null,d,i):ns(n,o,d,i),o.child;case 11:return _j(n,o,o.type,o.pendingProps,i);case 7:return d=o.pendingProps,yc(n,o),ns(n,o,d,i),o.child;case 8:return ns(n,o,o.pendingProps.children,i),o.child;case 12:return ns(n,o,o.pendingProps.children,i),o.child;case 10:return Xj(n,o,i);case 9:return y=o.type._context,d=o.pendingProps.children,sl(o),y=Ns(y),d=d(y),o.flags|=1,ns(n,o,d,i),o.child;case 14:return Lj(n,o,o.type,o.pendingProps,i);case 15:return Bj(n,o,o.type,o.pendingProps,i);case 19:return fb(n,o,i);case 31:return pD(n,o,i);case 22:return $j(n,o,i,o.pendingProps);case 24:return sl(o),d=Ns(Wn),n===null?(y=Ax(),y===null&&(y=bn,w=Ex(),y.pooledCache=w,w.refCount++,w!==null&&(y.pooledCacheLanes|=i),y=w),o.memoizedState={parent:d,cache:y},Mx(o),Za(o,Wn,y)):((n.lanes&i)!==0&&(Dx(n,o),Yu(o,null,null,i),qu()),y=n.memoizedState,w=o.memoizedState,y.parent!==d?(y={parent:d,cache:d},o.memoizedState=y,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=y),Za(o,Wn,d)):(d=w.cache,Za(o,Wn,d),d!==y.cache&&Tx(o,[Wn],i,!0))),ns(n,o,o.pendingProps.children,i),o.child;case 30:return o.stateNode===null&&(o.stateNode={autoName:null,paired:null,clones:null,ref:null}),d=o.pendingProps,d.name!=null&&d.name!=="auto"?o.flags|=n===null?18882560:18874368:Vt&&Zf(o),n!==null&&n.memoizedProps.name!==d.name?o.flags|=4194816:yc(n,o),ns(n,o,d.children,i),o.child;case 29:throw o.pendingProps}throw Error(a(156,o.tag))}function fa(n){n.flags|=4}function hb(n,o,i,d,y){var w;if((w=(n.mode&32)!==0)&&(w=i===null?CN(o,d):CN(o,d)&&(d.src!==i.src||d.srcSet!==i.srcSet)),w){if(n.flags|=16777216,(y&335544128)===y)if(n.stateNode.complete)n.flags|=8192;else if(OS())n.flags|=8192;else throw il=om,Ox}else n.flags&=-16777217}function Qj(n,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!kN(o))if(OS())n.flags|=8192;else throw il=om,Ox}function Nm(n,o){o!==null&&(n.flags|=4),n.flags&16384&&(o=n.tag!==22?ms():536870912,n.lanes|=o,Nc|=o)}function Ju(n,o){if(!Vt)switch(n.tailMode){case"visible":break;case"collapsed":for(var i=n.tail,d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?o||n.tail===null?n.tail=null:n.tail.sibling=null:d.sibling=null;break;default:for(o=n.tail,i=null;o!==null;)o.alternate!==null&&(i=o),o=o.sibling;i===null?n.tail=null:i.sibling=null}}function Sn(n){var o=n.alternate!==null&&n.alternate.child===n.child,i=0,d=0;if(o)for(var y=n.child;y!==null;)i|=y.lanes|y.childLanes,d|=y.subtreeFlags&1206910976,d|=y.flags&1206910976,y.return=n,y=y.sibling;else for(y=n.child;y!==null;)i|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=n,y=y.sibling;return n.subtreeFlags|=d,n.childLanes=i,o}function bD(n,o,i){var d=o.pendingProps;switch(Sx(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Sn(o),null;case 1:return Sn(o),null;case 3:return i=o.stateNode,d=null,n!==null&&(d=n.memoizedState.cache),o.memoizedState.cache!==d&&(o.flags|=2048),la(Wn),we(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(fc(o)?fa(o):n===null||n.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Cx())),Sn(o),null;case 26:var y=o.type,w=o.memoizedState;return n===null?(fa(o),w!==null?(Sn(o),Qj(o,w)):(Sn(o),hb(o,y,null,d,i))):w?w!==n.memoizedState?(fa(o),Sn(o),Qj(o,w)):(Sn(o),o.flags&=-16777217):(n=n.memoizedProps,n!==d&&fa(o),Sn(o),hb(o,y,n,d,i)),null;case 27:if(Re(o),i=xe.current,y=o.type,n!==null&&o.stateNode!=null)n.memoizedProps!==d&&fa(o);else{if(!d){if(o.stateNode===null)throw Error(a(166));return Sn(o),o.subtreeFlags&=-33554433,null}n=ee.current,fc(o)?R2(o):(n=xN(y,d,i),o.stateNode=n,fa(o))}return Sn(o),o.subtreeFlags&=-33554433,null;case 5:if(Re(o),y=o.type,n!==null&&o.stateNode!=null)n.memoizedProps!==d&&fa(o);else{if(!d){if(o.stateNode===null)throw Error(a(166));return Sn(o),o.subtreeFlags&=-33554433,null}if(w=ee.current,fc(o))R2(o);else{var z=ud(xe.current);switch(w){case 1:w=z.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:w=z.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":w=z.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":w=z.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":w=z.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof d.is=="string"?z.createElement("select",{is:d.is}):z.createElement("select"),d.multiple?w.multiple=!0:d.size&&(w.size=d.size);break;default:w=typeof d.is=="string"?z.createElement(y,{is:d.is}):z.createElement(y)}}w[zn]=o,w[ws]=d;e:for(z=o.child;z!==null;){if(z.tag===5||z.tag===6)w.appendChild(z.stateNode);else if(z.tag!==4&&z.tag!==27&&z.child!==null){z.child.return=z,z=z.child;continue}if(z===o)break e;for(;z.sibling===null;){if(z.return===null||z.return===o)break e;z=z.return}z.sibling.return=z.return,z=z.sibling}o.stateNode=w;e:switch(Es(w,y,d),y){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&fa(o)}}return Sn(o),o.subtreeFlags&=-33554433,hb(o,o.type,n===null?null:n.memoizedProps,o.pendingProps,i),null;case 6:if(n&&o.stateNode!=null)n.memoizedProps!==d&&fa(o);else{if(typeof d!="string"&&o.stateNode===null)throw Error(a(166));if(n=xe.current,fc(o)){if(n=o.stateNode,i=o.memoizedProps,d=null,y=gs,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}n[zn]=o,n=!!(n.nodeValue===i||d!==null&&d.suppressHydrationWarning===!0||WS(n.nodeValue,i)),n||Qa(o,!0)}else n=ud(n).createTextNode(d),n[zn]=o,o.stateNode=n}return Sn(o),null;case 31:if(i=o.memoizedState,n===null||n.memoizedState!==null){if(d=fc(o),i!==null){if(n===null){if(!d)throw Error(a(318));if(n=o.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(a(557));n[zn]=o}else el(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Sn(o),n=!1}else i=Cx(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return o.flags&256?(pr(o),o):(pr(o),null);if((o.flags&128)!==0)throw Error(a(558))}return Sn(o),null;case 13:if(d=o.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(y=fc(o),d!==null&&d.dehydrated!==null){if(n===null){if(!y)throw Error(a(318));if(y=o.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(a(317));y[zn]=o}else el(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Sn(o),y=!1}else y=Cx(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=y),y=!0;if(!y)return o.flags&256?(pr(o),o):(pr(o),null)}return pr(o),(o.flags&128)!==0?(o.lanes=i,o):(i=d!==null,n=n!==null&&n.memoizedState!==null,i&&(d=o.child,y=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(y=d.alternate.memoizedState.cachePool.pool),w=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(w=d.memoizedState.cachePool.pool),w!==y&&(d.flags|=2048)),i!==n&&i&&(o.child.flags|=8192),Nm(o,o.updateQueue),Sn(o),null);case 4:return we(),n===null&&Xb(o.stateNode.containerInfo),o.flags|=67108864,Sn(o),null;case 10:return la(o.type),Sn(o),null;case 19:if(Bx(o),d=o.memoizedState,d===null)return Sn(o),null;if(y=(o.flags&128)!==0,w=d.rendering,w===null)if(y)Ju(d,!1);else{if($n!==0||n!==null&&(n.flags&128)!==0)for(n=o.child;n!==null;){if(w=cm(n),w!==null){for(o.flags|=128,Ju(d,!1),n=w.updateQueue,o.updateQueue=n,Nm(o,n),o.subtreeFlags=0,n=i,i=o.child;i!==null;)N2(i,n),i=i.sibling;return Ku(o,ks.current&1|2),Vt&&aa(o,d.treeForkCount),o.child}n=n.sibling}d.tail!==null&&nt()>Im&&(o.flags|=128,y=!0,Ju(d,!1),o.lanes=4194304)}else{if(!y)if(n=cm(w),n!==null){if(o.flags|=128,y=!0,n=n.updateQueue,o.updateQueue=n,Nm(o,n),Ju(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!w.alternate&&!Vt)return Sn(o),null}else 2*nt()-d.renderingStartTime>Im&&i!==536870912&&(o.flags|=128,y=!0,Ju(d,!1),o.lanes=4194304);d.isBackwards?(w.sibling=o.child,o.child=w):(n=d.last,n!==null?n.sibling=w:o.child=w,d.last=w)}if(d.tail!==null){n=d.tail;e:{for(i=n;i!==null;){if(i.alternate!==null){i=!1;break e}i=i.sibling}i=!0}return d.rendering=n,d.tail=n.sibling,d.renderingStartTime=nt(),n.sibling=null,w=ks.current,w=y?w&1|2:w&1,d.tailMode==="visible"||d.tailMode==="collapsed"||!i||Vt?Ku(o,w):(i=w,Ae(Cs,o),Ae(ks,i),zs===null&&(zs=o)),Vt&&aa(o,d.treeForkCount),n}return Sn(o),null;case 22:case 23:return pr(o),_x(),d=o.memoizedState!==null,n!==null?n.memoizedState!==null!==d&&(o.flags|=8192):d&&(o.flags|=8192),d?(i&536870912)!==0&&(o.flags&128)===0&&(Sn(o),o.subtreeFlags&6&&(o.flags|=8192)):Sn(o),i=o.updateQueue,i!==null&&Nm(o,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==i&&(o.flags|=2048),n!==null&&Ne(ol),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),o.memoizedState.cache!==i&&(o.flags|=2048),la(Wn),Sn(o),null;case 25:return null;case 30:return o.flags|=33554432,Sn(o),null}throw Error(a(156,o.tag))}function yD(n,o){switch(Sx(o),o.tag){case 1:return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 3:return la(Wn),we(),n=o.flags,(n&65536)!==0&&(n&128)===0?(o.flags=n&-65537|128,o):null;case 26:case 27:case 5:return Re(o),null;case 31:if(o.memoizedState!==null){if(pr(o),o.alternate===null)throw Error(a(340));el()}return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 13:if(pr(o),n=o.memoizedState,n!==null&&n.dehydrated!==null){if(o.alternate===null)throw Error(a(340));el()}return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 19:return Bx(o),n=o.flags,n&65536?(o.flags=n&-65537|128,n=o.memoizedState,n!==null&&(n.rendering=null,n.tail=null),o.flags|=4,o):null;case 4:return we(),null;case 10:return la(o.type),null;case 22:case 23:return pr(o),_x(),n!==null&&Ne(ol),n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 24:return la(Wn),null;case 25:return null;default:return null}}function Zj(n,o){switch(Sx(o),o.tag){case 3:la(Wn),we();break;case 26:case 27:case 5:Re(o);break;case 4:we();break;case 31:o.memoizedState!==null&&pr(o);break;case 13:pr(o);break;case 19:Bx(o);break;case 10:la(o.type);break;case 22:case 23:pr(o),_x(),n!==null&&Ne(ol);break;case 24:la(Wn)}}function ed(n,o){try{var i=o.updateQueue,d=i!==null?i.lastEffect:null;if(d!==null){var y=d.next;i=y;do{if((i.tag&n)===n){d=void 0;var w=i.create,z=i.inst;d=w(),z.destroy=d}i=i.next}while(i!==y)}}catch(Y){an(o,o.return,Y)}}function ai(n,o,i){try{var d=o.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var w=y.next;d=w;do{if((d.tag&n)===n){var z=d.inst,Y=z.destroy;if(Y!==void 0){z.destroy=void 0,y=o;var ie=i,ve=Y;try{ve()}catch(ke){an(y,ie,ke)}}}d=d.next}while(d!==w)}}catch(ke){an(o,o.return,ke)}}function Jj(n){var o=n.updateQueue;if(o!==null){var i=n.stateNode;try{U2(o,i)}catch(d){an(n,n.return,d)}}}function eS(n,o,i){i.props=ul(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(d){an(n,o,d)}}function Eo(n,o){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var d=n.stateNode;break;case 30:var y=n.stateNode,w=sa(n.memoizedProps,y);(y.ref===null||y.ref.name!==w)&&(y.ref=iN(w)),d=y.ref;break;case 7:if(n.stateNode===null){var z=new vr(n);p(n.child,!1,cz,z,void 0,void 0),n.stateNode=z}d=n.stateNode;break;default:d=n.stateNode}typeof i=="function"?n.refCleanup=i(d):i.current=d}}catch(Y){an(n,o,Y)}}function Ts(n,o){var i=n.ref,d=n.refCleanup;if(i!==null)if(typeof d=="function")try{d()}catch(y){an(n,o,y)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(y){an(n,o,y)}else i.current=null}function Cm(n,o){if((n.tag===5||n.tag===27||n.tag===6)&&n.alternate===null&&o!==null)for(var i=0;i<o.length;i++)mN(n.stateNode,o[i])}function tS(n){for(var o=n.return;o!==null&&(gb(o)&&mN(n.stateNode,o.stateNode),!pb(o));)o=o.return}function td(n){for(var o=n.return;o!==null&&(gb(o)&&uz(n.stateNode,o.stateNode),!pb(o));)o=o.return}function pb(n){return n.tag===5||n.tag===3||n.tag===27}function gb(n){return n&&n.tag===7&&n.stateNode!==null}function xb(n){var o=n.type,i=n.memoizedProps,d=n.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":i.autoFocus&&d.focus();break e;case"img":i.src?d.src=i.src:i.srcSet&&(d.srcset=i.srcSet)}}catch(y){an(n,n.return,y)}}function bb(n,o,i){try{var d=n.stateNode;GD(d,n.type,i,o),d[ws]=o}catch(y){an(n,n.return,y)}}function nS(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&mi(n.type)||n.tag===4}function yb(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||nS(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&mi(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function vb(n,o,i,d){var y=n.tag;if(y===5||y===6)y=n.stateNode,o?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(y,o):(o=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,o.appendChild(y),i=i._reactRootContainer,i!=null||o.onclick!==null||(o.onclick=Us)),Cm(n,d),vt=!0;else if(y!==4&&(y===27&&(Cm(n,d),d=null,mi(n.type)&&(i=n.stateNode,o=null)),n=n.child,n!==null))for(vb(n,o,i,d),n=n.sibling;n!==null;)vb(n,o,i,d),n=n.sibling}function km(n,o,i,d){var y=n.tag;if(y===5||y===6)y=n.stateNode,o?i.insertBefore(y,o):i.appendChild(y),Cm(n,d),vt=!0;else if(y!==4&&(y===27&&(Cm(n,d),d=null,mi(n.type)&&(i=n.stateNode)),n=n.child,n!==null))for(km(n,o,i,d),n=n.sibling;n!==null;)km(n,o,i,d),n=n.sibling}function sS(n){var o=n.stateNode,i=n.memoizedProps;try{for(var d=n.type,y=o.attributes;y.length;)o.removeAttributeNode(y[0]);Es(o,d,i),o[zn]=n,o[ws]=i}catch(w){an(n,n.return,w)}}var Tm=!1,gr=null;function rS(n){(n.tag===30||(n.subtreeFlags&33554432)!==0)&&(Tm=!0)}var Ro=null;function oS(){var n=Ro;return Ro=null,n}var Zs=0;function vc(n,o,i,d,y){return Zs=0,aS(n.child,o,i,d,y)}function aS(n,o,i,d,y){for(var w=!1;n!==null;){if(n.tag===5){var z=n.stateNode;if(d!==null){var Y=s0(z);d.push(Y),Y.view&&(w=!0)}else w||s0(z).view&&(w=!0);Tm=!0,oN(z,Zs===0?o:o+"_"+Zs,i),Zs++}else(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&y||aS(n.child,o,i,d,y)&&(w=!0));n=n.sibling}return w}function Ao(n,o){for(;n!==null;)n.tag===5?aN(n.stateNode,n.memoizedProps):(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&o||Ao(n.child,o)),n=n.sibling}function Em(n){if((n.subtreeFlags&18874368)!==0)for(n=n.child;n!==null;){if((n.tag!==22||n.memoizedState===null)&&(Em(n),n.tag===30&&(n.flags&18874368)!==0&&n.stateNode.paired)){var o=n.memoizedProps;if(o.name==null||o.name==="auto")throw Error(a(544));var i=o.name;o=ra(o.default,o.share),o!=="none"&&(vc(n,i,o,null,!1)||Ao(n.child,!1))}n=n.sibling}}function wb(n,o){if(n.tag===30){var i=n.stateNode,d=n.memoizedProps,y=sa(d,i),w=ra(d.default,i.paired?d.share:d.enter);w!=="none"?vc(n,y,w,null,!1)?(Em(n),i.paired||o||Ec(n,d.onEnter)):Ao(n.child,!1):Em(n)}else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)wb(n,o),n=n.sibling;else Em(n)}function jb(n){if(gr!==null&&gr.size!==0){var o=gr;if((n.subtreeFlags&18874368)!==0)for(n=n.child;n!==null;){if(n.tag!==22||n.memoizedState===null){if(n.tag===30&&(n.flags&18874368)!==0){var i=n.memoizedProps,d=i.name;if(d!=null&&d!=="auto"){var y=o.get(d);if(y!==void 0){var w=ra(i.default,i.share);if(w!=="none"&&(vc(n,d,w,null,!1)?(w=n.stateNode,y.paired=w,w.paired=y,Ec(n,i.onShare)):Ao(n.child,!1)),o.delete(d),o.size===0)break}}}jb(n)}n=n.sibling}}}function Sb(n){if(n.tag===30){var o=n.memoizedProps,i=sa(o,n.stateNode),d=gr!==null?gr.get(i):void 0,y=ra(o.default,d!==void 0?o.share:o.exit);y!=="none"&&(vc(n,i,y,null,!1)?d!==void 0?(y=n.stateNode,d.paired=y,y.paired=d,gr.delete(i),Ec(n,o.onShare)):Ec(n,o.onExit):Ao(n.child,!1)),gr!==null&&jb(n)}else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)Sb(n),n=n.sibling;else gr!==null&&jb(n)}function iS(n){for(n=n.child;n!==null;){if(n.tag===30){var o=n.memoizedProps,i=sa(o,n.stateNode);o=ra(o.default,o.update),n.flags&=-5,o!=="none"&&vc(n,i,o,n.memoizedState=[],!1)}else(n.subtreeFlags&33554432)!==0&&iS(n);n=n.sibling}}function Nb(n){if((n.subtreeFlags&18874368)!==0)for(n=n.child;n!==null;){if(n.tag!==22||n.memoizedState===null){if(n.tag===30&&(n.flags&18874368)!==0){var o=n.stateNode;o.paired!==null&&(o.paired=null,Ao(n.child,!1))}Nb(n)}n=n.sibling}}function Rm(n){if(n.tag===30)n.stateNode.paired=null,Ao(n.child,!1),Nb(n);else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)Rm(n),n=n.sibling;else Nb(n)}function lS(n){for(n=n.child;n!==null;)n.tag===30?Ao(n.child,!1):(n.subtreeFlags&33554432)!==0&&lS(n),n=n.sibling}function Cb(n,o,i,d,y,w,z){for(var Y=!1;o!==null;){if(o.tag===5){var ie=o.stateNode;if(w!==null&&Zs<w.length){var ve=w[Zs],ke=s0(ie);(ve.view||ke.view)&&(Y=!0);var ze;if(ze=(n.flags&4)===0)if(ke.clip)ze=!0;else{ze=ve.rect;var ge=ke.rect;ze=ze.y!==ge.y||ze.x!==ge.x||ze.height!==ge.height||ze.width!==ge.width}ze&&(n.flags|=4),ke.abs?ke=!ve.abs:(ve=ve.rect,ke=ke.rect,ke=ve.height!==ke.height||ve.width!==ke.width),ke&&(n.flags|=32)}else n.flags|=32;(n.flags&4)!==0&&oN(ie,Zs===0?i:i+"_"+Zs,y),Y&&(n.flags&4)!==0||(Ro===null&&(Ro=[]),Ro.push(ie,Zs===0?d:d+"_"+Zs,o.memoizedProps)),Zs++}else(o.tag!==22||o.memoizedState===null)&&(o.tag===30&&z?n.flags|=o.flags&32:Cb(n,o.child,i,d,y,w,z)&&(Y=!0));o=o.sibling}return Y}function cS(n,o){for(n=n.child;n!==null;){if(n.tag===30){var i=n.memoizedProps,d=n.stateNode,y=sa(i,d),w=ra(i.default,i.update),z;z=n.memoizedState,n.memoizedState=null,d=n;var Y=n.child;Zs=0,y=Cb(d,Y,y,y,w,z,!1),(n.flags&4)!==0&&y&&Ec(n,i.onUpdate)}else(n.subtreeFlags&33554432)!==0&&cS(n);n=n.sibling}}var xs=!1,rn=!1,Oo=!1,kb=!1,uS=typeof WeakSet=="function"?WeakSet:Set,bs=null,Mo=!1,nd=!1,Am=!1,Tb=!1;function vD(n,o,i){if(n=n.containerInfo,Zb=Lc,n=h2(n),mx(n)){if("selectionStart"in n)var d={start:n.selectionStart,end:n.selectionEnd};else e:{d=(d=n.ownerDocument)&&d.defaultView||window;var y=d.getSelection&&d.getSelection();if(y&&y.rangeCount!==0){d=y.anchorNode;var w=y.anchorOffset,z=y.focusNode;y=y.focusOffset;try{d.nodeType,z.nodeType}catch{d=null;break e}var Y=0,ie=-1,ve=-1,ke=0,ze=0,ge=n,Se=null;t:for(;;){for(var tt;ge!==d||w!==0&&ge.nodeType!==3||(ie=Y+w),ge!==z||y!==0&&ge.nodeType!==3||(ve=Y+y),ge.nodeType===3&&(Y+=ge.nodeValue.length),(tt=ge.firstChild)!==null;)Se=ge,ge=tt;for(;;){if(ge===n)break t;if(Se===d&&++ke===w&&(ie=Y),Se===z&&++ze===y&&(ve=Y),(tt=ge.nextSibling)!==null)break;ge=Se,Se=ge.parentNode}ge=tt}d=ie===-1||ve===-1?null:{start:ie,end:ve}}else d=null}d=d||{start:0,end:0}}else d=null;for(Jb={focusedElem:n,selectionRange:d},Lc=!1,i=(i&335544064)===i,bs=o,o=i?9270:1024;bs!==null;){if(n=bs,i&&(d=n.deletions,d!==null))for(w=0;w<d.length;w++)i&&Sb(d[w]);if(n.alternate===null&&(n.flags&2)!==0)i&&rS(n),Om(i);else{if(n.tag===22){if(d=n.alternate,n.memoizedState!==null){d!==null&&d.memoizedState===null&&i&&Sb(d),Om(i);continue}else if(d!==null&&d.memoizedState!==null){i&&rS(n),Om(i);continue}}d=n.child,(n.subtreeFlags&o)!==0&&d!==null?(d.return=n,bs=d):(i&&iS(n),Om(i))}}gr=null}function Om(n){for(;bs!==null;){var o=bs,i=n,d=o.alternate,y=o.flags;switch(o.tag){case 0:case 11:case 15:break;case 1:if((y&1024)!==0&&d!==null){i=void 0,y=d.memoizedProps,d=d.memoizedState;var w=o.stateNode;try{var z=ul(o.type,y);i=w.getSnapshotBeforeUpdate(z,d),w.__reactInternalSnapshotBeforeUpdate=i}catch(Y){an(o,o.return,Y)}}break;case 3:if((y&1024)!==0){if(d=o.stateNode.containerInfo,i=d.nodeType,i===9)a0(d);else if(i===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":a0(d);break;default:d.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:i&&d!==null&&(i=sa(d.memoizedProps,d.stateNode),y=o.memoizedProps,y=ra(y.default,y.update),y!=="none"&&vc(d,i,y,d.memoizedState=[],!0));break;default:if((y&1024)!==0)throw Error(a(163))}if(d=o.sibling,d!==null){d.return=o.return,bs=d;break}bs=o.return}}function dS(n,o,i){var d=i.flags;switch(i.tag){case 0:case 11:case 15:Do(n,i),d&4&&ed(5,i);break;case 1:if(Do(n,i),d&4)if(n=i.stateNode,o===null)try{n.componentDidMount()}catch(z){an(i,i.return,z)}else{var y=ul(i.type,o.memoizedProps);o=o.memoizedState;try{n.componentDidUpdate(y,o,n.__reactInternalSnapshotBeforeUpdate)}catch(z){an(i,i.return,z)}}d&64&&Jj(i),d&512&&Eo(i,i.return);break;case 3:if(Do(n,i),d&64&&(n=i.updateQueue,n!==null)){if(o=null,i.child!==null)switch(i.child.tag){case 27:case 5:o=i.child.stateNode;break;case 1:o=i.child.stateNode}try{U2(n,o)}catch(z){an(i,i.return,z)}}break;case 27:o===null&&d&4&&sS(i);case 26:case 5:Do(n,i),o===null&&d&4&&xb(i),d&512&&Eo(i,i.return);break;case 12:Do(n,i);break;case 31:Do(n,i),d&4&&pS(n,i);break;case 13:Do(n,i),d&4&&gS(n,i),d&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=MD.bind(null,i),mz(n,i))));break;case 22:if(d=i.memoizedState!==null||xs,!d){var w=o!==null&&o.memoizedState!==null||rn;o=xs,y=rn,xs=d,(rn=w)&&!y?(d=2,(i.subtreeFlags&8772)!==0&&(d|=1),uo(n,i,d)):Do(n,i),xs=o,rn=y}break;case 30:Do(n,i),d&512&&Eo(i,i.return);break;case 7:d&512&&Eo(i,i.return);default:Do(n,i)}}function Eb(n,o){for(n=n.child;n!==null;)fS(n,o),n=n.sibling}function fS(n,o){switch(n.tag){case 5:case 26:try{var i=n.stateNode;if(o){var d=i.style;typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none"}else{var y=n.stateNode,w=n.memoizedProps.style,z=w!=null&&w.hasOwnProperty("display")?w.display:null;y.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(ie){an(n,n.return,ie)}Rb(n,o);break;case 6:try{n.stateNode.nodeValue=o?"":n.memoizedProps,vt=!0}catch(ie){an(n,n.return,ie)}break;case 18:try{var Y=n.stateNode;o?rN(Y,!0):rN(n.stateNode,!1)}catch(ie){an(n,n.return,ie)}break;case 22:case 23:n.memoizedState===null&&Eb(n,o);break;default:Eb(n,o)}}function Rb(n,o){if(n.subtreeFlags&67108864)for(n=n.child;n!==null;){e:{var i=n,d=o;switch(i.tag){case 4:fS(i,d);break e;case 22:i.memoizedState===null&&Rb(i,d);break e;default:Rb(i,d)}}n=n.sibling}}function mS(n){var o=n.alternate;o!==null&&(n.alternate=null,mS(o)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(o=n.stateNode,o!==null&&ec(o)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var An=null,Js=!1;function lo(n,o,i){for(i=i.child;i!==null;)hS(n,o,i),i=i.sibling}function hS(n,o,i){if(jt&&typeof jt.onCommitFiberUnmount=="function")try{jt.onCommitFiberUnmount(At,i)}catch{}switch(i.tag){case 26:rn||Ts(i,o),lo(n,o,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&!rn&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:rn||Ts(i,o),td(i);var d=An,y=Js;mi(i.type)&&(An=i.stateNode,Js=!1),lo(n,o,i),bN(i.stateNode,i.type,i.memoizedProps),An=d,Js=y;break;case 5:rn||Ts(i,o),td(i);case 6:if(i.tag===6&&td(i),d=An,y=Js,An=null,lo(n,o,i),An=d,Js=y,An!==null)if(Js)try{(An.nodeType===9?An.body:An.nodeName==="HTML"?An.ownerDocument.body:An).removeChild(i.stateNode),vt=!0}catch(w){an(i,o,w)}else try{An.removeChild(i.stateNode),vt=!0}catch(w){an(i,o,w)}break;case 18:An!==null&&(Js?(n=An,sN(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),Bc(n)):sN(An,i.stateNode));break;case 4:d=An,y=Js,An=i.stateNode.containerInfo,Js=!0,lo(n,o,i),An=d,Js=y;break;case 0:case 11:case 14:case 15:ai(2,i,o),rn||ai(4,i,o),lo(n,o,i);break;case 1:rn||(Ts(i,o),d=i.stateNode,typeof d.componentWillUnmount=="function"&&eS(i,o,d)),lo(n,o,i);break;case 21:lo(n,o,i);break;case 22:rn=(d=rn)||i.memoizedState!==null,lo(n,o,i),rn=d;break;case 30:Ts(i,o),lo(n,o,i);break;case 7:rn||Ts(i,o),lo(n,o,i);break;default:lo(n,o,i)}}function pS(n,o){if(o.memoizedState===null&&(n=o.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Bc(n)}catch(i){an(o,o.return,i)}}}function gS(n,o){if(o.memoizedState===null&&(n=o.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Bc(n)}catch(i){an(o,o.return,i)}}function wD(n){switch(n.tag){case 31:case 13:case 19:var o=n.stateNode;return o===null&&(o=n.stateNode=new uS),o;case 22:return n=n.stateNode,o=n._retryCache,o===null&&(o=n._retryCache=new uS),o;default:throw Error(a(435,n.tag))}}function Mm(n,o){var i=wD(n);o.forEach(function(d){if(!i.has(d)){i.add(d);var y=DD.bind(null,n,d);d.then(y,y)}})}function Gs(n,o,i){var d=o.deletions;if(d!==null)for(var y=0;y<d.length;y++){var w=d[y],z=n,Y=o,ie=Y;e:for(;ie!==null;){switch(ie.tag){case 27:if(mi(ie.type)){An=ie.stateNode,Js=!1;break e}break;case 5:An=ie.stateNode,Js=!1;break e;case 3:case 4:An=ie.stateNode.containerInfo,Js=!0;break e}ie=ie.return}if(An===null)throw Error(a(160));hS(z,Y,w),An=null,Js=!1,z=w.alternate,z!==null&&(z.return=null),w.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)xS(o,n,i),o=o.sibling}var co=null;function xS(n,o,i){var d=n.alternate,y=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(y&4&&(d=n.updateQueue,d=d!==null?d.events:null,d!==null))for(var w=0;w<d.length;w++){var z=d[w];z.ref.impl=z.nextImpl}Gs(o,n,i),qs(n),y&4&&(ai(3,n,n.return),ed(3,n),ai(5,n,n.return));break;case 1:Gs(o,n,i),qs(n),y&512&&(rn||d===null||Ts(d,d.return)),y&64&&xs&&(n=n.updateQueue,n!==null&&(o=n.callbacks,o!==null&&(i=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=i===null?o:i.concat(o))));break;case 26:if(w=co,Gs(o,n,i),qs(n),y&512&&(rn||d===null||Ts(d,d.return)),y&4)if(y=d!==null?d.memoizedState:null,i=n.memoizedState,d===null)if(i===null)if(n.stateNode===null)if(xs)n.stateNode=eN(n.type,n.memoizedProps,o.containerInfo,n);else{e:{o=n.type,i=n.memoizedProps,y=w.ownerDocument||w;t:switch(o){case"title":d=y.getElementsByTagName("title")[0],(!d||d[Hi]||d[zn]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=y.createElement(o),y.head.insertBefore(d,y.querySelector("head > title"))),Es(d,o,i),d[zn]=n,Fe(d),o=d;break e;case"link":if(w=NN("link","href",y).get(o+(i.href||""))){for(z=0;z<w.length;z++)if(d=w[z],d.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&d.getAttribute("rel")===(i.rel==null?null:i.rel)&&d.getAttribute("title")===(i.title==null?null:i.title)&&d.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){w.splice(z,1);break t}}d=y.createElement(o),Es(d,o,i),y.head.appendChild(d);break;case"meta":if(w=NN("meta","content",y).get(o+(i.content||""))){for(z=0;z<w.length;z++)if(d=w[z],d.getAttribute("content")===(i.content==null?null:""+i.content)&&d.getAttribute("name")===(i.name==null?null:i.name)&&d.getAttribute("property")===(i.property==null?null:i.property)&&d.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&d.getAttribute("charset")===(i.charSet==null?null:i.charSet)){w.splice(z,1);break t}}d=y.createElement(o),Es(d,o,i),y.head.appendChild(d);break;default:throw Error(a(468,o))}d[zn]=n,Fe(d),o=d}n.stateNode=o}else xs||m0(w,n.type,n.stateNode);else n.stateNode=SN(w,i,n.memoizedProps);else y!==i?(y===null?(o=d.stateNode,o===null||rn||o.parentNode.removeChild(o)):y.count--,i===null?xs||m0(w,n.type,n.stateNode):SN(w,i,n.memoizedProps)):i===null&&n.stateNode!==null&&bb(n,n.memoizedProps,d.memoizedProps);break;case 27:Gs(o,n,i),qs(n),y&512&&(rn||d===null||Ts(d,d.return)),d!==null&&y&4&&bb(n,n.memoizedProps,d.memoizedProps);break;case 5:if(w=Oo,Oo=!1,Gs(o,n,i),Oo=w,qs(n),y&512&&(rn||d===null||Ts(d,d.return)),n.flags&32){o=n.stateNode;try{Vs(o,""),vt=!0}catch(ke){an(n,n.return,ke)}}y&4&&n.stateNode!=null&&(o=n.memoizedProps,bb(n,o,d!==null?d.memoizedProps:o)),y&1024&&(kb=!0);break;case 6:if(Gs(o,n,i),qs(n),y&4){if(n.stateNode===null)throw Error(a(162));o=n.memoizedProps,i=n.stateNode;try{i.nodeValue=o,vt=!0}catch(ke){an(n,n.return,ke)}}break;case 3:if(vt=!1,Ym=null,w=co,co=dd(o.containerInfo),Gs(o,n,i),co=w,qs(n),y&4&&d!==null&&d.memoizedState.isDehydrated)try{Bc(o.containerInfo)}catch(ke){an(n,n.return,ke)}kb&&(kb=!1,bS(n)),vt=!1;break;case 4:y=Oo,Oo=xs,d=ts(),w=co,co=dd(n.stateNode.containerInfo),Gs(o,n,i),qs(n),co=w,vt&&nd&&(Am=!0),vt=d,Oo=y;break;case 12:Gs(o,n,i),qs(n);break;case 31:Gs(o,n,i),qs(n),y&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Mm(n,o)));break;case 13:Gs(o,n,i),qs(n),n.child.flags&8192&&n.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(Pm=nt()),y&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Mm(n,o)));break;case 22:w=n.memoizedState!==null,z=d!==null&&d.memoizedState!==null;var Y=xs,ie=rn,ve=Oo;xs=Y||w,Oo=ve||w,rn=ie||z,Gs(o,n,i),rn=ie,Oo=ve,xs=Y,qs(n),y&8192&&(o=n.stateNode,o._visibility=w?o._visibility&-2:o._visibility|1,!w||d===null||z||xs||rn||(o=z||rn,i=xs,d=rn,xs=w||xs,rn=o,ii(n,2),xs=i,rn=d),!w&&Oo||Eb(n,w)),y&4&&(o=n.updateQueue,o!==null&&(i=o.retryQueue,i!==null&&(o.retryQueue=null,Mm(n,i))));break;case 19:Gs(o,n,i),qs(n),y&4&&(o=n.updateQueue,o!==null&&(n.updateQueue=null,Mm(n,o)));break;case 30:y&512&&(rn||d===null||Ts(d,d.return)),y=ts(),w=nd,z=(i&335544064)===i,Y=n.memoizedProps,nd=z&&ra(Y.default,Y.update)!=="none",Gs(o,n,i),qs(n),z&&d!==null&&vt&&(n.flags|=4),nd=w,vt=y;break;case 21:break;case 7:y&512&&(rn||d===null||Ts(d,d.return)),d&&d.stateNode!==null&&(d.stateNode._fragmentFiber=n);default:Gs(o,n,i),qs(n)}}function qs(n){var o=n.flags;if(o&2){try{for(var i,d=n.return;d!==null;){if(nS(d)){i=d;break}d=d.return}d=null;for(var y=n.return;y!==null;){if(gb(y)){var w=y.stateNode;d===null?d=[w]:d.push(w)}if(pb(y))break;y=y.return}var z=d;if(i==null)throw Error(a(160));switch(i.tag){case 27:var Y=i.stateNode,ie=yb(n);km(n,ie,Y,z);break;case 5:var ve=i.stateNode;i.flags&32&&(Vs(ve,""),i.flags&=-33);var ke=yb(n);km(n,ke,ve,z);break;case 3:case 4:var ze=i.stateNode.containerInfo,ge=yb(n);vb(n,ge,ze,z);break;default:throw Error(a(161))}}catch(Se){an(n,n.return,Se)}n.flags&=-3}o&4096&&(n.flags&=-4097)}function bS(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var o=n;bS(o),o.tag===5&&o.flags&1024&&(o=o.stateNode,Lc=!0,o.reset(),Lc=!1),n=n.sibling}}function wc(n,o){if(o.subtreeFlags&9270)for(o=o.child;o!==null;)yS(o,n),o=o.sibling;else cS(o)}function yS(n,o){var i=n.alternate;if(i===null)wb(n,!1);else switch(n.tag){case 3:if(Tb=Mo=!1,oS(),wc(o,n),!Mo&&!Am){if(n=Ro,n!==null)for(var d=0;d<n.length;d+=3){i=n[d];var y=n[d+1];aN(i,n[d+2]),i=i.ownerDocument.documentElement,i!==null&&i.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+y+")"})}n=o.containerInfo,n=n.nodeType===9?n.documentElement:n.ownerDocument.documentElement,n!==null&&n.style.viewTransitionName===""&&(n.style.viewTransitionName="none",n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),n.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Tb=!0}Ro=null;break;case 5:wc(o,n);break;case 4:d=Mo,Mo=!1,wc(o,n),Mo&&(Am=!0),Mo=d;break;case 22:n.memoizedState===null&&(i.memoizedState!==null?wb(n,!1):wc(o,n));break;case 30:d=Mo,y=oS(),Mo=!1,wc(o,n),Mo&&(n.flags|=4);var w=n.memoizedProps,z=n.stateNode;o=sa(w,z),z=sa(i.memoizedProps,z);var Y=ra(w.default,w.update);Y==="none"?o=!1:(w=i.memoizedState,i.memoizedState=null,i=n.child,Zs=0,o=Cb(n,i,o,z,Y,w,!0),Zs!==(w===null?0:w.length)&&(n.flags|=32)),(n.flags&4)!==0&&o?(Ec(n,n.memoizedProps.onUpdate),Ro=y):y!==null&&(y.push.apply(y,Ro),Ro=y),Mo=(n.flags&32)!==0?!0:d;break;default:wc(o,n)}}function Do(n,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)dS(n,o.alternate,o),o=o.sibling}function ii(n,o){for(n=n.child;n!==null;){var i=n,d=o;switch(i.tag){case 0:case 11:case 14:case 15:ai(4,i,i.return),ii(i,d);break;case 1:Ts(i,i.return);var y=i.stateNode;typeof y.componentWillUnmount=="function"&&eS(i,i.return,y),ii(i,d);break;case 27:(d&2)!==0&&bN(i.stateNode,i.type,i.memoizedProps);case 5:Ts(i,i.return),i.tag!==5&&i.tag!==27||td(i),ii(i,d);break;case 6:td(i);break;case 26:Ts(i,i.return),y=i.stateNode,i.memoizedState!==null||y===null||rn||y.parentNode.removeChild(y),ii(i,d);break;case 22:i.memoizedState===null&&ii(i,d);break;case 30:Ts(i,i.return),ii(i,d);break;case 7:Ts(i,i.return);default:ii(i,d)}n=n.sibling}}function uo(n,o,i){for(i=(o.subtreeFlags&8772)!==0?i:i&-2,o=o.child;o!==null;){var d=o.alternate,y=n,w=o,z=w.flags,Y=(i&1)!==0;switch(w.tag){case 0:case 11:case 15:uo(y,w,i),ed(4,w);break;case 1:if(uo(y,w,i),d=w,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ke){an(d,d.return,ke)}if(d=w,y=d.updateQueue,y!==null){var ie=d.stateNode;try{var ve=y.shared.hiddenCallbacks;if(ve!==null)for(y.shared.hiddenCallbacks=null,y=0;y<ve.length;y++)V2(ve[y],ie)}catch(ke){an(d,d.return,ke)}}Y&&z&64&&Jj(w),Eo(w,w.return);break;case 27:(i&2)!==0&&sS(w);case 5:w.tag!==5&&w.tag!==27||tS(w),uo(y,w,i),Y&&d===null&&z&4&&xb(w),Eo(w,w.return);break;case 6:tS(w);break;case 26:ie=w.stateNode,w.memoizedState!==null||ie===null||xs||m0(dd(ie.ownerDocument),w.type,ie),uo(y,w,i),Y&&d===null&&z&4&&xb(w),Eo(w,w.return);break;case 12:uo(y,w,i);break;case 31:uo(y,w,i),Y&&z&4&&pS(y,w);break;case 13:uo(y,w,i),Y&&z&4&&gS(y,w);break;case 22:w.memoizedState===null&&uo(y,w,i),Eo(w,w.return);break;case 30:uo(y,w,i),Eo(w,w.return);break;case 7:Eo(w,w.return);default:uo(y,w,i)}o=o.sibling}}function Ab(n,o){var i=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),n=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(n=o.memoizedState.cachePool.pool),n!==i&&(n!=null&&n.refCount++,i!=null&&Vu(i))}function Ob(n,o){n=null,o.alternate!==null&&(n=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==n&&(o.refCount++,n!=null&&Vu(n))}function _r(n,o,i,d){var y=(i&335544064)===i;if(o.subtreeFlags&(y?10262:10256))for(o=o.child;o!==null;)vS(n,o,i,d),o=o.sibling;else y&&lS(o)}function vS(n,o,i,d){var y=(i&335544064)===i;y&&o.alternate===null&&o.return!==null&&o.return.alternate!==null&&Rm(o);var w=o.flags;switch(o.tag){case 0:case 11:case 15:_r(n,o,i,d),w&2048&&ed(9,o);break;case 1:_r(n,o,i,d);break;case 3:_r(n,o,i,d),y&&Tb&&(n=n.containerInfo,n=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,n.style.viewTransitionName==="root"&&(n.style.viewTransitionName=""),n=n.ownerDocument.documentElement,n!==null&&n.style.viewTransitionName==="none"&&(n.style.viewTransitionName="")),w&2048&&(w=null,o.alternate!==null&&(w=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==w&&(o.refCount++,w!=null&&Vu(w)));break;case 12:if(w&2048){_r(n,o,i,d),w=o.stateNode;try{var z=o.memoizedProps,Y=z.id,ie=z.onPostCommit;typeof ie=="function"&&ie(Y,o.alternate===null?"mount":"update",w.passiveEffectDuration,-0)}catch(ve){an(o,o.return,ve)}}else _r(n,o,i,d);break;case 31:_r(n,o,i,d);break;case 13:_r(n,o,i,d);break;case 23:break;case 22:z=o.stateNode,Y=o.alternate,o.memoizedState!==null?(y&&Y!==null&&Y.memoizedState===null&&Rm(Y),z._visibility&2?_r(n,o,i,d):sd(n,o)):(y&&Y!==null&&Y.memoizedState!==null&&Rm(o),z._visibility&2?_r(n,o,i,d):(z._visibility|=2,jc(n,o,i,d,(o.subtreeFlags&10256)!==0||!1))),w&2048&&Ab(Y,o);break;case 24:_r(n,o,i,d),w&2048&&Ob(o.alternate,o);break;case 30:y&&(w=o.alternate,w!==null&&(Ao(w.child,!0),Ao(o.child,!0))),_r(n,o,i,d);break;default:_r(n,o,i,d)}}function jc(n,o,i,d,y){for(y=y&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var w=n,z=o,Y=i,ie=d,ve=z.flags;switch(z.tag){case 0:case 11:case 15:jc(w,z,Y,ie,y),ed(8,z);break;case 23:break;case 22:var ke=z.stateNode;z.memoizedState!==null?ke._visibility&2?jc(w,z,Y,ie,y):sd(w,z):(ke._visibility|=2,jc(w,z,Y,ie,y)),y&&ve&2048&&Ab(z.alternate,z);break;case 24:jc(w,z,Y,ie,y),y&&ve&2048&&Ob(z.alternate,z);break;default:jc(w,z,Y,ie,y)}o=o.sibling}}function sd(n,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var i=n,d=o,y=d.flags;switch(d.tag){case 22:sd(i,d),y&2048&&Ab(d.alternate,d);break;case 24:sd(i,d),y&2048&&Ob(d.alternate,d);break;default:sd(i,d)}o=o.sibling}}var dl=8192;function fl(n,o,i){if(n.subtreeFlags&dl)for(n=n.child;n!==null;)wS(n,o,i),n=n.sibling}function wS(n,o,i){switch(n.tag){case 26:fl(n,o,i),n.flags&dl&&(n.memoizedState!==null?Tz(i,co,n.memoizedState,n.memoizedProps):(n=n.stateNode,(o&335544128)===o&&EN(i,n)));break;case 5:fl(n,o,i),n.flags&dl&&(n=n.stateNode,(o&335544128)===o&&EN(i,n));break;case 3:case 4:var d=co;co=dd(n.stateNode.containerInfo),fl(n,o,i),co=d;break;case 22:n.memoizedState===null&&(d=n.alternate,d!==null&&d.memoizedState!==null?(d=dl,dl=16777216,fl(n,o,i),dl=d):fl(n,o,i));break;case 30:if((n.flags&dl)!==0&&(d=n.memoizedProps.name,d!=null&&d!=="auto")){var y=n.stateNode;y.paired=null,gr===null&&(gr=new Map),gr.set(d,y)}fl(n,o,i);break;default:fl(n,o,i)}}function jS(n){var o=n.alternate;if(o!==null&&(n=o.child,n!==null)){o.child=null;do o=n.sibling,n.sibling=null,n=o;while(n!==null)}}function rd(n){var o=n.deletions;if((n.flags&16)!==0){if(o!==null)for(var i=0;i<o.length;i++){var d=o[i];bs=d,NS(d,n)}jS(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)SS(n),n=n.sibling}function SS(n){switch(n.tag){case 0:case 11:case 15:rd(n),n.flags&2048&&ai(9,n,n.return);break;case 3:rd(n);break;case 12:rd(n);break;case 22:var o=n.stateNode;n.memoizedState!==null&&o._visibility&2&&(n.return===null||n.return.tag!==13)?(o._visibility&=-3,Dm(n)):rd(n);break;default:rd(n)}}function Dm(n){var o=n.deletions;if((n.flags&16)!==0){if(o!==null)for(var i=0;i<o.length;i++){var d=o[i];bs=d,NS(d,n)}jS(n)}for(n=n.child;n!==null;){switch(o=n,o.tag){case 0:case 11:case 15:ai(8,o,o.return),Dm(o);break;case 22:i=o.stateNode,i._visibility&2&&(i._visibility&=-3,Dm(o));break;default:Dm(o)}n=n.sibling}}function NS(n,o){for(;bs!==null;){var i=bs;switch(i.tag){case 0:case 11:case 15:ai(8,i,o);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var d=i.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Vu(i.memoizedState.cache)}if(d=i.child,d!==null)d.return=i,bs=d;else e:for(i=n;bs!==null;){d=bs;var y=d.sibling,w=d.return;if(mS(d),d===i){bs=null;break e}if(y!==null){y.return=w,bs=y;break e}bs=w}}}var jD={getCacheForType:function(n){var o=Ns(Wn),i=o.data.get(n);return i===void 0&&(i=n(),o.data.set(n,i)),i},cacheSignal:function(){return Ns(Wn).controller.signal}},SD=typeof WeakMap=="function"?WeakMap:Map,nn=0,bn=null,qt=null,Kt=0,on=0,xr=null,li=!1,Sc=!1,Mb=!1,ma=0,$n=0,ci=0,ml=0,zm=0,br=0,Nc=0,od=null,er=null,Db=!1,Pm=0,CS=0,Im=1/0,_m=null,ui=null,In=0,fo=null,hl=null,zo=0,zb=0,Pb=null,kS=null,Cc=null,kc=null,Tc=null,ad=0,Lm=null;function yr(){return(nn&2)!==0&&Kt!==0?Kt&-Kt:ce.T!==null?Gb():Ar()}function TS(){if(br===0)if((Kt&536870912)===0||Vt){var n=rt;rt<<=1,(rt&3932160)===0&&(rt=262144),br=n}else br=536870912;return n=Cs.current,n!==null&&(n.flags|=32),br}function Ec(n,o){if(o!=null){var i=n.stateNode,d=i.ref;d===null&&(d=i.ref=iN(sa(n.memoizedProps,i))),kc===null&&(kc=[]),kc.push(o.bind(null,d))}}function tr(n,o,i){(n===bn&&(on===2||on===9)||n.cancelPendingCommit!==null)&&(Rc(n,0),di(n,Kt,br,!1)),hs(n,i),((nn&2)===0||n!==bn)&&(n===bn&&((nn&2)===0&&(ml|=i),$n===4&&di(n,Kt,br,!1)),Po(n))}function ES(n,o,i){if((nn&6)!==0)throw Error(a(327));var d=!i&&(o&127)===0&&(o&n.expiredLanes)===0||Mt(n,o),y=d?kD(n,o):_b(n,o,!0),w=d;do{if(y===0){Sc&&!d&&di(n,o,0,!1);break}else{if(i=n.current.alternate,w&&!ND(i)){y=_b(n,o,!1),w=!1;continue}if(y===2){if(w=o,n.errorRecoveryDisabledLanes&w)var z=0;else z=n.pendingLanes&-536870913,z=z!==0?z:z&536870912?536870912:0;if(z!==0){o=z;e:{var Y=n;y=od;var ie=Y.current.memoizedState.isDehydrated;if(ie&&(Rc(Y,z).flags|=256),z=_b(Y,z,!1),z!==2&&z!==6){if(Mb&&!ie){Y.errorRecoveryDisabledLanes|=w,ml|=w,y=4;break e}w=er,er=y,w!==null&&(er===null?er=w:er.push.apply(er,w))}y=z}if(w=!1,y!==2)continue}}if(y===1){Rc(n,0),di(n,o,0,!0);break}e:{switch(d=n,w=y,w){case 0:case 1:throw Error(a(345));case 4:if((o&4194048)!==o&&(o&62914560)!==o)break;case 6:di(d,o,br,!li);break e;case 2:er=null;break;case 3:case 5:break;default:throw Error(a(329))}if((o&62914560)===o&&(y=Pm+300-nt(),10<y)){if(di(d,o,br,!li),Pt(d,0,!0)!==0)break e;zo=o,d.timeoutHandle=n0(RS.bind(null,d,i,er,_m,Db,o,br,ml,Nc,li,w,"Throttled",-0,0),y);break e}RS(d,i,er,_m,Db,o,br,ml,Nc,li,w,null,-0,0)}}break}while(!0);Po(n)}function RS(n,o,i,d,y,w,z,Y,ie,ve,ke,ze,ge,Se){n.timeoutHandle=-1;var tt=o.subtreeFlags,ft=(w&335544064)===w;if(ze=null,(ft||tt&8192||(tt&16785408)===16785408)&&(ze={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Us},gr=null,wS(o,w,ze),ft&&(tt=ze,ft=n.containerInfo,ft=(ft.nodeType===9?ft:ft.ownerDocument).__reactViewTransition,ft!=null&&(tt.count++,tt.waitingForViewTransition=!0,tt=hd.bind(tt),ft.finished.then(tt,tt))),tt=(w&62914560)===w?Pm-nt():(w&4194048)===w?CS-nt():0,tt=Ez(ze,tt),tt!==null)){zo=w,n.cancelPendingCommit=tt(_S.bind(null,n,o,w,i,d,y,z,Y,ie,ve,ke,ze,null,ge,Se)),di(n,w,z,!ve);return}_S(n,o,w,i,d,y,z,Y,ie,ve,ke,ze)}function ND(n){for(var o=n;;){var i=o.tag;if((i===0||i===11||i===15)&&o.flags&16384&&(i=o.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var d=0;d<i.length;d++){var y=i[d],w=y.getSnapshot;y=y.value;try{if(!hr(w(),y))return!1}catch{return!1}}if(i=o.child,o.subtreeFlags&16384&&i!==null)i.return=o,o=i;else{if(o===n)break;for(;o.sibling===null;){if(o.return===null||o.return===n)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function di(n,o,i,d){o=Dn(n,o),o&=~zm,o&=~ml,n.suspendedLanes|=o,n.pingedLanes&=~o,d&&(n.warmLanes|=o),d=n.expirationTimes;for(var y=o;0<y;){var w=31-St(y),z=1<<w;d[w]=-1,y&=~z}i!==0&&$s(n,i,o)}function Bm(){return(nn&6)===0?(id(0),!1):!0}function Ib(){if(qt!==null){if(on===0)var n=qt.return;else n=qt,ia=tl=null,Fx(n),pc=null,Fu=0,n=qt;for(;n!==null;)Zj(n.alternate,n),n=n.return;qt=null}}function Rc(n,o){var i=n.timeoutHandle;return i!==-1&&(n.timeoutHandle=-1,KD(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),zo=0,Ib(),bn=n,qt=i=oa(n.current,null),Kt=o,on=0,xr=null,li=!1,Sc=Mt(n,o),Mb=!1,Nc=br=zm=ml=ci=$n=0,er=od=null,Db=!1,ma=Dn(n,o),Yf(),i}function AS(n,o){It=null,ce.H=bm,o===hc||o===rm?(o=_2(),on=3):o===Ox?(o=_2(),on=4):on=o===ob?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,xr=o,qt===null&&($n=1,ym(n,Dr(o,n.current)))}function OS(){var n=Cs.current;return n===null?!0:(Kt&4194048)===Kt?zs===null:(Kt&62914560)===Kt||(Kt&536870912)!==0?n===zs:!1}function MS(){var n=ce.H;return ce.H=bm,n===null?bm:n}function DS(){var n=ce.A;return ce.A=jD,n}function $m(){$n=4,li||(Kt&4194048)!==Kt&&Cs.current!==null||(Sc=!0),(ci&134217727)===0&&(ml&134217727)===0||bn===null||di(bn,Kt,br,!1)}function _b(n,o,i){var d=nn;nn|=2;var y=MS(),w=DS();(bn!==n||Kt!==o)&&(_m=null,Rc(n,o)),o=!1;var z=$n;e:do try{if(on!==0&&qt!==null){var Y=qt,ie=xr;switch(on){case 8:Ib(),z=6;break e;case 3:case 2:case 9:case 6:Cs.current===null&&(o=!0);var ve=on;if(on=0,xr=null,Ac(n,Y,ie,ve),i&&Sc){z=0;break e}break;default:ve=on,on=0,xr=null,Ac(n,Y,ie,ve)}}CD(),z=$n;break}catch(ke){AS(n,ke)}while(!0);return o&&n.shellSuspendCounter++,ia=tl=null,nn=d,ce.H=y,ce.A=w,qt===null&&(bn=null,Kt=0,Yf()),z}function CD(){for(;qt!==null;)zS(qt)}function kD(n,o){var i=nn;nn|=2;var d=MS(),y=DS();bn!==n||Kt!==o?(_m=null,Im=nt()+500,Rc(n,o)):Sc=Mt(n,o);e:do try{if(on!==0&&qt!==null){o=qt;var w=xr;t:switch(on){case 1:on=0,xr=null,Ac(n,o,w,1);break;case 2:case 9:if(P2(w)){on=0,xr=null,PS(o);break}o=function(){on!==2&&on!==9||bn!==n||(on=7),Po(n)},w.then(o,o);break e;case 3:on=7;break e;case 4:on=5;break e;case 7:P2(w)?(on=0,xr=null,PS(o)):(on=0,xr=null,Ac(n,o,w,7));break;case 5:var z=null;switch(qt.tag){case 26:z=qt.memoizedState;case 5:case 27:var Y=qt;if(z?kN(z):Y.stateNode.complete){on=0,xr=null;var ie=Y.sibling;if(ie!==null)qt=ie;else{var ve=Y.return;ve!==null?(qt=ve,Vm(ve)):qt=null}break t}}on=0,xr=null,Ac(n,o,w,5);break;case 6:on=0,xr=null,Ac(n,o,w,6);break;case 8:Ib(),$n=6;break e;default:throw Error(a(462))}}TD();break}catch(ke){AS(n,ke)}while(!0);return ia=tl=null,ce.H=d,ce.A=y,nn=i,qt!==null?0:(bn=null,Kt=0,Yf(),$n)}function TD(){for(;qt!==null&&!De();)zS(qt)}function zS(n){var o=Wj(n.alternate,n,ma);n.memoizedProps=n.pendingProps,o===null?Vm(n):qt=o}function PS(n){var o=n,i=o.alternate;switch(o.tag){case 15:case 0:o=Hj(i,o,o.pendingProps,o.type,void 0,Kt);break;case 11:o=Hj(i,o,o.pendingProps,o.type.render,o.ref,Kt);break;case 5:Fx(o);var d=o;d===gs&&(Vt?(Jf(d),d.tag===5&&d.stateNode!=null&&(jn=d.stateNode)):(Jf(d),Vt=!0));default:Zj(i,o),o=qt=N2(o,ma),o=Wj(i,o,ma)}n.memoizedProps=n.pendingProps,o===null?Vm(n):qt=o}function Ac(n,o,i,d){ia=tl=null,Fx(o),pc=null,Fu=0;var y=o.return;try{if(hD(n,y,o,i,Kt)){$n=1,ym(n,Dr(i,n.current)),qt=null;return}}catch(w){if(y!==null)throw qt=y,w;$n=1,ym(n,Dr(i,n.current)),qt=null;return}o.flags&32768?(Vt||d===1?n=!0:Sc||(Kt&536870912)!==0?n=!1:(li=n=!0,(d===2||d===9||d===3||d===6)&&(d=Cs.current,d!==null&&d.tag===13&&(d.flags|=16384))),IS(o,n)):Vm(o)}function Vm(n){var o=n;do{if((o.flags&32768)!==0){IS(o,li);return}n=o.return;var i=bD(o.alternate,o,ma);if(i!==null){qt=i;return}if(o=o.sibling,o!==null){qt=o;return}qt=o=n}while(o!==null);$n===0&&($n=5)}function IS(n,o){do{var i=yD(n.alternate,n);if(i!==null){i.flags&=32767,qt=i;return}if(i=n.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!o&&(n=n.sibling,n!==null)){qt=n;return}qt=n=i}while(n!==null);$n=6,qt=null}function _S(n,o,i,d,y,w,z,Y,ie,ve,ke,ze){n.cancelPendingCommit=null;do Um();while(In!==0);if((nn&6)!==0)throw Error(a(327));if(o!==null){if(o===n.current)throw Error(a(177));n===bn&&(qt=bn=null,Kt=0),hl=o,fo=n,zo=i,Pb=y,kS=d,ED(n,o,i,z,Y,ie,ze)}}function ED(n,o,i,d,y,w,z){var Y=o.lanes|o.childLanes;if(zb=Y,Y|=bx,Ms(n,i,Y,d,y,w),kc=null,(i&335544064)===i?(Tc=nD(n),d=10262):(Tc=null,d=10256),(o.subtreeFlags&d)!==0||(o.flags&d)!==0?(n.callbackNode=null,n.callbackPriority=0,zD(He,function(){return Vb(),null})):(n.callbackNode=null,n.callbackPriority=0),Tm=!1,d=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||d){d=ce.T,ce.T=null,y=oe.p,oe.p=2,w=nn,nn|=4;try{vD(n,o,i)}finally{nn=w,oe.p=y,ce.T=d}}In=1,Tm?Cc=ez(z,n.containerInfo,Tc,Lb,Bb,AD,$b,Vb,RD):(Lb(),Bb(),$b())}function RD(n){if(In!==0){var o=fo.onRecoverableError;o(n,{componentStack:null})}}function AD(){In===3&&(In=0,yS(hl,fo),In=4)}function Lb(){if(In===1){In=0;var n=fo,o=hl,i=zo,d=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||d){d=ce.T,ce.T=null;var y=oe.p;oe.p=2;var w=nn;nn|=4;try{nd=Am=!1,xS(o,n,i),i=Jb;var z=h2(n.containerInfo),Y=i.focusedElem,ie=i.selectionRange;if(z!==Y&&Y&&Y.ownerDocument&&m2(Y.ownerDocument.documentElement,Y)){if(ie!==null&&mx(Y)){var ve=ie.start,ke=ie.end;if(ke===void 0&&(ke=ve),"selectionStart"in Y)Y.selectionStart=ve,Y.selectionEnd=Math.min(ke,Y.value.length);else{var ze=Y.ownerDocument||document,ge=ze&&ze.defaultView||window;if(ge.getSelection){var Se=ge.getSelection(),tt=Y.textContent.length,ft=Math.min(ie.start,tt),_t=ie.end===void 0?ft:Math.min(ie.end,tt);!Se.extend&&ft>_t&&(z=_t,_t=ft,ft=z);var ye=f2(Y,ft),fe=f2(Y,_t);if(ye&&fe&&(Se.rangeCount!==1||Se.anchorNode!==ye.node||Se.anchorOffset!==ye.offset||Se.focusNode!==fe.node||Se.focusOffset!==fe.offset)){var je=ze.createRange();je.setStart(ye.node,ye.offset),Se.removeAllRanges(),ft>_t?(Se.addRange(je),Se.extend(fe.node,fe.offset)):(je.setEnd(fe.node,fe.offset),Se.addRange(je))}}}}for(ze=[],Se=Y;Se=Se.parentNode;)Se.nodeType===1&&ze.push({element:Se,left:Se.scrollLeft,top:Se.scrollTop});for(typeof Y.focus=="function"&&Y.focus(),Y=0;Y<ze.length;Y++){var Me=ze[Y];Me.element.scrollLeft=Me.left,Me.element.scrollTop=Me.top}}Lc=!!Zb,Jb=Zb=null}finally{nn=w,oe.p=y,ce.T=d}}n.current=o,In=2}}function Bb(){if(In===2){In=0;var n=fo,o=hl,i=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||i){i=ce.T,ce.T=null;var d=oe.p;oe.p=2;var y=nn;nn|=4;try{dS(n,o.alternate,o)}finally{nn=y,oe.p=d,ce.T=i}}In=3}}function $b(){if(In===4||In===3){In=0;var n=Cc;Cc=null,Oe();var o=fo,i=hl,d=zo,y=kS,w=(d&335544064)===d?10262:10256;if((i.subtreeFlags&w)!==0||(i.flags&w)!==0?In=5:(In=0,hl=fo=null,LS(o,o.pendingLanes)),w=o.pendingLanes,w===0&&(ui=null),Rr(d),i=i.stateNode,jt&&typeof jt.onCommitFiberRoot=="function")try{jt.onCommitFiberRoot(At,i,void 0,(i.current.flags&128)===128)}catch{}if(y!==null){i=ce.T,w=oe.p,oe.p=2,ce.T=null;try{for(var z=o.onRecoverableError,Y=0;Y<y.length;Y++){var ie=y[Y];z(ie.value,{componentStack:ie.stack})}}finally{ce.T=i,oe.p=w}}if(y=kc,z=Tc,Tc=null,y!==null&&(kc=null,z===null&&(z=[]),n!==null))for(ie=0;ie<y.length;ie++)i=(0,y[ie])(z),i!==void 0&&n.finished.finally(i);(zo&3)!==0&&Um(),Po(o),w=o.pendingLanes,(d&261930)!==0&&(w&42)!==0?o===Lm?ad++:(ad=0,Lm=o):(ad=0,Lm=null),id(0)}}function LS(n,o){(n.pooledCacheLanes&=o)===0&&(o=n.pooledCache,o!=null&&(n.pooledCache=null,Vu(o)))}function Um(){return Cc!==null&&(Cc.skipTransition(),Cc=null),Lb(),Bb(),$b(),Vb()}function Vb(){if(In!==5)return!1;var n=fo,o=zb;zb=0;var i=Rr(zo),d=ce.T,y=oe.p;try{oe.p=32>i?32:i,ce.T=null,i=Pb,Pb=null;var w=fo,z=zo;if(In=0,hl=fo=null,zo=0,(nn&6)!==0)throw Error(a(331));var Y=nn;if(nn|=4,SS(w.current),vS(w,w.current,z,i),nn=Y,id(0,!1),jt&&typeof jt.onPostCommitFiberRoot=="function")try{jt.onPostCommitFiberRoot(At,w)}catch{}return!0}finally{oe.p=y,ce.T=d,LS(n,o)}}function BS(n,o,i){o=Dr(i,o),o=rb(n.stateNode,o,2),n=ni(n,o,2),n!==null&&(hs(n,2),Po(n))}function an(n,o,i){if(n.tag===3)BS(n,n,i);else for(;o!==null;){if(o.tag===3){BS(o,n,i);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ui===null||!ui.has(d))){n=Dr(i,n),i=Pj(2),d=ni(o,i,2),d!==null&&(Ij(i,d,o,n),hs(d,2),Po(d));break}}o=o.return}}function Ub(n,o,i){var d=n.pingCache;if(d===null){d=n.pingCache=new SD;var y=new Set;d.set(o,y)}else y=d.get(o),y===void 0&&(y=new Set,d.set(o,y));y.has(i)||(Mb=!0,y.add(i),n=OD.bind(null,n,o,i),o.then(n,n))}function OD(n,o,i){var d=n.pingCache;d!==null&&d.delete(o),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,bn===n&&(Kt&i)===i&&(($n===4||$n===3&&(Kt&62914560)===Kt&&300>nt()-Pm)&&(nn&2)===0?Rc(n,0):zm|=i,Nc===Kt&&(Nc=0)),Po(n)}function $S(n,o){o===0&&(o=ms()),n=Zi(n,o),n!==null&&(hs(n,o),Po(n))}function MD(n){var o=n.memoizedState,i=0;o!==null&&(i=o.retryLane),$S(n,i)}function DD(n,o){var i=0;switch(n.tag){case 31:case 13:var d=n.stateNode,y=n.memoizedState;y!==null&&(i=y.retryLane);break;case 19:d=n.stateNode;break;case 22:d=n.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(o),$S(n,i)}function zD(n,o){return We(n,o)}var Oc=null,Mc=null,Hb=!1,Hm=!1,Fb=!1,fi=0;function Po(n){n!==Mc&&n.next===null&&(Mc===null?Oc=Mc=n:Mc=Mc.next=n),Hm=!0,Hb||(Hb=!0,ID())}function id(n,o){if(!Fb&&Hm){Fb=!0;do for(var i=!1,d=Oc;d!==null;){if(n!==0){var y=d.pendingLanes;if(y===0)var w=0;else{var z=d.suspendedLanes,Y=d.pingedLanes;w=(1<<31-St(42|n)+1)-1,w&=y&~(z&~Y),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(i=!0,FS(d,w))}else w=Kt,w=Pt(d,d===bn?w:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(w&3)===0||Mt(d,w)||(i=!0,FS(d,w));d=d.next}while(i);Fb=!1}}function PD(){VS()}function VS(){Hm=Hb=!1;var n=0;fi!==0&&YD()&&(n=fi);for(var o=nt(),i=null,d=Oc;d!==null;){var y=d.next,w=US(d,o);w===0?(d.next=null,i===null?Oc=y:i.next=y,y===null&&(Mc=i)):(i=d,(n!==0||(w&3)!==0)&&(Hm=!0)),d=y}In!==0&&In!==5||id(n),fi!==0&&(fi=0)}function US(n,o){for(var i=n.suspendedLanes,d=n.pingedLanes,y=n.expirationTimes,w=n.pendingLanes&-62914561;0<w;){var z=31-St(w),Y=1<<z,ie=y[z];ie===-1?((Y&i)===0||(Y&d)!==0)&&(y[z]=oo(Y,o)):ie<=o&&(n.expiredLanes|=Y),w&=~Y}if(o=bn,i=Kt,i=Pt(n,n===o?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d=n.callbackNode,i===0||n===o&&(on===2||on===9)||n.cancelPendingCommit!==null)return d!==null&&d!==null&&me(d),n.callbackNode=null,n.callbackPriority=0;if((i&3)===0||Mt(n,i)){if(o=i&-i,o===n.callbackPriority)return o;switch(d!==null&&me(d),Rr(i)){case 2:case 8:i=pe;break;case 32:i=He;break;case 268435456:i=ut;break;default:i=He}return d=HS.bind(null,n),i=We(i,d),n.callbackPriority=o,n.callbackNode=i,o}return d!==null&&d!==null&&me(d),n.callbackPriority=2,n.callbackNode=null,2}function HS(n,o){if(In!==0&&In!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(Um()&&n.callbackNode!==i)return null;var d=Kt;return d=Pt(n,n===bn?d:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d===0?null:(ES(n,d,o),US(n,nt()),n.callbackNode!=null&&n.callbackNode===i?HS.bind(null,n):null)}function FS(n,o){if(Um())return null;ES(n,o,!0)}function ID(){XD(function(){(nn&6)!==0?We(Ye,PD):VS()})}function Gb(){if(fi===0){var n=rl;n===0&&(n=Xe,Xe<<=1,(Xe&261888)===0&&(Xe=256)),fi=n}return fi}function GS(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:js(n)}function _D(n,o,i,d,y){if(o==="submit"&&i&&i.stateNode===y){var w=GS((y[ws]||null).action),z=d.submitter;z&&(o=(o=z[ws]||null)?GS(o.formAction):z.getAttribute("formAction"),o!==null&&(w=o,z=null));var Y=new Hf("action","action",null,d,y);n.push({event:Y,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(fi!==0){var ie=new FormData(y,z);Jx(i,{pending:!0,data:ie,method:y.method,action:w},null,ie)}}else typeof w=="function"&&(Y.preventDefault(),ie=new FormData(y,z),Jx(i,{pending:!0,data:ie,method:y.method,action:w},w,ie))},currentTarget:y}]})}}for(var qb=0;qb<xx.length;qb++){var Yb=xx[qb],LD=Yb.toLowerCase(),BD=Yb[0].toUpperCase()+Yb.slice(1);io(LD,"on"+BD)}io(x2,"onAnimationEnd"),io(b2,"onAnimationIteration"),io(y2,"onAnimationStart"),io("dblclick","onDoubleClick"),io("focusin","onFocus"),io("focusout","onBlur"),io(K4,"onTransitionRun"),io(X4,"onTransitionStart"),io(W4,"onTransitionCancel"),io(v2,"onTransitionEnd"),dn("onMouseEnter",["mouseout","mouseover"]),dn("onMouseLeave",["mouseout","mouseover"]),dn("onPointerEnter",["pointerout","pointerover"]),dn("onPointerLeave",["pointerout","pointerover"]),Bt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Bt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Bt("onBeforeInput",["compositionend","keypress","textInput","paste"]),Bt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Bt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Bt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ld="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(" "),$D=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ld));function qS(n,o){o=(o&4)!==0;for(var i=0;i<n.length;i++){var d=n[i],y=d.event;d=d.listeners;e:{var w=void 0;if(o)for(var z=d.length-1;0<=z;z--){var Y=d[z],ie=Y.instance,ve=Y.currentTarget;if(Y=Y.listener,ie!==w&&y.isPropagationStopped())break e;w=Y,y.currentTarget=ve;try{w(y)}catch(ke){qf(ke)}y.currentTarget=null,w=ie}else for(z=0;z<d.length;z++){if(Y=d[z],ie=Y.instance,ve=Y.currentTarget,Y=Y.listener,ie!==w&&y.isPropagationStopped())break e;w=Y,y.currentTarget=ve;try{w(y)}catch(ke){qf(ke)}y.currentTarget=null,w=ie}}}}function Yt(n,o){var i=o[ku];i===void 0&&(i=o[ku]=new Set);var d=n+"__bubble";i.has(d)||(YS(o,n,2,!1),i.add(d))}function Kb(n,o,i){var d=0;o&&(d|=4),YS(i,n,d,o)}var Fm="_reactListening"+Math.random().toString(36).slice(2);function Xb(n){if(!n[Fm]){n[Fm]=!0,Ot.forEach(function(i){i!=="selectionchange"&&($D.has(i)||Kb(i,!1,n),Kb(i,!0,n))});var o=n.nodeType===9?n:n.ownerDocument;o===null||o[Fm]||(o[Fm]=!0,Kb("selectionchange",!1,o))}}function YS(n,o,i,d){switch(IN(o)){case 2:var y=Mz;break;case 8:y=Dz;break;default:y=p0}i=y.bind(null,o,i,n),y=void 0,!Xi||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(y=!0),d?y!==void 0?n.addEventListener(o,i,{capture:!0,passive:y}):n.addEventListener(o,i,!0):y!==void 0?n.addEventListener(o,i,{passive:y}):n.addEventListener(o,i,!1)}function Wb(n,o,i,d,y){var w=d;if((o&1)===0&&(o&2)===0&&d!==null)e:for(;;){if(d===null)return;var z=d.tag;if(z===3||z===4){var Y=d.stateNode.containerInfo;if(Y===y)break;if(z===4)for(z=d.return;z!==null;){var ie=z.tag;if((ie===3||ie===4)&&z.stateNode.containerInfo===y)return;z=z.return}for(;Y!==null;){if(z=ao(Y),z===null)return;if(ie=z.tag,ie===5||ie===6||ie===26||ie===27){d=w=z;continue e}Y=Y.parentNode}}d=d.return}Ki(function(){var ve=w,ke=Yi(i),ze=[];e:{var ge=w2.get(n);if(ge!==void 0){var Se=Hf,tt=n;switch(n){case"keypress":if(Vf(i)===0)break e;case"keydown":case"keyup":Se=N4;break;case"focusin":tt="focus",Se=ix;break;case"focusout":tt="blur",Se=ix;break;case"beforeblur":case"afterblur":Se=ix;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Se=Ww;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Se=f4;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Se=R4;break;case x2:case b2:case y2:Se=p4;break;case v2:Se=O4;break;case"scroll":case"scrollend":Se=u4;break;case"wheel":Se=D4;break;case"copy":case"cut":case"paste":Se=x4;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Se=Zw;break;case"submit":Se=T4;break;case"toggle":case"beforetoggle":Se=P4}var ft=(o&4)!==0,_t=!ft&&(n==="scroll"||n==="scrollend"),ye=ft?ge!==null?ge+"Capture":null:ge;ft=[];for(var fe=ve,je;fe!==null;){var Me=fe;if(je=Me.stateNode,Me=Me.tag,Me!==5&&Me!==26&&Me!==27||je===null||ye===null||(Me=na(fe,ye),Me!=null&&ft.push(cd(fe,Me,je))),_t)break;fe=fe.return}0<ft.length&&(ge=new Se(ge,tt,null,i,ke),ze.push({event:ge,listeners:ft}))}}if((o&7)===0){e:{if(Se=n==="mouseover"||n==="pointerover",ge=n==="mouseout"||n==="pointerout",Se&&i!==qi&&(tt=i.relatedTarget||i.fromElement)&&(ao(tt)||tt[cr]))break e;(ge||Se)&&(tt=ke.window===ke?ke:(Se=ke.ownerDocument)?Se.defaultView||Se.parentWindow:window,ge?(Se=i.relatedTarget||i.toElement,ge=ve,Se=Se?ao(Se):null,Se!==null&&(_t=c(Se),ft=Se.tag,Se!==_t||ft!==5&&ft!==27&&ft!==6)&&(Se=null)):(ge=null,Se=ve),ge!==Se&&(ft=Ww,Me="onMouseLeave",ye="onMouseEnter",fe="mouse",(n==="pointerout"||n==="pointerover")&&(ft=Zw,Me="onPointerLeave",ye="onPointerEnter",fe="pointer"),_t=ge==null?tt:Ce(ge),je=Se==null?tt:Ce(Se),tt=new ft(Me,fe+"leave",ge,i,ke),tt.target=_t,tt.relatedTarget=je,Me=null,ao(ke)===ve&&(ft=new ft(ye,fe+"enter",Se,i,ke),ft.target=je,ft.relatedTarget=_t,Me=ft),_t=Me,ft=ge&&Se?M(ge,Se,VD):null,ge!==null&&KS(ze,tt,ge,ft,!1),Se!==null&&_t!==null&&KS(ze,_t,Se,ft,!0)))}e:{if(ge=ve?Ce(ve):window,Se=ge.nodeName&&ge.nodeName.toLowerCase(),Se==="select"||Se==="input"&&ge.type==="file")var ot=a2;else if(r2(ge))if(i2)ot=G4;else{ot=H4;var Xt=U4}else Se=ge.nodeName,!Se||Se.toLowerCase()!=="input"||ge.type!=="checkbox"&&ge.type!=="radio"?ve&&Gi(ve.elementType)&&(ot=a2):ot=F4;if(ot&&(ot=ot(n,ve))){o2(ze,ot,i,ke);break e}Xt&&Xt(n,ge,ve)}switch(Xt=ve?Ce(ve):window,n){case"focusin":(r2(Xt)||Xt.contentEditable==="true")&&(ac=Xt,hx=ve,Lu=null);break;case"focusout":Lu=hx=ac=null;break;case"mousedown":px=!0;break;case"contextmenu":case"mouseup":case"dragend":px=!1,p2(ze,i,ke);break;case"selectionchange":if(Y4)break;case"keydown":case"keyup":p2(ze,i,ke)}var xt;if(cx)e:{switch(n){case"compositionstart":var Ct="onCompositionStart";break e;case"compositionend":Ct="onCompositionEnd";break e;case"compositionupdate":Ct="onCompositionUpdate";break e}Ct=void 0}else oc?n2(n,i)&&(Ct="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(Ct="onCompositionStart");Ct&&(Jw&&i.locale!=="ko"&&(oc||Ct!=="onCompositionStart"?Ct==="onCompositionEnd"&&oc&&(xt=Kw()):(Ya=ke,rx="value"in Ya?Ya.value:Ya.textContent,oc=!0)),Xt=Gm(ve,Ct),0<Xt.length&&(Ct=new Qw(Ct,n,null,i,ke),ze.push({event:Ct,listeners:Xt}),xt?Ct.data=xt:(xt=s2(i),xt!==null&&(Ct.data=xt)))),(xt=_4?L4(n,i):B4(n,i))&&(Ct=Gm(ve,"onBeforeInput"),0<Ct.length&&(Xt=new Qw("onBeforeInput","beforeinput",null,i,ke),ze.push({event:Xt,listeners:Ct}),Xt.data=xt)),_D(ze,n,ve,i,ke)}qS(ze,o)})}function cd(n,o,i){return{instance:n,listener:o,currentTarget:i}}function Gm(n,o){for(var i=o+"Capture",d=[];n!==null;){var y=n,w=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||w===null||(y=na(n,i),y!=null&&d.unshift(cd(n,y,w)),y=na(n,o),y!=null&&d.push(cd(n,y,w))),n.tag===3)return d;n=n.return}return[]}function VD(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function KS(n,o,i,d,y){for(var w=o._reactName,z=[];i!==null&&i!==d;){var Y=i,ie=Y.alternate,ve=Y.stateNode;if(Y=Y.tag,ie!==null&&ie===d)break;Y!==5&&Y!==26&&Y!==27||ve===null||(ie=ve,y?(ve=na(i,w),ve!=null&&z.unshift(cd(i,ve,ie))):y||(ve=na(i,w),ve!=null&&z.push(cd(i,ve,ie)))),i=i.return}z.length!==0&&n.push({event:o,listeners:z})}var UD=/\r\n?/g,HD=/\u0000|\uFFFD/g;function XS(n){return(typeof n=="string"?n:""+n).replace(UD,`
50
- `).replace(HD,"")}function WS(n,o){return o=XS(o),XS(n)===o}function ln(n,o,i,d,y,w){switch(i){case"children":if(typeof d=="string")o==="body"||o==="textarea"&&d===""||Vs(n,d);else if(typeof d=="number"||typeof d=="bigint")o!=="body"&&Vs(n,""+d);else return;break;case"className":ur(n,"class",d);break;case"tabIndex":ur(n,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":ur(n,i,d);break;case"style":fr(n,d,w);return;case"data":if(o!=="object"){ur(n,"data",d);break}case"src":case"href":if(d===""&&(o!=="a"||i!=="href")){n.removeAttribute(i);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(i);break}d=js(d),n.setAttribute(i,d);break;case"action":case"formAction":if(typeof d=="function"){n.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof w=="function"&&(i==="formAction"?(o!=="input"&&ln(n,o,"name",y.name,y,null),ln(n,o,"formEncType",y.formEncType,y,null),ln(n,o,"formMethod",y.formMethod,y,null),ln(n,o,"formTarget",y.formTarget,y,null)):(ln(n,o,"encType",y.encType,y,null),ln(n,o,"method",y.method,y,null),ln(n,o,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(i);break}d=js(d),n.setAttribute(i,d);break;case"onClick":d!=null&&(n.onclick=Us);return;case"onScroll":d!=null&&Yt("scroll",n);return;case"onScrollEnd":d!=null&&Yt("scrollend",n);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(i=d.__html,i!=null){if(y.children!=null)throw Error(a(60));(w!=null?w.__html:void 0)!==i&&(n.innerHTML=i)}}break;case"multiple":n.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":n.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){n.removeAttribute("xlink:href");break}i=js(d),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,d):n.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,""):n.removeAttribute(i);break;case"capture":case"download":d===!0?n.setAttribute(i,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,d):n.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?n.setAttribute(i,d):n.removeAttribute(i);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?n.removeAttribute(i):n.setAttribute(i,d);break;case"popover":Yt("beforetoggle",n),Yt("toggle",n),Pn(n,"popover",d);break;case"xlinkActuate":Kn(n,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Kn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Kn(n,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Kn(n,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Kn(n,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Kn(n,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Kn(n,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Kn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Kn(n,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Pn(n,"is",d);break;case"innerText":case"textContent":return;default:if(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")i=Ru.get(i)||i,Pn(n,i,d);else return}vt=!0}function Qb(n,o,i,d,y,w){switch(i){case"style":fr(n,d,w);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(i=d.__html,i!=null){if(y.children!=null)throw Error(a(60));(w!=null?w.__html:void 0)!==i&&(n.innerHTML=i)}}break;case"children":if(typeof d=="string")Vs(n,d);else if(typeof d=="number"||typeof d=="bigint")Vs(n,""+d);else return;break;case"onScroll":d!=null&&Yt("scroll",n);return;case"onScrollEnd":d!=null&&Yt("scrollend",n);return;case"onClick":d!=null&&(n.onclick=Us);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!Tt.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(y=i.endsWith("Capture"),w=i.slice(2,y?i.length-7:void 0),o=n[ws]||null,o=o!=null?o[i]:null,typeof o=="function"&&n.removeEventListener(w,o,y),typeof d=="function")){typeof o!="function"&&o!==null&&(i in n?n[i]=null:n.hasAttribute(i)&&n.removeAttribute(i)),n.addEventListener(w,d,y);break e}vt=!0,i in n?n[i]=d:d===!0?n.setAttribute(i,""):Pn(n,i,d)}return}vt=!0}function Es(n,o,i){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Yt("error",n),Yt("load",n);var d=!1,y=!1,w;for(w in i)if(i.hasOwnProperty(w)){var z=i[w];if(z!=null)switch(w){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,o));default:ln(n,o,w,z,i,null)}}y&&ln(n,o,"srcSet",i.srcSet,i,null),d&&ln(n,o,"src",i.src,i,null);return;case"input":Yt("invalid",n);var Y=w=z=y=null,ie=null,ve=null;for(d in i)if(i.hasOwnProperty(d)){var ke=i[d];if(ke!=null)switch(d){case"name":y=ke;break;case"type":z=ke;break;case"checked":ie=ke;break;case"defaultChecked":ve=ke;break;case"value":w=ke;break;case"defaultValue":Y=ke;break;case"children":case"dangerouslySetInnerHTML":if(ke!=null)throw Error(a(137,o));break;default:ln(n,o,d,ke,i,null)}}Ga(n,w,Y,ie,ve,z,y,!1);return;case"select":Yt("invalid",n),d=z=w=null;for(y in i)if(i.hasOwnProperty(y)&&(Y=i[y],Y!=null))switch(y){case"value":w=Y;break;case"defaultValue":z=Y;break;case"multiple":d=Y;default:ln(n,o,y,Y,i,null)}o=w,i=z,n.multiple=!!d,o!=null?Ws(n,!!d,o,!1):i!=null&&Ws(n,!!d,i,!0);return;case"textarea":Yt("invalid",n),w=y=d=null;for(z in i)if(i.hasOwnProperty(z)&&(Y=i[z],Y!=null))switch(z){case"value":d=Y;break;case"defaultValue":y=Y;break;case"children":w=Y;break;case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(91));break;default:ln(n,o,z,Y,i,null)}dr(n,d,y,w);return;case"option":for(ie in i)if(i.hasOwnProperty(ie)&&(d=i[ie],d!=null))switch(ie){case"selected":n.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:ln(n,o,ie,d,i,null)}return;case"dialog":Yt("beforetoggle",n),Yt("toggle",n),Yt("cancel",n),Yt("close",n);break;case"iframe":case"object":Yt("load",n);break;case"video":case"audio":for(d=0;d<ld.length;d++)Yt(ld[d],n);break;case"image":Yt("error",n),Yt("load",n);break;case"details":Yt("toggle",n);break;case"embed":case"source":case"link":Yt("error",n),Yt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ve in i)if(i.hasOwnProperty(ve)&&(d=i[ve],d!=null))switch(ve){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,o));default:ln(n,o,ve,d,i,null)}return;default:if(Gi(o)){for(ke in i)i.hasOwnProperty(ke)&&(d=i[ke],d!==void 0&&Qb(n,o,ke,d,i,void 0));return}}for(Y in i)i.hasOwnProperty(Y)&&(d=i[Y],d!=null&&ln(n,o,Y,d,i,null))}var FD={};function GD(n,o,i,d){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,w=null,z=null,Y=null,ie=null,ve=null,ke=null;for(Se in i){var ze=i[Se];if(i.hasOwnProperty(Se)&&ze!=null)switch(Se){case"checked":break;case"value":break;case"defaultValue":ie=ze;default:d.hasOwnProperty(Se)||ln(n,o,Se,null,d,ze)}}for(var ge in d){var Se=d[ge];if(ze=i[ge],d.hasOwnProperty(ge)&&(Se!=null||ze!=null))switch(ge){case"type":Se!==ze&&(vt=!0),w=Se;break;case"name":Se!==ze&&(vt=!0),y=Se;break;case"checked":Se!==ze&&(vt=!0),ve=Se;break;case"defaultChecked":Se!==ze&&(vt=!0),ke=Se;break;case"value":Se!==ze&&(vt=!0),z=Se;break;case"defaultValue":Se!==ze&&(vt=!0),Y=Se;break;case"children":case"dangerouslySetInnerHTML":if(Se!=null)throw Error(a(137,o));break;default:Se!==ze&&ln(n,o,ge,Se,d,ze)}}Ds(n,z,Y,ie,ve,ke,w,y);return;case"select":Se=z=Y=ge=null;for(w in i)if(ie=i[w],i.hasOwnProperty(w)&&ie!=null)switch(w){case"value":break;case"multiple":Se=ie;default:d.hasOwnProperty(w)||ln(n,o,w,null,d,ie)}for(y in d)if(w=d[y],ie=i[y],d.hasOwnProperty(y)&&(w!=null||ie!=null))switch(y){case"value":w!==ie&&(vt=!0),ge=w;break;case"defaultValue":w!==ie&&(vt=!0),Y=w;break;case"multiple":w!==ie&&(vt=!0),z=w;default:w!==ie&&ln(n,o,y,w,d,ie)}o=Y,i=z,d=Se,ge!=null?Ws(n,!!i,ge,!1):!!d!=!!i&&(o!=null?Ws(n,!!i,o,!0):Ws(n,!!i,i?[]:"",!1));return;case"textarea":Se=ge=null;for(Y in i)if(y=i[Y],i.hasOwnProperty(Y)&&y!=null&&!d.hasOwnProperty(Y))switch(Y){case"value":break;case"children":break;default:ln(n,o,Y,null,d,y)}for(z in d)if(y=d[z],w=i[z],d.hasOwnProperty(z)&&(y!=null||w!=null))switch(z){case"value":y!==w&&(vt=!0),ge=y;break;case"defaultValue":y!==w&&(vt=!0),Se=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==w&&ln(n,o,z,y,d,w)}rc(n,ge,Se);return;case"option":for(var tt in i)if(ge=i[tt],i.hasOwnProperty(tt)&&ge!=null&&!d.hasOwnProperty(tt))switch(tt){case"selected":n.selected=!1;break;default:ln(n,o,tt,null,d,ge)}for(ie in d)if(ge=d[ie],Se=i[ie],d.hasOwnProperty(ie)&&ge!==Se&&(ge!=null||Se!=null))switch(ie){case"selected":ge!==Se&&(vt=!0),n.selected=ge&&typeof ge!="function"&&typeof ge!="symbol";break;default:ln(n,o,ie,ge,d,Se)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ft in i)ge=i[ft],i.hasOwnProperty(ft)&&ge!=null&&!d.hasOwnProperty(ft)&&ln(n,o,ft,null,d,ge);for(ve in d)if(ge=d[ve],Se=i[ve],d.hasOwnProperty(ve)&&ge!==Se&&(ge!=null||Se!=null))switch(ve){case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(a(137,o));break;default:ln(n,o,ve,ge,d,Se)}return;default:if(Gi(o)){for(var _t in i)ge=i[_t],i.hasOwnProperty(_t)&&ge!==void 0&&!d.hasOwnProperty(_t)&&Qb(n,o,_t,void 0,d,ge);for(ke in d)ge=d[ke],Se=i[ke],!d.hasOwnProperty(ke)||ge===Se||ge===void 0&&Se===void 0||Qb(n,o,ke,ge,d,Se);return}}for(var ye in i)ge=i[ye],i.hasOwnProperty(ye)&&ge!=null&&!d.hasOwnProperty(ye)&&ln(n,o,ye,null,d,ge);for(ze in d)ge=d[ze],Se=i[ze],!d.hasOwnProperty(ze)||ge===Se||ge==null&&Se==null||ln(n,o,ze,ge,d,Se)}function QS(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function qD(){if(typeof performance.getEntriesByType=="function"){for(var n=0,o=0,i=performance.getEntriesByType("resource"),d=0;d<i.length;d++){var y=i[d],w=y.transferSize,z=y.initiatorType,Y=y.duration;if(w&&Y&&QS(z)){for(z=0,Y=y.responseEnd,d+=1;d<i.length;d++){var ie=i[d],ve=ie.startTime;if(ve>Y)break;var ke=ie.transferSize,ze=ie.initiatorType;ke&&QS(ze)&&(ie=ie.responseEnd,z+=ke*(ie<Y?1:(Y-ve)/(ie-ve)))}if(--d,o+=8*(w+z)/(y.duration/1e3),n++,10<n)break}}if(0<n)return o/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Zb=null,Jb=null;function ud(n){return n.nodeType===9?n:n.ownerDocument}function ZS(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function JS(n,o){if(n===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&o==="foreignObject"?0:n}function eN(n,o,i,d){return i=ud(i).createElement(n),i[zn]=d,i[ws]=o,Es(i,n,o),Fe(i),i}function e0(n,o){return n==="textarea"||n==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var t0=null;function YD(){var n=window.event;return n&&n.type==="popstate"?n===t0?!1:(t0=n,!0):(t0=null,!1)}var n0=typeof setTimeout=="function"?setTimeout:void 0,KD=typeof clearTimeout=="function"?clearTimeout:void 0,tN=typeof Promise=="function"?Promise:void 0,nN=typeof requestAnimationFrame=="function"?requestAnimationFrame:n0,XD=typeof queueMicrotask=="function"?queueMicrotask:typeof tN<"u"?function(n){return tN.resolve(null).then(n).catch(WD)}:n0;function WD(n){setTimeout(function(){throw n})}function mi(n){return n==="head"}function sN(n,o){var i=o,d=0;do{var y=i.nextSibling;if(n.removeChild(i),y&&y.nodeType===8)if(i=y.data,i==="/$"||i==="/&"){if(d===0){n.removeChild(y),Bc(o);return}d--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")d++;else if(i==="html")u0(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,u0(i);for(var w=i.firstChild;w;){var z=w.nextSibling,Y=w.nodeName;w[Hi]||Y==="SCRIPT"||Y==="STYLE"||Y==="LINK"&&w.rel.toLowerCase()==="stylesheet"||i.removeChild(w),w=z}}else i==="body"&&u0(n.ownerDocument.body);i=y}while(i);Bc(o)}function rN(n,o){var i=n;n=0;do{var d=i.nextSibling;if(i.nodeType===1?o?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(o?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),d&&d.nodeType===8)if(i=d.data,i==="/$"){if(n===0)break;n--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||n++;i=d}while(i)}function oN(n,o,i){if(o=CSS.escape(o)!==o?"r-"+btoa(o).replace(/=/g,""):o,n.style.viewTransitionName=o,i!=null&&(n.style.viewTransitionClass=i),i=getComputedStyle(n),i.display==="inline"){if(o=n.getClientRects(),o.length===1)var d=1;else for(var y=d=0;y<o.length;y++){var w=o[y];0<w.width&&0<w.height&&d++}d===1&&(n=n.style,n.display=o.length===1?"inline-block":"block",n.marginTop="-"+i.paddingTop,n.marginBottom="-"+i.paddingBottom)}}function aN(n,o){n=n.style,o=o.style;var i=o!=null?o.hasOwnProperty("viewTransitionName")?o.viewTransitionName:o.hasOwnProperty("view-transition-name")?o["view-transition-name"]:null:null;n.viewTransitionName=i==null||typeof i=="boolean"?"":(""+i).trim(),i=o!=null?o.hasOwnProperty("viewTransitionClass")?o.viewTransitionClass:o.hasOwnProperty("view-transition-class")?o["view-transition-class"]:null:null,n.viewTransitionClass=i==null||typeof i=="boolean"?"":(""+i).trim(),n.display==="inline-block"&&(o==null?n.display=n.margin="":(i=o.display,n.display=i==null||typeof i=="boolean"?"":i,i=o.margin,i!=null?n.margin=i:(i=o.hasOwnProperty("marginTop")?o.marginTop:o["margin-top"],n.marginTop=i==null||typeof i=="boolean"?"":i,o=o.hasOwnProperty("marginBottom")?o.marginBottom:o["margin-bottom"],n.marginBottom=o==null||typeof o=="boolean"?"":o)))}function QD(n,o,i){return i=i.ownerDocument.defaultView,{rect:n,abs:o.position==="absolute"||o.position==="fixed",clip:o.clipPath!=="none"||o.overflow!=="visible"||o.filter!=="none"||o.mask!=="none"||o.mask!=="none"||o.borderRadius!=="0px",view:0<=n.bottom&&0<=n.right&&n.top<=i.innerHeight&&n.left<=i.innerWidth}}function s0(n){var o=n.getBoundingClientRect(),i=getComputedStyle(n);return QD(o,i,n)}function ZD(n){return n.documentElement.clientHeight}function JD(n){this.addEventListener("load",n),this.addEventListener("error",n)}function ez(n,o,i,d,y,w,z,Y,ie){var ve=o.nodeType===9?o:o.ownerDocument;try{var ke=ve.startViewTransition({update:function(){var ge=ve.defaultView,Se=ge.navigation&&ge.navigation.transition,tt=ve.fonts.status;d();var ft=[];if(tt==="loaded"&&(ZD(ve),ve.fonts.status==="loading"&&ft.push(ve.fonts.ready)),tt=ft.length,n!==null)for(var _t=n.suspenseyImages,ye=0,fe=0;fe<_t.length;fe++){var je=_t[fe];if(!je.complete){var Me=je.getBoundingClientRect();if(0<Me.bottom&&0<Me.right&&Me.top<ge.innerHeight&&Me.left<ge.innerWidth){if(ye+=TN(je),ye>Km){ft.length=tt;break}je=new Promise(JD.bind(je)),ft.push(je)}}}if(0<ft.length)return ge=Promise.race([Promise.all(ft),new Promise(function(ot){return setTimeout(ot,500)})]).then(y,y),(Se?Promise.allSettled([Se.finished,ge]):ge).then(w,w);if(y(),Se)return Se.finished.then(w,w);w()},types:i});ve.__reactViewTransition=ke;var ze=[];return ke.ready.then(function(){for(var ge=ve.documentElement.getAnimations({subtree:!0}),Se=0;Se<ge.length;Se++){var tt=ge[Se],ft=tt.effect,_t=ft.pseudoElement;if(_t!=null&&_t.startsWith("::view-transition")){ze.push(tt),tt=ft.getKeyframes();for(var ye=_t=void 0,fe=!0,je=0;je<tt.length;je++){var Me=tt[je],ot=Me.width;if(_t===void 0)_t=ot;else if(_t!==ot){fe=!1;break}if(ot=Me.height,ye===void 0)ye=ot;else if(ye!==ot){fe=!1;break}delete Me.width,delete Me.height,Me.transform==="none"&&delete Me.transform}fe&&_t!==void 0&&ye!==void 0&&(ft.setKeyframes(tt),fe=getComputedStyle(ft.target,ft.pseudoElement),fe.width!==_t||fe.height!==ye)&&(fe=tt[0],fe.width=_t,fe.height=ye,fe=tt[tt.length-1],fe.width=_t,fe.height=ye,ft.setKeyframes(tt))}}z()},function(ge){ve.__reactViewTransition===ke&&(ve.__reactViewTransition=null);try{if(typeof ge=="object"&&ge!==null)switch(ge.name){case"InvalidStateError":(ge.message==="View transition was skipped because document visibility state is hidden."||ge.message==="Skipping view transition because document visibility state has become hidden."||ge.message==="Skipping view transition because viewport size changed."||ge.message==="Transition was aborted because of invalid state")&&(ge=null)}ge!==null&&ie(ge)}finally{d(),y(),z()}}),ke.finished.finally(function(){for(var ge=0;ge<ze.length;ge++)ze[ge].cancel();ve.__reactViewTransition===ke&&(ve.__reactViewTransition=null),Y()}),ke}catch{return d(),y(),z(),null}}function pl(n,o){this._scope=document.documentElement,this._selector="::view-transition-"+n+"("+o+")"}pl.prototype.animate=function(n,o){return o=typeof o=="number"?{duration:o}:R({},o),o.pseudoElement=this._selector,this._scope.animate(n,o)},pl.prototype.getAnimations=function(){for(var n=this._scope,o=this._selector,i=n.getAnimations({subtree:!0}),d=[],y=0;y<i.length;y++){var w=i[y].effect;w!==null&&w.target===n&&w.pseudoElement===o&&d.push(i[y])}return d},pl.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function iN(n){return{name:n,group:new pl("group",n),imagePair:new pl("image-pair",n),old:new pl("old",n),new:new pl("new",n)}}function vr(n){this._fragmentFiber=n,this._observers=this._eventListeners=null}vr.prototype.addEventListener=function(n,o,i){var d=null,y=null;if(!(i!=null&&typeof i!="boolean"&&(d=i.signal||null,d!==null&&d.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var w=this._eventListeners;if(cN(w,n,o,i)===-1){var z=this,Y=o;i!=null&&typeof i!="boolean"&&i.once===!0&&(Y=function(ie){z.removeEventListener(n,o,i),typeof o=="function"?o.call(this,ie):o.handleEvent(ie)}),d!==null&&(y=z.removeEventListener.bind(z,n,o,i),d.addEventListener("abort",y,{once:!0}),y=d.removeEventListener.bind(d,"abort",y)),d=Dc(i),w.push({type:n,listener:o,optionsOrUseCapture:i,attachedListener:Y,cleanup:y}),p(this._fragmentFiber.child,!1,tz,n,Y,d)}this._eventListeners=w}};function tz(n,o,i,d){return C(n).addEventListener(o,i,d),!1}vr.prototype.removeEventListener=function(n,o,i){var d=this._eventListeners;if(d!==null&&(o=cN(d,n,o,i),o!==-1)){var y=d[o];i=y.attachedListener;var w=y.cleanup;y=Dc(y.optionsOrUseCapture),p(this._fragmentFiber.child,!1,nz,n,i,y),d.splice(o,1),w!==null&&w()}};function nz(n,o,i,d){return C(n).removeEventListener(o,i,d),!1}function Dc(n){return n!=null&&typeof n!="boolean"&&(n.once===!0||n.signal instanceof AbortSignal)?{capture:n.capture,passive:n.passive}:n}function lN(n){return n==null?"c=0":typeof n=="boolean"?"c="+(n?"1":"0"):"c="+(n.capture?"1":"0")}function cN(n,o,i,d){if(n.length===0)return-1;d=lN(d);for(var y=0;y<n.length;y++){var w=n[y];if(w.type===o&&w.listener===i&&lN(w.optionsOrUseCapture)===d)return y}return-1}vr.prototype.dispatchEvent=function(n){var o=b(this._fragmentFiber);if(o===null)return!0;o=C(o);var i=this._eventListeners;if(i!==null&&0<i.length||!n.bubbles){var d=o.nodeType===9?o.createComment(""):document.createTextNode("");if(i)for(var y=0;y<i.length;y++){var w=i[y];d.addEventListener(w.type,w.attachedListener,Dc(w.optionsOrUseCapture))}if(o.appendChild(d),n=d.dispatchEvent(n),i)for(y=0;y<i.length;y++)w=i[y],d.removeEventListener(w.type,w.attachedListener,Dc(w.optionsOrUseCapture));return o.removeChild(d),n}return o.dispatchEvent(n)},vr.prototype.focus=function(n){p(this._fragmentFiber.child,!0,uN,n,void 0,void 0)};function uN(n,o){return n.tag===6?!1:(n=C(n),hz(n,o))}vr.prototype.focusLast=function(n){var o=[];p(this._fragmentFiber.child,!0,r0,o,void 0,void 0);for(var i=o.length-1;0<=i&&!uN(o[i],n);i--);};function r0(n,o){return o.push(n),!1}vr.prototype.blur=function(){var n=b(this._fragmentFiber);n!==null&&(n=C(n),n=ud(n).activeElement,n!==null&&p(this._fragmentFiber.child,!1,sz,n,void 0,void 0))};function sz(n,o){return n.tag===6?!1:(n=C(n),n===o||n.contains(o)?(o.blur(),!0):!1)}vr.prototype.observeUsing=function(n){this._observers===null&&(this._observers=new Set),this._observers.add(n),p(this._fragmentFiber.child,!1,rz,n,void 0,void 0)};function rz(n,o){return n.tag===6||(n=C(n),o.observe(n)),!1}vr.prototype.unobserveUsing=function(n){var o=this._observers;if(o!==null&&o.has(n)){o.delete(n),p(this._fragmentFiber.child,!1,oz,n,void 0,void 0);for(var i=o=0;i<mo.length;i++){var d=mo[i];d.fragmentInstance===this&&d.observer===n?n.unobserve(d.instance):mo[o++]=d}mo.length=o}};function oz(n,o){return n.tag===6||(n=C(n),o.unobserve(n)),!1}var mo=[],o0=!1;function az(n,o,i){mo.push({fragmentInstance:n,observer:o,instance:i}),o0||(o0=!0,pz(function(){o0=!1;var d=mo;mo=[];for(var y=0;y<d.length;y++){var w=d[y];w.observer.unobserve(w.instance)}}))}vr.prototype.getClientRects=function(){var n=[];return p(this._fragmentFiber.child,!1,iz,n,void 0,void 0),n};function iz(n,o){if(n.tag===6){n=n.stateNode;var i=n.ownerDocument.createRange();i.selectNodeContents(n),o.push.apply(o,i.getClientRects())}else n=C(n),o.push.apply(o,n.getClientRects());return!1}vr.prototype.getRootNode=function(n){var o=b(this._fragmentFiber);return o===null?this:C(o).getRootNode(n)},vr.prototype.compareDocumentPosition=function(n){var o=b(this._fragmentFiber);if(o===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var i=[];p(this._fragmentFiber.child,!1,r0,i,void 0,void 0);var d=C(o);if(i.length===0){if(i=d,v(this._fragmentFiber)){e:{for(o=this._fragmentFiber.return;o!==null;){if(o.tag===4){o=o.stateNode.containerInfo;break e}if(o.tag===3||o.tag===5||o.tag===27)break;o=o.return}o=null}o!=null&&(i=o)}o=this._fragmentFiber;var y=d=i.compareDocumentPosition(n);return i===n?y=Node.DOCUMENT_POSITION_CONTAINS:d&Node.DOCUMENT_POSITION_CONTAINED_BY&&(i=j(o)[1],i===null?y=Node.DOCUMENT_POSITION_PRECEDING:(n=C(i).compareDocumentPosition(n),y=n===0||n&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),y|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}o=C(i[0]),y=C(i[i.length-1]);var w=v(this._fragmentFiber)?o.parentElement:d;if(w==null)return Node.DOCUMENT_POSITION_DISCONNECTED;d=w.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_CONTAINED_BY,w=w.compareDocumentPosition(y)&Node.DOCUMENT_POSITION_CONTAINED_BY;var z=o.compareDocumentPosition(n),Y=y.compareDocumentPosition(n),ie=z&Node.DOCUMENT_POSITION_CONTAINED_BY||Y&Node.DOCUMENT_POSITION_CONTAINED_BY;return Y=d&&w&&z&Node.DOCUMENT_POSITION_FOLLOWING&&Y&Node.DOCUMENT_POSITION_PRECEDING,o=d&&o===n||w&&y===n||ie||Y?Node.DOCUMENT_POSITION_CONTAINED_BY:!d&&o===n||!w&&y===n?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:z,o&Node.DOCUMENT_POSITION_DISCONNECTED||o&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||lz(o,this._fragmentFiber,i[0],i[i.length-1],n)?o:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function lz(n,o,i,d,y){var w=ao(y);if(n&Node.DOCUMENT_POSITION_CONTAINED_BY){if(i=!!w)e:{for(;w!==null;){if(w.tag===7&&(w===o||w.alternate===o)){i=!0;break e}w=w.return}i=!1}return i}if(n&Node.DOCUMENT_POSITION_CONTAINS){if(w===null)return w=y.ownerDocument,y===w||y===w.documentElement||y===w.body;e:{for(w=o,o=b(o);w!==null;){if(!(w.tag!==5&&w.tag!==3&&w.tag!==27||w!==o&&w.alternate!==o)){w=!0;break e}w=w.return}w=!1}return w}return n&Node.DOCUMENT_POSITION_PRECEDING?((o=!!w)&&!(o=w===i)&&(o=M(i,w,k),o===null?o=!1:(p(o,!0,T,w,i),w=N,N=null,o=w!==null)),o):n&Node.DOCUMENT_POSITION_FOLLOWING?((o=!!w)&&!(o=w===d)&&(o=M(d,w,k),o===null?o=!1:(p(o,!0,A,w,d),w=N,E=N=null,o=w!==null)),o):!1}function dN(n,o){var i=n.ownerDocument.createRange();i.selectNodeContents(n),n=i.getBoundingClientRect(),window.scrollTo(window.scrollX+n.left,o?window.scrollY+n.top:window.scrollY+n.bottom-window.innerHeight)}vr.prototype.scrollIntoView=function(n){if(typeof n=="object")throw Error(a(566));var o=[];p(this._fragmentFiber.child,!1,r0,o,void 0,void 0);var i=n!==!1;if(o.length===0){var d=j(this._fragmentFiber);if(d=i?d[1]||d[0]||b(this._fragmentFiber):d[0]||d[1],d===null)return;if(d.tag===6){n=C(d),dN(n,i);return}if(d=C(d),d.nodeType!==9){if(d.nodeType===11){i="host"in d?d.host:null,i!==null&&i.scrollIntoView(n);return}d.scrollIntoView(n)}}for(d=i?o.length-1:0;d!==(i?-1:o.length);){var y=o[d];y.tag===6?(y=C(y),dN(y,i)):C(y).scrollIntoView(n),d+=i?-1:1}};function cz(n,o){return n=C(n),fN(n,o),!1}function fN(n,o){n.reactFragments==null&&(n.reactFragments=new Set),n.reactFragments.add(o)}function mN(n,o){var i=o._eventListeners;if(i!==null)for(var d=0;d<i.length;d++){var y=i[d];n.addEventListener(y.type,y.attachedListener,Dc(y.optionsOrUseCapture))}n.nodeType!==3&&(i=o._observers,i!==null&&i.forEach(function(w){for(var z=0,Y=0;Y<mo.length;Y++){var ie=mo[Y];(ie.fragmentInstance!==o||ie.observer!==w||ie.instance!==n)&&(mo[z++]=ie)}mo.length=z,w.observe(n)}),fN(n,o))}function uz(n,o){var i=o._eventListeners;if(i!==null)for(var d=0;d<i.length;d++){var y=i[d];n.removeEventListener(y.type,y.attachedListener,Dc(y.optionsOrUseCapture))}n.nodeType!==3&&(i=o._observers,i!==null&&i.forEach(function(w){typeof w.rootMargin=="string"?az(o,w,n):w.unobserve(n)}),n.reactFragments!=null&&n.reactFragments.delete(o))}function a0(n){var o=n.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var i=o;switch(o=o.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":a0(i),ec(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function dz(n,o,i,d){for(;n.nodeType===1;){var y=i;if(n.nodeName.toLowerCase()!==o.toLowerCase()){if(!d&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(d){if(!n[Hi])switch(o){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(w=n.getAttribute("rel"),w==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(w!==y.rel||n.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||n.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||n.getAttribute("title")!==(y.title==null?null:y.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(w=n.getAttribute("src"),(w!==(y.src==null?null:y.src)||n.getAttribute("type")!==(y.type==null?null:y.type)||n.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&w&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(o==="input"&&n.type==="hidden"){var w=y.name==null?null:""+y.name;if(y.type==="hidden"&&n.getAttribute("name")===w)return n}else return n;if(n=Lr(n.nextSibling),n===null)break}return null}function fz(n,o,i){if(o==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Lr(n.nextSibling),n===null))return null;return n}function hN(n,o){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=Lr(n.nextSibling),n===null))return null;return n}function i0(n){return n.data==="$?"||n.data==="$~"}function l0(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function mz(n,o){var i=n.ownerDocument;if(n.data==="$~")n._reactRetry=o;else if(n.data!=="$?"||i.readyState!=="loading")o();else{var d=function(){o(),i.removeEventListener("DOMContentLoaded",d)};i.addEventListener("DOMContentLoaded",d),n._reactRetry=d}}function Lr(n){for(;n!=null;n=n.nextSibling){var o=n.nodeType;if(o===1||o===3)break;if(o===8){if(o=n.data,o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"||o==="F!"||o==="F")break;if(o==="/$"||o==="/&")return null}}return n}var c0=null;function pN(n){n=n.nextSibling;for(var o=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(o===0)return Lr(n.nextSibling);o--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||o++}n=n.nextSibling}return null}function gN(n){n=n.previousSibling;for(var o=0;n;){if(n.nodeType===8){var i=n.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(o===0)return n;o--}else i!=="/$"&&i!=="/&"||o++}n=n.previousSibling}return null}function hz(n,o){function i(){d=!0}if(n.ownerDocument.activeElement===n)return!0;var d=!1;try{n.ownerDocument.addEventListener("focus",i,!0),(n.focus||HTMLElement.prototype.focus).call(n,o)}finally{n.ownerDocument.removeEventListener("focus",i,!0)}return d}function pz(n){nN(function(){nN(function(o){return n(o)})})}function xN(n,o,i){switch(o=ud(i),n){case"html":if(n=o.documentElement,!n)throw Error(a(452));return n;case"head":if(n=o.head,!n)throw Error(a(453));return n;case"body":if(n=o.body,!n)throw Error(a(454));return n;default:throw Error(a(451))}}function bN(n,o,i){for(var d in i){var y=i[d];i.hasOwnProperty(d)&&y!=null&&ln(n,o,d,null,FD,y)}i.dangerouslySetInnerHTML!=null&&(n.textContent=""),n.onclick===Us&&(n.onclick=null),ec(n)}function u0(n){for(var o=n.attributes;o.length;)n.removeAttributeNode(o[0]);ec(n)}var Br=new Map,yN=new Set;function dd(n){if(typeof n.getRootNode=="function"){var o=n.getRootNode();if(o.nodeType===9||o.nodeType===11)return o}return n.nodeType===9?n:n.ownerDocument}var ha=oe.d;oe.d={f:gz,r:xz,D:bz,C:yz,L:vz,m:wz,X:Sz,S:jz,M:Nz};function gz(){var n=ha.f(),o=Bm();return n||o}function xz(n){var o=Fi(n);o!==null&&o.tag===5&&o.type==="form"?wj(o):ha.r(n)}var zc=typeof document>"u"?null:document;function vN(n,o,i){var d=zc;if(d&&typeof o=="string"&&o){var y=kn(o);y='link[rel="'+n+'"][href="'+y+'"]',typeof i=="string"&&(y+='[crossorigin="'+i+'"]'),yN.has(y)||(yN.add(y),n={rel:n,crossOrigin:i,href:o},d.querySelector(y)===null&&(o=d.createElement("link"),Es(o,"link",n),Fe(o),d.head.appendChild(o)))}}function bz(n){ha.D(n),vN("dns-prefetch",n,null)}function yz(n,o){ha.C(n,o),vN("preconnect",n,o)}function vz(n,o,i){ha.L(n,o,i);var d=zc;if(d&&n&&o){var y='link[rel="preload"][as="'+kn(o)+'"]';o==="image"&&i&&i.imageSrcSet?(y+='[imagesrcset="'+kn(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(y+='[imagesizes="'+kn(i.imageSizes)+'"]')):y+='[href="'+kn(n)+'"]';var w=y;switch(o){case"style":w=Pc(n);break;case"script":w=Ic(n)}if(!(Br.has(w)||(n=R({rel:"preload",href:o==="image"&&i&&i.imageSrcSet?void 0:n,as:o},i),Br.set(w,n),d.querySelector(y)!==null||o==="style"&&d.querySelector(fd(w))||o==="script"&&d.querySelector(md(w))))){var z=d.createElement("link");Es(z,"link",n),o==="style"&&(z[Jl]=!0,z.onload=z.onerror=function(){gt(z)}),Fe(z),d.head.appendChild(z)}}}function wz(n,o){ha.m(n,o);var i=zc;if(i&&n){var d=o&&typeof o.as=="string"?o.as:"script",y='link[rel="modulepreload"][as="'+kn(d)+'"][href="'+kn(n)+'"]',w=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=Ic(n)}if(!Br.has(w)&&(n=R({rel:"modulepreload",href:n},o),Br.set(w,n),i.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(md(w)))return}d=i.createElement("link"),Es(d,"link",n),Fe(d),i.head.appendChild(d)}}}function jz(n,o,i){ha.S(n,o,i);var d=zc;if(d&&n){var y=Ve(d).hoistableStyles,w=Pc(n);o=o||"default";var z=y.get(w);if(!z){var Y={loading:0,preload:null};if(z=d.querySelector(fd(w)))Y.loading=5;else{n=R({rel:"stylesheet",href:n,"data-precedence":o},i),(i=Br.get(w))&&d0(n,i);var ie=z=d.createElement("link");Fe(ie),Es(ie,"link",n),ie._p=new Promise(function(ve,ke){ie.onload=ve,ie.onerror=ke}),ie.addEventListener("load",function(){Y.loading|=1}),ie.addEventListener("error",function(){Y.loading|=2}),Y.loading|=4,qm(z,o,d)}z={type:"stylesheet",instance:z,count:1,state:Y},y.set(w,z)}}}function Sz(n,o){ha.X(n,o);var i=zc;if(i&&n){var d=Ve(i).hoistableScripts,y=Ic(n),w=d.get(y);w||(w=i.querySelector(md(y)),w||(n=R({src:n,async:!0},o),(o=Br.get(y))&&f0(n,o),w=i.createElement("script"),Fe(w),Es(w,"link",n),i.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},d.set(y,w))}}function Nz(n,o){ha.M(n,o);var i=zc;if(i&&n){var d=Ve(i).hoistableScripts,y=Ic(n),w=d.get(y);w||(w=i.querySelector(md(y)),w||(n=R({src:n,async:!0,type:"module"},o),(o=Br.get(y))&&f0(n,o),w=i.createElement("script"),Fe(w),Es(w,"link",n),i.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},d.set(y,w))}}function wN(n,o,i,d){var y=(y=xe.current)?dd(y):null;if(!y)throw Error(a(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(i=Pc(i.href),o=Ve(y).hoistableStyles,d=o.get(i),d||(d={type:"style",instance:null,count:0,state:null},o.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=Pc(i.href);var w=Ve(y).hoistableStyles,z=w.get(n);if(z||(y=y.ownerDocument||y,z={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(n,z),(w=y.querySelector(fd(n)))?w._p||(z.instance=w,z.state.loading=5):(w=Br.get(n),w||(w={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Br.set(n,w)),Cz(y,n,w,z.state))),o&&d===null)throw Error(a(528,""));return z}if(o&&d!==null)throw Error(a(529,""));return null;case"script":return o=i.async,i=i.src,typeof i=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(i=Ic(i),o=Ve(y).hoistableScripts,d=o.get(i),d||(d={type:"script",instance:null,count:0,state:null},o.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,n))}}function Pc(n){return'href="'+kn(n)+'"'}function fd(n){return'link[rel="stylesheet"]['+n+"]"}function jN(n){return R({},n,{"data-precedence":n.precedence,precedence:null})}function Cz(n,o,i,d){if(o=n.querySelector('link[rel="preload"][as="style"]['+o+"]")){if(o[Jl]!==!0){d.loading=1;return}}else o=n.createElement("link"),o[Jl]=!0,o.onload=o.onerror=gt.bind(null,o),Es(o,"link",i),Fe(o),n.head.appendChild(o);d.preload=o,o.addEventListener("load",function(){return d.loading|=1}),o.addEventListener("error",function(){return d.loading|=2})}function Ic(n){return'[src="'+kn(n)+'"]'}function md(n){return"script[async]"+n}function SN(n,o,i){if(o.count++,o.instance===null)switch(o.type){case"style":var d=n.querySelector('style[data-href~="'+kn(i.href)+'"]');if(d)return o.instance=d,Fe(d),d;var y=R({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return d=(n.ownerDocument||n).createElement("style"),Fe(d),Es(d,"style",y),qm(d,i.precedence,n),o.instance=d;case"stylesheet":y=Pc(i.href);var w=n.querySelector(fd(y));if(w)return o.state.loading|=4,o.instance=w,Fe(w),w;d=jN(i),(y=Br.get(y))&&d0(d,y),w=(n.ownerDocument||n).createElement("link"),Fe(w);var z=w;return z._p=new Promise(function(Y,ie){z.onload=Y,z.onerror=ie}),Es(w,"link",d),o.state.loading|=4,qm(w,i.precedence,n),o.instance=w;case"script":return w=Ic(i.src),(y=n.querySelector(md(w)))?(o.instance=y,Fe(y),y):(d=i,(y=Br.get(w))&&(d=R({},i),f0(d,y)),n=n.ownerDocument||n,y=n.createElement("script"),Fe(y),Es(y,"link",d),n.head.appendChild(y),o.instance=y);case"void":return null;default:throw Error(a(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(d=o.instance,o.state.loading|=4,qm(d,i.precedence,n));return o.instance}function qm(n,o,i){for(var d=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,w=y,z=0;z<d.length;z++){var Y=d[z];if(Y.dataset.precedence===o)w=Y;else if(w!==y)break}w?w.parentNode.insertBefore(n,w.nextSibling):(o=i.nodeType===9?i.head:i,o.insertBefore(n,o.firstChild))}function d0(n,o){n.crossOrigin==null&&(n.crossOrigin=o.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=o.referrerPolicy),n.title==null&&(n.title=o.title)}function f0(n,o){n.crossOrigin==null&&(n.crossOrigin=o.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=o.referrerPolicy),n.integrity==null&&(n.integrity=o.integrity)}var Ym=null;function NN(n,o,i){if(Ym===null){var d=new Map,y=Ym=new Map;y.set(i,d)}else y=Ym,d=y.get(i),d||(d=new Map,y.set(i,d));if(d.has(n))return d;for(d.set(n,null),i=i.getElementsByTagName(n),y=0;y<i.length;y++){var w=i[y];if(!(w[Hi]||w[zn]||n==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var z=w.getAttribute(o)||"";z=n+z;var Y=d.get(z);Y?Y.push(w):d.set(z,[w])}}return d}function m0(n,o,i){n=n.ownerDocument||n,n.head.insertBefore(i,o==="title"?n.querySelector("head > title"):null)}function kz(n,o,i){if(i===1||o.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;switch(o.rel){case"stylesheet":return n=o.disabled,typeof o.precedence=="string"&&n==null;default:return!0}case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function CN(n,o){return n==="img"&&o.src!=null&&o.src!==""&&o.onLoad==null&&o.loading!=="lazy"}function kN(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function TN(n){return(n.width||100)*(n.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function EN(n,o){typeof o.decode=="function"&&(n.imgCount++,o.complete||(n.imgBytes+=TN(o),n.suspenseyImages.push(o)),n=Rz.bind(n),o.decode().then(n,n))}function Tz(n,o,i,d){if(i.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var y=Pc(d.href),w=o.querySelector(fd(y));if(w){o=w._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(n.count++,n=hd.bind(n),o.then(n,n)),i.state.loading|=4,i.instance=w,Fe(w);return}w=o.ownerDocument||o,d=jN(d),(y=Br.get(y))&&d0(d,y),w=w.createElement("link"),Fe(w);var z=w;z._p=new Promise(function(Y,ie){z.onload=Y,z.onerror=ie}),Es(w,"link",d),i.instance=w}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,o),(o=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=hd.bind(n),o.addEventListener("load",i),o.addEventListener("error",i))}}var Km=0;function Ez(n,o){return n.stylesheets&&n.count===0&&Wm(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var d=setTimeout(function(){if(n.stylesheets&&Wm(n,n.stylesheets),n.unsuspend){var w=n.unsuspend;n.unsuspend=null,w()}},6e4+o);0<n.imgBytes&&Km===0&&(Km=62500*qD());var y=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Wm(n,n.stylesheets),n.unsuspend)){var w=n.unsuspend;n.unsuspend=null,w()}},(n.imgBytes>Km?50:800)+o);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function RN(n){if(n.count===0&&(n.imgCount===0||!n.waitingForImages)){if(n.stylesheets)Wm(n,n.stylesheets);else if(n.unsuspend){var o=n.unsuspend;n.unsuspend=null,o()}}}function hd(){this.count--,RN(this)}function Rz(){this.imgCount--,RN(this)}var Xm=null;function Wm(n,o){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Xm=new Map,o.forEach(Az,n),Xm=null,hd.call(n))}function Az(n,o){if(!(o.state.loading&4)){var i=Xm.get(n);if(i)var d=i.get(null);else{i=new Map,Xm.set(n,i);for(var y=n.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<y.length;w++){var z=y[w];(z.nodeName==="LINK"||z.getAttribute("media")!=="not all")&&(i.set(z.dataset.precedence,z),d=z)}d&&i.set(null,d)}y=o.instance,z=y.getAttribute("data-precedence"),w=i.get(z)||d,w===d&&i.set(null,y),i.set(z,y),this.count++,d=hd.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),w?w.parentNode.insertBefore(y,w.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(y,n.firstChild)),o.state.loading|=4}}var _c={$$typeof:H,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function Oz(n,o,i,d,y,w,z,Y,ie){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Er(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Er(0),this.hiddenUpdates=Er(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=w,this.onRecoverableError=z,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ie,this.transitionTypes=null,this.incompleteTransitions=new Map}function AN(n,o,i,d,y,w,z,Y,ie,ve,ke,ze){return n=new Oz(n,o,i,z,ie,ve,ke,ze,Y),o=1,w===!0&&(o|=24),w=Qs(3,null,null,o),n.current=w,w.stateNode=n,o=Ex(),o.refCount++,n.pooledCache=o,o.refCount++,w.memoizedState={element:d,isDehydrated:i,cache:o},Mx(w),n}function ON(n){return n?(n=cc,n):cc}function MN(n,o,i,d,y,w){y=ON(y),d.context===null?d.context=y:d.pendingContext=y,d=ti(o),d.payload={element:i},w=w===void 0?null:w,w!==null&&(d.callback=w),i=ni(n,d,o),i!==null&&(tr(i,n,o),Gu(i,n,o))}function DN(n,o){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<o?i:o}}function h0(n,o){DN(n,o),(n=n.alternate)&&DN(n,o)}function zN(n){if(n.tag===13||n.tag===31){var o=Zi(n,67108864);o!==null&&tr(o,n,67108864),h0(n,67108864)}}function PN(n){if(n.tag===13||n.tag===31){var o=yr();o=Ha(o);var i=Zi(n,o);i!==null&&tr(i,n,o),h0(n,o)}}var Lc=!0;function Mz(n,o,i,d){var y=ce.T;ce.T=null;var w=oe.p;try{oe.p=2,p0(n,o,i,d)}finally{oe.p=w,ce.T=y}}function Dz(n,o,i,d){var y=ce.T;ce.T=null;var w=oe.p;try{oe.p=8,p0(n,o,i,d)}finally{oe.p=w,ce.T=y}}function p0(n,o,i,d){if(Lc){var y=g0(d);if(y===null)Wb(n,o,d,Qm,i),_N(n,d);else if(Pz(y,n,o,i,d))d.stopPropagation();else if(_N(n,d),o&4&&-1<zz.indexOf(n)){for(;y!==null;){var w=Fi(y);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var z=Mn(w.pendingLanes);if(z!==0){var Y=w;for(Y.pendingLanes|=2,Y.entangledLanes|=2;z;){var ie=1<<31-St(z);Y.entanglements[1]|=ie,z&=~ie}Po(w),(nn&6)===0&&(Im=nt()+500,id(0))}}break;case 31:case 13:Y=Zi(w,2),Y!==null&&tr(Y,w,2),Bm(),h0(w,2)}if(w=g0(d),w===null&&Wb(n,o,d,Qm,i),w===y)break;y=w}y!==null&&d.stopPropagation()}else Wb(n,o,d,null,i)}}function g0(n){return n=Yi(n),x0(n)}var Qm=null;function x0(n){if(Qm=null,n=ao(n),n!==null){var o=c(n);if(o===null)n=null;else{var i=o.tag;if(i===13){if(n=u(o),n!==null)return n;n=null}else if(i===31){if(n=f(o),n!==null)return n;n=null}else if(i===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;n=null}else o!==n&&(n=null)}}return Qm=n,null}function IN(n){switch(n){case"beforetoggle":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"seeked":case"submit":case"toggle":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"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Ge()){case Ye:return 2;case pe:return 8;case He:case Ie:return 32;case ut:return 268435456;default:return 32}default:return 32}}var b0=!1,hi=null,pi=null,gi=null,pd=new Map,gd=new Map,xi=[],zz="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".split(" ");function _N(n,o){switch(n){case"focusin":case"focusout":hi=null;break;case"dragenter":case"dragleave":pi=null;break;case"mouseover":case"mouseout":gi=null;break;case"pointerover":case"pointerout":pd.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":gd.delete(o.pointerId)}}function xd(n,o,i,d,y,w){return n===null||n.nativeEvent!==w?(n={blockedOn:o,domEventName:i,eventSystemFlags:d,nativeEvent:w,targetContainers:[y]},o!==null&&(o=Fi(o),o!==null&&zN(o)),n):(n.eventSystemFlags|=d,o=n.targetContainers,y!==null&&o.indexOf(y)===-1&&o.push(y),n)}function Pz(n,o,i,d,y){switch(o){case"focusin":return hi=xd(hi,n,o,i,d,y),!0;case"dragenter":return pi=xd(pi,n,o,i,d,y),!0;case"mouseover":return gi=xd(gi,n,o,i,d,y),!0;case"pointerover":var w=y.pointerId;return pd.set(w,xd(pd.get(w)||null,n,o,i,d,y)),!0;case"gotpointercapture":return w=y.pointerId,gd.set(w,xd(gd.get(w)||null,n,o,i,d,y)),!0}return!1}function LN(n){var o=ao(n.target);if(o!==null){var i=c(o);if(i!==null){if(o=i.tag,o===13){if(o=u(i),o!==null){n.blockedOn=o,Ui(n.priority,function(){PN(i)});return}}else if(o===31){if(o=f(i),o!==null){n.blockedOn=o,Ui(n.priority,function(){PN(i)});return}}else if(o===3&&i.stateNode.current.memoizedState.isDehydrated){n.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Zm(n){if(n.blockedOn!==null)return!1;for(var o=n.targetContainers;0<o.length;){var i=g0(n.nativeEvent);if(i===null){i=n.nativeEvent;var d=new i.constructor(i.type,i);qi=d,i.target.dispatchEvent(d),qi=null}else return o=Fi(i),o!==null&&zN(o),n.blockedOn=i,!1;o.shift()}return!0}function BN(n,o,i){Zm(n)&&i.delete(o)}function Iz(){b0=!1,hi!==null&&Zm(hi)&&(hi=null),pi!==null&&Zm(pi)&&(pi=null),gi!==null&&Zm(gi)&&(gi=null),pd.forEach(BN),gd.forEach(BN)}function Jm(n,o){n.blockedOn===o&&(n.blockedOn=null,b0||(b0=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Iz)))}var eh=null;function $N(n){eh!==n&&(eh=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){eh===n&&(eh=null);for(var o=0;o<n.length;o+=3){var i=n[o],d=n[o+1],y=n[o+2];if(typeof d!="function"){if(x0(d||i)===null)continue;break}var w=Fi(i);w!==null&&(n.splice(o,3),o-=3,Jx(w,{pending:!0,data:y,method:i.method,action:d},d,y))}}))}function Bc(n){function o(ie){return Jm(ie,n)}hi!==null&&Jm(hi,n),pi!==null&&Jm(pi,n),gi!==null&&Jm(gi,n),pd.forEach(o),gd.forEach(o);for(var i=0;i<xi.length;i++){var d=xi[i];d.blockedOn===n&&(d.blockedOn=null)}for(;0<xi.length&&(i=xi[0],i.blockedOn===null);)LN(i),i.blockedOn===null&&xi.shift();if(i=(n.ownerDocument||n).$$reactFormReplay,i!=null)for(d=0;d<i.length;d+=3){var y=i[d],w=i[d+1],z=y[ws]||null;if(typeof w=="function")z||$N(i);else if(z){var Y=null;if(w&&w.hasAttribute("formAction")){if(y=w,z=w[ws]||null)Y=z.formAction;else if(x0(y)!==null)continue}else Y=z.action;typeof Y=="function"?i[d+1]=Y:(i.splice(d,3),d-=3),$N(i)}}}function VN(){function n(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(z){return y=z})},focusReset:"manual",scroll:"manual"})}function o(){y!==null&&(y(),y=null),d||setTimeout(i,20)}function i(){if(!d&&!navigation.transition){var w=navigation.currentEntry;w&&w.url!=null&&navigation.navigate(w.url,{state:w.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",o),navigation.addEventListener("navigateerror",o),setTimeout(i,100),function(){d=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",o),navigation.removeEventListener("navigateerror",o),y!==null&&(y(),y=null)}}}function y0(n){this._internalRoot=n}th.prototype.render=y0.prototype.render=function(n){var o=this._internalRoot;if(o===null)throw Error(a(409));var i=o.current,d=yr();MN(i,d,n,o,null,null)},th.prototype.unmount=y0.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var o=n.containerInfo;MN(n.current,2,null,n,null,null),Bm(),o[cr]=null}};function th(n){this._internalRoot=n}th.prototype.unstable_scheduleHydration=function(n){if(n){var o=Ar();n={blockedOn:null,target:n,priority:o};for(var i=0;i<xi.length&&o!==0&&o<xi[i].priority;i++);xi.splice(i,0,n),i===0&&LN(n)}};var UN=t.version;if(UN!=="19.3.0")throw Error(a(527,UN,"19.3.0"));oe.findDOMNode=function(n){var o=n._reactInternals;if(o===void 0)throw typeof n.render=="function"?Error(a(188)):(n=Object.keys(n).join(","),Error(a(268,n)));return n=h(o),n=n!==null?g(n):null,n=n===null?null:n.stateNode,n};var _z={bundleType:0,version:"19.3.0",rendererPackageName:"react-dom",currentDispatcherRef:ce,reconcilerVersion:"19.3.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var nh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nh.isDisabled&&nh.supportsFiber)try{At=nh.inject(_z),jt=nh}catch{}}return yd.createRoot=function(n,o){if(!l(n))throw Error(a(299));var i=!1,d="",y=Oj,w=Mj,z=Dj;return o!=null&&(o.unstable_strictMode===!0&&(i=!0),o.identifierPrefix!==void 0&&(d=o.identifierPrefix),o.onUncaughtError!==void 0&&(y=o.onUncaughtError),o.onCaughtError!==void 0&&(w=o.onCaughtError),o.onRecoverableError!==void 0&&(z=o.onRecoverableError)),o=AN(n,1,!1,null,null,i,d,null,y,w,z,VN),n[cr]=o.current,Xb(n),new y0(o)},yd.hydrateRoot=function(n,o,i){if(!l(n))throw Error(a(299));var d=!1,y="",w=Oj,z=Mj,Y=Dj,ie=null;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(y=i.identifierPrefix),i.onUncaughtError!==void 0&&(w=i.onUncaughtError),i.onCaughtError!==void 0&&(z=i.onCaughtError),i.onRecoverableError!==void 0&&(Y=i.onRecoverableError),i.formState!==void 0&&(ie=i.formState)),o=AN(n,1,!0,o,i??null,d,y,ie,w,z,Y,VN),o.context=ON(null),i=o.current,d=yr(),d=Ha(d),y=ti(d),y.callback=null,ni(i,y,d),i=d,o.current.lanes=i,hs(o,i),Po(o),n[cr]=o.current,Xb(n),new th(o)},yd.version="19.3.0",yd}var JN;function oP(){if(JN)return S0.exports;JN=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),S0.exports=rP(),S0.exports}var aP=oP();const iP="modulepreload",lP=function(e){return"/"+e},eC={},cP=function(t,r,a){let l=Promise.resolve();if(r&&r.length>0){let u=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));l=u(r.map(h=>{if(h=lP(h),h in eC)return;eC[h]=!0;const g=h.endsWith(".css"),p=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${p}`))return;const b=document.createElement("link");if(b.rel=g?"stylesheet":iP,g||(b.as="script"),b.crossOrigin="",b.href=h,m&&b.setAttribute("nonce",m),document.head.appendChild(b),g)return new Promise((v,j)=>{b.addEventListener("load",v),b.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function c(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return l.then(u=>{for(const f of u||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})},yR="openrod.compute-target";function uP(e,t){const r=new URL(e);if(r.hash.startsWith("#cloud-return="))return"local";const a=r.searchParams.get("target");if(a==="local"||a==="cloud")return a;try{return(t==null?void 0:t.getItem(yR))==="cloud"?"cloud":"local"}catch{return"local"}}function dP(e,t){if(!["local","cloud"].includes(e))throw new Error("Unknown compute target");return`${e==="cloud"?"/api/remote/os":"/api/os"}${t}`}let vR="local";const wR=()=>vR;function jR(e){if(!["local","cloud"].includes(e))throw new Error("Unknown compute target");vR=e}function fP(e,t){const r=t??null;return{uid:r,revision:e.revision+(e.uid&&e.uid!==r?1:0)}}let SR=null;const Ey=()=>SR;function tC(e){SR=typeof e=="string"&&/^[a-f0-9]{16}$/.test(e)?e:null}const Si="CONSOLE_TOKEN_REQUIRED";function Gr(e,t,r=null,a=Ey()){const l=()=>e??wR(),c=a;let u,f;const m=v=>dP(l(),v),h=v=>t&&v?AbortSignal.any([t,v]):t??v;async function g(){t==null||t.throwIfAborted();const v=await fetch(m("/context"),{signal:t,headers:l()==="cloud"&&c?{"x-openrod-local-owner":c}:void 0}),j=await v.json();if(t==null||t.throwIfAborted(),j.code===Si?window.dispatchEvent(new Event(Si)):(v.status===401||j.code==="CLOUD_OWNER_CHANGED")&&window.dispatchEvent(new Event("openrod-session-expired")),!v.ok)throw new Error(j.error??"Could not read gateway registrations.");return u??(u=JSON.stringify([j.gateway,j.workspace])),j}async function p(){return t==null||t.throwIfAborted(),r??(u||(f??(f=g().finally(()=>{f=null})),await f),u)}async function b(v,{method:j="GET",body:S,signal:C,scoped:N=!0,raw:E=!1}={}){const T=h(C);T==null||T.throwIfAborted();const A=N?await p():null;T==null||T.throwIfAborted();const k=await fetch(m(v),{method:j,signal:T,headers:{...l()==="cloud"&&c?{"x-openrod-local-owner":c}:{},...A?{"x-openshell-context":A}:{},...A&&r?{"x-openshell-location":"1"}:{},...j==="GET"?{}:{"content-type":E?"application/octet-stream":"application/json","x-openshell-console":"1"}},body:S===void 0?void 0:E?S:JSON.stringify(S)}),M=await k.json().catch(()=>({}));if(T==null||T.throwIfAborted(),M.code===Si?window.dispatchEvent(new Event(Si)):(k.status===401||M.code==="CLOUD_OWNER_CHANGED")&&window.dispatchEvent(new Event("openrod-session-expired")),!k.ok)throw Object.assign(new Error(M.error??`Request failed (${k.status})`),{code:M.code,sandboxes:M.sandboxes});return M}return{target:e,signal:t,path:m,owner:c,url:(v,j={})=>{const S=new URLSearchParams({...j,...l()==="cloud"&&c?{owner:c}:{}});return m(v)+(S.size?"?"+S:"")},forContext:v=>Gr(e,t,v,c),inventory:v=>b("/inventory",{signal:v,scoped:!1}),context:g,contextKey:p,connections:v=>b("/connections",{signal:v,scoped:!1}),connectionJob:(v,j)=>b(`/connections/jobs/${encodeURIComponent(v)}`,{signal:j,scoped:!1}),connect:v=>b("/connections/connect",{method:"POST",body:v}),installConnectionDocker:v=>b(`/connections/jobs/${encodeURIComponent(v)}/docker`,{method:"POST",body:{approve:!0}}),installConnectionRuntime:v=>b(`/connections/jobs/${encodeURIComponent(v)}/install`,{method:"POST",body:{method:"download"}}),uploadConnectionPackage:(v,j)=>b(`/connections/jobs/${encodeURIComponent(v)}/package`,{method:"POST",body:j,raw:!0}),scanSshHost:v=>b("/connections/hosts/scan",{method:"POST",body:v}),addSshHost:v=>b("/connections/hosts",{method:"POST",body:{token:v}}),removeSshHost:v=>b("/connections/hosts/remove",{method:"POST",body:{alias:v}}),forgetRemote:()=>b("/connections/forget",{method:"POST",body:{}}),disconnectRemote:()=>b("/connections/disconnect",{method:"POST",body:{}}),syncLocalCatalog:()=>b("/local-catalog",{method:"POST",body:{}}),setups:()=>b("/setups"),discoverSetups:v=>b("/setups/scan",{method:"POST",body:{sources:v}}),reviewSetup:(v,j)=>b("/setups/review",{method:"POST",body:{token:v,ids:j}}),removeSetupReviewItem:(v,j)=>b("/setups/remove-review-item",{method:"POST",body:{token:v,item:j}}),prepareSetup:(v,j)=>b("/setups/prepare",{method:"POST",body:{token:v,items:j,approved:!0}}),prepareLaunchSetup:(v,j)=>b(`/setups/${v}/prepare-launch`,{method:"POST",body:{revision:j}}),prepareSavedSetup:v=>b(`/setups/${v}/prepare`,{method:"POST",body:{}}),setupPreparation:v=>b(`/setups/preparations/${v}`),cancelSetupPreparation:v=>b(`/setups/preparations/${v}/cancel`,{method:"POST",body:{}}),setupFile:(v,j,S)=>b("/setups/file",{method:"POST",body:{token:v,item:j,path:S}}),saveSetup:(v,j,S)=>b("/setups/save",{method:"POST",body:{token:v,name:j,acknowledged:S}}),deleteSetup:(v,j)=>b(`/setups/${v}/delete`,{method:"POST",body:{revision:j}}),deleteSetupItem:(v,j,S)=>b(`/setups/${v}/delete-item`,{method:"POST",body:{item:j,revision:S}}),previewSetup:(v,j,S)=>b(`/setups/${v}/preview`,{method:"POST",body:{sandbox:j,targets:S}}),enableSetup:(v,j,S,C=!1)=>b(`/setups/${v}/enable`,{method:"POST",body:{sandbox:j,token:S,approveAccess:C}}),removeSetup:(v,j,S)=>b(`/setups/${v}/remove`,{method:"POST",body:{sandbox:j,token:S}}),setupJobs:v=>b(`/setups/${v}/jobs`),cloudExport:v=>b(`/cloud-export?name=${encodeURIComponent(v)}`),importCloud:v=>b("/cloud-import",{method:"POST",body:v}),cloudTransfer:(v,j)=>b("/cloud-transfer",{method:"POST",body:{name:v,ticket:j}}),selectContext:v=>b("/context",{method:"POST",body:v}),previewActivityDeletion:v=>b("/activity/delete-preview",{method:"POST",body:v}),deleteActivity:v=>b("/activity/delete",{method:"POST",body:{token:v}}),activityDestinations:()=>b("/activity-destinations"),createActivityDestination:v=>b("/activity-destinations",{method:"POST",body:v}),activityDestinationAction:(v,j)=>b(`/activity-destinations/${encodeURIComponent(v)}/${j}`,{method:"POST",body:{}}),overview:()=>b("/overview"),sandbox:v=>b(`/sandboxes/${encodeURIComponent(v)}`),activity:(v={})=>b(`/activity?query=${encodeURIComponent(JSON.stringify(v))}`),create:v=>b("/sandboxes",{method:"POST",body:v}),sshConnection:v=>b(`/sandboxes/${encodeURIComponent(v)}/ssh`),openSshTerminal:(v,j)=>b(`/sandboxes/${encodeURIComponent(v)}/ssh-open`,{method:"POST",body:{mode:j}}),sshConfig:v=>b(`/sandboxes/${encodeURIComponent(v)}/ssh-config`,{method:"POST",body:{}}),terminalSession:(v,j)=>b(`/sandboxes/${encodeURIComponent(v)}/terminal-session`,{method:"POST",body:j}),lifecycle:(v,j)=>b(`/sandboxes/${encodeURIComponent(v)}/${j}`,{method:"POST",body:{}}),editors:()=>b("/editors"),openEditor:(v,j)=>b(`/sandboxes/${encodeURIComponent(v)}/editor`,{method:"POST",body:{editor:j}}),fleetPolicy:()=>b("/policy/fleet"),policy:v=>b(`/policy/${encodeURIComponent(v)}`),revision:(v,j)=>b(`/policy/${encodeURIComponent(v)}/revisions/${j}`),applyOps:(v,j)=>b(`/policy/${encodeURIComponent(v)}/ops`,{method:"POST",body:{ops:j}}),restore:(v,j)=>b(`/policy/${encodeURIComponent(v)}/restore`,{method:"POST",body:{version:j}}),globalPolicy:()=>b("/policy/global"),removeGlobal:()=>b("/policy/global/remove",{method:"POST",body:{}}),settings:v=>b(`/settings${v?`/${encodeURIComponent(v)}`:""}`),setSetting:v=>b("/settings",{method:"POST",body:v}),secrets:()=>b("/secrets"),createSecret:v=>b("/secrets",{method:"POST",body:v}),rotateSecret:(v,j)=>b(`/secrets/${encodeURIComponent(v)}/rotate`,{method:"POST",body:{credentials:j}}),secretExpiry:(v,j,S)=>b(`/secrets/${encodeURIComponent(v)}/expiry`,{method:"POST",body:{key:j,expiresAt:S}}),deleteSecret:v=>b(`/secrets/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),attachSecret:(v,j,S)=>b(`/secrets/${encodeURIComponent(v)}/${S?"attach":"detach"}`,{method:"POST",body:{sandbox:j}}),importProfile:v=>b("/profiles/import",{method:"POST",body:{id:v}}),deleteTemplates:v=>b("/templates/delete",{method:"POST",body:{ids:v}}),templates:()=>b("/templates"),imageTemplates:()=>b("/image-templates"),localImages:()=>b("/image-templates/local-images"),buildImageTemplate:(v,j=!1)=>b("/image-templates",{method:"POST",body:{recipe:v,replace:j}}),cancelImageBuild:v=>b(`/image-templates/${encodeURIComponent(v)}/cancel`,{method:"POST",body:{}}),dismissImageBuild:v=>b(`/image-templates/${encodeURIComponent(v)}/dismiss`,{method:"POST",body:{}}),imageTemplateUsage:v=>b(`/image-templates/${encodeURIComponent(v)}/usage`),deleteImageTemplate:v=>b(`/image-templates/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),org:()=>b("/org"),saveOrg:v=>b("/org",{method:"POST",body:v}),saveGroup:v=>b("/org/groups",{method:"POST",body:v}),deleteGroup:v=>b(`/org/groups/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),setGroupMembers:(v,j,S="replace")=>b("/org/members",{method:"POST",body:{sandboxes:v,groups:j,mode:S}}),savePolicy:v=>b("/egress/policies",{method:"POST",body:v}),deletePolicy:v=>b(`/egress/policies/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),saveTemplate:v=>b("/templates",{method:"POST",body:v}),deleteTemplate:v=>b(`/templates/${encodeURIComponent(v)}/delete`,{method:"POST",body:{}}),localFolder:v=>b("/local-folder",{method:"POST",body:{path:v}}),files:(v,j)=>b(`/files/${encodeURIComponent(v)}?path=${encodeURIComponent(j)}`),seed:v=>b(`/files/${encodeURIComponent(v)}/seed`),retrySeed:v=>b(`/files/${encodeURIComponent(v)}/seed/retry`,{method:"POST",body:{}}),prepareDownload:(v,j)=>b(`/files/${encodeURIComponent(v)}/download`,{method:"POST",body:{path:j}}),startUpload:v=>b(`/files/${encodeURIComponent(v)}/uploads`,{method:"POST",body:{}}),uploadFile:(v,j,S,C,N)=>b(`/files/${encodeURIComponent(v)}/uploads/${j}?path=${encodeURIComponent(S)}`,{method:"POST",body:C,raw:!0,signal:N}),commitUpload:(v,j,S)=>b(`/files/${encodeURIComponent(v)}/uploads/${j}/commit`,{method:"POST",body:{dir:S}}),cancelUpload:(v,j)=>b(`/files/${encodeURIComponent(v)}/uploads/${j}/cancel`,{method:"POST",body:{}}),ingress:()=>b("/ingress"),exposeService:v=>b("/ingress/expose",{method:"POST",body:v}),closeService:v=>b("/ingress/close",{method:"POST",body:{sandbox:v.sandbox,name:v.name}}),extendService:(v,j)=>b("/ingress/extend",{method:"POST",body:{sandbox:v.sandbox,name:v.name,closeAfterMinutes:j}})}}const is=Gr(),nC="",va=/^https:\/\/[a-z0-9.-]+(:\d+)?$/i.test(nC)?nC:"",Ho=!!va,Rl="Cloud is coming soon. We're still working on it.";function mP(e){try{const t=new URL(e);return t.origin===e&&t.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(t.hostname)&&!!t.port&&Number(t.port)>0&&!t.username&&!t.password}catch{return!1}}function hP(e){var t;try{const r=(t=/^#local-connect=([A-Za-z0-9_-]+)$/.exec(e))==null?void 0:t[1];if(!r||r.length>2048)return null;const a=JSON.parse(atob(r.replaceAll("-","+").replaceAll("_","/")));return!mP(a.origin)||!/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(a.nonce??"")||!/^[a-f0-9]{64}$/.test(a.challenge??"")?null:{origin:a.origin,nonce:a.nonce,challenge:a.challenge}}catch{return null}}function pP(e,t,r,a=va){var l;return!!(a&&t&&e.source===t&&e.origin===a&&((l=e.data)==null?void 0:l.type)==="openrod-local-connected"&&e.data.nonce===r&&typeof e.data.code=="string"&&/^[a-f0-9]{64}\.[a-f0-9]{64}$/.test(e.data.code))}async function ru(e,t,{signal:r}={}){const a=await fetch(`/api/local-cloud/${e}`,{signal:r,method:t===void 0?"GET":"POST",headers:{...Ey()?{"x-openrod-local-owner":Ey()}:{},...t===void 0?{}:{"content-type":"application/json","x-openshell-console":"1"}},body:t===void 0?void 0:JSON.stringify(t)}),l=await a.json().catch(()=>({}));if(l.code==="CLOUD_OWNER_CHANGED"&&window.dispatchEvent(new Event("openrod-session-expired")),!a.ok)throw Object.assign(new Error(l.error??"Cloud connection unavailable"),{status:a.status});return l}const gP=(e,t)=>new Promise((r,a)=>{const l=()=>{clearTimeout(c),a(new DOMException("Cloud preparation cancelled.","AbortError"))},c=setTimeout(()=>{t==null||t.removeEventListener("abort",l),r()},e);t==null||t.addEventListener("abort",l,{once:!0}),t!=null&&t.aborted&&l()});async function NR(e,{signal:t,onProgress:r=()=>{},wait:a=gP,attempts:l=120}={}){var c,u,f;for(let m=0;m<l;m++){t==null||t.throwIfAborted();const h=await e();if(t==null||t.throwIfAborted(),!h.connected)throw new Error("Your cloud connection expired. Connect again to continue.");if(h.error)throw new Error(h.error);if(r(h),((c=h.machine)==null?void 0:c.status)==="ready")return h;if(((u=h.machine)==null?void 0:u.status)==="error"||(f=h.machine)!=null&&f.error)throw new Error(h.machine.error??"Your cloud machine could not start.");m<l-1&&await a(5e3,t)}throw new Error("Your private machine is still preparing. Check its status before trying again.")}async function CR(e,t,r,a){const l=await e.cloudExport(r),c=await t.importCloud(a?{...l.bundle,destinationGroups:a}:l.bundle);return{...c,warning:c.warning||l.warning}}async function xP(e,t,r,a){if(t.target!=="local")throw Error("Choose a local destination for this workspace.");return CR(e,t,r,a)}async function bP(e,t=fetch){const r=await t("/api/cloud/local-connect/authorize",{method:"POST",headers:{"content-type":"application/json","x-openshell-console":"1"},body:JSON.stringify(e)}),a=await r.json().catch(()=>({}));if(!r.ok)throw new Error(a.error??"Could not finish sign-in.");if(typeof a.code!="string"||!/^[a-f0-9]{64}\.[a-f0-9]{64}$/.test(a.code))throw new Error("Invalid sign-in response.");return a}function yP({popup:e,origin:t,cloud:r=va,request:a=ru,events:l=window,focus:c=()=>window.focus(),setTimer:u=setInterval,clearTimer:f=clearInterval,now:m=Date.now}){let h,g=!1,p=!1,b,v;const j=new Promise((k,M)=>{b=k,v=M}),S=async()=>{h&&await a("cancel",{nonce:h}).catch(()=>{})},C=()=>{f(A),l.removeEventListener("message",E)};function N(k="Cloud sign-in was cancelled."){return p?Promise.resolve():(p=!0,C(),e.close(),v(new Error(k)),S())}const E=async k=>{if(!(p||g||!h||!pP(k,e,h,r))){g=!0;try{const M=await a("finish",{nonce:h,code:k.data.code});if(p){await S();return}if(!M.connected||!M.user)throw new Error("Sign-in did not finish. Try again.");p=!0,C(),e.close(),c(),b(M)}catch(M){if(p){await S();return}await N(M.message)}}},T=m()+15*6e4,A=u(()=>{(e.closed||m()>T)&&N(e.closed?"Cloud sign-in was cancelled.":"Cloud sign-in timed out. Try again.")},500);return l.addEventListener("message",E),Promise.resolve().then(async()=>{if(p)return;const k=await a("start",{origin:t});if(h=k.nonce,p){await S();return}e.location.href=k.url}).catch(k=>{p||N(k.message)}),{promise:j,cancel:N}}const Jp=x.createContext(null),kR=x.createContext(null),Tr=()=>x.useContext(Jp);function eg(){const e=x.useContext(kR);if(!e)throw new Error("useApi outside ComputeSession");return e}function vP({target:e,children:t}){const r=Tr(),a=x.useMemo(()=>e&&(r!=null&&r.localViewer)?{...r,target:e,nativeActions:e==="local"||!!r.connected}:r,[r,e]);return s.jsx(Jp.Provider,{value:a,children:t})}function Ry({target:e,ownerScope:t,children:r}){const a=x.useMemo(()=>{const l=new AbortController;return{controller:l,generation:0,api:Gr(e,l.signal)}},[e,t]);return x.useEffect(()=>{const l=++a.generation;return()=>queueMicrotask(()=>{l===a.generation&&a.controller.abort()})},[a]),s.jsx(kR.Provider,{value:a.api,children:r})}function wP({children:e,user:t,logout:r}){jR("cloud");const a={target:"cloud",localViewer:!1,nativeActions:!1,user:t,logout:r};return s.jsx(Jp.Provider,{value:a,children:s.jsx(Ry,{target:"local",children:e})})}function jP({children:e,status:t,onStatus:r,onCancel:a}){var b;const[l,c]=x.useState(((b=t.machine)==null?void 0:b.status)==="ready"),[u,f]=x.useState(t.machine),[m,h]=x.useState(""),[g,p]=x.useState(0);return x.useEffect(()=>{if(l)return;const v=new AbortController;return h(""),NR(()=>ru("machine"),{signal:v.signal,onProgress:j=>{f(j.machine),r(j)}}).then(()=>c(!0)).catch(j=>{j.name!=="AbortError"&&h(j.message)}),()=>v.abort()},[g,l,r]),l?e:s.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:s.jsxs("section",{className:"max-w-sm text-center",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Preparing your private machine…"}),s.jsx("p",{role:"status",className:"mt-3 text-sm text-muted-foreground",children:(u==null?void 0:u.message)||"Your account has one dedicated machine. Its first start can take several minutes."}),m&&s.jsxs(s.Fragment,{children:[s.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:m}),s.jsx("button",{className:"mt-4 text-sm underline",onClick:()=>p(v=>v+1),children:"Try again"})]}),s.jsx("button",{className:"mt-6 block w-full text-xs underline",onClick:a,children:"Use local compute"}),va]})})}function SP({children:e}){var A;const[t,r]=x.useState(()=>uP(window.location.href,window.sessionStorage)),[a,l]=x.useState(()=>Ho?null:{connected:!1}),[c,u]=x.useState(""),[f,m]=x.useState(!1),[h,g]=x.useState(!1),p=x.useRef(null),b=x.useRef({uid:null,revision:0});jR(t),tC(a!=null&&a.connected?a.owner:null),x.useEffect(()=>{let k=!0;if(!Ho)return;ru("status").then(R=>{k&&l(R)}).catch(R=>{k&&(u(R.message),l({connected:!1}))});const M=()=>{l({connected:!1}),u("Your cloud connection expired. Connect again to continue.")};return window.addEventListener("openrod-session-expired",M),()=>{var R;k=!1,window.removeEventListener("openrod-session-expired",M),(R=p.current)==null||R.cancel("Cloud connection cancelled.")}},[]),x.useEffect(()=>{if(!(a!=null&&a.connected)||!a.expires)return;const k=typeof a.expires=="number"?a.expires:Date.parse(a.expires);if(!Number.isFinite(k))return;const M=setTimeout(()=>{l({connected:!1}),u("Your cloud connection expired. Connect again to continue.")},Math.max(0,k-Date.now()));return()=>clearTimeout(M)},[a]);function v(k){if(!["local","cloud"].includes(k))return;try{sessionStorage.setItem(yR,k)}catch{}const M=new URL(window.location.href);M.searchParams.delete("target"),M.hash="",window.history.replaceState(null,"",M),window.dispatchEvent(new HashChangeEvent("hashchange")),r(k)}async function j(){if(a!=null&&a.connected)return a;if(!Ho)throw new Error(Rl);if(p.current)throw new Error("A cloud sign-in is already open.");const k=window.open("about:blank","_blank","popup,width=520,height=720");if(!k)throw new Error("Allow popups to connect your local OpenRod to cloud.");const M=yP({popup:k,origin:window.location.origin});p.current=M,m(!0),u("");try{const R=await M.promise;if(p.current!==M)throw new Error("Cloud sign-in was cancelled.");return tC(R.owner),l(R),R}catch(R){throw p.current===M&&u(R.message),R}finally{p.current===M&&(p.current=null,m(!1))}}function S(k="Cloud connection cancelled."){const M=p.current;if(M)return p.current=null,m(!1),u(k),M.cancel(k)}async function C(){try{await ru("disconnect",{}),l({connected:!1}),v("local")}catch(k){[401,403].includes(k.status)&&(l({connected:!1}),v("local")),u(k.message)}}b.current=fP(b.current,a!=null&&a.connected?(A=a.user)==null?void 0:A.uid:null);const N=b.current.revision,E=`${t}:${N}`,T={target:t,localViewer:!0,nativeActions:t==="local"||!!(a!=null&&a.connected),user:a==null?void 0:a.user,connected:!!(a!=null&&a.connected),connecting:f,error:c,connect:j,disconnect:C,selectTarget:v,createRequested:h,requestCreate:g,cancelConnect:()=>S()};return s.jsx(Jp.Provider,{value:T,children:t==="cloud"&&!(a!=null&&a.connected)?s.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:s.jsxs("section",{className:"max-w-sm text-center",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Connect your cloud workspace"}),s.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Sign in with Google to control your private cloud machine from local OpenRod."}),c&&s.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:c}),Ho?s.jsx("button",{disabled:a===null||f,className:"mt-6 rounded-lg bg-primary px-4 py-3 text-sm text-primary-foreground disabled:opacity-50",onClick:()=>j().catch(()=>{}),children:a===null?"Checking connection…":f?"Connecting…":"Continue with Google"}):s.jsxs(s.Fragment,{children:[s.jsx("button",{disabled:!0,"aria-disabled":"true",title:Rl,className:"mt-6 cursor-not-allowed rounded-lg bg-primary px-4 py-3 text-sm text-primary-foreground opacity-50",children:"Continue with Google"}),s.jsx("p",{role:"status",className:"mt-3 text-xs text-muted-foreground",children:Rl})]}),s.jsx("button",{className:"mt-4 block w-full text-xs underline",onClick:()=>{S(),v("local")},children:"Use local compute"})]})}):t==="cloud"?s.jsx(jP,{status:a,onStatus:l,onCancel:()=>v("local"),children:s.jsx(Ry,{target:t,ownerScope:N,children:e},E)},"cloud"):s.jsx(Ry,{target:t,ownerScope:N,children:e},E)})}/**
51
- * @license lucide-react v0.577.0 - ISC
52
- *
53
- * This source code is licensed under the ISC license.
54
- * See the LICENSE file in the root directory of this source tree.
55
- */const TR=(...e)=>e.filter((t,r,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===r).join(" ").trim();/**
56
- * @license lucide-react v0.577.0 - ISC
57
- *
58
- * This source code is licensed under the ISC license.
59
- * See the LICENSE file in the root directory of this source tree.
60
- */const NP=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
61
- * @license lucide-react v0.577.0 - ISC
62
- *
63
- * This source code is licensed under the ISC license.
64
- * See the LICENSE file in the root directory of this source tree.
65
- */const CP=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,a)=>a?a.toUpperCase():r.toLowerCase());/**
66
- * @license lucide-react v0.577.0 - ISC
67
- *
68
- * This source code is licensed under the ISC license.
69
- * See the LICENSE file in the root directory of this source tree.
70
- */const sC=e=>{const t=CP(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
71
- * @license lucide-react v0.577.0 - ISC
72
- *
73
- * This source code is licensed under the ISC license.
74
- * See the LICENSE file in the root directory of this source tree.
75
- */var kP={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
76
- * @license lucide-react v0.577.0 - ISC
77
- *
78
- * This source code is licensed under the ISC license.
79
- * See the LICENSE file in the root directory of this source tree.
80
- */const TP=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
81
- * @license lucide-react v0.577.0 - ISC
82
- *
83
- * This source code is licensed under the ISC license.
84
- * See the LICENSE file in the root directory of this source tree.
85
- */const EP=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:l="",children:c,iconNode:u,...f},m)=>x.createElement("svg",{ref:m,...kP,width:t,height:t,stroke:e,strokeWidth:a?Number(r)*24/Number(t):r,className:TR("lucide",l),...!c&&!TP(f)&&{"aria-hidden":"true"},...f},[...u.map(([h,g])=>x.createElement(h,g)),...Array.isArray(c)?c:[c]]));/**
86
- * @license lucide-react v0.577.0 - ISC
87
- *
88
- * This source code is licensed under the ISC license.
89
- * See the LICENSE file in the root directory of this source tree.
90
- */const st=(e,t)=>{const r=x.forwardRef(({className:a,...l},c)=>x.createElement(EP,{ref:c,iconNode:t,className:TR(`lucide-${NP(sC(e))}`,`lucide-${e}`,a),...l}));return r.displayName=sC(e),r};/**
91
- * @license lucide-react v0.577.0 - ISC
92
- *
93
- * This source code is licensed under the ISC license.
94
- * See the LICENSE file in the root directory of this source tree.
95
- */const RP=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],AP=st("activity",RP);/**
96
- * @license lucide-react v0.577.0 - ISC
97
- *
98
- * This source code is licensed under the ISC license.
99
- * See the LICENSE file in the root directory of this source tree.
100
- */const OP=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],af=st("arrow-down",OP);/**
101
- * @license lucide-react v0.577.0 - ISC
102
- *
103
- * This source code is licensed under the ISC license.
104
- * See the LICENSE file in the root directory of this source tree.
105
- */const MP=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Vv=st("arrow-left",MP);/**
106
- * @license lucide-react v0.577.0 - ISC
107
- *
108
- * This source code is licensed under the ISC license.
109
- * See the LICENSE file in the root directory of this source tree.
110
- */const DP=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ay=st("arrow-right",DP);/**
111
- * @license lucide-react v0.577.0 - ISC
112
- *
113
- * This source code is licensed under the ISC license.
114
- * See the LICENSE file in the root directory of this source tree.
115
- */const zP=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Ri=st("arrow-up-right",zP);/**
116
- * @license lucide-react v0.577.0 - ISC
117
- *
118
- * This source code is licensed under the ISC license.
119
- * See the LICENSE file in the root directory of this source tree.
120
- */const PP=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],lf=st("arrow-up",PP);/**
121
- * @license lucide-react v0.577.0 - ISC
122
- *
123
- * This source code is licensed under the ISC license.
124
- * See the LICENSE file in the root directory of this source tree.
125
- */const IP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]],_P=st("ban",IP);/**
126
- * @license lucide-react v0.577.0 - ISC
127
- *
128
- * This source code is licensed under the ISC license.
129
- * See the LICENSE file in the root directory of this source tree.
130
- */const LP=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],BP=st("book-open",LP);/**
131
- * @license lucide-react v0.577.0 - ISC
132
- *
133
- * This source code is licensed under the ISC license.
134
- * See the LICENSE file in the root directory of this source tree.
135
- */const $P=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ER=st("bot",$P);/**
136
- * @license lucide-react v0.577.0 - ISC
137
- *
138
- * This source code is licensed under the ISC license.
139
- * See the LICENSE file in the root directory of this source tree.
140
- */const VP=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],ql=st("box",VP);/**
141
- * @license lucide-react v0.577.0 - ISC
142
- *
143
- * This source code is licensed under the ISC license.
144
- * See the LICENSE file in the root directory of this source tree.
145
- */const UP=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],HP=st("building-2",UP);/**
146
- * @license lucide-react v0.577.0 - ISC
147
- *
148
- * This source code is licensed under the ISC license.
149
- * See the LICENSE file in the root directory of this source tree.
150
- */const FP=[["path",{d:"M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z",key:"trhst0"}],["path",{d:"M17 21v-2",key:"ds4u3f"}],["path",{d:"M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10",key:"1mo9zo"}],["path",{d:"M21 21v-2",key:"eo0ou"}],["path",{d:"M3 5V3",key:"1k5hjh"}],["path",{d:"M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z",key:"1dd30t"}],["path",{d:"M7 5V3",key:"1t1388"}]],GP=st("cable",FP);/**
151
- * @license lucide-react v0.577.0 - ISC
152
- *
153
- * This source code is licensed under the ISC license.
154
- * See the LICENSE file in the root directory of this source tree.
155
- */const qP=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],YP=st("calendar-clock",qP);/**
156
- * @license lucide-react v0.577.0 - ISC
157
- *
158
- * This source code is licensed under the ISC license.
159
- * See the LICENSE file in the root directory of this source tree.
160
- */const KP=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Fn=st("check",KP);/**
161
- * @license lucide-react v0.577.0 - ISC
162
- *
163
- * This source code is licensed under the ISC license.
164
- * See the LICENSE file in the root directory of this source tree.
165
- */const XP=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Xo=st("chevron-down",XP);/**
166
- * @license lucide-react v0.577.0 - ISC
167
- *
168
- * This source code is licensed under the ISC license.
169
- * See the LICENSE file in the root directory of this source tree.
170
- */const WP=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ur=st("chevron-right",WP);/**
171
- * @license lucide-react v0.577.0 - ISC
172
- *
173
- * This source code is licensed under the ISC license.
174
- * See the LICENSE file in the root directory of this source tree.
175
- */const QP=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],RR=st("chevron-up",QP);/**
176
- * @license lucide-react v0.577.0 - ISC
177
- *
178
- * This source code is licensed under the ISC license.
179
- * See the LICENSE file in the root directory of this source tree.
180
- */const ZP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],rC=st("circle-alert",ZP);/**
181
- * @license lucide-react v0.577.0 - ISC
182
- *
183
- * This source code is licensed under the ISC license.
184
- * See the LICENSE file in the root directory of this source tree.
185
- */const JP=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],eI=st("circle-check",JP);/**
186
- * @license lucide-react v0.577.0 - ISC
187
- *
188
- * This source code is licensed under the ISC license.
189
- * See the LICENSE file in the root directory of this source tree.
190
- */const tI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],nI=st("circle-x",tI);/**
191
- * @license lucide-react v0.577.0 - ISC
192
- *
193
- * This source code is licensed under the ISC license.
194
- * See the LICENSE file in the root directory of this source tree.
195
- */const sI=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],rI=st("cloud",sI);/**
196
- * @license lucide-react v0.577.0 - ISC
197
- *
198
- * This source code is licensed under the ISC license.
199
- * See the LICENSE file in the root directory of this source tree.
200
- */const oI=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],cf=st("copy",oI);/**
201
- * @license lucide-react v0.577.0 - ISC
202
- *
203
- * This source code is licensed under the ISC license.
204
- * See the LICENSE file in the root directory of this source tree.
205
- */const aI=[["path",{d:"M11 20H2",key:"nlcfvz"}],["path",{d:"M11 4.562v16.157a1 1 0 0 0 1.242.97L19 20V5.562a2 2 0 0 0-1.515-1.94l-4-1A2 2 0 0 0 11 4.561z",key:"au4z13"}],["path",{d:"M11 4H8a2 2 0 0 0-2 2v14",key:"74r1mk"}],["path",{d:"M14 12h.01",key:"1jfl7z"}],["path",{d:"M22 20h-3",key:"vhrsz"}]],Uv=st("door-open",aI);/**
206
- * @license lucide-react v0.577.0 - ISC
207
- *
208
- * This source code is licensed under the ISC license.
209
- * See the LICENSE file in the root directory of this source tree.
210
- */const iI=[["path",{d:"M10 12h.01",key:"1kxr2c"}],["path",{d:"M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14",key:"36qu9e"}],["path",{d:"M2 20h20",key:"owomy5"}]],AR=st("door-closed",iI);/**
211
- * @license lucide-react v0.577.0 - ISC
212
- *
213
- * This source code is licensed under the ISC license.
214
- * See the LICENSE file in the root directory of this source tree.
215
- */const lI=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Kc=st("download",lI);/**
216
- * @license lucide-react v0.577.0 - ISC
217
- *
218
- * This source code is licensed under the ISC license.
219
- * See the LICENSE file in the root directory of this source tree.
220
- */const cI=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],OR=st("earth",cI);/**
221
- * @license lucide-react v0.577.0 - ISC
222
- *
223
- * This source code is licensed under the ISC license.
224
- * See the LICENSE file in the root directory of this source tree.
225
- */const uI=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],dI=st("ellipsis",uI);/**
226
- * @license lucide-react v0.577.0 - ISC
227
- *
228
- * This source code is licensed under the ISC license.
229
- * See the LICENSE file in the root directory of this source tree.
230
- */const fI=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],mI=st("external-link",fI);/**
231
- * @license lucide-react v0.577.0 - ISC
232
- *
233
- * This source code is licensed under the ISC license.
234
- * See the LICENSE file in the root directory of this source tree.
235
- */const hI=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],MR=st("file-code-corner",hI);/**
236
- * @license lucide-react v0.577.0 - ISC
237
- *
238
- * This source code is licensed under the ISC license.
239
- * See the LICENSE file in the root directory of this source tree.
240
- */const pI=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Hv=st("file-text",pI);/**
241
- * @license lucide-react v0.577.0 - ISC
242
- *
243
- * This source code is licensed under the ISC license.
244
- * See the LICENSE file in the root directory of this source tree.
245
- */const gI=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],xI=st("file",gI);/**
246
- * @license lucide-react v0.577.0 - ISC
247
- *
248
- * This source code is licensed under the ISC license.
249
- * See the LICENSE file in the root directory of this source tree.
250
- */const bI=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],yI=st("folder-git-2",bI);/**
251
- * @license lucide-react v0.577.0 - ISC
252
- *
253
- * This source code is licensed under the ISC license.
254
- * See the LICENSE file in the root directory of this source tree.
255
- */const vI=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],wI=st("folder-input",vI);/**
256
- * @license lucide-react v0.577.0 - ISC
257
- *
258
- * This source code is licensed under the ISC license.
259
- * See the LICENSE file in the root directory of this source tree.
260
- */const jI=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],oC=st("folder",jI);/**
261
- * @license lucide-react v0.577.0 - ISC
262
- *
263
- * This source code is licensed under the ISC license.
264
- * See the LICENSE file in the root directory of this source tree.
265
- */const SI=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],aC=st("funnel",SI);/**
266
- * @license lucide-react v0.577.0 - ISC
267
- *
268
- * This source code is licensed under the ISC license.
269
- * See the LICENSE file in the root directory of this source tree.
270
- */const NI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Fv=st("globe",NI);/**
271
- * @license lucide-react v0.577.0 - ISC
272
- *
273
- * This source code is licensed under the ISC license.
274
- * See the LICENSE file in the root directory of this source tree.
275
- */const CI=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],DR=st("hard-drive",CI);/**
276
- * @license lucide-react v0.577.0 - ISC
277
- *
278
- * This source code is licensed under the ISC license.
279
- * See the LICENSE file in the root directory of this source tree.
280
- */const kI=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],uf=st("info",kI);/**
281
- * @license lucide-react v0.577.0 - ISC
282
- *
283
- * This source code is licensed under the ISC license.
284
- * See the LICENSE file in the root directory of this source tree.
285
- */const TI=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],hu=st("key-round",TI);/**
286
- * @license lucide-react v0.577.0 - ISC
287
- *
288
- * This source code is licensed under the ISC license.
289
- * See the LICENSE file in the root directory of this source tree.
290
- */const EI=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],mp=st("laptop",EI);/**
291
- * @license lucide-react v0.577.0 - ISC
292
- *
293
- * This source code is licensed under the ISC license.
294
- * See the LICENSE file in the root directory of this source tree.
295
- */const RI=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],AI=st("layers",RI);/**
296
- * @license lucide-react v0.577.0 - ISC
297
- *
298
- * This source code is licensed under the ISC license.
299
- * See the LICENSE file in the root directory of this source tree.
300
- */const OI=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],zR=st("link-2",OI);/**
301
- * @license lucide-react v0.577.0 - ISC
302
- *
303
- * This source code is licensed under the ISC license.
304
- * See the LICENSE file in the root directory of this source tree.
305
- */const MI=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],DI=st("list-filter",MI);/**
306
- * @license lucide-react v0.577.0 - ISC
307
- *
308
- * This source code is licensed under the ISC license.
309
- * See the LICENSE file in the root directory of this source tree.
310
- */const zI=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],zl=st("loader-circle",zI);/**
311
- * @license lucide-react v0.577.0 - ISC
312
- *
313
- * This source code is licensed under the ISC license.
314
- * See the LICENSE file in the root directory of this source tree.
315
- */const PI=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],iC=st("lock",PI);/**
316
- * @license lucide-react v0.577.0 - ISC
317
- *
318
- * This source code is licensed under the ISC license.
319
- * See the LICENSE file in the root directory of this source tree.
320
- */const II=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],_I=st("monitor",II);/**
321
- * @license lucide-react v0.577.0 - ISC
322
- *
323
- * This source code is licensed under the ISC license.
324
- * See the LICENSE file in the root directory of this source tree.
325
- */const LI=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],BI=st("moon",LI);/**
326
- * @license lucide-react v0.577.0 - ISC
327
- *
328
- * This source code is licensed under the ISC license.
329
- * See the LICENSE file in the root directory of this source tree.
330
- */const $I=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],tg=st("network",$I);/**
331
- * @license lucide-react v0.577.0 - ISC
332
- *
333
- * This source code is licensed under the ISC license.
334
- * See the LICENSE file in the root directory of this source tree.
335
- */const VI=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],PR=st("octagon-x",VI);/**
336
- * @license lucide-react v0.577.0 - ISC
337
- *
338
- * This source code is licensed under the ISC license.
339
- * See the LICENSE file in the root directory of this source tree.
340
- */const UI=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],Gv=st("package",UI);/**
341
- * @license lucide-react v0.577.0 - ISC
342
- *
343
- * This source code is licensed under the ISC license.
344
- * See the LICENSE file in the root directory of this source tree.
345
- */const HI=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],FI=st("panel-left",HI);/**
346
- * @license lucide-react v0.577.0 - ISC
347
- *
348
- * This source code is licensed under the ISC license.
349
- * See the LICENSE file in the root directory of this source tree.
350
- */const GI=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],qI=st("pause",GI);/**
351
- * @license lucide-react v0.577.0 - ISC
352
- *
353
- * This source code is licensed under the ISC license.
354
- * See the LICENSE file in the root directory of this source tree.
355
- */const YI=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],lC=st("pencil",YI);/**
356
- * @license lucide-react v0.577.0 - ISC
357
- *
358
- * This source code is licensed under the ISC license.
359
- * See the LICENSE file in the root directory of this source tree.
360
- */const KI=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],IR=st("play",KI);/**
361
- * @license lucide-react v0.577.0 - ISC
362
- *
363
- * This source code is licensed under the ISC license.
364
- * See the LICENSE file in the root directory of this source tree.
365
- */const XI=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],qv=st("plug",XI);/**
366
- * @license lucide-react v0.577.0 - ISC
367
- *
368
- * This source code is licensed under the ISC license.
369
- * See the LICENSE file in the root directory of this source tree.
370
- */const WI=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],cs=st("plus",WI);/**
371
- * @license lucide-react v0.577.0 - ISC
372
- *
373
- * This source code is licensed under the ISC license.
374
- * See the LICENSE file in the root directory of this source tree.
375
- */const QI=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Ia=st("refresh-cw",QI);/**
376
- * @license lucide-react v0.577.0 - ISC
377
- *
378
- * This source code is licensed under the ISC license.
379
- * See the LICENSE file in the root directory of this source tree.
380
- */const ZI=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],JI=st("rotate-ccw",ZI);/**
381
- * @license lucide-react v0.577.0 - ISC
382
- *
383
- * This source code is licensed under the ISC license.
384
- * See the LICENSE file in the root directory of this source tree.
385
- */const e6=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],t6=st("rotate-cw",e6);/**
386
- * @license lucide-react v0.577.0 - ISC
387
- *
388
- * This source code is licensed under the ISC license.
389
- * See the LICENSE file in the root directory of this source tree.
390
- */const n6=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],s6=st("search",n6);/**
391
- * @license lucide-react v0.577.0 - ISC
392
- *
393
- * This source code is licensed under the ISC license.
394
- * See the LICENSE file in the root directory of this source tree.
395
- */const r6=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],df=st("server",r6);/**
396
- * @license lucide-react v0.577.0 - ISC
397
- *
398
- * This source code is licensed under the ISC license.
399
- * See the LICENSE file in the root directory of this source tree.
400
- */const o6=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],pu=st("shield-check",o6);/**
401
- * @license lucide-react v0.577.0 - ISC
402
- *
403
- * This source code is licensed under the ISC license.
404
- * See the LICENSE file in the root directory of this source tree.
405
- */const a6=[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]],Yv=st("shield-off",a6);/**
406
- * @license lucide-react v0.577.0 - ISC
407
- *
408
- * This source code is licensed under the ISC license.
409
- * See the LICENSE file in the root directory of this source tree.
410
- */const i6=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],l6=st("sliders-horizontal",i6);/**
411
- * @license lucide-react v0.577.0 - ISC
412
- *
413
- * This source code is licensed under the ISC license.
414
- * See the LICENSE file in the root directory of this source tree.
415
- */const c6=[["path",{d:"m10 9-3 3 3 3",key:"1oro0q"}],["path",{d:"m14 15 3-3-3-3",key:"bz13h7"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]],u6=st("square-code",c6);/**
416
- * @license lucide-react v0.577.0 - ISC
417
- *
418
- * This source code is licensed under the ISC license.
419
- * See the LICENSE file in the root directory of this source tree.
420
- */const d6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],f6=st("square-plus",d6);/**
421
- * @license lucide-react v0.577.0 - ISC
422
- *
423
- * This source code is licensed under the ISC license.
424
- * See the LICENSE file in the root directory of this source tree.
425
- */const m6=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],_R=st("square-terminal",m6);/**
426
- * @license lucide-react v0.577.0 - ISC
427
- *
428
- * This source code is licensed under the ISC license.
429
- * See the LICENSE file in the root directory of this source tree.
430
- */const h6=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],p6=st("square",h6);/**
431
- * @license lucide-react v0.577.0 - ISC
432
- *
433
- * This source code is licensed under the ISC license.
434
- * See the LICENSE file in the root directory of this source tree.
435
- */const g6=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],x6=st("sun",g6);/**
436
- * @license lucide-react v0.577.0 - ISC
437
- *
438
- * This source code is licensed under the ISC license.
439
- * See the LICENSE file in the root directory of this source tree.
440
- */const b6=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Kv=st("terminal",b6);/**
441
- * @license lucide-react v0.577.0 - ISC
442
- *
443
- * This source code is licensed under the ISC license.
444
- * See the LICENSE file in the root directory of this source tree.
445
- */const y6=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],cC=st("timer",y6);/**
446
- * @license lucide-react v0.577.0 - ISC
447
- *
448
- * This source code is licensed under the ISC license.
449
- * See the LICENSE file in the root directory of this source tree.
450
- */const v6=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Yn=st("trash-2",v6);/**
451
- * @license lucide-react v0.577.0 - ISC
452
- *
453
- * This source code is licensed under the ISC license.
454
- * See the LICENSE file in the root directory of this source tree.
455
- */const w6=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],_a=st("triangle-alert",w6);/**
456
- * @license lucide-react v0.577.0 - ISC
457
- *
458
- * This source code is licensed under the ISC license.
459
- * See the LICENSE file in the root directory of this source tree.
460
- */const j6=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],S6=st("upload",j6);/**
461
- * @license lucide-react v0.577.0 - ISC
462
- *
463
- * This source code is licensed under the ISC license.
464
- * See the LICENSE file in the root directory of this source tree.
465
- */const N6=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],C6=st("user-round",N6);/**
466
- * @license lucide-react v0.577.0 - ISC
467
- *
468
- * This source code is licensed under the ISC license.
469
- * See the LICENSE file in the root directory of this source tree.
470
- */const k6=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Ta=st("users",k6);/**
471
- * @license lucide-react v0.577.0 - ISC
472
- *
473
- * This source code is licensed under the ISC license.
474
- * See the LICENSE file in the root directory of this source tree.
475
- */const T6=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],uC=st("webhook",T6);/**
476
- * @license lucide-react v0.577.0 - ISC
477
- *
478
- * This source code is licensed under the ISC license.
479
- * See the LICENSE file in the root directory of this source tree.
480
- */const E6=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],On=st("x",E6),LR=[{id:"claude",name:"Claude Code",command:"claude",config:".claude.json",key:"mcpServers",format:"claude",skills:".claude/skills"},{id:"codex",name:"Codex",command:"codex",config:".codex/config.toml",key:"mcp_servers",format:"codex",skills:".agents/skills",extraSkillRoots:[".codex/skills"]},{id:"opencode",name:"OpenCode",command:"opencode",config:".config/opencode/opencode.json",alternateConfig:".config/opencode/opencode.jsonc",key:"mcp",format:"opencode",skills:".config/opencode/skills",extraSkillRoots:[".claude/skills",".agents/skills"]},{id:"pi",name:"Pi",command:"pi",config:".pi/agent/mcp.json",key:"mcpServers",format:"json",skills:".pi/agent/skills",extraSkillRoots:[".agents/skills"],note:"Requires a Pi version with built-in MCP support; MCP extensions can override it."},{id:"cursor",name:"Cursor",command:"cursor-agent",config:".cursor/mcp.json",key:"mcpServers",format:"json",skills:".cursor/skills"},{id:"antigravity",name:"Antigravity CLI",command:"agy",config:".gemini/config/mcp_config.json",key:"mcpServers",format:"antigravity",skills:".gemini/config/skills"},{id:"copilot",name:"GitHub Copilot",command:"copilot",config:".copilot/mcp-config.json",key:"mcpServers",format:"copilot",skills:".copilot/skills"},{id:"kiro",name:"Kiro CLI",command:"kiro-cli",config:".kiro/settings/mcp.json",key:"mcpServers",format:"json",skills:".kiro/skills"},{id:"droid",name:"Factory Droid",command:"droid",config:".factory/mcp.json",key:"mcpServers",format:"droid",skills:".factory/skills"},{id:"aider",name:"Aider",command:"aider",reason:"Aider has no supported native MCP or SKILL.md setup integration. Choose another agent to use this Setup."}],R6=LR,A6=LR.filter(e=>e.config&&e.skills),Oy=e=>A6.find(t=>t.id===e),O6=e=>e.filter(t=>!!Oy(t));function ng(){return typeof window<"u"}function Os(e){return Xv(e)?(e.nodeName||"").toLowerCase():"#document"}function xn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function La(e){var t;return(t=(Xv(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Xv(e){return ng()?e instanceof Node||e instanceof xn(e).Node:!1}function Gt(e){return ng()?e instanceof Element||e instanceof xn(e).Element:!1}function cn(e){return ng()?e instanceof HTMLElement||e instanceof xn(e).HTMLElement:!1}function ou(e){return!ng()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof xn(e).ShadowRoot}function ff(e){const{overflow:t,overflowX:r,overflowY:a,display:l}=Nr(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+r)&&l!=="inline"&&l!=="contents"}function M6(e){return/^(table|td|th)$/.test(Os(e))}function sg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const D6=/transform|translate|scale|rotate|perspective|filter/,z6=/paint|layout|strict|content/,gl=e=>!!e&&e!=="none";let T0;function Wv(e){const t=Gt(e)?Nr(e):e;return gl(t.transform)||gl(t.translate)||gl(t.scale)||gl(t.rotate)||gl(t.perspective)||!Qv()&&(gl(t.backdropFilter)||gl(t.filter))||D6.test(t.willChange||"")||z6.test(t.contain||"")}function P6(e){let t=Ea(e);for(;cn(t)&&!Sa(t);){if(Wv(t))return t;if(sg(t))return null;t=Ea(t)}return null}function Qv(){return T0==null&&(T0=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),T0}function Sa(e){return/^(html|body|#document)$/.test(Os(e))}function Nr(e){return xn(e).getComputedStyle(e)}function rg(e){return Gt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ea(e){if(Os(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ou(e)&&e.host||La(e);return ou(t)?t.host:t}function BR(e){const t=Ea(e);return Sa(t)?(e.ownerDocument||e).body:cn(t)&&ff(t)?t:BR(t)}function Fd(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=!0);const l=BR(e),c=l===((a=e.ownerDocument)==null?void 0:a.body),u=xn(l);if(c){const f=My(u);return t.concat(u,u.visualViewport||[],ff(l)?l:[],f&&r?Fd(f):[])}else return t.concat(l,Fd(l,[],r))}function My(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Zv={...Gz},dC={};function us(e,t){const r=x.useRef(dC);return r.current===dC&&(r.current=e(t)),r}const E0=Zv.useInsertionEffect,I6=E0&&E0!==Zv.useLayoutEffect?E0:e=>e();function et(e){const t=us(_6).current;return t.next=e,I6(t.effect),t.trampoline}function _6(){const e={next:void 0,callback:L6,trampoline:(...t)=>{var r;return(r=e.callback)==null?void 0:r.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function L6(){}const B6=()=>{},Ke=typeof document<"u"?x.useLayoutEffect:B6;function Dy(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}const Jv={};function Xs(e,t,r,a,l){if(!r&&!a&&!l&&!e)return hp(t);let c=hp(e);return t&&(c=kd(c,t)),r&&(c=kd(c,r)),a&&(c=kd(c,a)),l&&(c=kd(c,l)),c}function $6(e){if(e.length===0)return Jv;if(e.length===1)return hp(e[0]);let t=hp(e[0]);for(let r=1;r<e.length;r+=1)t=kd(t,e[r]);return t}function hp(e){return e1(e)?{...VR(e,Jv)}:V6(e)}function kd(e,t){return e1(t)?VR(t,e):U6(e,t)}function V6(e){const t={...e};for(const r in t){const a=t[r];$R(r,a)&&(t[r]=UR(a))}return t}function U6(e,t){if(!t)return e;for(const r in t){const a=t[r];switch(r){case"style":{e[r]=Dy(e.style,a);break}case"className":{e[r]=HR(e.className,a);break}default:$R(r,a)?e[r]=H6(e[r],a):e[r]=a}}return e}function $R(e,t){const r=e.charCodeAt(0),a=e.charCodeAt(1),l=e.charCodeAt(2);return r===111&&a===110&&l>=65&&l<=90&&(typeof t=="function"||typeof t>"u")}function e1(e){return typeof e=="function"}function VR(e,t){return e1(e)?e(t):e??Jv}function H6(e,t){return t?e?(...r)=>{const a=r[0];if(FR(a)){const c=a;pp(c);const u=t(...r);return c.baseUIHandlerPrevented||e==null||e(...r),u}const l=t(...r);return e==null||e(...r),l}:UR(t):e}function UR(e){return e&&((...t)=>{const r=t[0];return FR(r)&&pp(r),e(...t)})}function pp(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function HR(e,t){return t?e?t+" "+e:t:e}function FR(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function F6(e,t){return function(a,...l){const c=new URL(e);return c.searchParams.set("code",a.toString()),l.forEach(u=>c.searchParams.append("args[]",u)),`${t} error #${a}; visit ${c} for the full message.`}}const Jt=F6("https://base-ui.com/production-error","Base UI"),GR=x.createContext(void 0);function og(e=!1){const t=x.useContext(GR);if(t===void 0&&!e)throw new Error(Jt(16));return t}function G6(e){const{focusableWhenDisabled:t,disabled:r,composite:a=!1,tabIndex:l=0,isNativeButton:c}=e,u=a&&t!==!1,f=a&&t===!1;return{props:x.useMemo(()=>{const h={onKeyDown(g){r&&t&&g.key!=="Tab"&&g.preventDefault()}};return a||(h.tabIndex=l,!c&&r&&(h.tabIndex=t?l:-1)),(c&&(t||u)||!c&&r)&&(h["aria-disabled"]=r),c&&(!t||f)&&(h.disabled=r),h},[a,r,t,u,f,c,l])}}function Ft(e){return(e==null?void 0:e.ownerDocument)||document}function Xc(e,t,{detail:r=0}={}){e.dispatchEvent(new(xn(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:r,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function ro(e={}){const{disabled:t=!1,focusableWhenDisabled:r,tabIndex:a=0,native:l=!0,composite:c}=e,u=x.useRef(null),f=og(!0),m=c??f!==void 0,{props:h}=G6({focusableWhenDisabled:r,disabled:t,composite:m,tabIndex:a,isNativeButton:l}),g=x.useCallback(()=>{const v=u.current;R0(v)&&m&&t&&h.disabled===void 0&&v.disabled&&(v.disabled=!1)},[t,h.disabled,m]);Ke(g,[g]);const p=x.useCallback((v={})=>{const{onClick:j,onMouseDown:S,onKeyUp:C,onKeyDown:N,onPointerDown:E,...T}=v;return Xs({onClick(A){if(t){A.preventDefault();return}j==null||j(A)},onMouseDown(A){t||S==null||S(A)},onKeyDown(A){if(t||(pp(A),N==null||N(A),A.baseUIHandlerPrevented))return;const k=A.target===A.currentTarget,M=A.currentTarget,R=R0(M),O=!l&&q6(M),D=k&&(l?R:!O),_=A.key==="Enter",L=A.key===" ",q=M.getAttribute("role"),P=(q==null?void 0:q.startsWith("menuitem"))||q==="option"||q==="gridcell";if(k&&m&&L){if(A.defaultPrevented&&P)return;A.preventDefault(),(!l||R)&&(A.preventBaseUIHandler(),Xc(M,A));return}if(!D||l||!L&&!_){k&&O&&L&&A.preventDefault();return}A.defaultPrevented||(A.preventDefault(),_&&(A.preventBaseUIHandler(),Xc(M,A)))},onKeyUp(A){if(!t){if(pp(A),C==null||C(A),A.target===A.currentTarget&&l&&m&&R0(A.currentTarget)&&A.key===" "){A.preventDefault();return}A.baseUIHandlerPrevented||A.target===A.currentTarget&&!l&&!m&&!A.defaultPrevented&&A.key===" "&&(A.preventBaseUIHandler(),Xc(A.currentTarget,A))}},onPointerDown(A){if(t){A.preventDefault();return}E==null||E(A)}},l?{type:"button"}:{role:"button"},h,T)},[t,h,m,l]),b=et(v=>{u.current=v,g()});return{getButtonProps:p,buttonRef:b}}function R0(e){return cn(e)&&e.tagName==="BUTTON"}function q6(e){return cn(e)&&e.tagName==="A"&&!!e.href}function qr(e,t,r,a){const l=us(qR).current;return K6(l,e,t,r,a)&&YR(l,[e,t,r,a]),l.callback}function Y6(e){const t=us(qR).current;return X6(t,e)&&YR(t,e),t.callback}function qR(){return{callback:null,cleanup:null,refs:[]}}function K6(e,t,r,a,l){return e.refs[0]!==t||e.refs[1]!==r||e.refs[2]!==a||e.refs[3]!==l}function X6(e,t){return e.refs.length!==t.length||e.refs.some((r,a)=>r!==t[a])}function YR(e,t){if(e.refs=t,t.every(r=>r==null)){e.callback=null;return}e.callback=r=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),r!=null){const a=Array(t.length).fill(null);for(let l=0;l<t.length;l+=1){const c=t[l];if(c!=null)switch(typeof c){case"function":{const u=c(r);typeof u=="function"&&(a[l]=u);break}case"object":{c.current=r;break}}}e.cleanup=()=>{for(let l=0;l<t.length;l+=1){const c=t[l];if(c!=null)switch(typeof c){case"function":{const u=a[l];typeof u=="function"?u():c(null);break}case"object":{c.current=null;break}}}}}}}const W6=parseInt(x.version,10);function t1(e){return W6>=e}function fC(e){if(!x.isValidElement(e))return null;const t=e,r=t.props;return(t1(19)?r==null?void 0:r.ref:t.ref)??null}function Tn(){}const Cr=Object.freeze([]),gn=Object.freeze({});function Q6(e,t){const r={};for(const a in e){const l=e[a];if(t!=null&&t.hasOwnProperty(a)){const c=t[a](l);c!=null&&Object.assign(r,c);continue}l===!0?r[`data-${a.toLowerCase()}`]="":l&&(r[`data-${a.toLowerCase()}`]=l.toString())}return r}function Z6(e,t){return typeof e=="function"?e(t):e}function KR(e,t){return typeof e=="function"?e(t):e}function wt(e,t,r={}){let a=t.render;r.enabled!==!1&&(a=n_(a));const l=J6(t,r,a);if(r.enabled===!1)return null;const c=r.state??gn;return s_(e,a,l,c)}function J6(e,t,r){const{className:a,style:l}=e,{state:c=gn,ref:u,props:f,stateAttributesMapping:m,enabled:h=!0}=t,g=h?Z6(a,c):void 0,p=h?KR(l,c):void 0,b=h?Q6(c,m):gn,v=h&&f?e_(f):void 0,j=h?Dy(b,v)??{}:gn;return typeof document<"u"&&(h?Array.isArray(u)?j.ref=Y6([j.ref,fC(r),...u]):j.ref=qr(j.ref,fC(r),u):qr(null,null)),h?(g!==void 0&&(j.className=HR(j.className,g)),p!==void 0&&(j.style=Dy(j.style,p)),j):gn}function e_(e){return Array.isArray(e)?$6(e):Xs(void 0,e)}const t_=Symbol.for("react.lazy");function n_(e){if((e==null?void 0:e.$$typeof)!==t_)return e;const t=x.Children.toArray(e)[0];return x.isValidElement(t)?t:e}function s_(e,t,r,a){if(t){if(typeof t=="function")return t(r,a);const l=Xs(r,t.props);return l.ref=r.ref,x.cloneElement(t,l)}if(e&&typeof e=="string")return r_(e,r);throw new Error(Jt(8))}function r_(e,t){return e==="button"?x.createElement("button",{type:"button",...t,key:t.key}):e==="img"?x.createElement("img",{alt:"",...t,key:t.key}):x.createElement(e,t)}const o_=x.forwardRef(function(t,r){const{render:a,className:l,disabled:c=!1,focusableWhenDisabled:u=!1,nativeButton:f=!0,style:m,...h}=t,{getButtonProps:g,buttonRef:p}=ro({disabled:c,focusableWhenDisabled:u,native:f});return wt("button",t,{state:{disabled:c},ref:[r,p],props:[h,g]})});function XR(e){var t,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(r=XR(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function WR(){for(var e,t,r=0,a="",l=arguments.length;r<l;r++)(e=arguments[r])&&(t=XR(e))&&(a&&(a+=" "),a+=t);return a}const mC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,hC=WR,ag=(e,t)=>r=>{var a;if((t==null?void 0:t.variants)==null)return hC(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:l,defaultVariants:c}=t,u=Object.keys(l).map(h=>{const g=r==null?void 0:r[h],p=c==null?void 0:c[h];if(g===null)return null;const b=mC(g)||mC(p);return l[h][b]}),f=r&&Object.entries(r).reduce((h,g)=>{let[p,b]=g;return b===void 0||(h[p]=b),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,g)=>{let{class:p,className:b,...v}=g;return Object.entries(v).every(j=>{let[S,C]=j;return Array.isArray(C)?C.includes({...c,...f}[S]):{...c,...f}[S]===C})?[...h,p,b]:h},[]);return hC(e,u,m,r==null?void 0:r.class,r==null?void 0:r.className)},a_=(e,t)=>{const r=new Array(e.length+t.length);for(let a=0;a<e.length;a++)r[a]=e[a];for(let a=0;a<t.length;a++)r[e.length+a]=t[a];return r},i_=(e,t)=>({classGroupId:e,validator:t}),QR=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),gp="-",pC=[],l_="arbitrary..",c_=e=>{const t=d_(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return u_(u);const f=u.split(gp),m=f[0]===""&&f.length>1?1:0;return ZR(f,m,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const m=a[u],h=r[u];return m?h?a_(h,m):m:h||pC}return r[u]||pC}}},ZR=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const l=e[t],c=r.nextPart.get(l);if(c){const h=ZR(e,t+1,c);if(h)return h}const u=r.validators;if(u===null)return;const f=t===0?e.join(gp):e.slice(t).join(gp),m=u.length;for(let h=0;h<m;h++){const g=u[h];if(g.validator(f))return g.classGroupId}},u_=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),a=t.slice(0,r);return a?l_+a:void 0})(),d_=e=>{const{theme:t,classGroups:r}=e;return f_(r,t)},f_=(e,t)=>{const r=QR();for(const a in e){const l=e[a];n1(l,r,a,t)}return r},n1=(e,t,r,a)=>{const l=e.length;for(let c=0;c<l;c++){const u=e[c];m_(u,t,r,a)}},m_=(e,t,r,a)=>{if(typeof e=="string"){h_(e,t,r);return}if(typeof e=="function"){p_(e,t,r,a);return}g_(e,t,r,a)},h_=(e,t,r)=>{const a=e===""?t:JR(t,e);a.classGroupId=r},p_=(e,t,r,a)=>{if(x_(e)){n1(e(a),t,r,a);return}t.validators===null&&(t.validators=[]),t.validators.push(i_(r,e))},g_=(e,t,r,a)=>{const l=Object.entries(e),c=l.length;for(let u=0;u<c;u++){const[f,m]=l[u];n1(m,JR(t,f),r,a)}},JR=(e,t)=>{let r=e;const a=t.split(gp),l=a.length;for(let c=0;c<l;c++){const u=a[c];let f=r.nextPart.get(u);f||(f=QR(),r.nextPart.set(u,f)),r=f}return r},x_=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,b_=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),a=Object.create(null);const l=(c,u)=>{r[c]=u,t++,t>e&&(t=0,a=r,r=Object.create(null))};return{get(c){let u=r[c];if(u!==void 0)return u;if((u=a[c])!==void 0)return l(c,u),u},set(c,u){c in r?r[c]=u:l(c,u)}}},zy="!",gC=":",y_=[],xC=(e,t,r,a,l)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:a,isExternal:l}),v_=e=>{const{prefix:t,experimentalParseClassName:r}=e;let a=l=>{const c=[];let u=0,f=0,m=0,h;const g=l.length;for(let S=0;S<g;S++){const C=l[S];if(u===0&&f===0){if(C===gC){c.push(l.slice(m,S)),m=S+1;continue}if(C==="/"){h=S;continue}}C==="["?u++:C==="]"?u--:C==="("?f++:C===")"&&f--}const p=c.length===0?l:l.slice(m);let b=p,v=!1;p.endsWith(zy)?(b=p.slice(0,-1),v=!0):p.startsWith(zy)&&(b=p.slice(1),v=!0);const j=h&&h>m?h-m:void 0;return xC(c,v,b,j)};if(t){const l=t+gC,c=a;a=u=>u.startsWith(l)?c(u.slice(l.length)):xC(y_,!1,u,void 0,!0)}if(r){const l=a;a=c=>r({className:c,parseClassName:l})}return a},w_=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,a)=>{t.set(r,1e6+a)}),r=>{const a=[];let l=[];for(let c=0;c<r.length;c++){const u=r[c],f=u[0]==="[",m=t.has(u);f||m?(l.length>0&&(l.sort(),a.push(...l),l=[]),a.push(u)):l.push(u)}return l.length>0&&(l.sort(),a.push(...l)),a}},j_=e=>({cache:b_(e.cacheSize),parseClassName:v_(e),sortModifiers:w_(e),postfixLookupClassGroupIds:S_(e),...c_(e)}),S_=e=>{const t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let a=0;a<r.length;a++)t[r[a]]=!0;return t},N_=/\s+/,C_=(e,t)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:c,postfixLookupClassGroupIds:u}=t,f=[],m=e.trim().split(N_);let h="";for(let g=m.length-1;g>=0;g-=1){const p=m[g],{isExternal:b,modifiers:v,hasImportantModifier:j,baseClassName:S,maybePostfixModifierPosition:C}=r(p);if(b){h=p+(h.length>0?" "+h:h);continue}let N=!!C,E;if(N){const R=S.substring(0,C);E=a(R);const O=E&&u[E]?a(S):void 0;O&&O!==E&&(E=O,N=!1)}else E=a(S);if(!E){if(!N){h=p+(h.length>0?" "+h:h);continue}if(E=a(S),!E){h=p+(h.length>0?" "+h:h);continue}N=!1}const T=v.length===0?"":v.length===1?v[0]:c(v).join(":"),A=j?T+zy:T,k=A+E;if(f.indexOf(k)>-1)continue;f.push(k);const M=l(E,N);for(let R=0;R<M.length;++R){const O=M[R];f.push(A+O)}h=p+(h.length>0?" "+h:h)}return h},k_=(...e)=>{let t=0,r,a,l="";for(;t<e.length;)(r=e[t++])&&(a=eA(r))&&(l&&(l+=" "),l+=a);return l},eA=e=>{if(typeof e=="string")return e;let t,r="";for(let a=0;a<e.length;a++)e[a]&&(t=eA(e[a]))&&(r&&(r+=" "),r+=t);return r},T_=(e,...t)=>{let r,a,l,c;const u=m=>{const h=t.reduce((g,p)=>p(g),e());return r=j_(h),a=r.cache.get,l=r.cache.set,c=f,f(m)},f=m=>{const h=a(m);if(h)return h;const g=C_(m,r);return l(m,g),g};return c=u,(...m)=>c(k_(...m))},E_=[],ss=e=>{const t=r=>r[e]||E_;return t.isThemeGetter=!0,t.themeKey=e,t},tA=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,nA=/^\((?:(\w[\w-]*):)?(.+)\)$/i,R_=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,A_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,O_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,M_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,D_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,z_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,yi=e=>R_.test(e),Ut=e=>!!e&&!Number.isNaN(Number(e)),Io=e=>!!e&&Number.isInteger(Number(e)),A0=e=>e.endsWith("%")&&Ut(e.slice(0,-1)),pa=e=>A_.test(e),sA=()=>!0,P_=e=>O_.test(e)&&!M_.test(e),s1=()=>!1,I_=e=>D_.test(e),__=e=>z_.test(e),L_=e=>!it(e)&&!lt(e),B_=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),$_=e=>Ii(e,aA,s1),it=e=>tA.test(e),xl=e=>Ii(e,iA,P_),bC=e=>Ii(e,K_,Ut),V_=e=>Ii(e,cA,sA),U_=e=>Ii(e,lA,s1),yC=e=>Ii(e,rA,s1),H_=e=>Ii(e,oA,__),sh=e=>Ii(e,uA,I_),lt=e=>nA.test(e),vd=e=>Yl(e,iA),F_=e=>Yl(e,lA),vC=e=>Yl(e,rA),G_=e=>Yl(e,aA),q_=e=>Yl(e,oA),rh=e=>Yl(e,uA,!0),Y_=e=>Yl(e,cA,!0),Ii=(e,t,r)=>{const a=tA.exec(e);return a?a[1]?t(a[1]):r(a[2]):!1},Yl=(e,t,r=!1)=>{const a=nA.exec(e);return a?a[1]?t(a[1]):r:!1},rA=e=>e==="position"||e==="percentage",oA=e=>e==="image"||e==="url",aA=e=>e==="length"||e==="size"||e==="bg-size",iA=e=>e==="length",K_=e=>e==="number",lA=e=>e==="family-name",cA=e=>e==="number"||e==="weight",uA=e=>e==="shadow",X_=()=>{const e=ss("color"),t=ss("font"),r=ss("text"),a=ss("font-weight"),l=ss("tracking"),c=ss("leading"),u=ss("breakpoint"),f=ss("container"),m=ss("spacing"),h=ss("radius"),g=ss("shadow"),p=ss("inset-shadow"),b=ss("text-shadow"),v=ss("drop-shadow"),j=ss("blur"),S=ss("perspective"),C=ss("aspect"),N=ss("ease"),E=ss("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...A(),lt,it],M=()=>["auto","hidden","clip","visible","scroll"],R=()=>["auto","contain","none"],O=()=>[lt,it,m],D=()=>[yi,"full","auto",...O()],_=()=>[Io,"none","subgrid",lt,it],L=()=>["auto",{span:["full",Io,lt,it]},Io,lt,it],q=()=>[Io,"auto",lt,it],P=()=>["auto","min","max","fr",lt,it],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...O()],V=()=>[yi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],G=()=>[f,yi,"screen","full","dvw","lvw","svw","min","max","fit",...O()],X=()=>[yi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],B=()=>[e,lt,it],Z=()=>[...A(),vC,yC,{position:[lt,it]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",G_,$_,{size:[lt,it]}],I=()=>[A0,vd,xl],U=()=>["","none","full",h,lt,it],Q=()=>["",Ut,vd,xl],te=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[Ut,A0,vC,yC],ne=()=>["","none",j,lt,it],ce=()=>["none",Ut,lt,it],oe=()=>["none",Ut,lt,it],W=()=>[Ut,lt,it],de=()=>[yi,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[pa],breakpoint:[pa],color:[sA],container:[pa],"drop-shadow":[pa],ease:["in","out","in-out"],font:[L_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[pa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[pa],shadow:[pa],spacing:["px",Ut],text:[pa],"text-shadow":[pa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",yi,it,lt,C]}],container:["container"],"container-type":[{"@container":["","normal","size",lt,it]}],"container-named":[B_],columns:[{columns:[Ut,"auto",it,lt,f]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:M()}],"overflow-x":[{"overflow-x":M()}],"overflow-y":[{"overflow-y":M()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Io,"auto",lt,it]}],basis:[{basis:[yi,"full","auto",f,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ut,yi,"auto","initial","none",it]}],grow:[{grow:["",Ut,lt,it]}],shrink:[{shrink:["",Ut,lt,it]}],order:[{order:[Io,"first","last","none",lt,it]}],"grid-cols":[{"grid-cols":_()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":_()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mbs:[{mbs:F()}],mbe:[{mbe:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:V()}],"inline-size":[{inline:["auto",...G()]}],"min-inline-size":[{"min-inline":["auto",...G()]}],"max-inline-size":[{"max-inline":["none",...G()]}],"block-size":[{block:["auto",...X()]}],"min-block-size":[{"min-block":["auto",...X()]}],"max-block-size":[{"max-block":["none",...X()]}],w:[{w:[f,"screen",...V()]}],"min-w":[{"min-w":[f,"screen","none",...V()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...V()]}],h:[{h:["screen","lh",...V()]}],"min-h":[{"min-h":["screen","lh","none",...V()]}],"max-h":[{"max-h":["screen","lh","none",...V()]}],"font-size":[{text:["base",r,vd,xl]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,Y_,V_]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",A0,it]}],"font-family":[{font:[F_,U_,t]}],"font-features":[{"font-features":[it]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,lt,it]}],"line-clamp":[{"line-clamp":[Ut,"none",lt,bC]}],leading:[{leading:["none",c,...O()]}],"list-image":[{"list-image":["none",lt,it]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",lt,it]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ut,"from-font","auto",lt,xl]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[Ut,"auto",lt,it]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"tab-size":[{tab:[Io,lt,it]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",lt,it]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",lt,it]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Io,lt,it],radial:["",lt,it],conic:["",Io,lt,it]},q_,H_]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-bs":[{"border-bs":Q()}],"border-w-be":[{"border-be":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-bs":[{"border-bs":B()}],"border-color-be":[{"border-be":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ut,lt,it]}],"outline-w":[{outline:["",Ut,vd,xl]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","inner","none",g,rh,sh]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",p,rh,sh]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[Ut,xl]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",b,rh,sh]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[Ut,lt,it]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ut]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[lt,it]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[Ut]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",lt,it]}],filter:[{filter:["","none",lt,it]}],blur:[{blur:ne()}],brightness:[{brightness:[Ut,lt,it]}],contrast:[{contrast:[Ut,lt,it]}],"drop-shadow":[{"drop-shadow":["","none",v,rh,sh]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",Ut,lt,it]}],"hue-rotate":[{"hue-rotate":[Ut,lt,it]}],invert:[{invert:["",Ut,lt,it]}],saturate:[{saturate:[Ut,lt,it]}],sepia:[{sepia:["",Ut,lt,it]}],"backdrop-filter":[{"backdrop-filter":["","none",lt,it]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Ut,lt,it]}],"backdrop-contrast":[{"backdrop-contrast":[Ut,lt,it]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ut,lt,it]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ut,lt,it]}],"backdrop-invert":[{"backdrop-invert":["",Ut,lt,it]}],"backdrop-opacity":[{"backdrop-opacity":[Ut,lt,it]}],"backdrop-saturate":[{"backdrop-saturate":[Ut,lt,it]}],"backdrop-sepia":[{"backdrop-sepia":["",Ut,lt,it]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",lt,it]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ut,"initial",lt,it]}],ease:[{ease:["linear","initial",N,lt,it]}],delay:[{delay:[Ut,lt,it]}],animate:[{animate:["none",E,lt,it]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,lt,it]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:W()}],"skew-x":[{"skew-x":W()}],"skew-y":[{"skew-y":W()}],transform:[{transform:[lt,it,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"translate-none":["translate-none"],zoom:[{zoom:[Io,lt,it]}],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",lt,it]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":B()}],"scrollbar-track-color":[{"scrollbar-track":B()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",lt,it]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[Ut,vd,xl,bC]}],stroke:[{stroke:["none",...B()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},W_=T_(X_);function Le(...e){return W_(WR(e))}const Py=ag("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function ue({className:e,variant:t="default",size:r="default",...a}){return s.jsx(o_,{"data-slot":"button",className:Le(Py({variant:t,size:r,className:e})),...a})}const Q_="data-valid",Z_="data-invalid",J_={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},eL={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},tL={disabled:!1,...eL},ig={valid(e){return e===null?null:e?{[Q_]:""}:{[Z_]:""}}},nL={invalid:void 0,name:void 0,validityData:{state:J_,errors:[],error:"",value:"",initialValue:null},setValidityData:Tn,disabled:void 0,setTouched:Tn,setDirty:Tn,setFilled:Tn,setFocused:Tn,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:tL,registerFieldControl:Tn,validation:{getValidationProps:(e,t=gn)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Tn,getInputControl:()=>null,commit:async()=>{},change:Tn}},sL=x.createContext(nL);function gu(e=!0){const t=x.useContext(sL);if(t.setValidityData===Tn&&!e)throw new Error(Jt(28));return t}const rL=x.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Tn,validationMode:"onSubmit",submitCountRef:{current:0}});function lg(){return x.useContext(rL)}let wC=0;function oL(e,t="mui"){const[r,a]=x.useState(e),l=e||r;return x.useEffect(()=>{r==null&&(wC+=1,a(`${t}-${wC}`))},[r,t]),l}const jC=Zv.useId;function Pl(e,t){if(jC!==void 0){const r=jC();return e??(t?`${t}-${r}`:r)}return oL(e,t)}function ds(e){return Pl(e,"base-ui")}const aL=x.createContext({controlId:void 0,registerControlId:Tn,resetControlId:Tn,labelId:void 0,setLabelId:Tn,messageIds:[],setMessageIds:Tn,getDescriptionProps:e=>e});function mf(){return x.useContext(aL)}function dA(e,t,r,a=!0,l){const[c,u]=x.useState(),f=ds(l?`${l}-label`:void 0),m=e??t??c;return Ke(()=>{const h=e||t||!a?void 0:iL(r.current,f);c!==h&&u(h)}),m}function iL(e,t){const r=lL(e);if(r)return!r.id&&t&&(r.id=t),r.id||void 0}function lL(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const r=e.id;if(r){const l=e.nextElementSibling;if(l&&l.htmlFor===r)return l}const a=e.labels;return a&&a[0]}function hf(e={}){const{id:t,enabled:r=!0}=e,{controlId:a,registerControlId:l,resetControlId:c}=mf(),u=ds(),f=us(()=>Symbol()),m=x.useRef(!1),h=x.useRef(!1),g=et(()=>{!m.current||l===Tn||(m.current=!1,l(f.current,void 0))});return Ke(()=>{if(!r||l===Tn){g();return}let p;if(t!==void 0)h.current=!0,p=t;else if(h.current)p=u;else{c();return}if(p===void 0){g();return}m.current=!0,l(f.current,p)},[t,r,l,c,u,f,g]),Ke(()=>g,[g]),(r?a:void 0)??t??u}function cL(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:uL,platform:dL,maxTouchPoints:fL}=cL(),cg=uL.toLowerCase(),Gd=dL.toLowerCase(),ug=/^i(os$|p)/.test(Gd)||Gd==="macintel"&&fL>1,SC="android",Iy=Gd===SC||cg.includes(SC),r1=!ug&&Gd.startsWith("mac");Gd.startsWith("win");const mL=r1||ug;var hR;const Ba=typeof CSS<"u"&&!!((hR=CSS.supports)!=null&&hR.call(CSS,"-webkit-backdrop-filter:none"));!Ba&&cg.includes("firefox");!Ba&&cg.includes("chrom");const hL=mL,o1=/jsdom|happydom/.test(cg);function Is(e){var r;let t=e.activeElement;for(;((r=t==null?void 0:t.shadowRoot)==null?void 0:r.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function pt(e,t){var a;if(!e||!t)return!1;const r=(a=t.getRootNode)==null?void 0:a.call(t);if(e.contains(t))return!0;if(r&&ou(r)){let l=t;for(;l;){if(e===l)return!0;l=l.parentNode||l.host}}return!1}function As(e){return"composedPath"in e?e.composedPath()[0]??e.target:e.target}const _y="data-base-ui-focusable",fA="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",dg="ArrowLeft",fg="ArrowRight",mA="ArrowUp",a1="ArrowDown",i1="data-starting-style",pL="data-ending-style",gL={[i1]:""},xL={[pL]:""},$a={transitionStatus(e){return e==="starting"?gL:e==="ending"?xL:null}},bL="data-open",yL="data-closed",vL="data-anchor-hidden",hA="data-popup-open",wL="data-pressed",jL={[hA]:""},SL={[hA]:"",[wL]:""},NL={[bL]:""},CL={[yL]:""},kL={[vL]:""},l1={open(e){return e?jL:null}},xp={open(e){return e?SL:null}},pf={open(e){return e?NL:CL},anchorHidden(e){return e?kL:null}},mg={...pf,...$a},Ly="data-trigger-disabled";function bp(e,t){if(!Gt(e))return!1;const r=e;if(t.hasElement(r))return!r.hasAttribute(Ly);for(const[,a]of t.entries())if(pt(a,r))return!a.hasAttribute(Ly);return!1}function O0(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const r=e;return r.target!=null&&t.contains(r.target)}function TL(e){return e.matches("html,body")}function hg(e){return cn(e)&&e.matches(fA)}function EL(e){return(e==null?void 0:e.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${fA}`))!=null}function By(e){return e?e.getAttribute("role")==="combobox"&&hg(e):!1}function RL(e){if(!e||o1)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function yp(e){return e?e.hasAttribute(_y)?e:e.querySelector(`[${_y}]`)||e:null}function Ai(e,t,r=!0){return e.filter(l=>l.parentId===t).flatMap(l=>{var c;return[...!r||(c=l.context)!=null&&c.open?[l]:[],...Ai(e,l.id,r)]})}function NC(e,t){var l;let r=[],a=(l=e.find(c=>c.id===t))==null?void 0:l.parentId;for(;a;){const c=e.find(u=>u.id===a);a=c==null?void 0:c.parentId,c&&(r=r.concat(c))}return r}function Vo(e){e.preventDefault(),e.stopPropagation()}function AL(e){return"nativeEvent"in e}function pg(e){return e.pointerType===""&&e.isTrusted?!0:Iy&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function c1(e){return o1?!1:!Iy&&e.width===0&&e.height===0||Iy&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Ci(e,t){const r=["mouse","pen"];return t||r.push("",void 0),r.includes(e)}function OL(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const au=Math.min,Na=Math.max,vp=Math.round,oh=Math.floor,Ca=e=>({x:e,y:e}),ML={left:"right",right:"left",bottom:"top",top:"bottom"};function pA(e,t,r){return Na(e,au(t,r))}function Oi(e,t){return typeof e=="function"?e(t):e}function Hr(e){return e.split("-")[0]}function Ra(e){return e.split("-")[1]}function u1(e){return e==="x"?"y":"x"}function d1(e){return e==="y"?"height":"width"}function Vr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function f1(e){return u1(Vr(e))}function DL(e,t,r){r===void 0&&(r=!1);const a=Ra(e),l=f1(e),c=d1(l);let u=l==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=wp(u)),[u,wp(u)]}function zL(e){const t=wp(e);return[$y(e),t,$y(t)]}function $y(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const CC=["left","right"],kC=["right","left"],PL=["top","bottom"],IL=["bottom","top"];function _L(e,t,r){switch(e){case"top":case"bottom":return r?t?kC:CC:t?CC:kC;case"left":case"right":return t?PL:IL;default:return[]}}function LL(e,t,r,a){const l=Ra(e);let c=_L(Hr(e),r==="start",a);return l&&(c=c.map(u=>u+"-"+l),t&&(c=c.concat(c.map($y)))),c}function wp(e){const t=Hr(e);return ML[t]+e.slice(t.length)}function BL(e){var t,r,a,l;return{top:(t=e.top)!=null?t:0,right:(r=e.right)!=null?r:0,bottom:(a=e.bottom)!=null?a:0,left:(l=e.left)!=null?l:0}}function gA(e){return typeof e!="number"?BL(e):{top:e,right:e,bottom:e,left:e}}function qd(e){const{x:t,y:r,width:a,height:l}=e;return{width:a,height:l,top:r,left:t,right:t+a,bottom:r+l,x:t,y:r}}function Pd(e,t){return t<0||t>=e.length}function Bh(e,t){return wa(e.current,{disabledIndices:t})}function Vy(e,t){return wa(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function wa(e,{startingIndex:t=-1,decrement:r=!1,disabledIndices:a,amount:l=1}={}){let c=t;do c+=r?-l:l;while(c>=0&&c<=e.length-1&&Wc(e,c,a));return c}function Wc(e,t,r){if(typeof r=="function"?r(t):(r==null?void 0:r.includes(t))??!1)return!0;const l=e[t];return l?!gg(l)||l.matches(":disabled")?!0:!r&&(l.hasAttribute("disabled")||l.getAttribute("aria-disabled")==="true"):!1}function $L(e){return e.visibility==="hidden"||e.visibility==="collapse"}function gg(e,t=e?Nr(e):null){return!e||!e.isConnected||!t||$L(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const VL='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function UL(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const r=e.getRootNode();return ou(r)?r.host:null}function Uy(e){for(const t of Array.from(e.children))if(Os(t)==="summary")return t;return null}function HL(e,t){const r=Uy(t);return!!r&&(e===r||pt(r,e))}function xA(e){const t=e?Os(e):"";return e!=null&&e.matches(VL)&&(t!=="summary"||e.parentElement!=null&&Os(e.parentElement)==="details"&&Uy(e.parentElement)===e)&&(t!=="details"||Uy(e)==null)&&(t!=="input"||e.type!=="hidden")}function bA(e){if(!xA(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=UL(t)){const r=t!==e,a=Os(t)==="slot";if(t.hasAttribute("inert")||r&&Os(t)==="details"&&!t.open&&!HL(e,t)||t.hasAttribute("hidden")||!a&&!FL(t,r))return!1}return!0}function FL(e,t){const r=Nr(e);return t?r.display!=="none":gg(e,r)}function yA(e){const t=e.tabIndex;if(t<0){const r=Os(e);if(r==="details"||r==="audio"||r==="video"||cn(e)&&e.isContentEditable)return 0}return t}function M0(e){if(Os(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function GL(e,t){const r=M0(e);if(!r)return!0;const a=t.find(l=>{const c=M0(l);return(c==null?void 0:c.name)===r.name&&c.form===r.form&&c.checked});return a?a===r:t.find(l=>{const c=M0(l);return(c==null?void 0:c.name)===r.name&&c.form===r.form})===r}function vA(e){if(cn(e)&&Os(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return cn(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function wA(e,t){vA(e).forEach(r=>{xA(r)&&t.push(r),wA(r,t)})}function jA(e,t,r){vA(e).forEach(a=>{cn(a)&&a.matches(t)&&r.push(a),jA(a,t,r)})}function m1(e){return bA(e)&&yA(e)>=0}function SA(e){const t=[];return wA(e,t),t.filter(bA)}function gf(e){const t=SA(e);return t.filter(r=>yA(r)>=0&&GL(r,t))}function NA(e,t){const r=gf(e),a=r.length;if(a===0)return;const l=Is(Ft(e)),c=r.indexOf(l),u=c===-1?t===1?0:a-1:c+t;return r[u]}function h1(e){return NA(Ft(e).body,1)||e}function CA(e){return NA(Ft(e).body,-1)||e}function kA(e,t){if(!e)return null;const r=gf(Ft(e).body),a=r.length;if(a===0)return null;const l=r.indexOf(e);if(l===-1)return null;const c=(l+t+a)%a;return r[c]}function qL(e){return kA(e,1)}function YL(e){return kA(e,-1)}function Qc(e,t){const r=t||e.currentTarget,a=e.relatedTarget;return!a||!pt(r,a)}function KL(e){gf(e).forEach(r=>{r.dataset.tabindex=r.getAttribute("tabindex")||"",r.setAttribute("tabindex","-1")})}function TC(e){const t=[];jA(e,"[data-tabindex]",t),t.forEach(r=>{const a=r.dataset.tabindex;delete r.dataset.tabindex,a?r.setAttribute("tabindex",a):r.removeAttribute("tabindex")})}function p1(e){x.useEffect(e,Cr)}const wd=0;class Yr{constructor(){tn(this,"currentId",wd);tn(this,"clear",()=>{this.currentId!==wd&&(clearTimeout(this.currentId),this.currentId=wd)});tn(this,"disposeEffect",()=>this.clear)}static create(){return new Yr}start(t,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=wd,r()},t)}isStarted(){return this.currentId!==wd}}function es(){const e=us(Yr.create).current;return p1(e.disposeEffect),e}const XL=x.createContext({disabled:!1});function WL(){return x.useContext(XL)}var Kr=bR();const QL=pR(Kr),ah=null;class ZL{constructor(){tn(this,"callbacks",[]);tn(this,"callbacksCount",0);tn(this,"nextId",1);tn(this,"startId",1);tn(this,"isScheduled",!1);tn(this,"tick",t=>{var l;this.isScheduled=!1;const r=this.callbacks,a=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,a>0)for(let c=0;c<r.length;c+=1)(l=r[c])==null||l.call(r,t)})}request(t){const r=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),r}cancel(t){const r=t-this.startId;r<0||r>=this.callbacks.length||this.callbacks[r]!==null&&(this.callbacks[r]=null,this.callbacksCount-=1)}}let ih=new ZL;class ir{constructor(){tn(this,"currentId",ah);tn(this,"cancel",()=>{this.currentId!==ah&&(ih.cancel(this.currentId),this.currentId=ah)});tn(this,"disposeEffect",()=>this.cancel)}static create(){return new ir}static request(t){return ih.request(t)}static cancel(t){return ih.cancel(t)}request(t){this.cancel(),this.currentId=ih.request(()=>{this.currentId=ah,t()})}}function iu(){const e=us(ir.create).current;return p1(e.disposeEffect),e}function ga(e){return e==null?e:"current"in e?e.current:e}let lh=null;function JL(e){if(!lh){const t=[];lh=t,queueMicrotask(()=>{lh=null,Kr.flushSync(()=>{for(const r of t)r()})})}lh.push(e)}function xf(e,t=!1,r=!1){const a=iu();return et((l,c=null)=>{a.cancel();const u=ga(e);if(u==null)return;const f=u,m=()=>{if(!r){Kr.flushSync(l);return}JL(()=>{c!=null&&c.aborted||l()})};if(typeof f.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){l();return}function h(){Promise.all(f.getAnimations().map(g=>g.finished)).then(()=>{c!=null&&c.aborted||m()},()=>{if(c!=null&&c.aborted)return;if(f.getAnimations().some(p=>p.pending||p.playState!=="finished")){h();return}m()})}if(t){const g=i1;if(!f.hasAttribute(g)){a.request(h);return}const p=new MutationObserver(()=>{f.hasAttribute(g)||(p.disconnect(),h())});p.observe(f,{attributes:!0,attributeFilter:[g]}),c==null||c.addEventListener("abort",()=>p.disconnect(),{once:!0});return}a.request(h)})}function lr(e){const{enabled:t=!0,open:r,ref:a,batch:l=!1,onComplete:c}=e,u=et(c),f=xf(a,r,l);x.useEffect(()=>{if(!t)return;const m=new AbortController;return f(u,m.signal),()=>{m.abort()}},[t,r,u,f])}function Va(e,t=!1,r=!1,a=!1){const[l,c]=x.useState(e&&t?"idle":void 0),[u,f]=x.useState(e&&!a);return e&&!u&&(f(!0),c("starting")),!e&&u&&l!=="ending"&&!r&&c("ending"),!e&&!u&&l==="ending"&&c(void 0),Ke(()=>{if(!e&&u&&l!=="ending"&&r){const m=ir.request(()=>{c("ending")});return()=>{ir.cancel(m)}}},[e,u,l,r]),Ke(()=>{if(!e||t)return;const m=ir.request(()=>{c(void 0)});return()=>{ir.cancel(m)}},[t,e]),Ke(()=>{if(!e||!t)return;e&&u&&l!=="idle"&&c("starting");const m=ir.request(()=>{c("idle")});return()=>{ir.cancel(m)}},[t,e,u,l]),{mounted:u,setMounted:f,transitionStatus:l}}function Xr({controlled:e,default:t,name:r,state:a="value"}){const{current:l}=x.useRef(e!==void 0),[c,u]=x.useState(t),f=l&&e!==void 0?e:c,m=x.useCallback(h=>{l||u(h)},[]);return[f,m]}function xg(e,t,r,a,l=!0,c){const{registerFieldControl:u}=gu(),f=us(()=>Symbol());Ke(()=>{const m=f.current;if(!l){u(m,void 0);return}u(m,{controlRef:e,getValue:a,id:t,name:c,value:r})},[e,l,a,t,c,u,f,r]),Ke(()=>{const m=f.current;return()=>{u(m,void 0)}},[u,f])}function bf(e,t){const r=x.useRef(e),a=et(t);Ke(()=>{r.current!==e&&a(r.current),r.current=e},[e,a])}const kr="none",Wo="trigger-press",Un="trigger-hover",Zc="trigger-focus",bg="outside-press",Al="item-press",TA="close-press",Mi="focus-out",yf="escape-key",Hy="list-navigation",EA="cancel-open",Td="sibling-open",RA="disabled",EC="missing",RC="initial",yg="imperative-action",e8="window-resize";function bt(e,t,r,a){let l=!1,c=!1;const u=a??gn;return{reason:e,event:t??new Event("base-ui"),cancel(){l=!0},allowPropagation(){c=!0},get isCanceled(){return l},get isPropagationAllowed(){return c},trigger:r,...u}}const t8=x.forwardRef(function(t,r){const{render:a,className:l,id:c,name:u,value:f,disabled:m=!1,onValueChange:h,defaultValue:g,autoFocus:p=!1,style:b,...v}=t,{state:j,name:S,disabled:C,setTouched:N,setDirty:E,validityData:T,setFocused:A,setFilled:k,validationMode:M,validation:R}=gu(),{clearErrors:O,elementRef:D,submitCountRef:_}=lg(),L=C||m,q=S??u,P={...j,disabled:L},{labelId:$}=mf(),H=hf({id:c}),[F]=Xr({controlled:f,default:g,name:"FieldControl",state:"value"}),V=f!==void 0,G=V?F:void 0,X=G==null?void 0:String(G),B=et(()=>{var I;return(I=R.inputRef.current)==null?void 0:I.value});xg(R.inputRef,H,X,B,!L,u),Ke(()=>{var U;const I=X??((U=R.inputRef.current)==null?void 0:U.value);I!==void 0&&k(I!=="")},[X,R.inputRef,k]),bf(X,()=>{X!==void 0&&(O(q),E(X!==(T.initialValue??"")),R.change(X))});const Z=x.useRef(null),K=es();return Ke(()=>{p&&Z.current===Is(Ft(Z.current))&&A(!0)},[p,A]),wt("input",t,{ref:[r,Z],state:P,props:[{id:H,disabled:L,name:q,ref:R.inputRef,"aria-labelledby":$,autoFocus:p,...V?{value:G}:{defaultValue:g},onChange(I){const U=I.currentTarget.value,Q=bt(kr,I.nativeEvent);h==null||h(U,Q),!V&&(E(U!==(T.initialValue??"")),k(U!==""),!I.nativeEvent.defaultPrevented&&!Q.isCanceled&&(O(q),R.change(U)))},onFocus(){A(!0)},onBlur(I){if(N(!0),A(!1),M==="onBlur"){const U=I.currentTarget.value;R.commit(U),V&&queueMicrotask(()=>{var te;const Q=(te=R.inputRef.current)==null?void 0:te.value;Q!==void 0&&Q!==U&&Q!==(T.initialValue??"")&&R.commit(Q)})}},onKeyDown(I){if(I.currentTarget.tagName==="INPUT"&&I.key==="Enter"){N(!0);const U=I.currentTarget.value,Q=I.currentTarget.form;if(Q&&Q===D.current&&!I.defaultPrevented){const te=I.currentTarget,le=_.current;K.start(0,()=>{_.current===le&&R.commit(te.value)})}else R.commit(U)}}},v,I=>R.getValidationProps(L,I)],stateAttributesMapping:ig})}),n8=x.forwardRef(function(t,r){return s.jsx(t8,{ref:r,...t})});function Rt({className:e,type:t,...r}){return s.jsx(n8,{type:t,"data-slot":"input",className:Le("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...r})}const AA=48,Zo=(e,t=0)=>{const r=new Int32Array(e.length);for(let a=0;a<e.length;a++)r[a]=e.charCodeAt(a)-AA-t;return r},vg=e=>{const t=new Int32Array(e.length+1);for(let r=0;r<e.length;r++)t[r+1]=t[r]+e[r];return t},Di=e=>{const t=new Int32Array(e.length);let r=0;for(let a=0;a<e.length;a++){const l=e.charCodeAt(a)-AA;r+=l>>>1^-(l&1),t[a]=r}return t},s8=384,r8=[],wl=vg(Zo("E0500002005282000000002000150000020021820000011200000003022202000300004200120000200420001200021200301200010400162000010000220021010:2192001200220012000220012000200200200400010200040000000000400200108200110100000022010313000162002000020020012020080213000228200000000082000000000120002000120020020040101020300130001001010")),o8=vg(Zo(":11111111211111119311546544411119731869:671397415686432441111111111161114151214313433415:78311132233313187211117221449443411141111151152226611131111112212518142224214215421421542142424242516171151615616347111111111197911327451111111111111111111113134714133513411111311111111111111111111112444411111342312715245411117:3")),a8="@containerabcdefghinlmoprstunderlineviawzccentlignnimatespectuto-colsrowsaglorightnessckdrop-sisbcontrastfiltergrayscalehue-rotateinvertopacityslurrightnessaturateepia-coniclinearpositionradialsizeockurrderttom-belrstxyespacing-xyaretoursorlnt-umnsendspantartainentrasteividerop-shadowurationcorationlay-xyasendillexontromlter-featuresstretchapr-xyayscaleidow-colsrowsue-rotatedentlinesetvert-beringsxyeshadoweiadingftnest-clamp-imageabein-lrstxyskx--b-coniclpositionrsizet-x-y-fromto-fromto-inearfromto-fromto-adialfromto-fromtofromtofromtofromtoblockhinlinew-screenesblockhinlinewbjectpacityrutlinederigin-offsetbelrstxyesrspective-originaceholderioghtng-offsettateundedw-xyz-belrstlreseslr-endspantartaturatecepiahizekewpace-taleroll-xyz-barmpbelrstxyesbelrstxyes-thumbrackadowrink-xyxyartrokeabextora-shadowpckingnsformitionlate-xyz-offsetill-changeoom",i8=(()=>{const e=wl.length-1,t=new Int32Array(e);for(let l=e-1;l>=0;l--){let c=1,u=l+1;for(let f=wl[l];f<wl[l+1];f++)c+=t[u],u+=t[u];t[l]=c}const r=new Int32Array(wl[e]);let a=0;for(let l=0;l<e;l++){let c=l+1;for(let u=wl[l];u<wl[l+1];u++)r[a++]=c,c+=t[c]}return r})(),l8=Zo("02000000000000900<=0?000B000F00F00ŏI0J0LNPRTVX0000]_a00000000000000000000000rst0000000zŏ00000000000…ŏ000ˆ0000ŏ0000000000—0000000000000000000000000000000000000000000000000000Ë000000000000000000000Þ000000000000000000ð0000000ø0ùúûüýþÿĀāĂ㥹Ć000000000000000000000000000000000000000000ħ0ĨĪ00000000000000000000ļĽ00000Ŭ000000",1),c8=vg(Zo("1233333593464636351265367151576")),u8=Zo("93203242332583253248325D>E?F@03263243255B:032523853:0325B:8GA032542H<C=12727B:0324325853;D>E?3257D>03258432585:0325B:;0328B:032"),d8=Zo("012123445661666666789111:5;;;;;;;;444;;;:62999<1161=62>>?61:21@ABCD4446996:64E:::;:?::64:F114GHHIHHHHIHH1HH1HH1HHHHHH::EJK4444::EJ4444441691;644444114244444:;L6666555555555555555999666664444444444444444444444226?6:66644M9N?D:111::::6DJ199"),f8=Di("0202002020020020020020020020020200200200200200200200002020202001003040106000200200200200200200200200200200200200200200200200200200200200200200200200200200200020020020020020020002020200202002002002002002002002002002020002002020020200220200200200200200200200200200200020020020000200020002000200200200020020020002000200200200020020202002020202000200200020022000200200020020002002000200220002002000200W0Z00020020002002020002002000200g0j0002002000200200020020002002000200200020020002000200002000002002002002002000200020000200002002002002002002002020020020200200200200200200200200202020020020020020020020020002002002020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020020002002002002002002000200200200200200200200200200020202020002000200020002002002002000020200200"),m8=(()=>{const e=new Int32Array(319).fill(-1),t=Di("02422242:222222242224222242442222222422222244442242226224222426222422442462222422622222222626222462242622422622422424242422222222422222222242422222222222222222622442224222222222222224424442262222222222222222222226224222424242422224422422422222"),r=Di("02222222222222222222202222222222222222222222221422222222222222222222222222222222222Y\\222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221422222222222222222222222222222222222222Ŀł222222222222222222");for(let a=0;a<t.length;a++)e[t[a]]=r[a];return e})(),h8="container |break-after- all auto avoid avoid-page column left page right|break-before- all auto avoid avoid-page column left page right|break-inside-a uto void void-column void-page|box-decoration- clone slice|box- border content| contents flow-root hidden table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group| not-sr-only sr-only|float- end left none right start|clear- both end left none right start|isolat e ion-auto|overflow- auto clip hidden scroll visible|overflow-x- auto clip hidden scroll visible|overflow-y- auto clip hidden scroll visible|overscroll- auto contain none|overscroll-x- auto contain none|overscroll-y- auto contain none| absolute fixed relative static sticky| collapse invisible visible|justify- around baseline between center center-safe end end-safe evenly normal start stretch|justify-items- center center-safe end end-safe normal start stretch|justify-self- auto center center-safe end end-safe start stretch|items- baseline baseline-last center center-safe end end-safe start stretch|self- auto baseline baseline-last center center-safe end end-safe start stretch|place-content- around baseline between center center-safe end end-safe evenly start stretch|place-items- baseline center center-safe end end-safe start stretch|place-self- auto center center-safe end end-safe start stretch| antialiased subpixel-antialiased| italic not-italic|normal-nums |ordinal |slashed-zero | lining-nums oldstyle-nums| proportional-nums tabular-nums| diagonal-fractions stacked-fractions| no-underline overline| capitalize lowercase normal-case uppercase|truncate |whitespace- break-spaces normal nowrap pre pre-line pre-wrap|break- all keep normal words|wrap- anywhere break-word normal|hyphens- auto manual none|mix-blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay plus-darker plus-lighter saturation screen soft-light|table- auto fixed|caption- bottom top|backface- hidden visible|appearance- auto none|scheme- dark light light-dark normal only-dark only-light|field-sizing- content fixed|pointer-events- auto none|resize -none -x -y|snap- align-none center end start|snap- always normal|snap- both none x y|snap- mandatory proximity|touch- auto manipulation none|touch-pan- left right x|touch-pan- down up y|touch-pinch-zoom |select- all auto none text|forced-color-adjust- auto none| normal size| baseline bottom middle sub super text-bottom text-top top|none | auto square video| auto fr max min px| auto full px| fixed local scroll|clip- border content padding text|origin- border content padding| bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| no-repeat repeat repeat-round repeat-space repeat-x repeat-y| auto contain cover| gradient-to-b gradient-to-bl gradient-to-br gradient-to-l gradient-to-r gradient-to-t gradient-to-tl gradient-to-tr none|blend- color color-burn color-dodge darken difference exclusion hard-light hue lighten luminosity multiply normal overlay saturation screen soft-light|to- b bl br l r t tl tr| auto dvh fit full lh lvh max min px screen svh| dashed dotted double hidden none solid| collapse separate|px |auto |full | content none strict| inline-size size|layout |paint |style | around baseline between center center-safe end end-safe evenly normal start stretch| alias all-scroll auto cell col-resize context-menu copy crosshair default e-resize ew-resize grab grabbing help move n-resize ne-resize nesw-resize no-drop none not-allowed ns-resize nw-resize nwse-resize pointer progress row-resize s-resize se-resize sw-resize text vertical-text w-resize wait zoom-in zoom-out| dashed dotted double solid wavy| auto from-font|reverse |initial | in in-out initial linear out| col col-reverse row row-reverse| nowrap wrap wrap-reverse| auto initial none| black bold extrabold extralight light medium normal semibold thin| condensed expanded extra-condensed extra-expanded normal semi-condensed semi-expanded ultra-condensed ultra-expanded|flow- col col-dense dense row row-dense| none subgrid| auto dvh dvw fit full lh lvh lvw max min px screen svh svw| block flex grid table| auto dvw fit full lvw max min px screen svw| loose none normal px relaxed snug tight|through |item | inside outside| decimal disc none| auto px| clip-border clip-content clip-fill clip-padding clip-stroke clip-view no-clip| add exclude intersect subtract| alpha luminance match|origin- border content fill padding stroke view|type- alpha luminance| circle ellipse| closest-corner closest-side farthest-corner farthest-side|at- bottom bottom-left bottom-right center left left-bottom left-top right right-bottom right-top top top-left top-right| dvh fit full lh lvh max min none px screen svh| auto dvh dvw fit full lh lvh lvw max min none px screen svh svw| dvw fit full lvw max min none px screen svw| auto dvh dvw fit full lvh lvw max min none prose px svh svw| auto dvh dvw fit full lvh lvw max min none px screen svh svw| contain cover fill none scale-down| first last none| distant dramatic midrange near none normal|inset | full none|3d | auto smooth|gutter- auto both stable| auto none thin| inner none| auto dvh dvw fit full lvh lvw max min px svh svw|base | center end justify left right start| clip ellipsis| balance nowrap pretty wrap| normal tight tighter wide wider widest| cpu gpu none| 3d flat| all colors none opacity shadow transform| discrete normal| full px| auto dvh dvw fit full lvh lvw max min px screen svh svw| auto contents scroll transform".split("|").map(e=>{const t=e.split(" "),r=t.shift();for(let a=0;a<t.length;a++)t[a]=r+t[a];return t}),AC=Di("0000000000000000000000000000000000000000000000000000000000000262242:6@200000006:240B428:4422400002046044222426220026642642462026224222824220022400000000\\00N222422242222222224062242222222422226264222422222222222222442804222422222222222222222222220<4<0204260002444020204224422"),p8=Di("ɠ222222222222222222222222222222222222222222222222222222222222˕4222226>ʶ22ʷʺʷ2ʸʷ42ʴ2ʓ22>621422ɶ222ɹɼɷɺɷɺ22ɱ42222ɨ2ɧ26622ɘɓ244ƸƵ222]d24242ǖǓƚÄȫ2263ȨȥȨ2222222ǣ222222222222222222ǂƽ2ƾƵ2222222422222ƜƑ22222222222222222222144Ŧţ22Ţş222222222222222222222ĸ2ı68ĦģĦɡŰ4Ġ«®ĝ822ĔđĔ2ē2222622"),g8=Di("02222222222222222222222222222222222222222222222222222222222222222203062222222222IL2200IL021042222]`222IL0gj2e50n2222U00X202[^2y0000560|{~ƒ†22‰Œ‹>22|22222222222G000q†OVI00000}š2›>40000ŒB00000I¨­000°00000000000000021Q²±00´“000000000000000000000–222›HGHa5¾222Ã6À2222ÍÐ000­°2±"),OA=new Int32Array(991),MA=new Int32Array(991),DA=new Int32Array(991);let Fy="";const Gy=new Int32Array(1030);{const e=new Map;let t=0,r=0;for(let a=0;a<AC.length;a++)for(const l of h8[g8[a]]){let c=e.get(l);c===void 0&&(c=t++,e.set(l,c),Gy[c*2]=Fy.length,Gy[c*2+1]=l.length,Fy+=l),OA[r]=AC[a],MA[r]=p8[a],DA[r]=c,r++}}const x8=Di("0b2N:222@R>F@286¦2@H2D266226FB22B2>BD\\6N22222Z222D222p"),b8=vg(Zo("1::22222432:222:22:22>222222:22:2221322511111311111114")),y8=Di("2Š4A;33N=C@H4A;33N=C@<2;363@QTQʰ222ˉºŴŽ2R2=18cƴÅҜÜÛŲǝȈ:ħ25=11D3A@216Er25;11B3?<438Cn9@7=<8192>2E121@9@EHE@9>2T25511<398216=V25511<398216=„ƧNž2Đå242L222290000f22500ɛ000ǘ222"),v8=Zo("ij"),w8=Zo("—"),j8=Zo("1"),S8="* ** after backdrop before details-content file first-letter first-line marker placeholder selection";var N8={GROUP_COUNT:s8,customValidatorNames:r8,edgeStart:wl,labelStart:o8,labelText:a8,edgeTarget:i8,nodeGroup:l8,nodeVlist:m8,vlistPat:c8,vlistOps:u8,vlistRef:d8,vlistGroup:f8,litAnchor:OA,litGroup:MA,litPool:DA,poolOffsets:Gy,poolText:Fy,adjGid:x8,adjStart:b8,adjTgt:y8,patGid:v8,patTgt:w8,postfixLookupGroups:j8,orderSensitiveModifiers:S8};const C8="line"in new Error,_o=-1,bl=-1,D0=(e,t,r)=>{let a=2166136261;for(let l=t;l<r;l++)a=Math.imul(a^e.charCodeAt(l),16777619);return a},z0=(e,t,r)=>{const a=r-t;let l=Math.imul(a,2654435761)^e.charCodeAt(t);if(a>3){const c=a>>2,u=a>>1;l=Math.imul(l^e.charCodeAt(t+1)<<8^e.charCodeAt(t+2)<<16^e.charCodeAt(t+c),2246822507),l=Math.imul(l^e.charCodeAt(t+u)<<8^e.charCodeAt(t+u+c)<<16^e.charCodeAt(r-3),3266489909),l^=e.charCodeAt(r-2)<<8^e.charCodeAt(r-1)<<16;for(let f=t+3,m=r-4;f<t+8&&f<m;f++,m--)l=Math.imul(l^e.charCodeAt(f)^e.charCodeAt(m)<<8,16777619)}return l^l>>>15|0},k8=(e,t,r={})=>{const{GROUP_COUNT:a,edgeStart:l,labelStart:c,labelText:u,edgeTarget:f,nodeGroup:m,nodeVlist:h,vlistPat:g,vlistOps:p,vlistRef:b,vlistGroup:v,litAnchor:j,litGroup:S,litPool:C,poolOffsets:N,poolText:E,adjGid:T,adjStart:A,adjTgt:k,patGid:M,patTgt:R,postfixLookupGroups:O,customValidatorNames:D,orderSensitiveModifiers:_}=e,L=new Int32Array(a).fill(-1);for(let Ce=0;Ce<T.length;Ce++)L[T[Ce]]=Ce;let q=0;for(let Ce=0;Ce+1<A.length;Ce++){const Ve=A[Ce+1]-A[Ce];Ve>q&&(q=Ve)}let P=32;for(;P<2*(1+q+M.length);)P<<=1;const $=new Int32Array(b.length+1);for(let Ce=0;Ce<b.length;Ce++)$[Ce+1]=$[Ce]+g[b[Ce]+1]-g[b[Ce]];const H=new Uint8Array(a);for(let Ce=0;Ce<O.length;Ce++)H[O[Ce]]=1;const F=l.length-1,V=new Uint8Array(F);let G=0,X=!0;for(let Ce=0;Ce<j.length;Ce++){V[j[Ce]]=1;const Ve=N[C[Ce]*2+1];Ve>G&&(G=Ve);const Fe=E.charCodeAt(N[C[Ce]*2]);(Fe===91||Fe===40)&&(X=!1)}let B=1;for(;B<j.length*2;)B<<=1;const Z=new Int32Array(B).fill(-1);for(let Ce=0;Ce<j.length;Ce++){const Ve=N[C[Ce]*2];let Fe=(D0(E,Ve,Ve+N[C[Ce]*2+1])^Math.imul(j[Ce],2654435761)|0)&B-1;for(;Z[Fe]!==-1;)Fe=Fe+1&B-1;Z[Fe]=Ce}const K=(Ce,Ve,Fe,gt)=>{let Ot=(D0(Ve,Fe,gt)^Math.imul(Ce,2654435761)|0)&B-1;const Tt=gt-Fe;for(;;){const Bt=Z[Ot];if(Bt===-1)return-1;if(j[Bt]===Ce&&N[C[Bt]*2+1]===Tt){const dn=N[C[Bt]*2];let sn=!0;for(let Nt=0;Nt<Tt;Nt++)if(E.charCodeAt(dn+Nt)!==Ve.charCodeAt(Fe+Nt)){sn=!1;break}if(sn)return S[Bt]}Ot=Ot+1&B-1}},se=r.cacheSize??8192,I=r.prefix??e.prefix??"",U=I===""?"":I+":",Q=U.length,te=(D??[]).map(Ce=>{throw new Error("cn: missing validator "+Ce)}),le=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,J=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ne=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ce=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;let oe=0,W=-1,de=-1,Ee=-1,Be=-1;const Ne=Ce=>Ce>=97&&Ce<=122||Ce>=65&&Ce<=90||Ce>=48&&Ce<=57||Ce===95,Ae=Ce=>/\s/.test(String.fromCharCode(Ce)),ee=(Ce,Ve,Fe)=>{if(oe=0,W=-1,Fe-Ve<3)return;const gt=Ce.charCodeAt(Ve),Ot=Ce.charCodeAt(Fe-1);if(gt===91&&Ot===93)oe=1;else if(gt===40&&Ot===41)oe=2;else return;Ee=Ve+1,Be=Fe-1;let Tt=Ve+1;if(Ne(Ce.charCodeAt(Tt))){for(Tt++;Tt<Fe-1;){const Bt=Ce.charCodeAt(Tt);if(!Ne(Bt)&&Bt!==45)break;Tt++}Tt<Fe-2&&Ce.charCodeAt(Tt)===58&&(W=Ve+1,de=Tt,Ee=Tt+1)}},re=(Ce,Ve,Fe,gt)=>{if(Fe-Ve!==gt.length)return!1;for(let Ot=0;Ot<gt.length;Ot++)if(Ce.charCodeAt(Ve+Ot)!==gt.charCodeAt(Ot))return!1;return!0},xe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,he=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$e=Ce=>!!Ce&&!Number.isNaN(Number(Ce)),we=(Ce,Ve,Fe)=>{if(Fe-Ve<11||!re(Ce,Ve,Ve+10,"@container"))return!1;if(Ce.charCodeAt(Ve+10)===47)return Fe-Ve>=12;const gt=Ce.charCodeAt(Ve+11);return gt===115&&Fe-Ve>=17&&re(Ce,Ve+10,Ve+16,"-size/")||gt===110&&Fe-Ve>=19&&re(Ce,Ve+10,Ve+18,"-normal/")},_e=[1,1,1,1,1,1,1,1,2,2,2,2,2,2,2],Re="length|number|number weight|family-name|position percentage|length size bg-size|image url|shadow|length|family-name|position percentage|length size bg-size|image url|shadow|number weight".split("|").map(Ce=>Ce.split(" ")),Te=[2,3,1,0,0,0,4,5,0,0,0,0,0,1,1],be=(Ce,Ve,Fe,gt)=>{if(Ce>=10){if(Ce>=25)return te[Ce-25](Ve.slice(Fe,gt));const Ot=Ce-10;if(oe!==_e[Ot])return!1;if(W>=0){for(const Tt of Re[Ot])if(re(Ve,W,de,Tt))return!0;return!1}switch(Te[Ot]){case 0:return!1;case 1:return!0;case 2:{const Tt=Ve.slice(Ee,Be);return le.test(Tt)&&!J.test(Tt)}case 3:return $e(Ve.slice(Ee,Be));case 4:return ce.test(Ve.slice(Ee,Be));default:return ne.test(Ve.slice(Ee,Be))}}switch(Ce){case 0:return!0;case 1:return oe===0;case 2:return oe===1;case 3:return oe===2;case 4:return xe.test(Ve.slice(Fe,gt));case 5:return $e(Ve.slice(Fe,gt));case 6:{const Ot=Ve.slice(Fe,gt);return!!Ot&&Number.isInteger(Number(Ot))}case 7:return gt>Fe&&Ve.charCodeAt(gt-1)===37&&$e(Ve.slice(Fe,gt-1));case 8:return he.test(Ve.slice(Fe,gt));default:return we(Ve,Fe,gt)}},Ue=new Set(typeof _=="string"?_.split(" "):_),Ze=(Ce,Ve,Fe,gt,Ot,Tt)=>{const Bt=D0(Ve,Fe,gt)^(Ot?2654435769:0)|0;let dn=Ce.get(Bt);if(dn!==void 0)e:for(let Dt=0;Dt<dn.length;Dt++){const en=dn[Dt];if(!(en.imp!==Ot||en.k.length!==gt-Fe)){for(let vt=0;vt<en.k.length;vt++)if(en.k.charCodeAt(vt)!==Ve.charCodeAt(Fe+vt))continue e;return en.id}}else Ce.set(Bt,dn=[]);const sn=Ve.slice(Fe,gt),Nt=Tt(sn);return dn.push({k:sn,imp:Ot,id:Nt}),Nt};let ht=new Map,at=new Map,Pe=2;const ct=4096,We=(Ce,Ve)=>{const Fe=[];let gt=0,Ot=0,Tt=0;for(let Nt=0;Nt<Ce.length;Nt++){const Dt=Ce.charCodeAt(Nt);gt===0&&Ot===0&&Dt===58?(Fe.push(Ce.slice(Tt,Nt)),Tt=Nt+1):Dt===91?gt++:Dt===93?gt--:Dt===40?Ot++:Dt===41&&Ot--}Fe.push(Ce.slice(Tt));let Bt=Fe[0];if(Fe.length>1){const Nt=[];let Dt=[];for(const en of Fe)en.charCodeAt(0)===91||Ue.has(en)?(Dt.length&&(Nt.push(...Dt.sort()),Dt=[]),Nt.push(en)):Dt.push(en);Dt.length&&Nt.push(...Dt.sort()),Bt=Nt.join(":")}const dn=Ve?Bt+" !":Bt;let sn=at.get(dn);return sn===void 0&&at.set(dn,sn=Pe++),sn};let me=new Map,De=a;const Oe=a+4096,nt=()=>De++,Ge=2097152,Ye=8192,pe=new Int32Array(Ye),He=new Array(Ye).fill(null),Ie=new Int32Array(Ye),ut=new Int32Array(Ye),Qe=new Uint8Array(Ye);let kt=0;const At=(Ce,Ve,Fe,gt,Ot,Tt,Bt,dn)=>{let sn=Ce;if(He[Ce]!==null)if(He[Ce|1]===null)sn=Ce|1;else if((kt++&3)===0)sn=Ce|kt>>2&1;else return;He[sn]=Ve.slice(Fe,gt),pe[sn]=Ot,Ie[sn]=Tt,ut[sn]=Bt,Qe[sn]=dn},jt=()=>He.fill(null);let Ht=256,St=[new Int32Array(Ht),new Int32Array(Ht),new Int32Array(Ht),new Int32Array(Ht)],[dt,yt,ae,Xe]=St,rt=new Uint8Array(Ht),Wt=new Uint8Array(Ht);const Mn=()=>{Ht*=2,St=St.map(Ve=>{const Fe=new Int32Array(Ht);return Fe.set(Ve),Fe}),[dt,yt,ae,Xe]=St;const Ce=new Uint8Array(Ht);Ce.set(rt),rt=Ce,Wt=new Uint8Array(Ht)};let Pt=64,Mt=new Int32Array(Pt),Dn=new Int32Array(Pt);const oo=new Int32Array(a);let ms=2048,Er=21,hs=new Float64Array(ms),Ms=new Int32Array(ms),$s=0;const Wl=(Ce,Ve)=>{if(Ce===0&&Ve<a)return oo[Ve]===$s?1:(oo[Ve]=$s,0);const Fe=Ce*2097152+Ve+1;let gt=Math.imul(Fe,2654435761)>>>Er;for(;Ms[gt]===$s;){if(hs[gt]===Fe)return 1;gt=gt+1&ms-1}return hs[gt]=Fe,Ms[gt]=$s,0},Vi=(Ce,Ve,Fe,gt,Ot)=>{if(Fe-Ve>=2&&Ce.charCodeAt(Ve)===91&&Ce.charCodeAt(Fe-1)===93){let Tt=-1;for(let Bt=Ve+1;Bt<Fe-1;Bt++)if(Ce.charCodeAt(Bt)===58){Tt=Bt;break}return Tt===-1||Tt===Ve+1?_o:Ze(me,Ce,Ve+1,Tt,0,nt)}if(gt>=0&&m[gt]>=0)return m[gt];for(let Tt=Ot-1;Tt>=0;Tt--){const Bt=Dn[Tt];if(Bt>Fe)continue;const dn=Mt[Tt],sn=Fe-Bt;if(V[dn]===1&&sn>0&&sn<=G){const Pn=Ce.charCodeAt(Bt);if(X===!1||Pn!==91&&Pn!==40){const ur=K(dn,Ce,Bt,Fe);if(ur>=0)return ur}}const Nt=h[dn];if(Nt<0)continue;const Dt=b[Nt],en=g[Dt],vt=g[Dt+1];if(en===vt)continue;ee(Ce,Bt,Fe);const ts=$[Nt]-en;for(let Pn=en;Pn<vt;Pn++)if(be(p[Pn],Ce,Bt,Fe))return v[ts+Pn]}return _o},Ha=Ce=>{const Ve=Ce.length;let Fe=0,gt=0,Ot=!1;(Pe>ct||ht.size>ct)&&(ht=new Map,at=new Map,Pe=2,jt()),De>Oe&&(me=new Map,De=a,jt());let Tt=0;for(;Tt<Ve;){let Nt=Ce.charCodeAt(Tt);if(Nt===32||Nt>=9&&Nt<=13||Nt>=160&&Ae(Nt)){Nt!==32&&(Ot=!0),Tt++;continue}const Dt=Tt;let en=0;for(;Tt<Ve;){if(Nt=Ce.charCodeAt(Tt),Nt<=32){if(Nt===32)break;if(Nt>=9&&Nt<=13){Ot=!0;break}}else if(Nt>=160&&Ae(Nt)){Ot=!0;break}en=Math.imul(en^Nt,16777619),Tt++}const vt=Tt,ts=vt-Dt;Fe===Ht&&Mn();const Pn=Fe++;dt[Pn]=Dt,yt[Pn]=vt,gt+=ts,en^=Math.imul(ts,2654435761);const ur=en^en>>>15|0,Kn=ur&8190;{let Qt=-1;if(pe[Kn]===ur&&He[Kn]!==null&&He[Kn].length===ts?Qt=Kn:pe[Kn|1]===ur&&He[Kn|1]!==null&&He[Kn|1].length===ts&&(Qt=Kn|1),Qt>=0){const ps=He[Qt];let Or=!0;for(let mr=0;mr<ts;mr++)if(ps.charCodeAt(mr)!==Ce.charCodeAt(Dt+mr)){Or=!1;break}if(Or){ae[Pn]=Ie[Qt],Xe[Pn]=ut[Qt],rt[Pn]=Qe[Qt];continue}}}let Xn=Dt;if(Q!==0){if(vt-Dt<=Q||!Ce.startsWith(U,Dt)){ae[Pn]=_o,At(Kn,Ce,Dt,vt,ur,_o,0,0);continue}Xn=Dt+Q}let tc=0,Tu=0,ta=-1,nc=-1;for(let Qt=Xn;Qt<vt;Qt++){const ps=Ce.charCodeAt(Qt);if(tc===0&&Tu===0){if(ps===58){ta=Qt;continue}if(ps===47){nc=Qt;continue}}ps===91?tc++:ps===93?tc--:ps===40?Tu++:ps===41&&Tu--}const Bf=ta>=Xn?ta+1:Xn;let kn=Bf,Ds=vt,Ga=!1,sc=0;Ds>kn&&Ce.charCodeAt(Ds-1)===33?(Ga=!0,Ds--):Ds>kn&&Ce.charCodeAt(kn)===33&&(Ga=!0,kn++,sc=1);let Ws=-1;nc>Bf&&(Ws=nc+sc,Ws>=Ds&&(Ws=-1));let rc=kn;Ds-kn>1&&Ce.charCodeAt(kn)===45&&(rc=kn+1);let dr=0,Vs=0,qa=0,Eu=-1,fr=0;(h[0]>=0||V[0]===1)&&(Mt[0]=0,Dn[0]=rc,fr=1);let Gi=bl,Ru=0;for(let Qt=rc;Qt<Ds;Qt++)if(Qt===Ws&&(Gi=Vs<qa?bl:dr,Ru=fr),dr!==bl){const ps=Ce.charCodeAt(Qt);let Or=-1;if(Vs<qa)u.charCodeAt(Vs)===ps?(Vs++,Vs===qa&&(Or=dr=Eu)):dr=bl;else{const mr=l[dr],Ki=l[dr+1];let na=bl;for(let Ss=mr;Ss<Ki;Ss++){const Xi=c[Ss];if(u.charCodeAt(Xi)===ps){c[Ss+1]-Xi===1?Or=na=f[Ss]:(Vs=Xi+1,qa=c[Ss+1],Eu=f[Ss],na=dr);break}}dr=na}if(Or>=0&&(h[Or]>=0||V[Or]===1)&&Qt+1<Ds&&Ce.charCodeAt(Qt+1)===45){if(fr===Pt){Pt*=2;const mr=new Int32Array(Pt);mr.set(Mt),Mt=mr;const Ki=new Int32Array(Pt);Ki.set(Dn),Dn=Ki}Mt[fr]=Or,Dn[fr]=Qt+2,fr++}}Ws===Ds&&(Gi=Vs<qa?bl:dr,Ru=fr);const Au=Vs<qa?bl:dr;let js,Us=!1;if(Ws>=0)if(Us=!0,js=Vi(Ce,kn,Ws,Gi,Ru),js!==_o&&js<a&&H[js]){const Qt=Vi(Ce,kn,Ds,Au,fr);Qt!==_o&&Qt!==js&&(js=Qt,Us=!1)}else js===_o&&(js=Vi(Ce,kn,Ds,Au,fr),Us=!1);else js=Vi(Ce,kn,Ds,Au,fr);let qi=0,Yi=0;js===_o?ae[Pn]=_o:(Yi=Us?1:0,qi=Xn>=ta?Ga?1:0:Ze(ht,Ce,Xn,ta,Ga?1:0,Qt=>We(Qt,Ga)),ae[Pn]=js,rt[Pn]=Yi,Xe[Pn]=qi),At(Kn,Ce,Dt,vt,ur,js,qi,Yi)}if(Fe===0)return"";if(Fe===1)return dt[0]===0&&yt[0]===Ve?Ce:Ce.slice(dt[0],yt[0]);if(Fe*P>ms){for(;Fe*P>ms;)ms<<=1,Er--;hs=new Float64Array(ms),Ms=new Int32Array(ms)}if(Pe>=Ge||De>=Ge)throw new Error("cn: too many distinct classes in one merge");$s=$s+1|0,$s===0&&(oo.fill(0),Ms.fill(0),$s=1);let Bt=!1;for(let Nt=Fe-1;Nt>=0;Nt--){const Dt=ae[Nt];if(Dt===_o){Wt[Nt]=1;continue}const en=Xe[Nt];if(Wl(en,Dt)===1){Wt[Nt]=0,Bt=!0;continue}if(Wt[Nt]=1,Dt<a){const vt=L[Dt];if(vt>=0)for(let ts=A[vt];ts<A[vt+1];ts++)Wl(en,k[ts]);if(rt[Nt]&1)for(let ts=0;ts<M.length;ts++)M[ts]===Dt&&Wl(en,R[ts])}}if(!Bt&&!Ot&&Ve===gt+Fe-1)return Ce;let dn="",sn=0;for(;sn<Fe;){if(!Wt[sn]){sn++;continue}const Nt=dt[sn];let Dt=yt[sn],en=sn+1;for(;en<Fe&&Wt[en]&&dt[en]===Dt+1&&Ce.charCodeAt(Dt)===32;)Dt=yt[en],en++;dn.length>0&&(dn+=" "),dn+=Ce.slice(Nt,Dt),sn=en}return dn},Rr=16384,Ar=new Int32Array(Rr*2);let Ui=0,Gn=1,zn=Object.create(null),ws=Object.create(null),cr=new Map,ku=new Map,Ql=0,Zl=0;const Fa=()=>{Ui^=Rr,Gn=Gn+1|0,Zl=0},Hi=Ce=>{let Ve=zn[Ce];if(Ve!==void 0)return Ve;const Fe=z0(Ce,0,Ce.length),gt=(Fe&16383)+Ui,Ot=Ar[gt]===(Fe^Gn)||Ar[gt^Rr]===(Fe^Gn-1);return Ot&&(Ve=ws[Ce],Ve!==void 0)?(zn[Ce]=Ve,Ve):(Ve=Ha(Ce),Ot?(zn[Ce]=Ve,++Ql>se&&(Ql=0,ws=zn,zn=Object.create(null),Fa())):(Ar[gt]=Fe^Gn,++Zl>Rr&&Fa()),Ve)},Jl=Ce=>{let Ve=cr.get(Ce);if(Ve!==void 0)return Ve;const Fe=z0(Ce,0,Ce.length),gt=(Fe&16383)+Ui,Ot=Ar[gt]===(Fe^Gn)||Ar[gt^Rr]===(Fe^Gn-1);return Ot&&(Ve=ku.get(Ce),Ve!==void 0)?(cr.set(Ce,Ve),Ve):(Ve=Ha(Ce),Ot?(cr.set(Ce,Ve),++Ql>se&&(Ql=0,ku=cr,cr=new Map,Fa())):(Ar[gt]=Fe^Gn,++Zl>Rr&&Fa()),Ve)},ec=Ce=>{const Ve=z0(Ce,0,Ce.length),Fe=(Ve&16383)+Ui;return Ar[Fe]===(Ve^Gn)||Ar[Fe^Rr]===(Ve^Gn-1)?!0:(Ar[Fe]=Ve^Gn,++Zl>Rr&&Fa(),!1)},ao=se===0?Ha:C8?Ce=>{const Ve=cr.get(Ce);return Ve!==void 0?Ve:Jl(Ce)}:Hi;return{merge:function(){return arguments.length===1&&typeof arguments[0]=="string"?ao(arguments[0]):ao(E8.apply(null,arguments))},mergeString:ao,seenBefore:se===0?()=>!1:ec,mergeUncached:Ha}},jp=(e,t)=>{if(!e)return"";if(typeof e=="string")return e;let r="";if(typeof e.length=="number"&&(!t||Array.isArray(e))){const a=e;for(let l=0;l<a.length;l++){const c=a[l];if(!c)continue;const u=typeof c=="string"?c:jp(c,t);u&&(r&&(r+=" "),r+=u)}return r}if(t){if(typeof e=="number")return""+e;if(typeof e=="object")for(const a in e)e[a]&&(r&&(r+=" "),r+=a)}return r},T8=(e,t)=>{let r="";for(let a=0;a<e.length;a++){const l=e[a];if(!l)continue;const c=typeof l=="string"?l:jp(l,t);c&&(r&&(r+=" "),r+=c)}return r},E8=function(){return T8(arguments,!1)},R8=(e,t)=>{const r=t===void 0?()=>!0:t.seenBefore,a=t===void 0?e:t.mergeUncached;let l=new Map,c=new Map,u=0,f=null;const m=(b,v,j,S)=>{let C=0;if(v){if(v!==b.a0)return!1;C=1}if(j){if(j!==(C===0?b.a0:b.a1))return!1;C++}if(S){if(S!==(C===0?b.a0:C===1?b.a1:b.a2))return!1;C++}return C===b.t},h=(b,v)=>{const j=b.a;let S=0;for(let C=0;C<v.length;C++){const N=v[C];if(N){if(N!==j[S])return!1;S++}}return S===b.t},g=(b,v)=>{const j=b.length,S=f===null?null:f.n;if(!v){if(S!==null&&h(S,b))return f=S,S.r;if(f!==null&&f!==S&&h(f,b))return f.r}let C="",N=-1,E=0,T=!1;for(let M=0;M<j;M++){let R=b[M];if(R){if(typeof R!="string"){if(R=b[M]=jp(R,!0),!R)continue;T=!0}N<0&&(C=R,N=M),E++}}if(E===0)return"";if(E===1)return e(C);if(T){if(S!==null&&h(S,b))return f=S,S.r;if(f!==null&&f!==S&&h(f,b))return f.r}let A=l.get(C);A===void 0&&(A=c.get(C),A!==void 0&&l.set(C,A));let k=null;if(A!==void 0)e:for(let M=0;M<A.length;M++){const R=A[M];if(R.t!==E)continue;const O=R.a;let D=1;for(let _=N+1;_<j;_++){const L=b[_];if(L&&L!==O[D++])continue e}k=R;break}if(k===null){let M=C;const R=[C];for(let O=N+1;O<j;O++){const D=b[O];D&&(M+=" "+D,R.push(D))}if(!r(M))return a(M);k={r:e(M),t:R.length,a0:R[0],a1:R[1],a2:R[2]??"",a:R,n:null},A===void 0&&l.set(C,A=[]),A.length>=256&&A.shift(),A.push(k),++u>1e3&&(u=0,c=l,l=new Map)}return f!==null&&f!==k&&(f.n=k),f=k,k.r},p=b=>Array.isArray(b)?g(b.slice(),!1):e(jp(b,!0));return function(b,v,j){const S=arguments.length;if((S|1)===3){const E=f;if(E!==null){const T=E.n;if(T!==null&&m(T,b,v,j))return f=T,T.r;if(E!==T&&m(E,b,v,j))return E.r}return g([b,v,j],!0)}if(S===1)return typeof b=="string"?e(b):p(b);const C=f;if(C!==null){const E=C.n;if(E!==null){const T=E.a;let A=0,k=!0;for(let M=0;M<S;M++){const R=arguments[M];if(R){if(R!==T[A]){k=!1;break}A++}}if(k&&A===E.t)return f=E,E.r}if(C!==E){const T=C.a;let A=0,k=!0;for(let M=0;M<S;M++){const R=arguments[M];if(R){if(R!==T[A]){k=!1;break}A++}}if(k&&A===C.t)return C.r}}const N=[];for(let E=0;E<S;E++)N.push(arguments[E]);return g(N,!0)}},OC=k8(N8),fs=R8(OC.mergeString,OC);function A8({className:e,...t}){return s.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:s.jsx("table",{"data-slot":"table",className:fs("w-full caption-bottom text-sm",e),...t})})}function O8({className:e,...t}){return s.jsx("thead",{"data-slot":"table-header",className:fs("[&_tr]:border-b",e),...t})}function M8({className:e,...t}){return s.jsx("tbody",{"data-slot":"table-body",className:fs("[&_tr:last-child]:border-0",e),...t})}function MC({className:e,...t}){return s.jsx("tr",{"data-slot":"table-row",className:fs("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function P0({className:e,...t}){return s.jsx("th",{"data-slot":"table-head",className:fs("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",e),...t})}function $c({className:e,...t}){return s.jsx("td",{"data-slot":"table-cell",className:fs("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",e),...t})}function xu(e){const t=Math.round((Date.now()-new Date(e).getTime())/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const r=Math.round(t/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function Yd(e){return!e||!Number.isFinite(Date.parse(e))?"Not reported":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(e))}const zA={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},wg={...zA,position:"fixed",top:0,left:0},g1={...zA,position:"absolute"};function D8(e){if(!e)return null;for(const t of e.elements){const r=t.tagName;if(r==="BUTTON"||r==="INPUT"){const a=t;if(a.type==="submit")return a}}return null}const z8="data-checked",P8="data-unchecked";function PA(e){return{checked(t){return e.indeterminate?{}:t?{[z8]:""}:{[P8]:""}},...ig}}const I8=x.createContext(void 0);function _8(){return x.useContext(I8)}const IA=x.createContext(void 0);function L8(){const e=x.useContext(IA);if(e===void 0)throw new Error(Jt(14));return e}const B8="data-parent",$8=x.forwardRef(function(t,r){const{checked:a,className:l,defaultChecked:c=!1,"aria-labelledby":u,disabled:f=!1,form:m,id:h,indeterminate:g=!1,inputRef:p,name:b,onCheckedChange:v,parent:j=!1,readOnly:S=!1,render:C,required:N=!1,uncheckedValue:E,value:T,nativeButton:A=!1,style:k,...M}=t,{clearErrors:R}=lg(),{disabled:O,name:D,setDirty:_,setFilled:L,setFocused:q,setTouched:P,state:$,validationMode:H,validityData:F,validation:V}=gu(),G=WL(),{labelId:X,registerControlId:B,getDescriptionProps:Z}=mf(),K=_8(),se=(K==null?void 0:K.allValues)===void 0?void 0:K.parent,I=se!==void 0,U=O||G.disabled||(K==null?void 0:K.disabled)||f,Q=D??b,te=T??Q,le=ds(),J=(K==null?void 0:K.registerControlId)!==B,ne=hf({id:h||void 0,enabled:J}),ce=A?ne:le;let oe={};I&&(j?oe=se.getParentProps():te!==void 0&&(oe=se.getChildProps(te)));const{checked:W=a,indeterminate:de=g,onCheckedChange:Ee,...Be}=oe,Ne=K==null?void 0:K.value,Ae=x.useRef(null),{getButtonProps:ee,buttonRef:re}=ro({disabled:U,native:A}),xe=(K==null?void 0:K.validation)??V,[he,$e]=Xr({controlled:te!==void 0&&Ne!==void 0&&!j?Ne.includes(te):W,default:c,name:"Checkbox",state:"checked"}),we=I?!!W:he,_e=I&&de||g;xg(Ae,le,he,void 0,!K&&!U,b);const Re=se==null?void 0:se.registerChildId,Te=x.useRef(null),be=xe.registerInput,Ue=K?te:void 0,Ze=x.useCallback(Oe=>be(Oe,{controlRef:Ae,value:Ue}),[be,Ue]),ht=qr(p,Te,j?void 0:Ze),at=dA(u,X,Te,!A,ne);Ke(()=>{Te.current&&(Te.current.indeterminate=_e),K||L(he)},[he,_e,K,L]),bf(he,()=>{K||(R(Q),_(he!==F.initialValue),xe.change(he))});const Pe=Xs({checked:he,disabled:U,form:m,name:j?void 0:Q,id:A?void 0:ne,required:N,ref:ht,style:Q?g1:wg,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Oe){if(Oe.nativeEvent.defaultPrevented)return;if(S){Oe.preventDefault();return}const nt=Oe.currentTarget.checked,Ge=bt(kr,Oe.nativeEvent);if(v==null||v(nt,Ge),!Ge.isCanceled&&(Ee==null||Ee(nt,Ge),!Ge.isCanceled&&($e(nt),te!==void 0&&K!==void 0&&!j&&!I))){const Ye=nt?[...K.value,te]:K.value.filter(pe=>pe!==te);K.setValue(Ye,Ge)}},onClick(Oe){Oe.stopPropagation()},onFocus(){var Oe;(Oe=Ae.current)==null||Oe.focus()}},T!==void 0?{value:(K?he&&T:T)||""}:gn,Z,Oe=>xe.getValidationProps(U,Oe));x.useEffect(()=>{if(!se||te===void 0)return;const Oe=se.disabledStatesRef.current;return Oe.set(te,U),()=>{Oe.delete(te)}},[se,U,te]);const ct=x.useMemo(()=>({...$,checked:we,disabled:U,readOnly:S,required:N,indeterminate:_e}),[$,we,U,S,N,_e]),We=PA(ct),me=wt("span",t,{state:ct,ref:[re,Ae,r],props:[{id:ce,role:"checkbox","aria-checked":_e?"mixed":we,"aria-readonly":S||void 0,"aria-required":N||void 0,"aria-labelledby":at,[B8]:j?"":void 0,onFocus(){U||q(!0)},onBlur(){const Oe=Te.current;Oe&&(P(!0),q(!1),H==="onBlur"&&xe.commit(K?Ne:Oe.checked))},onKeyDown(Oe){var ut;if(Oe.key!=="Enter"||(Oe.preventBaseUIHandler(),Oe.defaultPrevented))return;const nt=((ut=Te.current)==null?void 0:ut.form)??null,Ge=Oe.currentTarget,Ye=Oe.nativeEvent,pe=Oe.preventDefault,He=Ye.preventDefault;let Ie=!1;Oe.preventDefault=()=>{Ie=!0,pe.call(Oe)},Ye.preventDefault=()=>{Ie=!0,He.call(Ye)},He.call(Ye),xn(Ge).queueMicrotask(()=>{var Qe;Oe.preventDefault=pe,Ye.preventDefault=He,Ie||(Qe=D8(nt))==null||Qe.click()})},onClick(Oe){if(S||U)return;Oe.preventDefault();const nt=Te.current;nt&&Xc(nt,Oe)}},M,Be,ee,Z,Oe=>xe.getValidationProps(U,Oe)],stateAttributesMapping:We}),De=me.props.id;return Ke(()=>{if(!(!Re||j||te===void 0||De===void 0))return Re(te,De)},[Re,j,te,De]),s.jsxs(IA.Provider,{value:ct,children:[me,!he&&!K&&Q&&!j&&E!==void 0&&s.jsx("input",{type:"hidden",form:m,name:Q,value:E,disabled:U}),s.jsx("input",{...Pe,suppressHydrationWarning:!0})]})}),V8=x.forwardRef(function(t,r){const{render:a,className:l,style:c,keepMounted:u=!1,...f}=t,m=L8(),h=m.checked||m.indeterminate,{mounted:g,transitionStatus:p,setMounted:b}=Va(h),v=x.useRef(null),j={...m,transitionStatus:p};lr({batch:!0,enabled:!h,open:h,ref:v,onComplete(){h||b(!1)}});const C={...PA(m),...$a},N=u||g,E=wt("span",t,{ref:[r,v],state:j,stateAttributesMapping:C,props:f});return N?E:null});function Il({className:e,...t}){return s.jsx($8,{"data-slot":"checkbox",className:fs("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",e),...t,children:s.jsx(V8,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:s.jsx(Fn,{})})})}function U8(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}function H8(e){const[t,r]=x.useState({current:e,previous:null});return Object.is(e,t.current)||r({current:e,previous:t.current}),t.previous}function _A(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Ln(e){const t=us(F8,e).current;return t.next=e,Ke(t.effect),t}function F8(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var I0={exports:{}},_0={};/**
481
- * @license React
482
- * use-sync-external-store-shim.production.js
483
- *
484
- * Copyright (c) Meta Platforms, Inc. and affiliates.
485
- *
486
- * This source code is licensed under the MIT license found in the
487
- * LICENSE file in the root directory of this source tree.
488
- */var DC;function G8(){if(DC)return _0;DC=1;var e=of();function t(p,b){return p===b&&(p!==0||1/p===1/b)||p!==p&&b!==b}var r=typeof Object.is=="function"?Object.is:t,a=e.useState,l=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue;function f(p,b){var v=b(),j=a({inst:{value:v,getSnapshot:b}}),S=j[0].inst,C=j[1];return c(function(){S.value=v,S.getSnapshot=b,m(S)&&C({inst:S})},[p,v,b]),l(function(){return m(S)&&C({inst:S}),p(function(){m(S)&&C({inst:S})})},[p]),u(v),v}function m(p){var b=p.getSnapshot;p=p.value;try{var v=b();return!r(p,v)}catch{return!0}}function h(p,b){return b()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return _0.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,_0}var zC;function LA(){return zC||(zC=1,I0.exports=G8()),I0.exports}var x1=LA(),L0={exports:{}},B0={};/**
489
- * @license React
490
- * use-sync-external-store-shim/with-selector.production.js
491
- *
492
- * Copyright (c) Meta Platforms, Inc. and affiliates.
493
- *
494
- * This source code is licensed under the MIT license found in the
495
- * LICENSE file in the root directory of this source tree.
496
- */var PC;function q8(){if(PC)return B0;PC=1;var e=of(),t=LA();function r(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var a=typeof Object.is=="function"?Object.is:r,l=t.useSyncExternalStore,c=e.useRef,u=e.useEffect,f=e.useMemo,m=e.useDebugValue;return B0.useSyncExternalStoreWithSelector=function(h,g,p,b,v){var j=c(null);if(j.current===null){var S={hasValue:!1,value:null};j.current=S}else S=j.current;j=f(function(){function N(M){if(!E){if(E=!0,T=M,M=b(M),v!==void 0&&S.hasValue){var R=S.value;if(v(R,M))return A=R}return A=M}if(R=A,a(T,M))return R;var O=b(M);return v!==void 0&&v(R,O)?(T=M,R):(T=M,A=O)}var E=!1,T,A,k=p===void 0?null:p;return[function(){return N(g())},k===null?void 0:function(){return N(k())}]},[g,p,b,v]);var C=l(h,j[0],j[1]);return u(function(){S.hasValue=!0,S.value=C},[C]),m(C),C},B0}var IC;function Y8(){return IC||(IC=1,L0.exports=q8()),L0.exports}var K8=Y8();const qy=[];let Yy;function X8(){return Yy}function W8(e){qy.push(e)}function vf(e){const t=(r,a)=>{const l=us(Q8).current;let c;try{Yy=l;for(const u of qy)u.before(l);c=e(r,a);for(const u of qy)u.after(l);l.didInitialize=!0}finally{Yy=void 0}return c};return t.displayName=e.displayName||e.name,t}function b1(e){return x.forwardRef(vf(e))}function Q8(){return{didInitialize:!1}}const Z8=t1(19),J8=Z8?tB:nB;function BA(e,t,r,a,l){return J8(e,t,r,a,l)}function eB(e,t,r,a,l){const c=x.useCallback(()=>t(e.getSnapshot(),r,a,l),[e,t,r,a,l]);return x1.useSyncExternalStore(e.subscribe,c,c)}W8({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let r=0;r<e.syncHooks.length;r+=1){const a=e.syncHooks[r],l=a.selector(a.store.state,a.a1,a.a2,a.a3);Object.is(a.value,l)||(t=!0,a.value=l)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const r=new Set;for(const l of e.syncHooks)r.add(l.store);const a=[];for(const l of r)a.push(l.subscribe(t));return()=>{for(const l of a)l()}}),x1.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function tB(e,t,r,a,l){const c=X8();if(!c)return eB(e,t,r,a,l);const u=c.syncIndex;c.syncIndex+=1;let f;return c.didInitialize?(f=c.syncHooks[u],(f.store!==e||f.selector!==t||!Object.is(f.a1,r)||!Object.is(f.a2,a)||!Object.is(f.a3,l))&&(f.store!==e&&(c.didChangeStore=!0),f.store=e,f.selector=t,f.a1=r,f.a2=a,f.a3=l,f.value=t(e.getSnapshot(),r,a,l))):(f={store:e,selector:t,a1:r,a2:a,a3:l,value:t(e.getSnapshot(),r,a,l)},c.syncHooks.push(f)),f.value}function nB(e,t,r,a,l){return K8.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>t(c,r,a,l))}class sB{constructor(t){tn(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tn(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}static create(t){return new this(t)}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const r=this.updateTick;for(const a of this.listeners){if(r!==this.updateTick)return;a(t)}}update(t){for(const r in t)if(!Object.is(this.state[r],t[r])){this.setState({...this.state,...t});return}}set(t,r){Object.is(this.state[t],r)||this.setState({...this.state,[t]:r})}notifyAll(){const t={...this.state};this.setState(t)}use(t,r,a,l){return BA(this,t,r,a,l)}}class bu extends sB{constructor(t,r={},a){super(t),this.context=r,this.selectors=a}useSyncedValue(t,r){x.useDebugValue(t);const a=this;Ke(()=>{a.state[t]!==r&&a.set(t,r)},[a,t,r])}useSyncedValueWithCleanup(t,r){const a=this;Ke(()=>(a.state[t]!==r&&a.set(t,r),()=>{a.set(t,void 0)}),[a,t,r])}useSyncedValues(t){const r=this,a=Object.values(t);Ke(()=>{r.update(t)},[r,...a])}useControlledProp(t,r){x.useDebugValue(t);const a=this,l=r!==void 0;Ke(()=>{l&&!Object.is(a.state[t],r)&&a.setState({...a.state,[t]:r})},[a,t,r,l])}select(t,r,a,l){const c=this.selectors[t];return c(this.state,r,a,l)}useState(t,r,a,l){return x.useDebugValue(t),BA(this,this.selectors[t],r,a,l)}useContextCallback(t,r){x.useDebugValue(t);const a=et(r??Tn);this.context[t]=a}useStateSetter(t){const r=x.useRef(void 0);return r.current===void 0&&(r.current=a=>{this.set(t,a)}),r.current}observe(t,r){let a;typeof t=="function"?a=t:a=this.selectors[t];let l=a(this.state);return r(l,l,this),this.subscribe(c=>{const u=a(c);if(!Object.is(l,u)){const f=l;l=u,r(u,f,this)}})}}function Fo(...e){return()=>{for(let t=0;t<e.length;t+=1){const r=e[t];r&&r()}}}function Lt(e,t,r,a){return e.addEventListener(t,r,a),()=>{e.removeEventListener(t,r,a)}}function rB(e,t){return t!=null&&!Ci(t)?0:typeof e=="function"?e():e}function _l(e,t,r){const a=rB(e,r);return typeof a=="number"?a:a==null?void 0:a[t]}function _C(e){return typeof e=="function"?e():e}function $A(e,t){return t||e==="click"||e==="mousedown"}function oB(e){return(e==null?void 0:e.includes("mouse"))&&e!=="mousedown"}const VA=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Yr,currentIdRef:{current:null},currentContextRef:{current:null}});function aB(e,t){e.current=t.current}function iB(e){const{children:t,delay:r,timeoutMs:a=0}=e,l=x.useRef(r),c=x.useRef(r),u=x.useRef(null),f=x.useRef(null),m=es();return Ke(()=>{if(c.current=r,!u.current){l.current=r;return}l.current={open:_l(l.current,"open"),close:_l(r,"close")}},[r,u,l,c]),s.jsx(VA.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:u,timeoutMs:a,currentContextRef:f,timeout:m}),[a,m]),children:t})}function lB(e,t={open:!1}){const{open:r}=t,a="rootStore"in e?e.rootStore:e,l=a.useState("floatingId"),c=x.useContext(VA),{currentIdRef:u,delayRef:f,timeoutMs:m,initialDelayRef:h,currentContextRef:g,hasProvider:p,timeout:b}=c,[v,j]=x.useState(!1),S=x.useRef(r);return Ke(()=>{S.current=r},[r]),Ke(()=>{function C(){var N;(N=g.current)==null||N.setIsInstantPhase(!1),u.current=null,g.current=null,f.current=h.current,b.clear()}if(u.current&&!r&&u.current===l){if(j(!1),m){const N=l;return b.start(m,()=>{a.select("open")||u.current&&u.current!==N||C()}),()=>{(S.current||u.current!==N)&&b.clear()}}C()}},[r,l,u,f,m,h,g,b,a]),Ke(()=>{if(!r)return;const C=g.current,N=u.current;b.clear(),g.current={onOpenChange:a.setOpen,setIsInstantPhase:j},u.current=l,f.current={open:0,close:_l(h.current,"close")},N!==null&&N!==l?(j(!0),C==null||C.setIsInstantPhase(!0),C==null||C.onOpenChange(!1,bt(kr))):(j(!1),C==null||C.setIsInstantPhase(!1))},[r,l,a,u,f,h,g,b]),Ke(()=>()=>{if(u.current===l){if(g.current=null,!S.current)return;u.current=null,aB(f,h),b.clear()}},[g,u,f,l,h,b]),x.useMemo(()=>({activeIdRef:u,hasProvider:p,delayRef:f,isInstantPhase:v}),[u,p,f,v])}const zi=x.forwardRef(function(t,r){const[a,l]=x.useState();Ke(()=>{hL&&Ba&&l("button")},[]);const c={tabIndex:0,role:a};return s.jsx("span",{...t,ref:r,style:wg,"aria-hidden":a?void 0:!0,...c,"data-base-ui-focus-guard":""})});function Kd(e){return`data-base-ui-${e}`}let ch=0;function $h(e,t={}){const{preventScroll:r=!1,sync:a=!1,shouldFocus:l}=t;cancelAnimationFrame(ch);function c(){l&&!l()||e==null||e.focus({preventScroll:r})}if(a)return c(),Tn;const u=requestAnimationFrame(c);return ch=u,()=>{ch===u&&(cancelAnimationFrame(u),ch=0)}}const $0={inert:new WeakMap,"aria-hidden":new WeakMap},LC="data-base-ui-inert",Ky={inert:new WeakSet,"aria-hidden":new WeakSet};let jd=new WeakMap,V0=0;function cB(e){return Ky[e]}function UA(e){return e?ou(e)?e.host:UA(e.parentNode):null}const BC=(e,t)=>t.map(r=>{if(e.contains(r))return r;const a=UA(r);return e.contains(a)?a:null}).filter(r=>r!=null),$C=e=>{const t=new Set;return e.forEach(r=>{let a=r;for(;a&&!t.has(a);)t.add(a),a=a.parentNode}),t},VC=(e,t,r)=>{const a=[],l=c=>{!c||r.has(c)||Array.from(c.children).forEach(u=>{Os(u)!=="script"&&(t.has(u)?l(u):a.push(u))})};return l(e),a};function uB(e,t,r,a,{mark:l=!0}){let c=null;a?c="inert":r&&(c="aria-hidden");let u=null,f=null;const m=BC(t,e),h=l?VC(t,$C(m),new Set(m)):[],g=[],p=[];if(c){const b=$0[c],v=cB(c);f=v,u=b;const j=BC(t,Array.from(t.querySelectorAll("[aria-live]"))),S=m.concat(j);VC(t,$C(S),new Set(S)).forEach(N=>{const E=N.getAttribute(c),T=E!==null&&E!=="false",A=(b.get(N)||0)+1;b.set(N,A),g.push(N),A===1&&T&&v.add(N),T||N.setAttribute(c,c==="inert"?"":"true")})}return l&&h.forEach(b=>{const v=(jd.get(b)||0)+1;jd.set(b,v),p.push(b),v===1&&b.setAttribute(LC,"")}),V0+=1,()=>{u&&g.forEach(b=>{const j=(u.get(b)||0)-1;u.set(b,j),j||(!(f!=null&&f.has(b))&&c&&b.removeAttribute(c),f==null||f.delete(b))}),l&&p.forEach(b=>{const v=(jd.get(b)||0)-1;jd.set(b,v),v||b.removeAttribute(LC)}),V0-=1,V0||($0.inert=new WeakMap,$0["aria-hidden"]=new WeakMap,Ky.inert=new WeakSet,Ky["aria-hidden"]=new WeakSet,jd=new WeakMap)}}function UC(e,t={}){const{ariaHidden:r=!1,inert:a=!1,mark:l=!0}=t,c=Ft(e[0]).body;return uB(e,c,r,a,{mark:l})}const dB=500,HA=500,fB={style:{transition:"none"}},FA="data-base-ui-click-trigger",GA={fallbackAxisSide:"none"},y1={fallbackAxisSide:"end"},mB={clipPath:"inset(50%)",position:"fixed",top:0,left:0},qA=x.createContext(null),YA=()=>x.useContext(qA),hB=Kd("portal");function KA(e={}){const{ref:t,container:r,componentProps:a=gn,elementProps:l}=e,c=Pl(),u=YA(),f=u==null?void 0:u.portalNode,[m,h]=x.useState(null),[g,p]=x.useState(null),b=et(C=>{C!==null&&p(C)}),v=x.useRef(null);Ke(()=>{if(r===null){v.current&&(v.current=null,p(null),h(null));return}const C=(r&&(Xv(r)?r:r.current))??f??document.body;if(C==null){v.current&&(v.current=null,p(null),h(null));return}v.current!==C&&(v.current=C,p(null),h(C))},[r,f]);const j=wt("div",a,{ref:[t,b],props:[{id:c,[hB]:""},l]}),S=m&&j?Kr.createPortal(j,m):null;return{node:g,nodeId:x.isValidElement(j)?j.props.id:void 0,subtree:S}}const jg=x.forwardRef(function(t,r){const{render:a,className:l,style:c,children:u,container:f,portalOwnerRole:m,...h}=t,{node:g,nodeId:p,subtree:b}=KA({container:f,ref:r,componentProps:t,elementProps:h}),v=x.useRef(null),j=x.useRef(null),S=x.useRef(null),C=x.useRef(null),[N,E]=x.useState(null),T=x.useRef(!1),A=N==null?void 0:N.modal,k=N==null?void 0:N.open,M=!!N&&!N.modal&&N.open&&!!g;x.useEffect(()=>{if(!g||A)return;function O(D){g&&D.relatedTarget&&Qc(D)&&(D.type==="focusin"?T.current&&(TC(g),T.current=!1):(KL(g),T.current=!0))}return Fo(Lt(g,"focusin",O,!0),Lt(g,"focusout",O,!0))},[g,A]),Ke(()=>{!g||k!==!0||!T.current||(TC(g),T.current=!1)},[k,g]);const R=x.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:j,beforeInsideRef:S,afterInsideRef:C,portalNode:g,setFocusManagerState:E}),[g]);return s.jsxs(x.Fragment,{children:[b,s.jsxs(qA.Provider,{value:R,children:[M&&g&&s.jsx(zi,{"data-type":"outside",ref:v,onFocus:O=>{var D;if(Qc(O,g))(D=S.current)==null||D.focus();else{const _=N?N.domReference:null,L=CA(_);L==null||L.focus()}}}),M&&g&&s.jsx("span",{role:m,"aria-owns":p,style:mB}),g&&Kr.createPortal(u,g),M&&g&&s.jsx(zi,{"data-type":"outside",ref:j,onFocus:O=>{var D;if(Qc(O,g))(D=C.current)==null||D.focus();else{const _=N?N.domReference:null,L=h1(_);L==null||L.focus(),N!=null&&N.closeOnFocusOut&&(N==null||N.onOpenChange(!1,bt(Mi,O.nativeEvent)))}}})]})]})});function XA(){const e=new Map;return{emit(t,r){var a;(a=e.get(t))==null||a.forEach(l=>l(r))},on(t,r){e.has(t)||e.set(t,new Set),e.get(t).add(r)},off(t,r){var a;(a=e.get(t))==null||a.delete(r)}}}class v1{constructor(){tn(this,"nodesRef",{current:[]});tn(this,"events",XA())}addNode(t){this.nodesRef.current.push(t)}removeNode(t){const r=this.nodesRef.current.findIndex(a=>a===t);r!==-1&&this.nodesRef.current.splice(r,1)}}const WA=x.createContext(null),QA=x.createContext(null),_i=()=>{var e;return((e=x.useContext(WA))==null?void 0:e.id)||null},Li=e=>{const t=x.useContext(QA);return e??t};function w1(e){const t=Pl(),r=Li(e),a=_i();return Ke(()=>{if(!t)return;const l={id:t,parentId:a};return r==null||r.addNode(l),()=>{r==null||r.removeNode(l)}},[r,t,a]),t}function ZA(e){const{children:t,id:r}=e,a=_i();return s.jsx(WA.Provider,{value:x.useMemo(()=>({id:r,parentId:a}),[r,a]),children:t})}function JA(e){const{children:t,externalTree:r}=e,a=us(()=>r??new v1).current;return s.jsx(QA.Provider,{value:a,children:t})}function pB(e,t){const r=xn(As(e));return e instanceof r.KeyboardEvent?"keyboard":e instanceof r.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof r.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const HC=20;let Ni=[];function j1(){Ni=Ni.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function FC(e){j1(),e&&Os(e)!=="body"&&(Ni.push(new WeakRef(e)),Ni.length>HC&&(Ni=Ni.slice(-HC)))}function GC(){var e;return j1(),(e=Ni[Ni.length-1])==null?void 0:e.deref()}function gB(e){return e?m1(e)?e:gf(e)[0]||e:null}function qC(e){var l;if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!((l=e.getAttribute("role"))!=null&&l.includes("dialog")))return;const r=SA(e).filter(c=>{const u=c.getAttribute("data-tabindex")||"";return m1(c)||c.hasAttribute("data-tabindex")&&!u.startsWith("-")}),a=e.getAttribute("tabindex");r.length===0?a!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(a!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Sg(e){const{context:t,children:r,disabled:a=!1,initialFocus:l=!0,returnFocus:c=!0,restoreFocus:u=!1,modal:f=!0,closeOnFocusOut:m=!0,openInteractionType:h="",nextFocusableElement:g,previousFocusableElement:p,beforeContentFocusGuardRef:b,externalTree:v,getInsideElements:j}=e,S="rootStore"in t?t.rootStore:t,C=S.useState("open"),N=S.useState("domReferenceElement"),E=S.useState("floatingElement"),{events:T,dataRef:A}=S.context,k=et(()=>{var oe;return(oe=A.current.floatingContext)==null?void 0:oe.nodeId}),M=l===!1,R=By(N)&&M,O=Ln(l),D=Ln(c),_=Ln(h),L=Ln(C),q=Li(v),P=YA(),$=x.useRef(!1),H=x.useRef(!1),F=x.useRef(!1),V=x.useRef(null),G=x.useRef(""),X=x.useRef(""),B=x.useRef(null),Z=x.useRef(null),K=qr(B,b,P==null?void 0:P.beforeInsideRef),se=qr(Z,P==null?void 0:P.afterInsideRef),I=es(),U=es(),Q=iu(),te=P!=null,le=yp(E),J=et((oe=le)=>oe?gf(oe):[]),ne=et(()=>(j==null?void 0:j().filter(oe=>oe!=null))??[]);x.useEffect(()=>{if(a||!f)return;function oe(de){de.key==="Tab"&&pt(le,Is(Ft(le)))&&J().length===0&&!R&&Vo(de)}const W=Ft(le);return Lt(W,"keydown",oe)},[a,le,f,R,J]),x.useEffect(()=>{if(a||!C)return;const oe=Ft(le);function W(){F.current=!1}function de(Be){const Ne=As(Be),Ae=ne(),ee=pt(E,Ne)||pt(N,Ne)||pt(P==null?void 0:P.portalNode,Ne)||Ae.some(re=>re===Ne||pt(re,Ne));F.current=!ee,X.current=Be.pointerType||"keyboard",Ne!=null&&Ne.closest(`[${FA}]`)&&(H.current=!0,U.start(0,()=>{H.current=!1}))}function Ee(){X.current="keyboard"}return Fo(Lt(oe,"pointerdown",de,!0),Lt(oe,"pointerup",W,!0),Lt(oe,"pointercancel",W,!0),Lt(oe,"keydown",Ee,!0),W)},[a,E,N,le,C,P,U,ne]),x.useEffect(()=>{if(a||!m)return;const oe=Ft(le);function W(){H.current=!0,U.start(0,()=>{H.current=!1})}function de(Ae){const ee=As(Ae);m1(ee)&&(V.current=ee)}function Ee(Ae){const ee=Ae.relatedTarget,re=Ae.currentTarget,xe=As(Ae);f&&ee==null&&xe!=null&&pt(E,xe)&&FC(xe),queueMicrotask(()=>{const he=k(),$e=S.context.triggerElements,we=ne(),_e=(ee==null?void 0:ee.hasAttribute(Kd("focus-guard")))&&[B.current,Z.current,P==null?void 0:P.beforeInsideRef.current,P==null?void 0:P.afterInsideRef.current,P==null?void 0:P.beforeOutsideRef.current,P==null?void 0:P.afterOutsideRef.current,ga(p),ga(g)].includes(ee),Re=!(pt(N,ee)||pt(E,ee)||pt(ee,E)||pt(P==null?void 0:P.portalNode,ee)||we.some(Te=>Te===ee||pt(Te,ee))||$e.hasMatchingElement(Te=>pt(Te,ee))||_e||q&&(Ai(q.nodesRef.current,he).find(Te=>{var be,Ue;return pt((be=Te.context)==null?void 0:be.elements.floating,ee)||pt((Ue=Te.context)==null?void 0:Ue.elements.domReference,ee)})||NC(q.nodesRef.current,he).find(Te=>{var be,Ue,Ze;return[(be=Te.context)==null?void 0:be.elements.floating,yp((Ue=Te.context)==null?void 0:Ue.elements.floating)].includes(ee)||((Ze=Te.context)==null?void 0:Ze.elements.domReference)===ee})));if(re===N&&le&&qC(le),u&&re!==N&&!gg(xe)&&Is(oe)===oe.body){if(cn(le)&&(le.focus(),u==="popup")){Q.request(()=>{le.focus()});return}const Te=J(),be=V.current,Ue=(be&&Te.includes(be)?be:null)||Te[Te.length-1]||le;cn(Ue)&&Ue.focus()}if(A.current.insideReactTree){A.current.insideReactTree=!1;return}(R||!f)&&ee&&Re&&!H.current&&(R||ee!==GC())&&($.current=!0,S.setOpen(!1,bt(Mi,Ae)))})}function Be(){F.current||(A.current.insideReactTree=!0,I.start(0,()=>{A.current.insideReactTree=!1}))}const Ne=cn(N)?N:null;if(!(!E&&!Ne))return Fo(Ne&&Lt(Ne,"focusout",Ee),Ne&&Lt(Ne,"pointerdown",W),E&&Lt(E,"focusin",de),E&&Lt(E,"focusout",Ee),E&&P&&Lt(E,"focusout",Be,!0))},[a,N,E,le,f,q,P,S,m,u,J,R,k,A,I,U,Q,g,p,ne]),x.useEffect(()=>{var re,xe,he;if(a||!E||!C)return;const oe=Array.from(((re=P==null?void 0:P.portalNode)==null?void 0:re.querySelectorAll(`[${Kd("portal")}]`))||[]),de=(he=(xe=(q?NC(q.nodesRef.current,k()):[]).find($e=>{var we;return By(((we=$e.context)==null?void 0:we.elements.domReference)||null)}))==null?void 0:xe.context)==null?void 0:he.elements.domReference,Be=[...[E,...oe,B.current,Z.current,P==null?void 0:P.beforeOutsideRef.current,P==null?void 0:P.afterOutsideRef.current,...ne()],de,ga(p),ga(g),R?N:null].filter($e=>$e!=null),Ne=UC(Be,{ariaHidden:f||R,mark:!1}),Ae=[E,...oe].filter($e=>$e!=null),ee=UC(Ae);return()=>{ee(),Ne()}},[C,a,N,E,f,P,R,q,k,g,p,ne]),Ke(()=>{if(!C||a||!cn(le))return;G.current="",X.current="";const oe=Ft(le),W=Is(oe);queueMicrotask(()=>{const de=O.current,Ee=typeof de=="function"?de(_.current||""):de;if(Ee===void 0||Ee===!1||pt(le,W))return;let Ne=null;const Ae=()=>(Ne==null&&(Ne=J(le)),Ne[0]||le);let ee;Ee===!0||Ee===null?ee=Ae():ee=ga(Ee),ee=ee||Ae();const re=pt(le,Is(oe));$h(ee,{preventScroll:ee===le,shouldFocus(){if(!L.current)return!1;if(re)return!0;const xe=Is(oe);return!(xe!==ee&&pt(le,xe))}})})},[a,C,le,J,O,_,L]),Ke(()=>{if(a||!le)return;const oe=Ft(le),W=Is(oe),de=_.current==null;FC(W);function Ee(Ne){if(Ne.open||(G.current=pB(Ne.nativeEvent,X.current)),Ne.reason===Un&&Ne.nativeEvent.type==="mouseleave"&&($.current=!0),Ne.reason===bg)if(Ne.nested)$.current=!1;else if(pg(Ne.nativeEvent)||c1(Ne.nativeEvent))$.current=!1;else{let Ae=!1;Ft(le).createElement("div").focus({get preventScroll(){return Ae=!0,!1}}),Ae?$.current=!1:$.current=!0}}T.on("openchange",Ee);function Be(Ne){const Ae=D.current;let ee=typeof Ae=="function"?Ae(Ne):Ae;if(ee===void 0||ee===!1)return null;ee===null&&(ee=!0);const re=N!=null&&N.isConnected?N:null,xe=W!=null&&W.isConnected&&Os(W)!=="body"?W:null;let he=de?xe||re:re||xe;return he||(he=GC()||null),typeof ee=="boolean"?he:ga(ee)||he||null}return()=>{T.off("openchange",Ee);const Ne=Is(oe),Ae=ne(),ee=pt(E,Ne)||Ae.some($e=>$e===Ne||pt($e,Ne))||q&&Ai(q.nodesRef.current,k(),!1).some($e=>{var we;return pt((we=$e.context)==null?void 0:we.elements.floating,Ne)}),re=D.current,xe=G.current,he=Be(xe);queueMicrotask(()=>{const $e=gB(he),we=typeof re!="boolean";if(re&&!$.current&&cn($e)&&(!(!we&&$e!==Ne&&Ne!==oe.body)||ee)){const _e={preventScroll:!0};xe==="keyboard"&&(_e.focusVisible=!0),$e.focus(_e)}$.current=!1})}},[a,E,le,D,_,T,q,N,k,ne]),Ke(()=>{if(!Ba||C||!E)return;const oe=Is(Ft(E));!cn(oe)||!hg(oe)||pt(E,oe)&&oe.blur()},[C,E]),Ke(()=>{if(!(a||!P))return P.setFocusManagerState({modal:f,closeOnFocusOut:m,open:C,onOpenChange:S.setOpen,domReference:N}),()=>{P.setFocusManagerState(null)}},[a,P,f,C,S,m,N]),Ke(()=>{if(!(a||!le))return qC(le),()=>{queueMicrotask(j1)}},[a,le]);const ce=!a&&(f?!R:!0)&&(te||f);return s.jsxs(x.Fragment,{children:[ce&&s.jsx(zi,{"data-type":"inside",ref:K,onFocus:oe=>{var W;if(f){const de=J();$h(de[de.length-1])}else if(P!=null&&P.portalNode)if($.current=!1,Qc(oe,P.portalNode)){const de=h1(N);de==null||de.focus()}else(W=ga(p??P.beforeOutsideRef))==null||W.focus()}}),r,ce&&s.jsx(zi,{"data-type":"inside",ref:se,onFocus:oe=>{var W;if(f)$h(J()[0]);else if(P!=null&&P.portalNode)if(m&&($.current=!0),Qc(oe,P.portalNode)){const de=CA(N);de==null||de.focus()}else(W=ga(g??P.afterOutsideRef))==null||W.focus()}})]})}function S1(e,t={}){const{enabled:r=!0,event:a="click",toggle:l=!0,ignoreMouse:c=!1,stickIfOpen:u=!0,touchOpenDelay:f=0,reason:m=Wo}=t,h="rootStore"in e?e.rootStore:e,g=h.context.dataRef,p=x.useRef(void 0),b=iu(),v=es(),j=x.useMemo(()=>{function S(N,E,T,A){const k=bt(m,E,T);N&&A==="touch"&&f>0?v.start(f,()=>{h.setOpen(!0,k)}):h.setOpen(N,k)}function C(N,E,T){const A=g.current.openEvent,k=h.select("domReferenceElement")!==E;return N&&k||!N||!l?!0:A&&u?!T(A.type):!1}return{onPointerDown(N){p.current=Ci(N.pointerType,!0)&&c1(N.nativeEvent)?"virtual":N.pointerType},onMouseDown(N){const E=p.current,T=N.nativeEvent,A=h.select("open");if(N.button!==0||a==="click"||Ci(E,!0)&&c)return;const k=C(A,N.currentTarget,O=>O==="click"||O==="mousedown"),M=As(T);if(hg(M)){S(k,T,M,E);return}const R=N.currentTarget;b.request(()=>{S(k,T,R,E)})},onClick(N){if(a==="mousedown-only")return;const E=p.current;if(a==="mousedown"&&E){p.current=void 0;return}if(Ci(E,!0)&&c)return;const T=h.select("open"),A=C(T,N.currentTarget,k=>k==="click"||k==="mousedown"||k==="keydown"||k==="keyup");S(A,N.nativeEvent,N.currentTarget,E)},onKeyDown(){p.current=void 0}}},[g,a,c,m,h,u,l,b,v,f]);return x.useMemo(()=>r?{reference:j}:gn,[r,j])}function xB(e,t){let r=null,a=null,l=!1;return{contextElement:e||void 0,getBoundingClientRect(){var v;const c=(e==null?void 0:e.getBoundingClientRect())||{width:0,height:0,x:0,y:0},u=t.axis==="x"||t.axis==="both",f=t.axis==="y"||t.axis==="both",m=["mouseenter","mousemove"].includes(((v=t.dataRef.current.openEvent)==null?void 0:v.type)||"")&&t.pointerType!=="touch";let h=c.width,g=c.height,p=c.x,b=c.y;return r==null&&t.x&&u&&(r=c.x-t.x),a==null&&t.y&&f&&(a=c.y-t.y),p-=r||0,b-=a||0,h=0,g=0,!l||m?(h=t.axis==="y"?c.width:0,g=t.axis==="x"?c.height:0,p=u&&t.x!=null?t.x:p,b=f&&t.y!=null?t.y:b):l&&!m&&(g=t.axis==="x"?c.height:g,h=t.axis==="y"?c.width:h),l=!0,{width:h,height:g,x:p,y:b,top:b,right:p+h,bottom:b+g,left:p}}}}function YC(e){return e!=null&&e.clientX!=null}function bB(e,t={}){const{enabled:r=!0,axis:a="both"}=t,l="rootStore"in e?e.rootStore:e,c=l.useState("open"),u=l.useState("floatingElement"),f=l.useState("domReferenceElement"),m=l.context.dataRef,h=x.useRef(!1),g=x.useRef(null),[p,b]=x.useState(),[v,j]=x.useState([]),S=et(A=>{l.set("positionReference",A)}),C=et((A,k,M)=>{h.current||m.current.openEvent&&!YC(m.current.openEvent)||l.set("positionReference",xB(M??f,{x:A,y:k,axis:a,dataRef:m,pointerType:p}))}),N=et(A=>{c?g.current||(C(A.clientX,A.clientY,A.currentTarget),j([])):C(A.clientX,A.clientY,A.currentTarget)}),E=Ci(p)?u:c;x.useEffect(()=>{if(!r){S(f);return}if(!E)return;function A(){var R;(R=g.current)==null||R.call(g),g.current=null}const k=xn(u);function M(R){const O=As(R);pt(u,O)?A():C(R.clientX,R.clientY)}return!m.current.openEvent||YC(m.current.openEvent)?g.current=Lt(k,"mousemove",M):S(f),A},[E,r,u,m,f,l,C,S,v]),x.useEffect(()=>()=>{l.set("positionReference",null)},[l]),x.useEffect(()=>{r&&!u&&(h.current=!1)},[r,u]),x.useEffect(()=>{!r&&c&&(h.current=!0)},[r,c]);const T=x.useMemo(()=>{function A(k){b(k.pointerType)}return{onPointerDown:A,onPointerEnter:A,onMouseMove:N,onMouseEnter:N}},[N]);return x.useMemo(()=>r?{reference:T,trigger:T}:{},[r,T])}function yB(){return!1}function vB(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function wf(e,t={}){const{enabled:r=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:u=yB,bubbles:f,externalTree:m}=t,h="rootStore"in e?e.rootStore:e,g=h.useState("open"),p=h.useState("floatingElement"),{dataRef:b,events:v}=h.context,j=Li(m),S=et(typeof l=="function"?l:()=>!1),C=typeof l=="function"?S:l,N=C!==!1,E=et(()=>c),{escapeKey:T,outsidePress:A}=vB(f),k=x.useRef(!1),M=x.useRef(!1),R=x.useRef(!1),O=x.useRef(!1),D=x.useRef(!1),_=x.useRef(""),L=x.useRef(null),q=es(),P=es(),$=et(()=>{P.clear(),b.current.insideReactTree=!1}),H=et(I=>{var te;const U=(te=b.current.floatingContext)==null?void 0:te.nodeId;return(j?Ai(j.nodesRef.current,U):[]).some(le=>{var J;return((J=le.context)==null?void 0:J.open)&&!le.context.dataRef.current[I]})}),F=et(I=>O0(I,h.select("floatingElement"))||O0(I,h.select("domReferenceElement"))),V=et(I=>{u()&&h.setOpen(!1,bt(Wo,I.nativeEvent))}),G=et(I=>{if(!g||!r||!a||I.key!=="Escape"||D.current||!T&&H("__escapeKeyBubbles"))return;const U=AL(I)?I.nativeEvent:I,Q=bt(yf,U);h.setOpen(!1,Q),Q.isCanceled||I.preventDefault(),!T&&!Q.isPropagationAllowed&&I.stopPropagation()}),X=et(()=>{b.current.insideReactTree=!0,P.start(0,$)}),B=et(I=>{if(!g||!r||I.button!==0)return;const U=As(I.nativeEvent);pt(h.select("floatingElement"),U)&&(k.current||(k.current=!0,M.current=!1))}),Z=et(I=>{!g||!r||(I.defaultPrevented||I.nativeEvent.defaultPrevented)&&k.current&&(M.current=!0)});x.useEffect(()=>{function I(U){U.open||(O.current=!1)}return v.on("openchange",I),()=>{v.off("openchange",I)}},[v]),x.useEffect(()=>{if(!g||!r)return g||(O.current=!1),$;b.current.__escapeKeyBubbles=T,b.current.__outsidePressBubbles=A;const I=new Yr,U=new Yr,Q=Ft(p);function te(){I.clear(),D.current=!0}function le(){I.start(Ba?5:0,()=>{D.current=!1})}function J(){R.current=!0,U.start(0,()=>{R.current=!1})}function ne(){k.current=!1,M.current=!1}function ce(){const Re=_.current,Te=Re==="pen"||!Re?"mouse":Re,be=E(),Ue=typeof be=="function"?be():be;return typeof Ue=="string"?Ue:Ue[Te]}function oe(Re){const Te=ce();return Te==="intentional"&&Re.type!=="click"||Te==="sloppy"&&Re.type==="click"}function W(Re){var Ue;const Te=(Ue=b.current.floatingContext)==null?void 0:Ue.nodeId,be=j&&Ai(j.nodesRef.current,Te).some(Ze=>{var ht;return O0(Re,(ht=Ze.context)==null?void 0:ht.elements.floating)});return F(Re)||be}function de(Re){if(oe(Re)){Re.type!=="click"&&!F(Re)&&(U.clear(),R.current=!1),$();return}if(b.current.insideReactTree){$();return}const Te=As(Re),be=`[${Kd("inert")}]`,Ue=Gt(Te)?Te.getRootNode():null,Ze=Array.from((ou(Ue)?Ue:Ft(h.select("floatingElement"))).querySelectorAll(be)),ht=h.context.triggerElements;if(Te&&(ht.hasElement(Te)||ht.hasMatchingElement(Pe=>pt(Pe,Te))))return;let at=Gt(Te)?Te:null;for(;at&&!Sa(at);){const Pe=Ea(at);if(Sa(Pe)||!Gt(Pe))break;at=Pe}if(!(Ze.length&&Gt(Te)&&!TL(Te)&&!pt(Te,h.select("floatingElement"))&&Ze.every(Pe=>!pt(at,Pe)))){if(cn(Te)&&!("touches"in Re)){const Pe=Sa(Te),ct=Nr(Te),We=/auto|scroll/,me=Pe||We.test(ct.overflowX),De=Pe||We.test(ct.overflowY),Oe=me&&Te.clientWidth>0&&Te.scrollWidth>Te.clientWidth,nt=De&&Te.clientHeight>0&&Te.scrollHeight>Te.clientHeight,Ge=ct.direction==="rtl",Ye=nt&&(Ge?Re.offsetX<=Te.offsetWidth-Te.clientWidth:Re.offsetX>Te.clientWidth),pe=Oe&&Re.offsetY>Te.clientHeight;if(Ye||pe)return}if(!W(Re)){if(ce()==="intentional"){if(Re.detail!==0&&!pg(Re)&&!O.current)return;if(R.current){U.clear(),R.current=!1;return}}typeof C=="function"&&!C(Re)||H("__outsidePressBubbles")||(h.setOpen(!1,bt(bg,Re)),$())}}}function Ee(Re){ce()!=="sloppy"||Re.pointerType==="touch"||!h.select("open")||!r||F(Re)||de(Re)}function Be(Re){if(ce()!=="sloppy"||!h.select("open")||!r||F(Re))return;const Te=Re.touches[0];Te&&(L.current={startTime:Date.now(),startX:Te.clientX,startY:Te.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},q.start(1e3,()=>{L.current&&(L.current.dismissOnTouchEnd=!1,L.current.dismissOnMouseDown=!1)}))}function Ne(Re,Te){const be=As(Re);if(!be)return;const Ue=Lt(be,Re.type,()=>{Te(Re),Ue()})}function Ae(Re){_.current="touch",Ne(Re,Be)}function ee(Re){q.clear(),Re.type==="pointerdown"&&(Re.button===0&&(O.current=!0),_.current=Re.pointerType),!(Re.type==="mousedown"&&L.current&&!L.current.dismissOnMouseDown)&&Ne(Re,Te=>{Te.type==="pointerdown"?Ee(Te):de(Te)})}function re(Re){if(Re.type==="pointercancel"&&(O.current=!1),!k.current)return;const Te=M.current;if(ne(),ce()==="intentional"){if(Re.type==="pointercancel"){Te&&J();return}if(!W(Re)){if(Te){J();return}typeof C=="function"&&!C(Re)||(U.clear(),R.current=!0,$())}}}function xe(Re){if(ce()!=="sloppy"||!L.current||F(Re))return;const Te=Re.touches[0];if(!Te)return;const be=Math.abs(Te.clientX-L.current.startX),Ue=Math.abs(Te.clientY-L.current.startY),Ze=Math.sqrt(be*be+Ue*Ue);Ze>5&&(L.current.dismissOnTouchEnd=!0),Ze>10&&(de(Re),q.clear(),L.current=null)}function he(Re){Ne(Re,xe)}function $e(Re){ce()!=="sloppy"||!L.current||F(Re)||(L.current.dismissOnTouchEnd&&de(Re),q.clear(),L.current=null)}function we(Re){Ne(Re,$e)}const _e=Fo(a&&Fo(Lt(Q,"keydown",G),Lt(Q,"compositionstart",te),Lt(Q,"compositionend",le)),N&&Fo(Lt(Q,"click",ee,!0),Lt(Q,"pointerdown",ee,!0),Lt(Q,"pointerup",re,!0),Lt(Q,"pointercancel",re,!0),Lt(Q,"mousedown",ee,!0),Lt(Q,"mouseup",re,!0),Lt(Q,"touchstart",Ae,{capture:!0,passive:!0}),Lt(Q,"touchmove",he,{capture:!0,passive:!0}),Lt(Q,"touchend",we,{capture:!0,passive:!0})));return()=>{_e(),I.clear(),U.clear(),ne(),R.current=!1,$()}},[b,p,a,N,C,g,r,T,A,G,$,E,H,F,j,h,q]);const K=x.useMemo(()=>({onKeyDown:G,onPointerDown:V,onClick:V}),[G,V]),se=x.useMemo(()=>({onKeyDown:G,onPointerDown:Z,onMouseDown:Z,onClickCapture:X,onMouseDownCapture(I){X(),B(I)},onPointerDownCapture(I){X(),B(I)},onMouseUpCapture:X,onTouchEndCapture:X,onTouchMoveCapture:X}),[G,X,B,Z]);return x.useMemo(()=>r?{reference:K,floating:se,trigger:K}:{},[r,K,se])}function KC(e,t,r){let{reference:a,floating:l}=e;const c=Vr(t),u=f1(t),f=d1(u),m=Hr(t),h=c==="y",g=a.x+a.width/2-l.width/2,p=a.y+a.height/2-l.height/2,b=a[f]/2-l[f]/2;let v;switch(m){case"top":v={x:g,y:a.y-l.height};break;case"bottom":v={x:g,y:a.y+a.height};break;case"right":v={x:a.x+a.width,y:p};break;case"left":v={x:a.x-l.width,y:p};break;default:v={x:a.x,y:a.y}}const j=Ra(t);return j&&(v[u]+=b*(j==="end"?1:-1)*(r&&h?-1:1)),v}async function wB(e,t){var r;t===void 0&&(t={});const{x:a,y:l,platform:c,rects:u,elements:f,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:g="viewport",elementContext:p="floating",altBoundary:b=!1,padding:v=0}=Oi(t,e),j=gA(v),C=f[b?p==="floating"?"reference":"floating":p],N=qd(await c.getClippingRect({element:(r=await(c.isElement==null?void 0:c.isElement(C)))==null||r?C:C.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:h,rootBoundary:g,strategy:m})),E=p==="floating"?{x:a,y:l,width:u.floating.width,height:u.floating.height}:u.reference,T=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),A=await(c.isElement==null?void 0:c.isElement(T))&&await(c.getScale==null?void 0:c.getScale(T))||{x:1,y:1},k=qd(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:E,offsetParent:T,strategy:m}):E);return{top:(N.top-k.top+j.top)/A.y,bottom:(k.bottom-N.bottom+j.bottom)/A.y,left:(N.left-k.left+j.left)/A.x,right:(k.right-N.right+j.right)/A.x}}const jB=50,SB=async(e,t,r)=>{const{placement:a="bottom",strategy:l="absolute",middleware:c=[],platform:u}=r,f=u.detectOverflow?u:{...u,detectOverflow:wB},m=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:l}),{x:g,y:p}=KC(h,a,m),b=a,v=0;const j={};for(let S=0;S<c.length;S++){const C=c[S];if(!C)continue;const{name:N,fn:E}=C,{x:T,y:A,data:k,reset:M}=await E({x:g,y:p,initialPlacement:a,placement:b,strategy:l,middlewareData:j,rects:h,platform:f,elements:{reference:e,floating:t}});g=T??g,p=A??p,j[N]={...j[N],...k},M&&v<jB&&(v++,typeof M=="object"&&(M.placement&&(b=M.placement),M.rects&&(h=M.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:l}):M.rects),{x:g,y:p}=KC(h,b,m)),S=-1)}return{x:g,y:p,placement:b,strategy:l,middlewareData:j}},NB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,a;const{placement:l,middlewareData:c,rects:u,initialPlacement:f,platform:m,elements:h}=t,{mainAxis:g=!0,crossAxis:p=!0,fallbackPlacements:b,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:S=!0,...C}=Oi(e,t);if((r=c.arrow)!=null&&r.alignmentOffset)return{};const N=Hr(l),E=Vr(f),T=Hr(f)===f,A=await(m.isRTL==null?void 0:m.isRTL(h.floating)),k=b||(T||!S?[wp(f)]:zL(f)),M=j!=="none";!b&&M&&k.push(...LL(f,S,j,A));const R=[f,...k],O=await m.detectOverflow(t,C),D=[];let _=((a=c.flip)==null?void 0:a.overflows)||[];if(g&&D.push(O[N]),p){const $=DL(l,u,A);D.push(O[$[0]],O[$[1]])}if(_=[..._,{placement:l,overflows:D}],!D.every($=>$<=0)){var L,q;const $=(((L=c.flip)==null?void 0:L.index)||0)+1,H=R[$];if(H&&(!(p==="alignment"?E!==Vr(H):!1)||_.every(G=>Vr(G.placement)===E?G.overflows[0]>0:!0)))return{data:{index:$,overflows:_},reset:{placement:H}};let F=(q=_.filter(V=>V.overflows[0]<=0).sort((V,G)=>V.overflows[1]-G.overflows[1])[0])==null?void 0:q.placement;if(!F)switch(v){case"bestFit":{var P;const V=(P=_.filter(G=>{if(M){const X=Vr(G.placement);return X===E||X==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(X=>X>0).reduce((X,B)=>X+B,0)]).sort((G,X)=>G[1]-X[1])[0])==null?void 0:P[0];V&&(F=V);break}case"initialPlacement":F=f;break}if(l!==F)return{reset:{placement:F}}}return{}}}},e5=new Set(["left","top"]);async function CB(e,t){const{placement:r,platform:a,elements:l}=e,c=await(a.isRTL==null?void 0:a.isRTL(l.floating)),u=Hr(r),f=Ra(r),m=Vr(r)==="y",h=e5.has(u)?-1:1,g=c&&m?-1:1,p=Oi(t,e);let{mainAxis:b,crossAxis:v,alignmentAxis:j}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return f&&typeof j=="number"&&(v=f==="end"?j*-1:j),m?{x:v*g,y:b*h}:{x:b*h,y:v*g}}const kB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,a;const{x:l,y:c,placement:u,middlewareData:f}=t,m=await CB(t,e);return u===((r=f.offset)==null?void 0:r.placement)&&(a=f.arrow)!=null&&a.alignmentOffset?{}:{x:l+m.x,y:c+m.y,data:{...m,placement:u}}}}},TB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:a,placement:l,platform:c}=t,{mainAxis:u=!0,crossAxis:f=!1,limiter:m={fn:E=>{let{x:T,y:A}=E;return{x:T,y:A}}},...h}=Oi(e,t),g={x:r,y:a},p=await c.detectOverflow(t,h),b=Vr(l),v=u1(b);let j=g[v],S=g[b];const C=(E,T)=>pA(T+p[E==="y"?"top":"left"],T,T-p[E==="y"?"bottom":"right"]);u&&(j=C(v,j)),f&&(S=C(b,S));const N=m.fn({...t,[v]:j,[b]:S});return{...N,data:{x:N.x-r,y:N.y-a,enabled:{[v]:u,[b]:f}}}}}},EB=function(e){return e===void 0&&(e={}),{options:e,fn(t){var r,a;const{x:l,y:c,placement:u,rects:f,middlewareData:m}=t,{offset:h=0,mainAxis:g=!0,crossAxis:p=!0}=Oi(e,t),b={x:l,y:c},v=Vr(u),j=u1(v);let S=b[j],C=b[v];const N=Oi(h,t),E=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:(r=N.mainAxis)!=null?r:0,crossAxis:(a=N.crossAxis)!=null?a:0};if(g){const k=j==="y"?"height":"width",M=f.reference[j]-f.floating[k]+E.mainAxis,R=f.reference[j]+f.reference[k]-E.mainAxis;S<M?S=M:S>R&&(S=R)}if(p){var T,A;const k=j==="y"?"width":"height",M=e5.has(Hr(u)),R=f.reference[v]-f.floating[k]+(M&&((T=m.offset)==null?void 0:T[v])||0)+(M?0:E.crossAxis),O=f.reference[v]+f.reference[k]+(M?0:((A=m.offset)==null?void 0:A[v])||0)-(M?E.crossAxis:0);C<R?C=R:C>O&&(C=O)}return{[j]:S,[v]:C}}}},RB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:a,platform:l,elements:c}=t,{apply:u=()=>{},...f}=Oi(e,t),m=await l.detectOverflow(t,f),h=Hr(r),g=Ra(r),p=Vr(r)==="y",{width:b,height:v}=a.floating;let j,S;h==="top"||h==="bottom"?(j=h,S=g===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(S=h,j=g==="end"?"top":"bottom");const C=v-m.top-m.bottom,N=b-m.left-m.right,E=au(v-m[j],C),T=au(b-m[S],N),A=t.middlewareData.shift,k=!A;let M=E,R=T;A!=null&&A.enabled.x&&(R=N),A!=null&&A.enabled.y&&(M=C),k&&!g&&(p?R=b-2*Na(m.left,m.right):M=v-2*Na(m.top,m.bottom)),await u({...t,availableWidth:R,availableHeight:M});const O=await l.getDimensions(c.floating);return b!==O.width||v!==O.height?{reset:{rects:!0}}:{}}}};function t5(e){const t=Nr(e);let r=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const l=cn(e),c=l?e.offsetWidth:r,u=l?e.offsetHeight:a,f=vp(r)!==c||vp(a)!==u;return f&&(r=c,a=u),{width:r,height:a,$:f}}function N1(e){return Gt(e)?e:e.contextElement}function Jc(e){const t=N1(e);if(!cn(t))return Ca(1);const r=t.getBoundingClientRect(),{width:a,height:l,$:c}=t5(t);let u=(c?vp(r.width):r.width)/a,f=(c?vp(r.height):r.height)/l;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const AB=Ca(0);function n5(e){const t=xn(e);return!Qv()||!t.visualViewport?AB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function OB(e,t,r){return t===void 0&&(t=!1),!!r&&t&&r===xn(e)}function Ll(e,t,r,a){t===void 0&&(t=!1),r===void 0&&(r=!1);const l=e.getBoundingClientRect(),c=N1(e);let u=Ca(1);t&&(a?Gt(a)&&(u=Jc(a)):u=Jc(e));const f=OB(c,r,a)?n5(c):Ca(0);let m=(l.left+f.x)/u.x,h=(l.top+f.y)/u.y,g=l.width/u.x,p=l.height/u.y;if(c&&a){const b=xn(c),v=Gt(a)?xn(a):a;let j=b,S=My(j);for(;S&&v!==j;){const C=Jc(S),N=S.getBoundingClientRect(),E=Nr(S),T=N.left+(S.clientLeft+parseFloat(E.paddingLeft))*C.x,A=N.top+(S.clientTop+parseFloat(E.paddingTop))*C.y;m*=C.x,h*=C.y,g*=C.x,p*=C.y,m+=T,h+=A,j=xn(S),S=My(j)}}return qd({width:g,height:p,x:m,y:h})}function Ng(e,t){const r=rg(e).scrollLeft;return t?t.left+r:Ll(La(e)).left+r}function s5(e,t){const r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-Ng(e,r),l=r.top+t.scrollTop;return{x:a,y:l}}function MB(e){let{elements:t,rect:r,offsetParent:a,strategy:l}=e;const c=l==="fixed",u=La(a),f=t?sg(t.floating):!1;if(a===u||f&&c)return r;let m={scrollLeft:0,scrollTop:0},h=Ca(1);const g=Ca(0),p=cn(a);if((p||!c)&&((Os(a)!=="body"||ff(u))&&(m=rg(a)),p)){const v=Ll(a);h=Jc(a),g.x=v.x+a.clientLeft,g.y=v.y+a.clientTop}const b=u&&!p&&!c?s5(u,m):Ca(0);return{width:r.width*h.x,height:r.height*h.y,x:r.x*h.x-m.scrollLeft*h.x+g.x+b.x,y:r.y*h.y-m.scrollTop*h.y+g.y+b.y}}function DB(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function zB(e){const t=rg(e),r=e.ownerDocument.body,a=Na(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),l=Na(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let c=-t.scrollLeft+Ng(e);const u=-t.scrollTop;return Nr(r).direction==="rtl"&&(c+=Na(e.clientWidth,r.clientWidth)-a),{width:a,height:l,x:c,y:u}}const PB=25;function IB(e,t,r){r===void 0&&(r="viewport");const a=r==="layoutViewport",l=xn(e),c=La(e),u=l.visualViewport;let f=c.clientWidth,m=c.clientHeight,h=0,g=0;if(u){const b=!Qv()||t==="fixed";a?b||(h=-u.offsetLeft,g=-u.offsetTop):(f=u.width,m=u.height,b&&(h=u.offsetLeft,g=u.offsetTop))}if(Ng(c)<=0){const b=c.ownerDocument,v=b.body,j=getComputedStyle(v),S=b.compatMode==="CSS1Compat"&&parseFloat(j.marginLeft)+parseFloat(j.marginRight)||0,C=Math.abs(c.clientWidth-v.clientWidth-S),N=getComputedStyle(c).scrollbarGutter==="stable both-edges"?C/2:C;N<=PB&&(f-=N)}return{width:f,height:m,x:h,y:g}}function _B(e,t){const r=Ll(e,!0,t==="fixed"),a=r.top+e.clientTop,l=r.left+e.clientLeft,c=Jc(e),u=e.clientWidth*c.x,f=e.clientHeight*c.y,m=l*c.x,h=a*c.y;return{width:u,height:f,x:m,y:h}}function XC(e,t,r){let a;if(t==="viewport"||t==="layoutViewport")a=IB(e,r,t);else if(t==="document")a=zB(La(e));else if(Gt(t))a=_B(t,r);else{const l=n5(e);a={x:t.x-l.x,y:t.y-l.y,width:t.width,height:t.height}}return qd(a)}function LB(e,t){const r=t.get(e);if(r)return r;let a=Fd(e,[],!1).filter(f=>Gt(f)&&Os(f)!=="body"),l=null;const c=Nr(e).position==="fixed";let u=c?Ea(e):e;for(;Gt(u)&&!Sa(u);){const f=Nr(u),m=Wv(u),h=l?l.position:c?"fixed":"";!m&&(h==="fixed"||h==="absolute"&&f.position==="static")?a=a.filter(p=>p!==u):l=f,u=Ea(u)}return t.set(e,a),a}function BB(e){let{element:t,boundary:r,rootBoundary:a,strategy:l}=e;const u=[...r==="clippingAncestors"?sg(t)?[]:LB(t,this._c):[].concat(r),a],f=XC(t,u[0],l);let m=f.top,h=f.right,g=f.bottom,p=f.left;for(let b=1;b<u.length;b++){const v=XC(t,u[b],l);m=Na(v.top,m),h=au(v.right,h),g=au(v.bottom,g),p=Na(v.left,p)}return{width:h-p,height:g-m,x:p,y:m}}function $B(e){const{width:t,height:r}=t5(e);return{width:t,height:r}}function VB(e,t,r){const a=cn(t),l=La(t),c=r==="fixed",u=Ll(e,!0,c,t);let f={scrollLeft:0,scrollTop:0};const m=Ca(0);if((a||!c)&&((Os(t)!=="body"||ff(l))&&(f=rg(t)),a)){const b=Ll(t,!0,c,t);m.x=b.x+t.clientLeft,m.y=b.y+t.clientTop}!a&&l&&(m.x=Ng(l));const h=l&&!a&&!c?s5(l,f):Ca(0),g=u.left+f.scrollLeft-m.x-h.x,p=u.top+f.scrollTop-m.y-h.y;return{x:g,y:p,width:u.width,height:u.height}}function U0(e){return Nr(e).position==="static"}function WC(e,t){if(!cn(e)||Nr(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return La(e)===r&&(r=r.ownerDocument.body),r}function r5(e,t){const r=xn(e);if(sg(e))return r;if(!cn(e)){let l=Ea(e);for(;l&&!Sa(l);){if(Gt(l)&&!U0(l))return l;l=Ea(l)}return r}let a=WC(e,t);for(;a&&M6(a)&&U0(a);)a=WC(a,t);return a&&Sa(a)&&U0(a)&&!Wv(a)?r:a||P6(e)||r}const UB=async function(e){const t=this.getOffsetParent||r5,r=this.getDimensions,a=await r(e.floating);return{reference:VB(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function HB(e){return Nr(e).direction==="rtl"}const o5={convertOffsetParentRelativeRectToViewportRelativeRect:MB,getDocumentElement:La,getClippingRect:BB,getOffsetParent:r5,getElementRects:UB,getClientRects:DB,getDimensions:$B,getScale:Jc,isElement:Gt,isRTL:HB};function a5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function FB(e,t,r){let a=null,l;const c=La(e);function u(){var g;clearTimeout(l),(g=a)==null||g.disconnect(),a=null}function f(g,p){g===void 0&&(g=!1),p===void 0&&(p=1),u();const b=e.getBoundingClientRect(),{left:v,top:j,width:S,height:C}=b;if(g||t(),!S||!C)return;const N=oh(j),E=oh(c.clientWidth-(v+S)),T=oh(c.clientHeight-(j+C)),A=oh(v),M={rootMargin:-N+"px "+-E+"px "+-T+"px "+-A+"px",threshold:Na(0,au(1,p))||1};let R=!0;function O(D){const _=D[0].intersectionRatio;if(!a5(b,e.getBoundingClientRect()))return f();if(_!==p){if(!R)return f();_?f(!1,_):l=setTimeout(()=>{f(!1,1e-7)},1e3)}R=!1}try{a=new IntersectionObserver(O,{...M,root:c.ownerDocument})}catch{a=new IntersectionObserver(O,M)}a.observe(e)}const m=xn(e),h=()=>f(r);return m.addEventListener("resize",h),f(!0),()=>{m.removeEventListener("resize",h),u()}}function QC(e,t,r,a){a===void 0&&(a={});const{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:m=!1}=a,h=N1(e),g=l||c?[...h?Fd(h):[],...t?Fd(t):[]]:[];g.forEach(N=>{l&&N.addEventListener("scroll",r),c&&N.addEventListener("resize",r)});const p=h&&f?FB(h,r,c):null;let b=-1,v=null;u&&(v=new ResizeObserver(N=>{let[E]=N;E&&E.target===h&&v&&t&&(v.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var T;(T=v)==null||T.observe(t)})),r()}),h&&!m&&v.observe(h),t&&v.observe(t));let j,S=m?Ll(e):null;m&&C();function C(){const N=Ll(e);S&&!a5(S,N)&&r(),S=N,j=requestAnimationFrame(C)}return r(),()=>{var N;g.forEach(E=>{l&&E.removeEventListener("scroll",r),c&&E.removeEventListener("resize",r)}),p==null||p(),(N=v)==null||N.disconnect(),v=null,m&&cancelAnimationFrame(j)}}const GB=kB,qB=TB,YB=NB,KB=RB,XB=EB,WB=(e,t,r)=>{const a=new Map,l=r??{},c={...o5,...l.platform,_c:a};return SB(e,t,{...l,platform:c})};var QB=typeof document<"u",ZB=function(){},Vh=QB?x.useLayoutEffect:ZB;function Sp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,a,l;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(a=r;a--!==0;)if(!Sp(e[a],t[a]))return!1;return!0}if(l=Object.keys(e),r=l.length,r!==Object.keys(t).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(t,l[a]))return!1;for(a=r;a--!==0;){const c=l[a];if(!(c==="_owner"&&e.$$typeof)&&!Sp(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function i5(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ZC(e,t){const r=i5(e);return Math.round(t*r)/r}function H0(e){const t=x.useRef(e);return Vh(()=>{t.current=e}),t}function JB(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:l,elements:{reference:c,floating:u}={},transform:f=!0,whileElementsMounted:m,open:h}=e,[g,p]=x.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[b,v]=x.useState(a);Sp(b,a)||v(a);const[j,S]=x.useState(null),[C,N]=x.useState(null),E=x.useCallback(G=>{G!==M.current&&(M.current=G,S(G))},[]),T=x.useCallback(G=>{G!==R.current&&(R.current=G,N(G))},[]),A=c||j,k=u||C,M=x.useRef(null),R=x.useRef(null),O=x.useRef(g),D=m!=null,_=H0(m),L=H0(l),q=H0(h),P=x.useCallback(()=>{if(!M.current||!R.current)return;const G={placement:t,strategy:r,middleware:b};L.current&&(G.platform=L.current),WB(M.current,R.current,G).then(X=>{const B={...X,isPositioned:q.current!==!1};$.current&&!Sp(O.current,B)&&(O.current=B,Kr.flushSync(()=>{p(B)}))})},[b,t,r,L,q]);Vh(()=>{h===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(G=>({...G,isPositioned:!1})))},[h]);const $=x.useRef(!1);Vh(()=>($.current=!0,()=>{$.current=!1}),[]),Vh(()=>{if(A&&(M.current=A),k&&(R.current=k),A&&k){if(_.current)return _.current(A,k,P);P()}},[A,k,P,_,D]);const H=x.useMemo(()=>({reference:M,floating:R,setReference:E,setFloating:T}),[E,T]),F=x.useMemo(()=>({reference:A,floating:k}),[A,k]),V=x.useMemo(()=>{const G={position:r,left:0,top:0};if(!F.floating)return G;const X=ZC(F.floating,g.x),B=ZC(F.floating,g.y);return f?{...G,transform:"translate("+X+"px, "+B+"px)",...i5(F.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:X,top:B}},[r,f,F.floating,g.x,g.y]);return x.useMemo(()=>({...g,update:P,refs:H,elements:F,floatingStyles:V}),[g,P,H,F,V])}const e$=(e,t)=>{const r=GB(e);return{name:r.name,fn:r.fn,options:[e,t]}},t$=(e,t)=>{const r=qB(e);return{name:r.name,fn:r.fn,options:[e,t]}},n$=(e,t)=>({fn:XB(e).fn,options:[e,t]}),s$=(e,t)=>{const r=YB(e);return{name:r.name,fn:r.fn,options:[e,t]}},r$=(e,t)=>{const r=KB(e);return{name:r.name,fn:r.fn,options:[e,t]}},o$={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class C1 extends bu{constructor(r){const{syncOnly:a,nested:l,onOpenChange:c,triggerElements:u,...f}=r;super({...f,positionReference:f.referenceElement,domReferenceElement:f.referenceElement},{onOpenChange:c,dataRef:{current:{}},events:XA(),nested:l,triggerElements:u},o$);tn(this,"syncOpenEvent",(r,a)=>{(!r||!this.state.open||a!=null&&OL(a))&&(this.context.dataRef.current.openEvent=r?a:void 0)});tn(this,"dispatchOpenChange",(r,a)=>{this.syncOpenEvent(r,a.event);const l={open:r,reason:a.reason,nativeEvent:a.event,nested:this.context.nested,triggerElement:a.trigger};this.context.events.emit("openchange",l)});tn(this,"setOpen",(r,a)=>{var l,c,u,f;if(this.syncOnly){(c=(l=this.context).onOpenChange)==null||c.call(l,r,a);return}this.dispatchOpenChange(r,a),(f=(u=this.context).onOpenChange)==null||f.call(u,r,a)});this.syncOnly=a}}function l5(e){const{popupStore:t,treatPopupAsFloatingElement:r=!1,floatingRootContext:a,floatingId:l,nested:c,onOpenChange:u}=e,f=t.useState("open"),m=t.useState("activeTriggerElement"),h=t.useState(r?"popupElement":"positionerElement"),g=t.context.triggerElements,p=u,b=x.useRef(null);a===void 0&&b.current===null&&(b.current=new C1({open:f,transitionStatus:void 0,referenceElement:m,floatingElement:h,triggerElements:g,onOpenChange:p,floatingId:l,syncOnly:!0,nested:c}));const v=a??b.current;return t.useSyncedValue("floatingId",l),Ke(()=>{const j={open:f,floatingId:l,referenceElement:m,floatingElement:h};Gt(m)&&(j.domReferenceElement=m),v.state.positionReference===v.state.referenceElement&&(j.positionReference=m),v.update(j)},[f,l,m,h,v]),v.context.onOpenChange=p,v.context.nested=c,v}const jf={tabIndex:-1,[_y]:""};function c5(e){return t=>t==="touch"?e.current:!0}function k1(e,t=!1){const r=Pl(),a=_i()!=null,l=us(()=>e(r,a)).current;return l5({popupStore:l,treatPopupAsFloatingElement:t,floatingRootContext:l.state.floatingRootContext,floatingId:r,nested:a,onOpenChange:l.setOpen}),l}function Cg({handle:e,store:t}){return Ke(()=>e.attachStore(t),[e,t]),null}function JC(e){const t=e.context.triggerElements.size;e.select("open")&&e.state.triggerCount!==t&&e.set("triggerCount",t)}function a$(e,t){const r=x.useRef(null);return et(a=>{const l=r.current;if(l!==null){if(l.element===a&&l.store===t&&l.id===e)return;r.current=null;const c=l.store;c.context.triggerElements.getById(l.id)===l.element&&(c.context.triggerElements.delete(l.id),JC(c))}a!==null&&e!==void 0&&(r.current={store:t,id:e,element:a},t.context.triggerElements.add(e,a),JC(t))})}function kg(e,t,r,a=!1){let l=e.preventUnmountingOnClose;t?l=!1:a&&(l=!0);const c=(r==null?void 0:r.id)??null;let u=e.activeTriggerId,f=e.activeTriggerElement;return(c||t)&&(u=c,f=r??null),{open:t,preventUnmountingOnClose:l,activeTriggerId:u,activeTriggerElement:f}}function T1(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function i$(e,t,r,a={}){var g,p,b;const l=r.reason,c=l===Un,u=t&&l===Zc,f=!t&&(l===Wo||l===yf),m=T1(r);if((p=(g=e.context).onOpenChange)==null||p.call(g,t,r),r.isCanceled)return;(b=a.onBeforeDispatch)==null||b.call(a),e.state.floatingRootContext.dispatchOpenChange(t,r);const h=()=>{const v=kg(e.state,t,r.trigger,m()),j={...a.extraState,...v};u?j.instantType="focus":f?j.instantType="dismiss":c&&(j.instantType=void 0),e.update(j)};c?Kr.flushSync(h):h()}function E1(e,t,r,a){const l=r.useState("isMountedByTrigger",e),c=a$(e,r),u=et(m=>{const h=r.select("open"),g=r.select("activeTriggerId");if(g===e){const p={activeTriggerElement:m,...h?a:null};r.update(p);return}if(g==null&&h){const p={activeTriggerId:e??null,activeTriggerElement:m,...a};r.update(p)}}),f=et(m=>{c(m),m&&u(m)});return Ke(()=>(f(t.current),()=>f(null)),[f,t,r,e]),Ke(()=>{if(l){const m={activeTriggerElement:t.current,...a};r.update(m)}},[l,r,t,...Object.values(a)]),{registerTrigger:f,isMountedByThisTrigger:l}}function Tg(e,t={}){const{closeOnActiveTriggerUnmount:r=!1}=t,a=x.useRef(null),l=e.useState("open"),c=e.useState("triggerCount"),u=e.useState("activeTriggerId"),f=e.useState("activeTriggerElement");Ke(()=>{if(!l){a.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const m=e.context.triggerElements.size,h={};e.state.triggerCount!==m&&(h.triggerCount=m);const g=e.select("activeTriggerId");let p=null;if(g){const b=e.context.triggerElements.getById(g);if(b)a.current=g,b!==e.state.activeTriggerElement&&(h.activeTriggerElement=b);else{for(const[v,j]of e.context.triggerElements.entries())if(j===e.state.activeTriggerElement){h.activeTriggerId=v,h.activeTriggerElement=j,a.current=v;break}h.activeTriggerId===void 0&&(a.current===g?p=g:a.current=null)}}else a.current=null;if(!p&&!g&&m===1){const b=e.context.triggerElements.entries().next();if(!b.done){const[v,j]=b.value;h.activeTriggerId=v,h.activeTriggerElement=j,a.current=v}}(h.triggerCount!==void 0||h.activeTriggerId!==void 0||h.activeTriggerElement!==void 0)&&e.update(h),p&&r&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===p&&!e.context.triggerElements.getById(p)){const b=bt(kr);e.setOpen(!1,b),b.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[l,e,c,u,f,r])}function Eg(e,t,r,a){const{mounted:l,setMounted:c,transitionStatus:u}=Va(e,!1,!1,a),f=t.useState("preventUnmountingOnClose"),m=e?!1:f;t.useSyncedValues({mounted:l,transitionStatus:u,preventUnmountingOnClose:m});const h=et(()=>{var g,p;c(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),r==null||r(),(p=(g=t.context).onOpenChangeComplete)==null||p.call(g,!1)});return lr({enabled:l&&!e&&!m,open:e,ref:t.context.popupRef,onComplete(){e||h()}}),{forceUnmount:h,transitionStatus:u}}function Rg(e,t){e.useSyncedValues(t),Ke(()=>()=>{e.update({activeTriggerProps:gn,inactiveTriggerProps:gn,popupProps:gn})},[e])}function u5(e,t){Ke(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),Ke(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Sf{constructor(){this.idMap=new Map}add(t,r){this.idMap.set(t,r)}delete(t){this.idMap.delete(t)}hasElement(t){for(const r of this.idMap.values())if(r===t)return!0;return!1}hasMatchingElement(t){for(const r of this.idMap.values())if(t(r))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function Ag(e,t,r=!1){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:new C1({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:r,onOpenChange:void 0}),floatingId:t,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:gn,inactiveTriggerProps:gn,popupProps:gn}}const Id=e=>e.triggerIdProp??e.activeTriggerId,R1=e=>e.openProp??e.open,ek=e=>{var r;return(((r=e.popupElement)==null?void 0:r.id)??e.floatingId)||void 0};function d5(e,t){return t!==void 0&&R1(e)&&Id(e)===t}function l$(e,t){return d5(e,t)?!0:t!==void 0&&R1(e)&&Id(e)==null&&e.triggerCount===1}const Og={open:R1,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Id,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:ek,isTriggerActive:(e,t)=>t!==void 0&&Id(e)===t,isOpenedByTrigger:(e,t)=>d5(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Id(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>l$(e,t)?ek(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function A1(e){const t=x.useCallback(a=>e===void 0?Tn:e.subscribeStore(a),[e]),r=x.useCallback(()=>e===void 0?void 0:e.store,[e]);return x1.useSyncExternalStore(t,r,()=>e==null?void 0:e.serverStore)}function c$(e){const{open:t=!1,onOpenChange:r,elements:a={}}=e,l=Pl(),c=_i()!=null,u=us(()=>new C1({open:t,transitionStatus:void 0,onOpenChange:r,referenceElement:a.reference??null,floatingElement:a.floating??null,triggerElements:new Sf,floatingId:l,syncOnly:!1,nested:c})).current;return Ke(()=>{const f={open:t,floatingId:l};a.reference!==void 0&&(f.referenceElement=a.reference,f.domReferenceElement=Gt(a.reference)?a.reference:null),a.floating!==void 0&&(f.floatingElement=a.floating),u.update(f)},[t,l,a.reference,a.floating,u]),u.context.onOpenChange=r,u.context.nested=c,u}function u$(e){return d$(e,e.rootContext)}function d$(e,t){const{nodeId:r,externalTree:a}=e,l=t.useState("referenceElement"),c=t.useState("floatingElement"),u=t.useState("domReferenceElement"),f=t.useState("open"),m=t.useState("floatingId"),[h,g]=x.useState(null),[p,b]=x.useState(void 0),[v,j]=x.useState(void 0),S=x.useRef(null),C=Li(a),N=x.useMemo(()=>({reference:l,floating:c,domReference:u}),[l,c,u]),E=JB({...e,elements:{...N,...h&&{reference:h}}}),T=Gt(p)?p:null,A=v===void 0?t.state.floatingElement:v;t.useSyncedValue("referenceElement",p??null),t.useSyncedValue("domReferenceElement",p===void 0?u:T),t.useSyncedValue("floatingElement",A);const k=x.useCallback(L=>{const q=Gt(L)?{getBoundingClientRect:()=>L.getBoundingClientRect(),getClientRects:()=>L.getClientRects(),contextElement:L}:L;g(q),E.refs.setReference(q)},[E.refs]),M=x.useCallback(L=>{(Gt(L)||L===null)&&(S.current=L,b(L)),(Gt(E.refs.reference.current)||E.refs.reference.current===null||L!==null&&!Gt(L))&&E.refs.setReference(L)},[E.refs,b]),R=x.useCallback(L=>{j(L),E.refs.setFloating(L)},[E.refs]),O=x.useMemo(()=>({...E.refs,setReference:M,setFloating:R,setPositionReference:k,domReference:S}),[E.refs,M,R,k]),D=x.useMemo(()=>({...E.elements,domReference:u}),[E.elements,u]),_=x.useMemo(()=>({...E,dataRef:t.context.dataRef,open:f,onOpenChange:t.setOpen,events:t.context.events,floatingId:m,refs:O,elements:D,nodeId:r,rootStore:t}),[E,O,D,r,t,f,m]);return Ke(()=>{u&&(S.current=u)},[u]),Ke(()=>{t.context.dataRef.current.floatingContext=_;const L=C==null?void 0:C.nodesRef.current.find(q=>q.id===r);L&&(L.context=_)}),x.useMemo(()=>({...E,context:_,refs:O,elements:D,rootStore:t}),[E,O,D,_,t])}const F0=r1&&Ba;function f5(e,t={}){const{enabled:r=!0,delay:a}=t,l="rootStore"in e?e.rootStore:e,{events:c,dataRef:u}=l.context,f=x.useRef(!1),m=x.useRef(null),h=x.useRef(!0),g=es();x.useEffect(()=>{const b=l.select("domReferenceElement");if(!r)return;const v=xn(b);function j(){const N=l.select("domReferenceElement");!l.select("open")&&cn(N)&&N===Is(Ft(N))&&(f.current=!0,m.current=N)}function S(){h.current=!0}function C(){h.current=!1}return Fo(Lt(v,"blur",j),F0&&Lt(v,"keydown",S,!0),F0&&Lt(v,"pointerdown",C,!0))},[l,r]),x.useEffect(()=>{if(!r)return;function b(v){if(v.reason===Wo||v.reason===yf){const j=l.select("domReferenceElement");Gt(j)&&(m.current=j,f.current=!0)}}return c.on("openchange",b),()=>{c.off("openchange",b)}},[c,r,l]);const p=x.useMemo(()=>{function b(){f.current=!1,m.current=null}return{onMouseLeave(){b()},onFocus(v){const j=v.currentTarget;if(f.current){if(m.current===j)return;b()}const S=As(v.nativeEvent);if(Gt(S)){if(F0&&!v.relatedTarget){if(!h.current&&!hg(S))return}else if(!RL(S))return}const C=bp(v.relatedTarget,l.context.triggerElements),{nativeEvent:N,currentTarget:E}=v,T=typeof a=="function"?a():a;if(l.select("open")&&C||T===0||T===void 0){l.setOpen(!0,bt(Zc,N,E));return}g.start(T,()=>{f.current||l.setOpen(!0,bt(Zc,N,E))})},onBlur(v){b();const j=v.relatedTarget,S=v.nativeEvent,C=Gt(j)&&j.hasAttribute(Kd("focus-guard"))&&j.getAttribute("data-type")==="outside";g.start(0,()=>{var A;const N=l.select("domReferenceElement"),E=Is(Ft(N));!j&&E===N||pt((A=u.current.floatingContext)==null?void 0:A.refs.floating.current,E)||pt(N,E)||C||bp(j??E,l.context.triggerElements)||l.setOpen(!1,bt(Zc,S))})}}},[u,a,l,g]);return x.useMemo(()=>r?{reference:p,trigger:p}:{},[r,p])}class O1{constructor(){tn(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});tn(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Yr,this.restTimeout=new Yr,this.handleCloseOptions=void 0}static create(){return new O1}}const Np=new WeakMap;function Cp(e){var r,a,l;if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Np.get(t)===e&&((r=e.pointerEventsScopeElement)==null||r.style.removeProperty("pointer-events"),(a=e.pointerEventsReferenceElement)==null||a.style.removeProperty("pointer-events"),(l=e.pointerEventsFloatingElement)==null||l.style.removeProperty("pointer-events"),Np.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function m5(e,t){const{scopeElement:r,referenceElement:a,floatingElement:l}=t,c=Np.get(r);c&&c!==e&&Cp(c),Cp(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=r,e.pointerEventsReferenceElement=a,e.pointerEventsFloatingElement=l,Np.set(r,e),r.style.pointerEvents="none",a.style.pointerEvents="auto",l.style.pointerEvents="auto"}function M1(e){const t=e.context.dataRef.current,r=us(()=>t.hoverInteractionState??O1.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=r),p1(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function D1(e,t={}){const{enabled:r=!0,closeDelay:a=0,nodeId:l}=t,c="rootStore"in e?e.rootStore:e,u=c.useState("open"),f=c.useState("floatingElement"),m=c.useState("domReferenceElement"),{dataRef:h}=c.context,g=Li(),p=_i(),b=M1(c),v=es(),j=et(()=>{var N;return $A((N=h.current.openEvent)==null?void 0:N.type,b.interactedInside)}),S=et(()=>{var N;return oB((N=h.current.openEvent)==null?void 0:N.type)}),C=et(()=>{Cp(b)});Ke(()=>{u||(b.pointerType=void 0,b.restTimeoutPending=!1,b.interactedInside=!1,C())},[u,b,C]),x.useEffect(()=>C,[C]),Ke(()=>{var N,E,T,A,k;if(r&&u&&(N=b.handleCloseOptions)!=null&&N.blockPointerEvents&&S()&&Gt(m)&&f){const M=m,R=f,O=Ft(f),D=(T=(E=g==null?void 0:g.nodesRef.current.find(P=>P.id===p))==null?void 0:E.context)==null?void 0:T.elements.floating;D&&(D.style.pointerEvents="");const _=b.pointerEventsScopeElement!==R?b.pointerEventsScopeElement:null,L=D!==R?D:null,q=((k=(A=b.handleCloseOptions)==null?void 0:A.getScope)==null?void 0:k.call(A))??_??L??M.closest("[data-rootownerid]")??O.body;return m5(b,{scopeElement:q,referenceElement:M,floatingElement:R}),()=>{C()}}},[r,u,m,f,b,S,g,p,C]),x.useEffect(()=>{if(!r)return;function N(){return!!(g&&p&&Ai(g.nodesRef.current,p).length>0)}function E(O){const D=_l(a,"close",b.pointerType),_=()=>{c.setOpen(!1,bt(Un,O)),g==null||g.events.emit("floating.closed",O)};D?b.openChangeTimeout.start(D,_):(b.openChangeTimeout.clear(),_())}function T(O){const D=As(O);if(!EL(D)){b.interactedInside=!1;return}b.interactedInside=(D==null?void 0:D.closest("[aria-haspopup]"))!=null}function A(){b.openChangeTimeout.clear(),v.clear(),g==null||g.events.off("floating.closed",M),C()}function k(O){var q;if(N()&&g){g.events.on("floating.closed",M);return}if(bp(O.relatedTarget,c.context.triggerElements))return;const D=((q=h.current.floatingContext)==null?void 0:q.nodeId)??l,_=O.relatedTarget;if(!(g&&D&&Gt(_)&&Ai(g.nodesRef.current,D,!1).some(P=>{var $;return pt(($=P.context)==null?void 0:$.elements.floating,_)}))){if(b.handler){b.handler(O);return}C(),S()&&!j()&&E(O)}}function M(O){!g||!p||N()||v.start(0,()=>{g.events.off("floating.closed",M),c.setOpen(!1,bt(Un,O)),g.events.emit("floating.closed",O)})}const R=f;return Fo(R&&Lt(R,"mouseenter",A),R&&Lt(R,"mouseleave",k),R&&Lt(R,"pointerdown",T,!0),()=>{g==null||g.events.off("floating.closed",M)})},[r,f,c,h,a,l,S,j,C,b,g,p,v])}const f$={current:null};function z1(e,t={}){const{enabled:r=!0,delay:a=0,handleClose:l=null,mouseOnly:c=!1,restMs:u=0,move:f=!0,triggerElementRef:m=f$,externalTree:h,isActiveTrigger:g=!0,getHandleCloseContext:p,isClosing:b,shouldOpen:v,guardStaleOpen:j=!1}=t,S="rootStore"in e?e.rootStore:e,{dataRef:C,events:N}=S.context,E=Li(h),T=M1(S),A=x.useRef(!1),k=Ln(l),M=Ln(a),R=Ln(u),O=Ln(r),D=Ln(v),_=Ln(b),L=et(()=>{var F;return $A((F=C.current.openEvent)==null?void 0:F.type,T.interactedInside)}),q=et(()=>{var F;return((F=D.current)==null?void 0:F.call(D))!==!1}),P=et((F,V,G)=>{const X=S.context.triggerElements;if(X.hasElement(V))return!F||!pt(F,V);if(!Gt(G))return!1;const B=G;return X.hasMatchingElement(Z=>pt(Z,B))&&(!F||!pt(F,B))}),$=et(()=>{if(!T.handler)return;Ft(S.select("domReferenceElement")).removeEventListener("mousemove",T.handler),T.handler=void 0}),H=et(()=>{Cp(T)});return g&&(T.handleCloseOptions=l==null?void 0:l.__options),x.useEffect(()=>$,[$]),x.useEffect(()=>{if(!r)return;function F(V){V.open?A.current=!1:(A.current=V.reason===Un,$(),T.openChangeTimeout.clear(),T.restTimeout.clear(),T.blockMouseMove=!0,T.restTimeoutPending=!1)}return N.on("openchange",F),()=>{N.off("openchange",F)}},[r,N,T,$]),x.useEffect(()=>{if(!r)return;function F(K,se=!0){const I=_l(M.current,"close",T.pointerType);I?T.openChangeTimeout.start(I,()=>{S.setOpen(!1,bt(Un,K)),E==null||E.events.emit("floating.closed",K)}):se&&(T.openChangeTimeout.clear(),S.setOpen(!1,bt(Un,K)),E==null||E.events.emit("floating.closed",K))}const V=m.current??(g?S.select("domReferenceElement"):null);if(!Gt(V))return;function G(K){var Ne;if(T.openChangeTimeout.clear(),T.blockMouseMove=!1,c&&!Ci(T.pointerType))return;const se=_C(R.current),I=_l(M.current,"open",T.pointerType),U=As(K),Q=K.currentTarget??null,te=S.select("domReferenceElement");let le=Q;if(Gt(U)&&!S.context.triggerElements.hasElement(U)){for(const Ae of S.context.triggerElements.elements())if(pt(Ae,U)){le=Ae;break}}Gt(Q)&&Gt(te)&&!S.context.triggerElements.hasElement(Q)&&pt(Q,te)&&(le=te);const J=le==null?!1:P(te,le,U),ne=S.select("open"),ce=((Ne=_.current)==null?void 0:Ne.call(_))??S.select("transitionStatus")==="ending",oe=!ne&&ce&&A.current,W=!J&&Gt(le)&&Gt(te)&&pt(te,le)&&oe,de=se>0&&!I,Ee=J&&(ne||oe)||W,Be=!ne||J;if(Ee){q()&&S.setOpen(!0,bt(Un,K,le));return}de||(I?T.openChangeTimeout.start(I,()=>{Be&&q()&&S.setOpen(!0,bt(Un,K,le))}):Be&&q()&&S.setOpen(!0,bt(Un,K,le)))}function X(K){if(L()){H();return}$();const se=S.select("domReferenceElement"),I=Ft(se);T.restTimeout.clear(),T.restTimeoutPending=!1;const U=C.current.floatingContext??(p==null?void 0:p());if(bp(K.relatedTarget,S.context.triggerElements))return;if(k.current&&U){S.select("open")||T.openChangeTimeout.clear();const te=m.current;T.handler=k.current({...U,tree:E,x:K.clientX,y:K.clientY,onClose(){H(),$(),O.current&&!L()&&te===S.select("domReferenceElement")&&F(K,!0)}}),I.addEventListener("mousemove",T.handler),T.handler(K);return}(T.pointerType==="touch"?!pt(S.select("floatingElement"),K.relatedTarget):!0)&&F(K)}function B(K){pt(V,K.relatedTarget)||(T.openChangeTimeout.clear(),T.restTimeout.clear(),T.restTimeoutPending=!1)}const Z=j?Lt(V,"mouseout",B):void 0;return f?Fo(Lt(V,"mousemove",G,{once:!0}),Lt(V,"mouseenter",G),Lt(V,"mouseleave",X),Z):Fo(Lt(V,"mouseenter",G),Lt(V,"mouseleave",X),Z)},[$,H,C,M,S,r,k,T,g,P,L,c,f,R,m,E,O,p,_,q,j]),x.useMemo(()=>{if(!r)return;function F(V){T.pointerType=V.pointerType}return{onPointerDown:F,onPointerEnter:F,onMouseMove(V){var U,Q,te;const{nativeEvent:G}=V,X=V.currentTarget,B=S.select("domReferenceElement"),Z=S.select("open"),K=P(B,X,V.target);if(c&&!Ci(T.pointerType))return;if(Z&&K&&((U=T.handleCloseOptions)!=null&&U.blockPointerEvents)){const le=S.select("floatingElement");if(le){const J=((te=(Q=T.handleCloseOptions)==null?void 0:Q.getScope)==null?void 0:te.call(Q))??X.ownerDocument.body;m5(T,{scopeElement:J,referenceElement:X,floatingElement:le})}}const se=_C(R.current);if(Z&&!K||se===0||!K&&T.restTimeoutPending&&V.movementX**2+V.movementY**2<2)return;T.restTimeout.clear();function I(){if(T.restTimeoutPending=!1,L())return;const le=S.select("open");!T.blockMouseMove&&(!le||K)&&q()&&S.setOpen(!0,bt(Un,G,X))}T.pointerType==="touch"?Kr.flushSync(()=>{I()}):K&&Z?I():(T.restTimeoutPending=!0,T.restTimeout.start(se,I))}}},[r,T,L,P,c,S,R,q])}const m$="Escape";function tk(e){return Ba&&e.movementX===0&&e.movementY===0}function Mg(e,t,r){switch(e){case"vertical":return t;case"horizontal":return r;default:return t||r}}function uh(e,t){return Mg(t,e===mA||e===a1,e===dg||e===fg)}function G0(e,t,r){return Mg(t,e===a1,r?e===dg:e===fg)||e==="Enter"||e===" "||e===""}function h$(e,t,r){return Mg(t,r?e===dg:e===fg,e===a1)}function p$(e,t,r,a){const l=r?e===fg:e===dg,c=e===mA;return t==="both"||t==="horizontal"&&a?e===m$:Mg(t,l,c)}function h5(e,t){const{listRef:r,activeIndex:a,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:u=null,allowEscape:f=!1,loopFocus:m=!1,nested:h=!1,rtl:g=!1,virtual:p=!1,focusItemOnOpen:b="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:j=!0,disabledIndices:S=void 0,orientation:C="vertical",parentOrientation:N,id:E,resetOnPointerLeave:T=!0,externalTree:A,grid:k}=t,M=k!=null,R="rootStore"in e?e.rootStore:e,O=R.useState("open"),D=R.useState("floatingElement"),_=R.useState("domReferenceElement"),L=R.context.dataRef,q=yp(D),P=By(_),$=Ln(q),H=_i(),F=Li(A),V=x.useRef(b),G=x.useRef(u??-1),X=x.useRef(null),B=x.useRef(!0),Z=et(we=>{l(G.current===-1?null:G.current,we)}),K=x.useRef(!!D),se=x.useRef(O),I=x.useRef(!1),U=x.useRef(!1),Q=x.useRef(null),te=Ln(S),le=Ln(O),J=Ln(u),ne=Ln(T),ce=iu(),oe=iu(),W=et(()=>{function we(be){p?F==null||F.events.emit("virtualfocus",be):Q.current=$h(be,{sync:I.current,preventScroll:!0})}const _e=r.current[G.current],Re=U.current;_e&&we(_e),(I.current?be=>be():be=>ce.request(be))(()=>{var Ze;const be=r.current[G.current]||_e;if(!be)return;_e||we(be),ee&&(Re||!B.current)&&((Ze=be.scrollIntoView)==null||Ze.call(be,{block:"nearest",inline:"nearest"}))})});Ke(()=>{L.current.orientation=C},[L,C]),Ke(()=>{c&&(O&&D?(G.current=u??-1,V.current&&u!=null&&(U.current=!0,Z())):K.current&&(G.current=-1,Z()))},[c,O,D,u,Z]),Ke(()=>{if(c){if(!O){I.current=!1;return}if(D)if(a==null){if(I.current=!1,J.current!=null)return;if(K.current&&(G.current=-1,W()),(!se.current||!K.current)&&V.current&&(X.current!=null||V.current===!0&&X.current==null)){let we=0;const _e=()=>{r.current[0]==null?(we<2&&(we?Te=>oe.request(Te):queueMicrotask)(_e),we+=1):(G.current=X.current==null||G0(X.current,C,g)||h?Bh(r):Vy(r),X.current=null,Z())};_e()}}else Pd(r.current,a)||(G.current=a,W(),U.current=!1)}},[c,O,D,a,J,h,r,C,g,Z,W,oe]),Ke(()=>{var be,Ue;if(!c||D||!F||p||!K.current)return;const we=F.nodesRef.current,_e=(Ue=(be=we.find(Ze=>Ze.id===H))==null?void 0:be.context)==null?void 0:Ue.elements.floating,Re=Is(Ft(_??_e??null)),Te=we.some(Ze=>Ze.context&&pt(Ze.context.elements.floating,Re));_e&&!Te&&B.current&&_e.focus({preventScroll:!0})},[c,D,_,F,H,p]),Ke(()=>{se.current=O,K.current=!!D}),Ke(()=>{O||(X.current=null,V.current=b)},[O,b]);const de=a!=null,Ee=et(we=>{if(!le.current)return;const _e=r.current.indexOf(we.currentTarget);_e!==-1&&(G.current!==_e||a!==_e)&&(G.current=_e,Z(we))}),Be=et(()=>{var we,_e,Re;return N??((Re=(_e=(we=F==null?void 0:F.nodesRef.current.find(Te=>Te.id===H))==null?void 0:we.context)==null?void 0:_e.dataRef)==null?void 0:Re.current.orientation)}),Ne=et(()=>Bh(r,te.current)),Ae=et(we=>{if(B.current=!1,I.current=!0,we.which===229||!le.current&&we.currentTarget===$.current)return;if(h&&p$(we.key,C,g,M)){uh(we.key,Be())||Vo(we),R.setOpen(!1,bt(Hy,we.nativeEvent)),cn(_)&&(p?F==null||F.events.emit("virtualfocus",_):_.focus());return}const _e=G.current,Re=Bh(r,S),Te=Vy(r,S);if(P||(we.key==="Home"&&(Vo(we),G.current=Re,Z(we)),we.key==="End"&&(Vo(we),G.current=Te,Z(we))),k!=null){const be=k(we,G.current,r,C,m,g,S,Re,Te);if(be!=null&&(G.current=be,Z(we)),C==="both")return}if(uh(we.key,C)){if(Vo(we),O&&!p&&Is(we.currentTarget.ownerDocument)===we.currentTarget){G.current=G0(we.key,C,g)?Re:Te,Z(we);return}G0(we.key,C,g)?m?_e>=Te?f&&_e!==r.current.length?G.current=-1:(I.current=!1,G.current=Re):G.current=wa(r.current,{startingIndex:_e,disabledIndices:S}):G.current=Math.min(Te,wa(r.current,{startingIndex:_e,disabledIndices:S})):m?_e<=Re?f&&_e!==-1?G.current=r.current.length:(I.current=!1,G.current=Te):G.current=wa(r.current,{startingIndex:_e,decrement:!0,disabledIndices:S}):G.current=Math.max(Re,wa(r.current,{startingIndex:_e,decrement:!0,disabledIndices:S})),Pd(r.current,G.current)&&(G.current=-1),Z(we)}}),ee=x.useMemo(()=>({onFocus(_e){I.current=!0,Ee(_e)},onClick:({currentTarget:_e})=>_e.focus({preventScroll:!0}),onMouseMove(_e){tk(_e)||(I.current=!0,U.current=!1,v&&Ee(_e))},onPointerLeave(_e){var Te;if(!le.current||!B.current||_e.pointerType==="touch")return;I.current=!0;const Re=_e.relatedTarget;if(!(!v||r.current.includes(Re))&&ne.current&&((Te=Q.current)==null||Te.call(Q),Q.current=null,G.current=-1,Z(_e),!p)){const be=$.current,Ue=Is(Ft(be));be&&pt(be,Ue)&&be.focus({preventScroll:!0})}}}),[Ee,le,$,v,r,Z,ne,p]),re=x.useMemo(()=>p&&O&&de&&{"aria-activedescendant":`${E}-${a}`},[p,O,de,E,a]),xe=x.useMemo(()=>({...P?{}:re,onKeyDown(we){if(we.key==="Tab"&&we.shiftKey&&O&&!p){const _e=As(we.nativeEvent);if(_e&&!pt($.current,_e))return;Vo(we),R.setOpen(!1,bt(Mi,we.nativeEvent)),cn(_)&&_.focus();return}Ae(we)},onPointerMove(we){tk(we)||(B.current=!0)}}),[re,Ae,$,P,R,O,p,_]),he=x.useMemo(()=>{function we(Te){R.setOpen(!0,bt(Hy,Te.nativeEvent,Te.currentTarget))}function _e(Te){b==="auto"&&pg(Te.nativeEvent)&&(V.current=!p)}function Re(Te){V.current=b,b==="auto"&&c1(Te.nativeEvent)&&(V.current=!0)}return{onKeyDown(Te){const be=R.select("open");B.current=!1;const Ue=Te.key.startsWith("Arrow"),Ze=h$(Te.key,Be(),g),ht=uh(Te.key,C),at=(h?Ze:ht)||Te.key==="Enter"||Te.key.trim()==="";if(p&&be)return Ae(Te);if(!(!be&&!j&&Ue)){if(at){const Pe=uh(Te.key,Be());X.current=h&&Pe?null:Te.key}if(h){Ze&&(Vo(Te),be?(G.current=Ne(),Z(Te)):we(Te));return}ht&&(J.current!=null&&(G.current=J.current),Vo(Te),!be&&j?we(Te):Ae(Te),be&&Z(Te))}},onFocus(Te){R.select("open")&&!p&&(G.current=-1,Z(Te))},onPointerDown:Re,onPointerEnter:Re,onMouseDown:_e,onClick:_e}},[Ae,b,Ne,h,Z,R,j,C,Be,g,J,p]),$e=x.useMemo(()=>({...re,...he}),[re,he]);return x.useMemo(()=>c?{reference:$e,floating:xe,item:ee,trigger:he}:{},[c,$e,xe,he,ee])}function p5(e,t){const{listRef:r,elementsRef:a,activeIndex:l,onMatch:c,disabledIndices:u,onTyping:f,enabled:m=!0,resetMs:h=750,selectedIndex:g=null}=t,p="rootStore"in e?e.rootStore:e,b=p.useState("open"),v=es(),j=x.useRef(""),S=x.useRef(g??l??-1),C=x.useRef(null),N=et(A=>{function k($){return a==null?void 0:a.current[$]}function M($){const H=k($);return H&&!gg(H)||H!=null&&H.matches(":disabled")?!1:u==null||!Wc(Cr,$,u)}function R($,H,F=0){if($.length===0)return-1;const V=(F%$.length+$.length)%$.length,G=H.toLowerCase();for(let X=0;X<$.length;X+=1){const B=(V+X)%$.length,Z=$[B];if(!(!(Z!=null&&Z.toLowerCase().startsWith(G))||!M(B)))return B}return-1}const O=r.current;if(j.current.length>0&&A.key===" "&&(Vo(A),f==null||f(!0)),j.current.length>0&&j.current[0]!==" "&&R(O,j.current)===-1&&A.key!==" "&&(f==null||f(!1)),O==null||A.key.length!==1||A.ctrlKey||A.metaKey||A.altKey)return;b&&A.key!==" "&&(Vo(A),f==null||f(!0));const D=j.current==="";D&&(S.current=g??l??-1),O.every(($,H)=>{var F,V;return $&&M(H)?((F=$[0])==null?void 0:F.toLowerCase())!==((V=$[1])==null?void 0:V.toLowerCase()):!0})&&j.current===A.key&&(j.current="",S.current=C.current),j.current+=A.key,v.start(h,()=>{j.current="",S.current=C.current,f==null||f(!1)});const q=((D?g??l??-1:S.current)??0)+1,P=R(O,j.current,q);P!==-1?(c==null||c(P),C.current=P):A.key!==" "&&(j.current="",f==null||f(!1))}),E=et(A=>{const k=A.relatedTarget,M=p.select("domReferenceElement"),R=p.select("floatingElement");pt(M,k)||pt(R,k)||(v.clear(),j.current="",S.current=C.current,f==null||f(!1))});Ke(()=>{!b&&g!==null||(v.clear(),C.current=null,j.current!==""&&(j.current=""))},[b,g,v]);const T=x.useMemo(()=>({onKeyDown:N,onBlur:E}),[N,E]);return x.useMemo(()=>m?{reference:T,floating:T}:{},[m,T])}const nk=.1,g$=nk*nk,mn=.5;function dh(e,t,r,a,l,c){return a>=t!=c>=t&&e<=(l-r)*(t-a)/(c-a)+r}function fh(e,t,r,a,l,c,u,f,m,h){let g=!1;return dh(e,t,r,a,l,c)&&(g=!g),dh(e,t,l,c,u,f)&&(g=!g),dh(e,t,u,f,m,h)&&(g=!g),dh(e,t,m,h,r,a)&&(g=!g),g}function x$(e,t,r){return e>=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height}function mh(e,t,r,a,l,c){const u=Math.min(r,l),f=Math.max(r,l),m=Math.min(a,c),h=Math.max(a,c);return e>=u&&e<=f&&t>=m&&t<=h}function P1(e={}){const{blockPointerEvents:t=!1}=e,r=new Yr,a=({x:l,y:c,placement:u,elements:f,onClose:m,nodeId:h,tree:g})=>{const p=u==null?void 0:u.split("-")[0];let b=!1,v=null,j=null,S=typeof performance<"u"?performance.now():0;function C(E,T){const A=performance.now(),k=A-S;if(v===null||j===null||k===0)return v=E,j=T,S=A,!1;const M=E-v,R=T-j,O=M*M+R*R,D=k*k*g$;return v=E,j=T,S=A,O<D}function N(){r.clear(),m()}return function(T){r.clear();const A=f.domReference,k=f.floating;if(!A||!k||p==null||l==null||c==null)return;const{clientX:M,clientY:R}=T,O=As(T),D=T.type==="mouseleave",_=pt(k,O),L=pt(A,O);if(_&&(b=!0,!D))return;if(L&&(b=!1,!D)){b=!0;return}if(D&&Gt(T.relatedTarget)&&pt(k,T.relatedTarget))return;function q(){return!!(g&&Ai(g.nodesRef.current,h).length>0)}function P(){q()||N()}if(q())return;const $=A.getBoundingClientRect(),H=k.getBoundingClientRect(),F=l>H.right-H.width/2,V=c>H.bottom-H.height/2,G=H.width>$.width,X=H.height>$.height,B=(G?$:H).left,Z=(G?$:H).right,K=(X?$:H).top,se=(X?$:H).bottom;if(p==="top"&&c>=$.bottom-1||p==="bottom"&&c<=$.top+1||p==="left"&&l>=$.right-1||p==="right"&&l<=$.left+1){P();return}let I=!1;switch(p){case"top":I=mh(M,R,B,$.top+1,Z,H.bottom-1);break;case"bottom":I=mh(M,R,B,H.top+1,Z,$.bottom-1);break;case"left":I=mh(M,R,H.right-1,se,$.left+1,K);break;case"right":I=mh(M,R,$.right-1,se,H.left+1,K);break}if(I)return;if(b&&!x$(M,R,$)){P();return}if(!D&&C(M,R)){P();return}let U=!1;switch(p){case"top":{const Q=G?mn/2:mn*4,te=G||F?l+Q:l-Q,le=G?l-Q:F?l+Q:l-Q,J=c+mn+1,ne=F||G?H.bottom-mn:H.top,ce=F?G?H.bottom-mn:H.top:H.bottom-mn;U=fh(M,R,te,J,le,J,H.left,ne,H.right,ce);break}case"bottom":{const Q=G?mn/2:mn*4,te=G||F?l+Q:l-Q,le=G?l-Q:F?l+Q:l-Q,J=c-mn,ne=F||G?H.top+mn:H.bottom,ce=F?G?H.top+mn:H.bottom:H.top+mn;U=fh(M,R,te,J,le,J,H.left,ne,H.right,ce);break}case"left":{const Q=X?mn/2:mn*4,te=X||V?c+Q:c-Q,le=X?c-Q:V?c+Q:c-Q,J=l+mn+1,ne=V||X?H.right-mn:H.left,ce=V?X?H.right-mn:H.left:H.right-mn;U=fh(M,R,ne,H.top,ce,H.bottom,J,te,J,le);break}case"right":{const Q=X?mn/2:mn*4,te=X||V?c+Q:c-Q,le=X?c-Q:V?c+Q:c-Q,J=l-mn,ne=V||X?H.left+mn:H.right,ce=V?X?H.left+mn:H.right:H.left+mn;U=fh(M,R,J,te,J,le,ne,H.top,ce,H.bottom);break}}U?b||r.start(40,P):P()}};return a.__options={...e,blockPointerEvents:t},a}const g5=x.createContext(void 0),x5=x.createContext(void 0),b5=x.createContext(void 0);function Jo(){const e=x.useContext(g5);if(e===void 0)throw new Error(Jt(60));return e}function Dg(){const e=x.useContext(x5);if(e===void 0)throw new Error(Jt(101));return e}function y5(){const e=x.useContext(b5);if(e===void 0)throw new Error(Jt(61));return e}function b$(e,t,r=Object.is){const{length:a}=e;if(a!==t.length)return!1;for(let l=0;l<a;l+=1)if(!r(e[l],t[l]))return!1;return!0}const v5=(e,t)=>Object.is(e,t);function Bl(e,t,r){return e==null||t==null?Object.is(e,t):r(e,t)}function y$(e,t,r){return Array.isArray(e)&&Array.isArray(t)?!b$(e,t,(a,l)=>Bl(a,l,r)):e!==t}function Xy(e,t,r){return e?e.some(a=>a===void 0?!1:Bl(t,a,r)):!1}function Uh(e,t,r){return e?e.findIndex(a=>a===void 0?!1:Bl(a,t,r)):-1}function v$(e,t){if(t!==v5)return a=>Xy(e,a,t);const r=new Set(e);return r.delete(void 0),a=>r.has(a)&&(a!==0||e.some(l=>Object.is(a,l)))}function w5(e,t,r,a){const l=a&&Array.isArray(t)?e.findIndex(v$(t,r)):Uh(e,t,r);return l===-1?null:l}function w$(e,t,r,a,l,c){return Xy(a,t,l)?c!=null&&e>c&&Xy(a,r[c],l)?c:e:e===c?w5(r,a,l,!0):c}function j$(e,t,r){return e.filter(a=>!Bl(t,a,r))}function Wy(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function S$(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function j5(e){return S$(e==null?void 0:e[0])}function N$(e){return j5(e)?e.flatMap(t=>t.items):e}function C$(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(j5(t)){for(const r of t)for(const a of r.items)if(a&&a.value==null&&a.label!=null)return!0;return!1}for(const r of t)if(r&&r.value==null&&r.label!=null)return!0;return!1}function S5(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Wy(e)}function Hc(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Wy(e.value):Wy(e)}function N5(e,t,r){function a(){return S5(e,r)}if(r&&e!=null)return r(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??a();if(Array.isArray(t)){const c=N$(t);if(e==null||typeof e!="object"){const u=c.find(f=>f.value===e);return u&&u.label!=null?u.label:a()}if("value"in e){const u=c.find(f=>f&&f.value===e.value);if(u&&u.label!=null)return u.label}}return a()}function k$(e,t,r){return e.reduce((a,l,c)=>(c>0&&a.push(", "),a.push(s.jsx(x.Fragment,{children:N5(l,t,r)},c)),a),[])}const T$={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:r,itemToStringValue:a}=e;return t==null?!1:r&&Array.isArray(t)?t.length>0:Hc(t,a)!==""},hasNullItemLabel:(e,t)=>t?C$(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const r=e.isItemEqualToValue,a=e.value;return e.multiple?Array.isArray(a)&&a.some(l=>Bl(t,l,r)):Bl(t,a,r)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function E$(e){const t=x.useRef(""),r=x.useCallback(l=>{l.defaultPrevented||(t.current=l.pointerType,e(l,l.pointerType))},[e]);return{onClick:x.useCallback(l=>{if(l.detail===0){e(l,"keyboard");return}"pointerType"in l?e(l,l.pointerType):e(l,t.current),t.current=""},[e]),onPointerDown:r}}function C5(e,t){const r=et((c,u)=>{(typeof e=="function"?e():e)||t(u||(ug?"touch":""))}),{onClick:a,onPointerDown:l}=E$(r);return x.useMemo(()=>({onClick:a,onPointerDown:l}),[a,l])}function k5(e){const[t,r]=x.useState(null),a=C5(e,r);return bf(e,l=>{l&&!e&&r(null)}),x.useMemo(()=>({openMethod:t,triggerProps:a}),[t,a])}function Ed(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}const xo=1;function I1(e,t){return Math.max(0,e-t)}function kp(e,t){if(t<=0)return 0;const r=Ed(e,0,t),a=r,l=t-r,c=a<=xo,u=l<=xo;return c&&u?a<=l?0:t:c?0:u?t:r}function R$(e){const{id:t,value:r,defaultValue:a=null,onValueChange:l,open:c,defaultOpen:u=!1,onOpenChange:f,name:m,form:h,autoComplete:g,disabled:p=!1,readOnly:b=!1,required:v=!1,modal:j=!0,actionsRef:S,inputRef:C,onOpenChangeComplete:N,items:E,multiple:T=!1,itemToStringLabel:A,itemToStringValue:k,isItemEqualToValue:M=v5,highlightItemOnHover:R=!0,children:O}=e,{clearErrors:D}=lg(),{setDirty:_,setTouched:L,setFocused:q,validityData:P,setFilled:$,name:H,disabled:F,validation:V,validationMode:G}=gu(),X=hf({id:t}),B=F||p,Z=H??m,[K,se]=Xr({controlled:r,default:T?a??Cr:a,name:"Select",state:"value"}),[I,U]=Xr({controlled:c,default:u,name:"Select",state:"open"}),Q=x.useRef([]),te=x.useRef([]),le=x.useRef(null),J=x.useRef(null),ne=x.useRef(0),ce=x.useRef(null),oe=x.useRef([]),W=x.useRef(!1),de=x.useRef(null),Ee=x.useRef(null),Be=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Ne=x.useRef(!1),Ae=x.useRef(K),{mounted:ee,setMounted:re,transitionStatus:xe}=Va(I),{openMethod:he,triggerProps:$e}=k5(I),we=us(()=>new bu({id:X,labelId:void 0,modal:j,multiple:T,itemToStringLabel:A,itemToStringValue:k,isItemEqualToValue:M,value:K,open:I,mounted:ee,transitionStatus:xe,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:gn,triggerProps:gn,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:Tn,setOpen:Tn,handleScrollArrowVisibility:Tn,onOpenChangeComplete:Tn,listRef:Q,popupRef:le,scrollHandlerRef:J,scrollArrowsMountedCountRef:ne,valueRef:ce,valuesRef:oe,labelsRef:te,typingRef:W,selectionRef:Be,firstItemTextRef:de,selectedItemTextRef:Ee,alignItemWithTriggerActiveRef:Ne,initialValueRef:Ae},T$)).current,_e=we.useState("activeIndex"),Re=we.useState("selectedIndex"),Te=we.useState("triggerElement"),be=we.useState("positionerElement"),Ue=H8(he),Ze=he??Ue,ht=x.useMemo(()=>T?"":Hc(K,k),[T,K,k]),at=x.useMemo(()=>T&&Array.isArray(K)?K.map(dt=>Hc(dt,k)):Hc(K,k),[T,K,k]),Pe=Ln(Te),ct=et(()=>at);xg(Pe,X,K,ct,!B,m);const We=T?Array.isArray(K)&&K.length>0:K!=null&&ht!=="";Ke(()=>{$(We)},[We,$]),Ke(function(){const yt=w5(oe.current,K,M,T);yt===null&&(Ee.current=null),!I&&we.set("selectedIndex",yt)},[T,I,K,M,we]),bf(K,()=>{D(Z),_(y$(K,P.initialValue,M)),V.change(K)});const me=et((dt,yt)=>{f==null||f(dt,yt),!yt.isCanceled&&(U(dt),!dt&&(yt.reason===Mi||yt.reason===bg)&&(L(!0),q(!1),G==="onBlur"&&V.commit(K)))}),De=et(()=>{re(!1),we.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),N==null||N(!1)});lr({enabled:!S,open:I,ref:le,onComplete(){I||De()}}),x.useImperativeHandle(S,()=>({unmount:De}),[De]);const Oe=et((dt,yt)=>{l==null||l(dt,yt),!yt.isCanceled&&se(dt)}),nt=et(dt=>{const yt=I1(dt.scrollHeight,dt.clientHeight),ae=kp(dt.scrollTop,yt),Xe=ae>0,rt=ae<yt;we.set("scrollUpArrowVisible",Xe),we.set("scrollDownArrowVisible",rt)}),Ge=c$({open:I,onOpenChange:me,elements:{reference:Te,floating:be}}),Ye=S1(Ge,{enabled:!B,event:"mousedown"}),pe=wf(Ge),He=h5(Ge,{enabled:!B,listRef:Q,activeIndex:_e,selectedIndex:Re,disabledIndices:Cr,onNavigate(dt){dt===null&&!I||we.set("activeIndex",dt)},focusItemOnHover:R}),Ie=p5(Ge,{enabled:!B&&(I||!b&&!T),listRef:te,activeIndex:_e,selectedIndex:Re,disabledIndices:dt=>_A(Q.current[dt]),onMatch(dt){I?we.set("activeIndex",dt):Oe(oe.current[dt],bt(kr))},onTyping(dt){W.current=dt}}),ut=x.useMemo(()=>Xs(Ie.reference,He.reference,pe.reference,Ye.reference,$e),[Ye.reference,Ie.reference,He.reference,pe.reference,$e]),Qe=x.useMemo(()=>Xs(jf,Ie.floating,He.floating,pe.floating),[Ie.floating,He.floating,pe.floating]),kt=He.item??gn;we.useContextCallback("setValue",Oe),we.useContextCallback("setOpen",me),we.useContextCallback("handleScrollArrowVisibility",nt),we.useContextCallback("onOpenChangeComplete",N),U8(()=>{we.update({popupProps:Qe,triggerProps:ut})}),we.useSyncedValues({id:X,modal:j,multiple:T,value:K,open:I,mounted:ee,transitionStatus:xe,popupProps:Qe,triggerProps:ut,items:E,itemToStringLabel:A,itemToStringValue:k,isItemEqualToValue:M,openMethod:Ze});const At=x.useMemo(()=>({disabled:B,readOnly:b,required:v,multiple:T,highlightItemOnHover:R,itemProps:kt}),[B,b,v,T,R,kt]),jt=qr(C,V.inputRef),Ht=T?void 0:Z,St=x.useMemo(()=>!T||!Array.isArray(K)||!Z?null:K.map(dt=>{const yt=Hc(dt,k);return s.jsx("input",{type:"hidden",form:h,name:Z,value:yt,disabled:B},yt)}),[T,K,h,Z,k,B]);return s.jsxs(g5.Provider,{value:we,children:[s.jsx(x5.Provider,{value:At,children:s.jsx(b5.Provider,{value:Ge,children:O})}),s.jsx("input",{...V.getValidationProps(B,{onFocus(){var dt;(dt=we.state.triggerElement)==null||dt.focus({focusVisible:!0})},onChange(dt){if(dt.nativeEvent.defaultPrevented||B||b)return;const yt=dt.currentTarget.value,ae=bt(kr,dt.nativeEvent);function Xe(){if(T)return;const rt=yt.toLowerCase();let Wt=oe.current.findIndex(Pt=>Hc(Pt,k).toLowerCase()===rt||S5(Pt,A).toLowerCase()===rt);Wt===-1&&(Wt=oe.current.findIndex((Pt,Mt)=>{const Dn=te.current[Mt];return Dn!=null&&Dn.toLowerCase()===rt}));const Mn=oe.current[Wt];Mn!=null&&Oe(Mn,ae)}we.set("forceMount",!0),queueMicrotask(Xe)}}),id:X&&Ht==null?`${X}-hidden-input`:void 0,form:h,name:Ht,autoComplete:g,value:ht,disabled:B,required:v&&!(T&&We),readOnly:b,ref:jt,style:Z?g1:wg,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),St]})}function A$(e,t){return e??t}const hh=5;function T5(e,t){const r=O$(t);return e.clientX>=r.left-hh&&e.clientX<=r.right+hh&&e.clientY>=r.top-hh&&e.clientY<=r.bottom+hh}function O$(e){const t=e.getBoundingClientRect(),r=xn(e);if(o1)return t;const a=r.getComputedStyle(e,"::before"),l=r.getComputedStyle(e,"::after");if(!(a.content!=="none"||l.content!=="none"))return t;const u=parseFloat(a.width)||0,f=parseFloat(a.height)||0,m=parseFloat(l.width)||0,h=parseFloat(l.height)||0,g=Math.max(t.width,u,m),p=Math.max(t.height,f,h),b=g-t.width,v=p-t.height;return{left:t.left-b/2,right:t.right+b/2,top:t.top-v/2,bottom:t.bottom+v/2}}const M$="data-popup-side",D$=400,z$={...xp,...ig,popupSide:e=>e?{[M$]:e}:null,value:()=>null},P$=x.forwardRef(function(t,r){var ne;const{render:a,className:l,id:c,disabled:u=!1,nativeButton:f=!0,style:m,...h}=t,{setTouched:g,setFocused:p,validationMode:b,validation:v,state:j,disabled:S}=gu(),{labelId:C}=mf(),N=Jo(),{readOnly:E,required:T,disabled:A}=Dg(),k=S||A||u,M=N.useState("open"),R=N.useState("mounted"),O=N.useState("value"),D=N.useState("triggerProps"),_=N.useState("positionerElement"),L=N.useState("listElement"),q=N.useState("popupSide"),P=N.useState("id"),$=N.useState("labelId"),H=N.useState("hasSelectedValue"),F=R&&_?q:null,V=c??P,G=A$(C,$);hf({id:c});const X=Ln(_),B=x.useRef(null),{getButtonProps:Z,buttonRef:K}=ro({disabled:k,native:f}),se=N.useStateSetter("triggerElement"),I=es(),U=es(),Q=es();x.useEffect(()=>{if(M)return Q.start(D$,()=>{N.context.selectionRef.current.allowUnselectedMouseUp=!0,N.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{Q.clear()};N.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[M,N,U,Q]);const te=Xs(D,{id:V,role:"combobox","aria-expanded":M,"aria-haspopup":"listbox","aria-controls":M?(L==null?void 0:L.id)??((ne=yp(_))==null?void 0:ne.id):void 0,"aria-labelledby":G,"aria-readonly":E||void 0,"aria-required":T||void 0,tabIndex:k?-1:0,onFocus(ce){p(!0),M&&N.context.alignItemWithTriggerActiveRef.current&&N.context.setOpen(!1,bt(kr,ce.nativeEvent)),I.start(0,()=>{N.set("forceMount",!0)})},onBlur(ce){pt(_,ce.relatedTarget)||(g(!0),p(!1),b==="onBlur"&&v.commit(O))},onMouseDown(ce){if(M)return;const oe=Ft(ce.currentTarget);function W(de){if(!B.current)return;const Ee=de.target;pt(B.current,Ee)||pt(X.current,Ee)||T5(de,B.current)||N.context.setOpen(!1,bt(EA,de))}U.start(0,()=>{oe.addEventListener("mouseup",W,{once:!0})})}},h,Z),le=v.getValidationProps(k,te);le.role="combobox";const J={...j,open:M,disabled:k,value:O,readOnly:E,popupSide:F,placeholder:!H};return wt("button",t,{ref:[r,B,K,se],state:J,stateAttributesMapping:z$,props:le})}),I$={value:()=>null},_$=x.forwardRef(function(t,r){const{className:a,render:l,children:c,placeholder:u,style:f,...m}=t,h=Jo(),g=h.useState("value"),p=h.useState("items"),b=h.useState("itemToStringLabel"),v=h.useState("hasSelectedValue"),j=!v&&u!=null&&c==null,S=h.useState("hasNullItemLabel",j),C={value:g,placeholder:!v};let N=null;return typeof c=="function"?N=c(g):c!=null?N=c:j&&!S?N=u:Array.isArray(g)?N=k$(g,p,b):N=N5(g,p,b),wt("span",t,{state:C,ref:[r,h.context.valueRef],props:[{children:N},m],stateAttributesMapping:I$})}),L$=x.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,h={open:Jo().useState("open")};return wt("span",t,{state:h,ref:r,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:l1})}),B$=x.forwardRef(function(t,r){const a=Jo(),l=a.useState("mounted"),c=a.useState("forceMount");return l||c?s.jsx(jg,{ref:r,...t}):null});function Nf(e){return t1(19)?e:e?"true":void 0}const E5=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function $$(){return x.useContext(E5)}function Cf(e){const{children:t,elementsRef:r,labelsRef:a,onMapChange:l}=e,c=et(l),[,u]=x.useState(!1),f=us(U$).current,m=us(V$).current,h=x.useRef(0),g=x.useRef(!0),p=x.useRef(null),b=x.useRef(null),v=et(()=>{g.current||(g.current=!0,u(k=>!k))}),j=et((k,M)=>{m.set(k,M),v()}),S=et(k=>{m.delete(k),v()}),C=et(k=>{const M=new Map;return r.current.length=0,a&&(a.current.length=0),k.forEach(R=>{var O,D;M.set(R.element,{...R.registration.metadata??{},index:R.index}),r.current[R.index]=R.element,a&&(a.current[R.index]=R.registration.label!==void 0?R.registration.label:((D=(O=R.registration.textRef)==null?void 0:O.current)==null?void 0:D.textContent)??R.element.textContent)}),h.current=r.current.length,M});function N(k){var O;if((O=b.current)==null||O.disconnect(),b.current=null,typeof MutationObserver!="function"||k.length<2)return;const M=new MutationObserver(D=>{if(!G$(D))return;let _=null;for(const L of k)if(L.isConnected){if(_&&R5(_,L)>0){M.disconnect(),v();return}_=L}});b.current=M;const R=new Set;for(let D=1;D<k.length;D+=1){const _=F$(k[D-1],k[D]);_&&R.add(_)}R.forEach(D=>M.observe(D,{childList:!0}))}const E=et(()=>{const[k,M]=H$(m),R=C(k),O=p.current,D=!O||O.length!==k.length||k.some((_,L)=>{const q=O[L];return _.index!==q.index||_.element!==q.element||_.registration.index!==q.registration.index||_.registration.metadata!==q.registration.metadata});N(M),p.current=k,g.current=!1,D&&(f.forEach(_=>_(R)),c(R))});Ke(()=>(!g.current&&p.current&&C(p.current),()=>{r.current=[],a&&(a.current=[])}),[r,a,C]),Ke(()=>{g.current&&E()}),Ke(()=>()=>{var k;(k=b.current)==null||k.disconnect(),g.current=!0},[]);const T=et(k=>(f.add(k),()=>{f.delete(k)})),A=x.useMemo(()=>({register:j,unregister:S,subscribeMapChange:T,nextIndexRef:h}),[j,S,T,h]);return s.jsx(E5.Provider,{value:A,children:t})}function V$(){return new Map}function U$(){return new Set}function H$(e){const t=new Set,r=[],a=[];e.forEach((c,u)=>{if(!u.isConnected)return;const f=c.index,m={index:f??-1,element:u,registration:c};f===null?a.push(m):f>=0&&(t.add(f),r.push(m))});let l=0;return a.sort((c,u)=>R5(c.element,u.element)),a.forEach(c=>{for(;t.has(l);)l+=1;c.index=l,r.push(c),l+=1}),t.size>0&&r.sort((c,u)=>c.index-u.index),[r,a.map(c=>c.element)]}function F$(e,t){let r=e.parentElement;for(;r&&!r.contains(t);)r=r.parentElement;return r}function G$(e){for(const t of e)for(let r=0;r<t.removedNodes.length;r+=1)if(t.removedNodes[r].isConnected)return!0;return!1}function R5(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const q$=x.createContext(void 0);function zg(){const e=x.useContext(q$);return(e==null?void 0:e.direction)??"ltr"}const Y$=e=>({name:"arrow",options:e,async fn(t){var X,B;const{x:r,y:a,placement:l,rects:c,platform:u,elements:f,middlewareData:m}=t,{element:h,padding:g=0,offsetParent:p="real"}=Oi(e,t)||{};if(h==null)return{};const b=gA(g),v={x:r,y:a},j=f1(l),S=d1(j),C=await u.getDimensions(h),N=j==="y",E=N?"top":"left",T=N?"bottom":"right",A=N?"clientHeight":"clientWidth",k=c.reference[S]+c.reference[j]-v[j]-c.floating[S],M=v[j]-c.reference[j],R=p==="real"?await((X=u.getOffsetParent)==null?void 0:X.call(u,h)):f.floating;let O=f.floating[A]||c.floating[S];(!O||!await((B=u.isElement)==null?void 0:B.call(u,R)))&&(O=f.floating[A]||c.floating[S]);const D=k/2-M/2,_=O/2-C[S]/2-1,L=Math.min(b[E],_),q=Math.min(b[T],_),P=L,$=O-C[S]-q,H=O/2-C[S]/2+D,F=pA(P,H,$),V=!m.arrow&&Ra(l)!=null&&H!==F&&c.reference[S]/2-(H<P?L:q)-C[S]/2<0,G=V?H<P?H-P:H-$:0;return{[j]:v[j]+G,data:{[j]:F,centerOffset:H-F-G,...V&&{alignmentOffset:G}},reset:V}}}),K$=(e,t)=>{const{name:r,fn:a}=Y$(e);return{name:r,fn:a,options:[e,t]}},X$={name:"hide",async fn(e){const{width:t,height:r,x:a,y:l}=e.rects.reference,c=t===0&&r===0&&a===0&&l===0,u=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:u.top-r>=0||u.right-t>=0||u.bottom-r>=0||u.left-t>=0||c}}}},W$={sideX:"left",sideY:"top"},Q$="--available-width",Z$="--available-height",J$="--anchor-width",eV="--anchor-height",tV="--transform-origin",sk=Q$,rk=Z$;function A5(e,t,r){const a=e==="inline-start"||e==="inline-end";return{top:"top",right:a?r?"inline-start":"inline-end":"right",bottom:"bottom",left:a?r?"inline-end":"inline-start":"left"}[t]}function ok(e,t,r){const{rects:a,placement:l}=e;return{side:A5(t,Hr(l),r),align:Ra(l)||"center",anchor:{width:a.reference.width,height:a.reference.height},positioner:{width:a.floating.width,height:a.floating.height}}}function Pg(e){return nV(e,u$)}function nV(e,t){var pe,He;const{anchor:r,positionMethod:a="absolute",side:l="bottom",sideOffset:c=0,align:u="center",alignOffset:f=0,collisionBoundary:m,collisionPadding:h=5,sticky:g=!1,arrowPadding:p=5,disableAnchorTracking:b=!1,inline:v,keepMounted:j=!1,floatingRootContext:S,mounted:C,collisionAvoidance:N,shift:E,nodeId:T,adaptiveOrigin:A,lazyFlip:k=!1,externalTree:M}=e,[R,O]=x.useState(null);!C&&R!==null&&O(null);const D=N.side||"flip",_=N.align||"flip",L=N.fallbackAxisSide||"end",q=(E==null?void 0:E.crossAxis)??!1,P=E==null?void 0:E.rootBoundary,$=typeof r=="function"?r:void 0,H=et($),F=$?H:r,V=Ln(r),G=Ln(C),B=zg()==="rtl",Z=R||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":B?"left":"right","inline-start":B?"right":"left"}[l],K=u==="center"?Z:`${Z}-${u}`;let se=h;typeof se=="number"?se={top:se,right:se,bottom:se,left:se}:se&&(se={top:se.top||0,right:se.right||0,bottom:se.bottom||0,left:se.left||0});const I=1,U=l==="bottom"?I:0,Q=l==="top"?I:0,te=l==="right"?I:0,le=l==="left"?I:0,J={boundary:m==="clipping-ancestors"?"clippingAncestors":m,padding:se},ne=x.useRef(null),ce=Ln(c),oe=Ln(f),W=typeof c!="function"?c:0,de=typeof f!="function"?f:0,Ee=[];v&&Ee.push(v),Ee.push(e$(Ie=>{const ut=ok(Ie,l,B),Qe=typeof ce.current=="function"?ce.current(ut):ce.current,kt=typeof oe.current=="function"?oe.current(ut):oe.current;return{mainAxis:Qe,crossAxis:kt,alignmentAxis:kt}},[W,de,B,l]));const Be=_==="none"&&D!=="shift",Ne=!Be&&(g||q||D==="shift"),Ae=D==="none"?null:s$({...J,padding:{top:se.top+I+U,right:se.right+I+le,bottom:se.bottom+I+Q,left:se.left+I+te},mainAxis:!q&&D==="flip",crossAxis:_==="flip"?"alignment":!1,fallbackAxisSideDirection:L}),ee=Be?null:t$({...J,rootBoundary:P,mainAxis:_!=="none",crossAxis:Ne,limiter:g||q?void 0:n$(Ie=>{if(!ne.current)return{};const{width:ut,height:Qe}=ne.current.getBoundingClientRect(),kt=Vr(Hr(Ie.placement)),At=kt==="y"?ut:Qe,jt=kt==="y"?se.left+se.right:se.top+se.bottom;return{offset:At/2+jt/2}})},[J,g,q,P,se,_]);D==="shift"||_==="shift"||u==="center"?Ee.push(ee,Ae):Ee.push(Ae,ee),Ee.push(r$({...J,apply({elements:{floating:Ie},availableWidth:ut,availableHeight:Qe,rects:kt}){if(!G.current)return;const At=Ie.style;At.setProperty(sk,`${ut}px`),At.setProperty(rk,`${Qe}px`);const jt=xn(Ie).devicePixelRatio||1,{x:Ht,y:St,width:dt,height:yt}=kt.reference,ae=(Math.round((Ht+dt)*jt)-Math.round(Ht*jt))/jt,Xe=(Math.round((St+yt)*jt)-Math.round(St*jt))/jt;At.setProperty(J$,`${ae}px`),At.setProperty(eV,`${Xe}px`)}}),K$(Ie=>({element:ne.current||Ft(Ie.elements.floating).createElement("div"),padding:ne.current?p:0,offsetParent:"floating"}),[p]),{name:"transformOrigin",fn(Ie){var Mn,Pt,Mt,Dn,oo,ms;const{elements:{floating:ut},middlewareData:Qe,placement:kt,platform:At,rects:jt,y:Ht}=Ie,St=Hr(kt),dt=Ra(kt),yt=Vr(St)==="y",ae=ne.current,Xe=typeof c=="function"?c(ok(Ie,l,B)):c;let rt;if(!ae&&dt&&Math.abs(yt?((Mn=Qe.shift)==null?void 0:Mn.x)||0:((Pt=Qe.shift)==null?void 0:Pt.y)||0)<=1)rt=dt==="start"===(yt&&((Mt=At.isRTL)==null?void 0:Mt.call(At,ut))===!0)?"100%":"0%";else{const Er=yt?((Dn=Qe.arrow)==null?void 0:Dn.x)||0:((oo=Qe.arrow)==null?void 0:oo.y)||0,hs=yt?(ae==null?void 0:ae.clientWidth)||0:(ae==null?void 0:ae.clientHeight)||0;rt=`${Er+hs/2}px`}let Wt=St==="top"||St==="left"?`calc(100% + ${Xe}px)`:`${-Xe}px`;return Ne&&yt&&Math.abs(((ms=Qe.shift)==null?void 0:ms.y)||0)>Xe&&(Wt=`${jt.reference.y+jt.reference.height/2-Ht}px`),ut.style.setProperty(tV,yt?`${rt} ${Wt}`:`${Wt} ${rt}`),{}}},X$,A),Ke(()=>{!C&&S&&S.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[C,S]);const re=x.useMemo(()=>({ancestorScroll:!b,elementResize:!b&&typeof ResizeObserver<"u",layoutShift:!b&&typeof IntersectionObserver<"u"}),[b]),{refs:xe,elements:he,x:$e,y:we,middlewareData:_e,update:Re,placement:Te,context:be,isPositioned:Ue,floatingStyles:Ze}=t({rootContext:S,open:j?C:void 0,placement:K,middleware:Ee,strategy:a,whileElementsMounted:j?void 0:(...Ie)=>QC(...Ie,re),nodeId:T,externalTree:M}),{sideX:ht,sideY:at}=_e.adaptiveOrigin||W$,Pe=Ue?a:"fixed",ct=x.useMemo(()=>{let Ie;return Ue?A?Ie={position:Pe,[ht]:$e,[at]:we}:Ie={...Ze,position:Pe}:Ie={position:Pe,top:0,left:0},Ie[sk]="100vw",Ie[rk]="100vh",Ue||(Ie.opacity=0),Ie},[A,Pe,ht,$e,at,we,Ze,Ue]),We=x.useRef(null);Ke(()=>{if(!C)return;const Ie=V.current,ut=typeof Ie=="function"?Ie():Ie,kt=(ak(ut)?ut.current:ut)||null||null;kt!==We.current&&(xe.setPositionReference(kt),We.current=kt)},[C,xe,F,V]),x.useEffect(()=>{if(!C)return;const Ie=V.current;typeof Ie!="function"&&ak(Ie)&&Ie.current!==We.current&&(xe.setPositionReference(Ie.current),We.current=Ie.current)},[C,xe,F,V]),x.useEffect(()=>{if(j&&C&&he.reference&&he.floating)return QC(he.reference,he.floating,Re,re)},[j,C,he,Re,re]);const me=Hr(Te),De=A5(l,me,B),Oe=Ra(Te)||"center",nt=!!((pe=_e.hide)!=null&&pe.referenceHidden);Ke(()=>{k&&C&&Ue&&me!==Z&&O(me)},[k,C,Ue,me,Z]);const Ge=x.useMemo(()=>{var Ie,ut;return{position:"absolute",top:(Ie=_e.arrow)==null?void 0:Ie.y,left:(ut=_e.arrow)==null?void 0:ut.x}},[_e.arrow]),Ye=((He=_e.arrow)==null?void 0:He.centerOffset)!==0;return x.useMemo(()=>({positionerStyles:ct,arrowStyles:Ge,arrowRef:ne,arrowUncentered:Ye,side:De,align:Oe,physicalSide:me,anchorHidden:nt,refs:xe,context:be,isPositioned:Ue,update:Re}),[ct,Ge,ne,Ye,De,Oe,me,nt,xe,be,Ue,Re])}function ak(e){return e!=null&&"current"in e}const O5=x.createContext(void 0);function _1(){const e=x.useContext(O5);if(!e)throw new Error(Jt(59));return e}const Ig=x.forwardRef(function(t,r){const{cutout:a,...l}=t;let c;if(a){const u=a.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${u.left}px ${u.top}px,${u.left}px ${u.bottom}px,${u.right}px ${u.bottom}px,${u.right}px ${u.top}px,${u.left}px ${u.top}px)`}return s.jsx("div",{ref:r,role:"presentation","data-base-ui-inert":"",...l,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});function Tp(e,t){e&&Object.assign(e.style,t)}const M5={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"};function kf(e){return e==="starting"?fB:gn}function _g(e,t,{styles:r,transitionStatus:a,props:l,refs:c,hidden:u,inert:f=!1}){const m={...r};return f&&(m.pointerEvents="none"),wt("div",e,{state:t,ref:c,props:[{role:"presentation",hidden:u,style:m},kf(a),l],stateAttributesMapping:pf})}let ik={},lk={},ck="";function Lg(e,t){return ff(e)?e:t}function uk(e,t,r){return/hidden|clip/.test(e.getComputedStyle(Lg(t,r)).overflowY)}function sV(e){if(typeof document>"u")return!1;const t=Ft(e);return xn(t).innerWidth-t.documentElement.clientWidth>0}function rV(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const r=Ft(e),a=r.documentElement,l=r.body,c=Lg(a,l),u=c.style.overflowY,f=a.style.scrollbarGutter;a.style.scrollbarGutter="stable",c.style.overflowY="scroll";const m=c.offsetWidth;c.style.overflowY="hidden";const h=c.offsetWidth;return c.style.overflowY=u,a.style.scrollbarGutter=f,m===h}function oV(e){const t=Ft(e),r=t.documentElement,a=t.body,l=Lg(r,a),c={overflowY:l.style.overflowY,overflowX:l.style.overflowX};return Object.assign(l.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(l.style,c)}}function aV(e){var v;const t=Ft(e),r=t.documentElement,a=t.body,l=xn(r);let c=0,u=0,f=!1;const m=ir.create();if(Ba&&(((v=l.visualViewport)==null?void 0:v.scale)??1)!==1)return()=>{};function h(){const j=l.getComputedStyle(r),S=l.getComputedStyle(a),E=(j.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=r.scrollTop,u=r.scrollLeft,ik={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},ck=r.style.scrollBehavior,lk={position:a.style.position,height:a.style.height,width:a.style.width,boxSizing:a.style.boxSizing,overflowY:a.style.overflowY,overflowX:a.style.overflowX,scrollBehavior:a.style.scrollBehavior};const T=r.scrollHeight>r.clientHeight,A=r.scrollWidth>r.clientWidth,k=j.overflowY==="scroll"||S.overflowY==="scroll",M=j.overflowX==="scroll"||S.overflowX==="scroll",R=Math.max(0,l.innerWidth-a.clientWidth),O=Math.max(0,l.innerHeight-a.clientHeight),D=parseFloat(S.marginTop)+parseFloat(S.marginBottom),_=parseFloat(S.marginLeft)+parseFloat(S.marginRight),L=Lg(r,a);if(f=rV(e),f){r.style.scrollbarGutter=E,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(r.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(T||k)&&(r.style.overflowY="scroll"),(A||M)&&(r.style.overflowX="scroll"),Object.assign(a.style,{position:"relative",height:D||O?`calc(100dvh - ${D+O}px)`:"100dvh",width:_||R?`calc(100vw - ${_+R}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),a.scrollTop=c,a.scrollLeft=u,r.setAttribute("data-base-ui-scroll-locked",""),r.style.scrollBehavior="unset"}function g(){Object.assign(r.style,ik),Object.assign(a.style,lk),f||(r.scrollTop=c,r.scrollLeft=u,r.removeAttribute("data-base-ui-scroll-locked"),r.style.scrollBehavior=ck)}function p(){g(),m.request(h)}h();const b=Lt(l,"resize",p);return()=>{m.cancel(),g(),typeof l.removeEventListener=="function"&&b()}}class iV{constructor(){tn(this,"lockCount",0);tn(this,"restore",null);tn(this,"timeoutLock",Yr.create());tn(this,"timeoutUnlock",Yr.create());tn(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});tn(this,"unlock",()=>{var t;this.lockCount===0&&this.restore&&((t=this.restore)==null||t.call(this),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const r=Ft(t),a=r.documentElement,l=r.body,c=xn(a);if(uk(c,a,l)){const f=new c.MutationObserver(()=>{uk(c,a,l)||(f.disconnect(),this.restore=null,this.lock(t))}),m={attributes:!0};f.observe(a,m),f.observe(l,m),this.restore=()=>f.disconnect();return}const u=ug||!sV(t);this.restore=u?oV(t):aV(t)}}const lV=new iV;function D5(e=!0,t=null){Ke(()=>{if(e)return lV.acquire(t)},[e,t])}const cV=20;function L1(e,t,r,a){const[l,c]=x.useState(!1);Ke(()=>{if(!e||!t||r==null){c(!1);return}const u=Ft(r).documentElement.clientWidth,f=r.offsetWidth;c(u>0&&f>0&&f>=u-cV)},[e,t,r]),D5(e&&(!t||l),a)}const uV={position:"fixed"},dV=x.forwardRef(function(t,r){const{anchor:a,className:l,render:c,positionMethod:u,side:f,align:m,sideOffset:h,alignOffset:g,collisionBoundary:p="clipping-ancestors",collisionPadding:b,arrowPadding:v,sticky:j,disableAnchorTracking:S,alignItemWithTrigger:C=!0,collisionAvoidance:N=GA,style:E,...T}=t,A=Jo(),k=y5(),M=A.useState("open"),R=A.useState("mounted"),O=A.useState("modal"),D=A.useState("value"),_=A.useState("openMethod"),L=A.useState("positionerElement"),q=A.useState("triggerElement"),P=A.useState("isItemEqualToValue"),$=A.useState("transitionStatus"),H=x.useRef(null),F=x.useRef(null),[V,G]=x.useState(C),X=R&&V&&_!=="touch";!R&&V!==C&&G(C),x.useImperativeHandle(A.context.alignItemWithTriggerActiveRef,()=>X),L1((X||O)&&M,_==="touch",L,q);const B=Pg({anchor:a,floatingRootContext:k,positionMethod:u,mounted:R,side:f,sideOffset:h,align:m,alignOffset:g,arrowPadding:v,collisionBoundary:p,collisionPadding:b,sticky:j,disableAnchorTracking:S??X,collisionAvoidance:N,keepMounted:!0}),Z=X?"none":B.side,K=X?uV:B.positionerStyles,se={open:M,side:Z,align:B.align,anchorHidden:B.anchorHidden};Ke(()=>{A.set("popupSide",B.side)},[A,B.side]);const I=A.useStateSetter("positionerElement"),U=_g(t,se,{styles:K,transitionStatus:$,props:T,refs:[r,I],hidden:!R,inert:!M}),Q=x.useRef(0),te=et(J=>{if(A.context.valuesRef.current.length===0)return;const ne=Q.current;Q.current=J.size;const ce=bt(kr);if(ne!==0&&!A.state.multiple&&D!==null&&Uh(A.context.valuesRef.current,D,P)===-1){const W=A.context.initialValueRef.current,Ee=W!=null&&Uh(A.context.valuesRef.current,W,P)!==-1?W:null;A.context.setValue(Ee,ce),Ee===null&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null)}if(ne!==0&&A.state.multiple&&Array.isArray(D)){const oe=D.filter(W=>Uh(A.context.valuesRef.current,W,P)!==-1);oe.length!==D.length&&(A.context.setValue(oe,ce),oe.length===0&&(A.set("selectedIndex",null),A.context.selectedItemTextRef.current=null))}if(M&&X){A.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const oe={height:""};Tp(L,oe),Tp(A.context.popupRef.current,oe)}}),le=x.useMemo(()=>({...B,side:Z,alignItemWithTriggerActive:X,setControlledAlignItemWithTrigger:G,scrollUpArrowRef:H,scrollDownArrowRef:F}),[B,Z,X,G]);return s.jsx(Cf,{elementsRef:A.context.listRef,labelsRef:A.context.labelsRef,onMapChange:te,children:s.jsxs(O5.Provider,{value:le,children:[R&&O&&s.jsx(Ig,{inert:Nf(!M),cutout:q}),U]})})}),ph="base-ui-disable-scrollbar",Qy={className:ph,getElement(e){return s.jsx("style",{nonce:e,href:ph,precedence:"base-ui:low",children:`.${ph}{scrollbar-width:none}.${ph}::-webkit-scrollbar{display:none}`})}},fV=x.createContext(void 0);function Bg(e){return x.useContext(fV)}const Zy="ArrowUp",Jy="ArrowDown",ev="ArrowLeft",tv="ArrowRight",nv="Home",sv="End",Tf=new Set([Zy,Jy,ev,tv,nv,sv]),mV="Shift",hV=[mV,"Control","Alt","Meta"];function pV(e){return cn(e)&&e.tagName==="INPUT"}function dk(e){return!!(pV(e)&&e.selectionStart!=null||cn(e)&&e.tagName==="TEXTAREA")}function fk(e,t,r,a){if(!e||!t||!t.scrollTo)return;let l=e.scrollLeft,c=e.scrollTop;const u=e.clientWidth<e.scrollWidth,f=e.clientHeight<e.scrollHeight;if(u&&a!=="vertical"){const m=mk(e,t,"left"),h=gh(e),g=gh(t);r==="ltr"&&(m+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-h.scrollPaddingRight?l=m+t.offsetWidth+g.scrollMarginRight-e.clientWidth+h.scrollPaddingRight:m-g.scrollMarginLeft<e.scrollLeft+h.scrollPaddingLeft&&(l=m-g.scrollMarginLeft-h.scrollPaddingLeft)),r==="rtl"&&(m-g.scrollMarginLeft<e.scrollLeft+h.scrollPaddingLeft?l=m-g.scrollMarginLeft-h.scrollPaddingLeft:m+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-h.scrollPaddingRight&&(l=m+t.offsetWidth+g.scrollMarginRight-e.clientWidth+h.scrollPaddingRight))}if(f&&a!=="horizontal"){const m=mk(e,t,"top"),h=gh(e),g=gh(t);m-g.scrollMarginTop<e.scrollTop+h.scrollPaddingTop?c=m-g.scrollMarginTop-h.scrollPaddingTop:m+t.offsetHeight+g.scrollMarginBottom>e.scrollTop+e.clientHeight-h.scrollPaddingBottom&&(c=m+t.offsetHeight+g.scrollMarginBottom-e.clientHeight+h.scrollPaddingBottom)}e.scrollTo({left:l,top:c,behavior:"auto"})}function mk(e,t,r){const a=r==="left"?"offsetLeft":"offsetTop";let l=0;for(;t.offsetParent&&(l+=t[a],t.offsetParent!==e);)t=t.offsetParent;return l}function gh(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const gV=x.createContext(void 0),xV={disableStyleElements:!1};function bV(){return x.useContext(gV)??xV}const hk="--transform-origin",yV={...pf,...$a},vV=x.forwardRef(function(t,r){const{render:a,className:l,style:c,finalFocus:u,...f}=t,m=Jo(),{multiple:h,readOnly:g,highlightItemOnHover:p}=Dg(),b=y5(),{side:v,align:j,alignItemWithTriggerActive:S,isPositioned:C,setControlledAlignItemWithTrigger:N}=_1(),E=Bg()!=null,T=zg(),{nonce:A,disableStyleElements:k}=bV(),M=m.useState("id"),R=m.useState("open"),O=m.useState("openMethod"),D=m.useState("mounted"),_=m.useState("popupProps"),L=m.useState("transitionStatus"),q=m.useState("triggerElement"),P=m.useState("positionerElement"),$=m.useState("listElement"),H=x.useRef(!1),F=x.useRef(!1),V=x.useRef({}),G=iu(),X=et(se=>{if(!P||!m.context.popupRef.current||!F.current)return;const I=P.style.top==="0px",U=P.style.bottom==="0px";if(H.current||!S||!I&&!U){m.context.handleScrollArrowVisibility(se);return}const Q=gk(P),te=Rd(P.getBoundingClientRect().height,"y",Q),le=Ft(P),J=xn(P),ne=J.getComputedStyle(P),ce=parseFloat(ne.marginTop),oe=parseFloat(ne.marginBottom),W=pk(J.getComputedStyle(m.context.popupRef.current)),de=Math.min(le.documentElement.clientHeight-ce-oe,W),Ee=se.scrollTop,Be=xh(se);let Ne=null;const Ae=he=>{P.style.height=`${he}px`},ee=I?Be-Ee:Ee,re=Math.min(te+ee,de);if(ee<=xo){const he=Ed(ee,0,de-te);he>0&&Ae(te+he),se.scrollTop=I?Be:0,de-(te+he)<=xo&&(H.current=!0),m.context.handleScrollArrowVisibility(se);return}if(de-re>xo)Ne=I?1/0:0;else if(U&&Ee<Be){const he=te+ee-de;Ne=Ee-(ee-he)}const xe=Math.ceil(re);if(xe!==0&&Ae(xe),Ne!=null){const he=Ed(Ne,0,xh(se));Math.abs(se.scrollTop-he)>xo&&(se.scrollTop=he)}xe>=de-xo&&(H.current=!0),m.context.handleScrollArrowVisibility(se)});x.useImperativeHandle(m.context.scrollHandlerRef,()=>X,[X]),lr({open:R,ref:m.context.popupRef,onComplete(){R&&m.context.onOpenChangeComplete(!0)}});const B={open:R,transitionStatus:L,side:v,align:j};Ke(()=>{!P||!m.context.popupRef.current||Object.keys(V.current).length||(V.current={top:P.style.top||"0",left:P.style.left||"0",right:P.style.right,height:P.style.height,bottom:P.style.bottom,minHeight:P.style.minHeight,maxHeight:P.style.maxHeight,marginTop:P.style.marginTop,marginBottom:P.style.marginBottom})},[m,P]),Ke(()=>{R||S||(F.current=!1,H.current=!1,Tp(P,V.current))},[R,S,P]),Ke(()=>{var U,Q;const se=m.context.popupRef.current;if(!R||!q||!P||!se||S&&!C||m.state.transitionStatus==="ending")return;if(F.current=!0,se.style.removeProperty(hk),!S){G.request(()=>m.context.handleScrollArrowVisibility($||se));return}const I=wV(se);try{let te=m.context.selectedItemTextRef.current;te!=null&&te.isConnected||(te=!m.select("hasSelectedValue")&&((U=m.context.firstItemTextRef.current)!=null&&U.isConnected)?m.context.firstItemTextRef.current:null);const le=m.context.valueRef.current,J=xn(P),ne=J.getComputedStyle(P),ce=J.getComputedStyle(se),oe=Ft(q),W=gk(q),de=bh(q.getBoundingClientRect(),W),Ee=bh(P.getBoundingClientRect(),W),Be=de.height,Ne=$||se,Ae=Ne.scrollHeight,ee=parseFloat(ce.borderBottomWidth),re=parseFloat(ne.marginTop)||10,xe=parseFloat(ne.marginBottom)||10,he=parseFloat(ne.minHeight)||100,$e=pk(ce),we=5,_e=5,Re=20,Te=oe.documentElement.clientHeight-re-xe,be=oe.documentElement.clientWidth,Ue=Te-de.bottom+Be;let Ze,ht=T==="rtl"?de.right-Ee.width:de.left,at=0;if(te&&le){const He=bh(le.getBoundingClientRect(),W);Ze=bh(te.getBoundingClientRect(),W),ht=Ee.left+(T==="rtl"?He.right-Ze.right:He.left-Ze.left);const Ie=He.top-de.top+He.height/2;at=Ze.top-Ee.top+Ze.height/2-Ie}const Pe=Ue+at+xe+ee;let ct=Math.min(Te,Pe);const We=Te-re-xe,me=Pe-ct,De=be-_e;P.style.left=`${Ed(ht,we,De-Ee.width)}px`,P.style.height=`${ct}px`,P.style.maxHeight="none",P.style.marginTop=`${re}px`,P.style.marginBottom=`${xe}px`,se.style.height="100%";const Oe=xh(Ne),nt=me>=Oe-xo;nt&&(ct=Math.min(Te,Ee.height)-(me-Oe));const Ge=de.top<Re||de.bottom>Te-Re||Math.ceil(ct)+xo<Math.min(Ae,he),Ye=(((Q=J.visualViewport)==null?void 0:Q.scale)??1)!==1&&Ba;if(Ge||Ye){Tp(P,V.current),N(!1);return}const pe=Math.max(he,ct);if(nt){const He=Math.max(0,Te-Pe);P.style.top=Ee.height>=We?"0":`${He}px`,P.style.height=`${ct}px`,Ne.scrollTop=xh(Ne)}else P.style.bottom="0",Ne.scrollTop=me;if(Ze){const He=Ee.top,Ie=Ee.height,ut=Ze.top+Ze.height/2,Qe=Ed(Ie>0?(ut-He)/Ie*100:50,0,100);se.style.setProperty(hk,`50% ${Qe}%`)}(pe===Te||ct>=$e)&&(H.current=!0),m.context.handleScrollArrowVisibility(Ne),p&&m.state.selectedIndex===null&&m.state.activeIndex===null&&m.context.listRef.current[0]!=null&&m.set("activeIndex",0)}finally{I()}},[m,R,P,q,S,N,G,$,p,T,C]),x.useEffect(()=>{if(!S||!P||!R)return;const se=xn(P);function I(U){m.context.setOpen(!1,bt(e8,U))}return Lt(se,"resize",I)},[m,S,P,R]);const Z={...$?{role:"presentation"}:{role:"listbox","aria-multiselectable":h||void 0,"aria-readonly":g||void 0,id:`${M}-list`},onKeyDown(se){E&&Tf.has(se.key)&&se.stopPropagation()},onScroll(se){$||X(se.currentTarget)},...S&&{style:$?{height:"100%"}:M5},className:!$&&S?Qy.className:void 0},K=wt("div",t,{ref:[r,m.context.popupRef],state:B,stateAttributesMapping:yV,props:[_,Z,kf(L),f]});return s.jsxs(x.Fragment,{children:[!k&&Qy.getElement(A),s.jsx(Sg,{context:b,modal:!1,disabled:!D,openInteractionType:O,returnFocus:u,restoreFocus:!0,children:K})]})});function pk(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function xh(e){return I1(e.scrollHeight,e.clientHeight)}function gk(e){return o5.getScale(e)}function Rd(e,t,r){return e/r[t]}function bh(e,t){return qd({x:Rd(e.x,"x",t),y:Rd(e.y,"y",t),width:Rd(e.width,"x",t),height:Rd(e.height,"y",t)})}const xk=[["transform","none"],["scale","1"],["translate","0 0"]];function wV(e){const{style:t}=e,r={};for(const[a,l]of xk)r[a]=t.getPropertyValue(a),t.setProperty(a,l,"important");return()=>{for(const[a]of xk){const l=r[a];l?t.setProperty(a,l):t.removeProperty(a)}}}const jV=x.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,f=Jo(),{multiple:m,readOnly:h}=Dg(),{alignItemWithTriggerActive:g}=_1(),p=f.useState("hasScrollArrows"),b=f.useState("openMethod"),j={id:`${f.useState("id")}-list`,role:"listbox","aria-multiselectable":m||void 0,"aria-readonly":h||void 0,onScroll(C){var N,E;(E=(N=f.context.scrollHandlerRef).current)==null||E.call(N,C.currentTarget)},...g&&{style:M5},className:p&&b!=="touch"?Qy.className:void 0},S=f.useStateSetter("listElement");return wt("div",t,{ref:[r,S],props:[j,u]})});function Kl(e={}){const{guess:t,label:r,metadata:a,textRef:l,index:c}=e,{register:u,unregister:f,subscribeMapChange:m,nextIndexRef:h}=$$(),g=x.useRef(-1),[p,b]=x.useState(c==null&&t?()=>{if(g.current===-1){const C=h.current;h.current+=1,g.current=C}return g.current}:-1),v=c??p,j=x.useRef(null),S=x.useCallback(C=>{const N=j.current;N&&f(N),j.current=C,C&&u(C,{metadata:a??null,index:c??null,label:r,textRef:l})},[c,u,f,a,r,l]);return Ke(()=>{if(c==null)return m(C=>{var E;const N=j.current?(E=C.get(j.current))==null?void 0:E.index:null;N!=null&&b(N)})},[c,m]),{ref:S,index:v}}const z5=x.createContext(void 0);function B1(){const e=x.useContext(z5);if(!e)throw new Error(Jt(57));return e}const SV=x.memo(x.forwardRef(function(t,r){const{render:a,className:l,style:c,value:u=null,label:f,disabled:m=!1,nativeButton:h=!1,...g}=t,p=x.useRef(null),b=Kl({guess:!0,label:f,textRef:p}),v=Jo(),{itemProps:j,multiple:S,disabled:C,readOnly:N}=Dg(),E=C||m,T=v.useState("isActive",b.index),A=v.useState("open"),k=v.useState("isSelected",u),M=v.useState("isSelectedByFocus",b.index),R=v.useState("isItemEqualToValue"),O=b.index,D=x.useRef(null);Ke(()=>{const B=v.context.valuesRef.current;return B[O]=u,()=>{delete B[O]}},[O,u,v]),Ke(()=>{const B=v.state.value,Z=v.state.selectedIndex;let K=Z,se;S&&Array.isArray(B)?(K=w$(O,u,v.context.valuesRef.current,B,R,Z),se=K===O,O===Z&&!se&&(v.context.selectedItemTextRef.current=null)):(se=B!==void 0&&Bl(u,B,R),se&&(K=O)),v.set("selectedIndex",K),se&&p.current&&(v.context.selectedItemTextRef.current=p.current)},[O,S,R,v,u]);const _=x.useRef("mouse"),L=x.useRef(!1),{getButtonProps:q,buttonRef:P}=ro({disabled:E,focusableWhenDisabled:!0,native:h,composite:!0}),$={disabled:E,selected:k,highlighted:T};function H(B){if(C||N)return;const Z=v.state.value;if(S){const K=Array.isArray(Z)?Z:[],se=k?j$(K,u,R):[...K,u];v.context.setValue(se,bt(Al,B))}else v.context.setValue(u,bt(Al,B)),v.context.setOpen(!1,bt(Al,B))}function F(){v.context.selectionRef.current.dragY=0}const V={role:"option","aria-selected":k,tabIndex:A&&T?0:-1,onKeyDown(B){v.set("activeIndex",O),B.key===" "&&v.context.typingRef.current&&B.preventDefault()},onClick(B){const Z=_.current!=="touch",K=B.nativeEvent.pointerType,se=Z&&pg(B.nativeEvent)&&(K!==void 0||T),I=Z&&!se&&!L.current;L.current=!1,!(E||I)&&H(B.nativeEvent)},onPointerEnter(B){_.current=B.pointerType},onPointerMove(B){if(B.pointerType==="mouse"&&B.buttons===1){const Z=v.context.selectionRef.current;Z.dragY+=B.movementY,Z.dragY**2>=64&&(Z.allowUnselectedMouseUp=!0)}},onPointerDown(B){_.current=B.pointerType,L.current=!0,F()},onMouseUp(){var K;if(F(),E||_.current==="touch"||L.current)return;const B=!v.context.selectionRef.current.allowSelectedMouseUp&&k,Z=!v.context.selectionRef.current.allowUnselectedMouseUp&&!k;B||Z||(L.current=!0,(K=D.current)==null||K.click(),L.current=!1)}},G=wt("div",t,{ref:[P,r,b.ref,D],state:$,props:[j,V,g,q]}),X=x.useMemo(()=>({selected:k,index:O,textRef:p,selectedByFocus:M}),[k,O,p,M]);return s.jsx(z5.Provider,{value:X,children:G})})),NV=x.forwardRef(function(t,r){const{selected:a}=B1();return t.keepMounted||a?s.jsx(CV,{...t,ref:r}):null}),CV=x.memo(x.forwardRef((e,t)=>{const{render:r,className:a,style:l,keepMounted:c,...u}=e,{selected:f}=B1(),m=x.useRef(null),{transitionStatus:h,setMounted:g}=Va(f),b=wt("span",e,{ref:[t,m],state:{selected:f,transitionStatus:h},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:$a});return lr({batch:!0,enabled:!f,open:f,ref:m,onComplete(){f||g(!1)}}),b})),kV=x.memo(x.forwardRef(function(t,r){const{index:a,textRef:l,selectedByFocus:c}=B1(),u=Jo(),{render:f,className:m,style:h,...g}=t,p=x.useCallback(v=>{v&&(a===0&&(u.context.firstItemTextRef.current=v),c&&(u.context.selectedItemTextRef.current=v))},[u,a,c]);return wt("div",t,{ref:[p,r,l],props:g})})),P5=x.forwardRef(function(t,r){const{render:a,className:l,style:c,direction:u,keepMounted:f,...m}=t,h=u==="up",g=Jo(),{side:p,scrollDownArrowRef:b,scrollUpArrowRef:v}=_1(),j=h?"scrollUpArrowVisible":"scrollDownArrowVisible",S=g.useState(j),C=g.useState("openMethod"),N=S&&C!=="touch",E=es(),T=h?v:b,{mounted:A,transitionStatus:k,setMounted:M}=Va(N);Ke(()=>(g.context.scrollArrowsMountedCountRef.current+=1,g.set("hasScrollArrows",!0),()=>{g.context.scrollArrowsMountedCountRef.current=Math.max(0,g.context.scrollArrowsMountedCountRef.current-1),g.context.scrollArrowsMountedCountRef.current===0&&g.set("hasScrollArrows",!1)}),[g]),lr({open:N,ref:T,onComplete(){N||M(!1)}});const D=wt("div",t,{ref:[r,T],state:{direction:u,visible:N,side:p,transitionStatus:k},props:[{"aria-hidden":!0,children:h?"▲":"▼",style:{position:"absolute"},onMouseMove(L){if(L.movementX===0&&L.movementY===0||E.isStarted())return;g.set("activeIndex",null);function q(){var G;const P=g.state.listElement??g.context.popupRef.current;if(!P)return;g.set("activeIndex",null),g.context.handleScrollArrowVisibility(P);const $=I1(P.scrollHeight,P.clientHeight),H=kp(P.scrollTop,$),F=H===(h?0:$),V=g.context.listRef.current;if(H!==P.scrollTop&&(P.scrollTop=H),F){E.clear();return}if(V.length>0){const X=((G=T.current)==null?void 0:G.offsetHeight)||0;P.scrollTop=TV(V,h,H,P.clientHeight,X,$)}E.start(40,q)}E.start(40,q)},onMouseLeave(){E.clear()}},m],stateAttributesMapping:$a});return A||f?D:null});function TV(e,t,r,a,l,c){if(t){let g=0;const p=r+l-xo;for(let j=0;j<e.length;j+=1){const S=e[j];if(S&&S.offsetTop>=p){g=j;break}}const b=Math.max(0,g-1),v=e[b];return b<g&&v?kp(v.offsetTop-l,c):0}let u=e.length-1;const f=r+a-l+xo;for(let g=0;g<e.length;g+=1){const p=e[g];if(p&&p.offsetTop+p.offsetHeight>f){u=Math.max(0,g-1);break}}const m=Math.min(e.length-1,u+1),h=e[m];return m>u&&h?kp(h.offsetTop+h.offsetHeight-a+l,c):c}const EV=x.forwardRef(function(t,r){return s.jsx(P5,{...t,ref:r,direction:"down"})}),RV=x.forwardRef(function(t,r){return s.jsx(P5,{...t,ref:r,direction:"up"})}),AV=x.createContext(void 0),OV=x.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,[f,m]=x.useState(),h=x.useMemo(()=>({labelId:f,setLabelId:m}),[f,m]),g=wt("div",t,{ref:r,props:[{role:"group","aria-labelledby":f},u]});return s.jsx(AV.Provider,{value:h,children:g})}),Hh=R$;function bk({className:e,...t}){return s.jsx(OV,{"data-slot":"select-group",className:Le("scroll-my-1 p-1",e),...t})}function Fh({className:e,...t}){return s.jsx(_$,{"data-slot":"select-value",className:Le("flex flex-1 text-left",e),...t})}function Gh({className:e,size:t="default",children:r,...a}){return s.jsxs(P$,{"data-slot":"select-trigger","data-size":t,className:Le("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...a,children:[r,s.jsx(L$,{render:s.jsx(Xo,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function qh({className:e,children:t,side:r="bottom",sideOffset:a=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:u=!0,...f}){return s.jsx(B$,{children:s.jsx(dV,{side:r,sideOffset:a,align:l,alignOffset:c,alignItemWithTrigger:u,className:"isolate z-50",children:s.jsxs(vV,{"data-slot":"select-content","data-align-trigger":u,className:Le("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...f,children:[s.jsx(MV,{}),s.jsx(jV,{children:t}),s.jsx(DV,{})]})})})}function Ad({className:e,children:t,...r}){return s.jsxs(SV,{"data-slot":"select-item",className:Le("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[s.jsx(kV,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),s.jsx(NV,{render:s.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:s.jsx(Fn,{className:"pointer-events-none"})})]})}function MV({className:e,...t}){return s.jsx(RV,{"data-slot":"select-scroll-up-button",className:Le("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:s.jsx(RR,{})})}function DV({className:e,...t}){return s.jsx(EV,{"data-slot":"select-scroll-down-button",className:Le("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:s.jsx(Xo,{})})}function hn({children:e,value:t,onChange:r,className:a,disabled:l,...c}){const u=m=>x.Children.toArray(m).join(""),f=x.Children.toArray(e).map(m=>({value:m.props.value??u(m.props.children),label:u(m.props.children),disabled:m.props.disabled}));return s.jsxs(Hh,{items:f,value:t,disabled:l,onValueChange:m=>r==null?void 0:r({target:{value:m}}),children:[s.jsx(Gh,{className:a,...c,children:s.jsx(Fh,{})}),s.jsx(qh,{align:"start",alignItemWithTrigger:!1,children:f.map(m=>s.jsx(Ad,{className:"text-xs",value:m.value,disabled:m.disabled,children:m.label},m.value))})]})}const I5=x.createContext(void 0);function Xl(e){const t=x.useContext(I5);if(!e&&t===void 0)throw new Error(Jt(27));return t}const $1=x.forwardRef(function(t,r){const{render:a,className:l,style:c,forceRender:u=!1,...f}=t,m=Xl(),h=m.useState("open"),g=m.useState("nested"),p=m.useState("mounted"),b=m.useState("transitionStatus");return wt("div",t,{state:{open:h,transitionStatus:b},ref:[m.context.backdropRef,r],stateAttributesMapping:mg,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:u||!g})}),$g=x.forwardRef(function(t,r){const{render:a,className:l,style:c,disabled:u=!1,nativeButton:f=!0,...m}=t,h=Xl(),g=h.useState("open"),{getButtonProps:p,buttonRef:b}=ro({disabled:u,native:f}),v={disabled:u};function j(S){g&&h.setOpen(!1,bt(TA,S.nativeEvent))}return wt("button",t,{state:v,ref:[r,b],props:[{onClick:j},m,p]})}),V1=x.forwardRef(function(t,r){const{render:a,className:l,style:c,id:u,...f}=t,m=Xl(),h=ds(u);return m.useSyncedValueWithCleanup("descriptionElementId",h),wt("p",t,{ref:r,props:[{id:h},f]})}),_5=x.createContext(void 0);function zV(){const e=x.useContext(_5);if(e===void 0)throw new Error(Jt(26));return e}const PV="--nested-dialogs",IV="data-nested-dialog-open",_V={...pf,...$a,nestedDialogOpen(e){return e?{[IV]:""}:null}},U1=x.forwardRef(function(t,r){const{render:a,className:l,style:c,finalFocus:u,initialFocus:f,...m}=t,h=Xl(),g=h.useState("descriptionElementId"),p=h.useState("disablePointerDismissal"),b=h.useState("floatingRootContext"),v=h.useState("popupProps"),j=h.useState("modal"),S=h.useState("mounted"),C=h.useState("nested"),N=h.useState("nestedOpenDialogCount"),E=h.useState("open"),T=h.useState("openMethod"),A=h.useState("titleElementId"),k=h.useState("transitionStatus"),M=h.useState("role"),R=b.useState("floatingId");zV(),lr({open:E,ref:h.context.popupRef,onComplete(){var P,$;E&&(($=(P=h.context).onOpenChangeComplete)==null||$.call(P,!0))}});const O=f===void 0?c5(h.context.popupRef):f,D=N>0,_=h.useStateSetter("popupElement"),q=wt("div",t,{state:{open:E,nested:C,transitionStatus:k,nestedDialogOpen:D},props:[v,{id:R,"aria-labelledby":A,"aria-describedby":g,role:M,...jf,hidden:!S,onKeyDown(P){Tf.has(P.key)&&P.stopPropagation()},style:{[PV]:N}},m],ref:[r,h.context.popupRef,_],stateAttributesMapping:_V});return s.jsx(Sg,{context:b,openInteractionType:T,disabled:!S,closeOnFocusOut:!p,initialFocus:O,returnFocus:u,modal:j!==!1,restoreFocus:"popup",children:q})}),H1=x.forwardRef(function(t,r){const{keepMounted:a=!1,...l}=t,c=Xl(),u=c.useState("mounted"),f=c.useState("modal"),m=c.useState("open");return u||a?s.jsx(_5.Provider,{value:a,children:s.jsxs(jg,{ref:r,...l,children:[u&&f===!0&&s.jsx(Ig,{ref:c.context.internalBackdropRef,inert:Nf(!m)}),t.children]})}):null});function LV({store:e,parentContext:t,isDrawer:r}){const a=e.useState("open"),l=e.useState("disablePointerDismissal"),c=e.useState("modal"),u=e.useState("popupElement"),f=e.useState("floatingRootContext"),[m,h]=x.useState(0),[g,p]=x.useState(0),b=m===0,v=wf(f,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:c==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(j){if(!e.context.outsidePressEnabledRef.current||"button"in j&&j.button!==0)return!1;if("touches"in j){if(j.type==="touchend"){if(j.changedTouches.length!==1||j.touches.length!==0)return!1}else if(j.touches.length!==1)return!1}const S=As(j);if(b&&!l){if(c){const C=e.context.internalBackdropRef.current,N=e.context.backdropRef.current;return C||N?C===S||N===S||pt(S,u)&&!(S!=null&&S.hasAttribute("data-base-ui-portal")):!0}return!0}return!1},escapeKey:b});return D5(a&&c===!0,u),e.useContextCallback("onNestedDialogOpen",(j,S)=>{h(j),p(S)}),Ke(()=>(t!=null&&t.onNestedDialogOpen&&(a?t.onNestedDialogOpen(m+1,g+(r?1:0)):t.onNestedDialogOpen(0,0)),()=>{t!=null&&t.onNestedDialogOpen&&a&&t.onNestedDialogOpen(0,0)}),[r,a,m,g,t]),Rg(e,{activeTriggerProps:v.reference,inactiveTriggerProps:v.trigger,popupProps:v.floating,nestedOpenDialogCount:m,nestedOpenDrawerCount:g}),null}const BV={...Og,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class $V extends bu{constructor(r,a,l){const c=new Sf,u=VV(r,c,a,l);super(u,UV(c),BV);tn(this,"setOpen",(r,a)=>{var l,c;a.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!r&&a.trigger==null&&this.state.activeTriggerId!=null&&(a.trigger=this.state.activeTriggerElement??void 0),(c=(l=this.context).onOpenChange)==null||c.call(l,r,a),!a.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(r,a),this.update(kg(this.state,r,a.trigger)))})}}function VV(e,t,r,a=!1){return{...Ag(t,r,a),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function UV(e){return{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function L5(e,t){const{children:r,open:a,defaultOpen:l=!1,onOpenChange:c,onOpenChangeComplete:u,disablePointerDismissal:f=!1,modal:m=!0,actionsRef:h,handle:g,triggerId:p,defaultTriggerId:b=null}=t,v=e==="drawer",j=e==="alert-dialog",S=j?!0:m,C=j||f,N=j?"alertdialog":"dialog",E=Xl(!0),T=E!=null,A={modal:S,disablePointerDismissal:C,nested:T,role:N},k=k1((L,q)=>new $V({open:l,openProp:a,activeTriggerId:b,triggerIdProp:p,...A},L,q),!0);k.useControlledProp("openProp",a),k.useControlledProp("triggerIdProp",p),k.useSyncedValues(A),k.useContextCallback("onOpenChange",c),k.useContextCallback("onOpenChangeComplete",u);const M=k.useState("open"),R=k.useState("mounted"),O=k.useState("payload");u5(k,M),Tg(k);const{forceUnmount:D}=Eg(M,k);x.useImperativeHandle(h,()=>({unmount:D,close:()=>k.setOpen(!1,bt(yg))}),[D,k]);const _=M||R;return s.jsxs(I5.Provider,{value:k,children:[g&&s.jsx(Cg,{handle:g,store:k}),_&&s.jsx(LV,{store:k,parentContext:E==null?void 0:E.context,isDrawer:v}),typeof r=="function"?r({payload:O}):r]})}const B5=vf(function(t){return L5("dialog",t)}),F1=x.forwardRef(function(t,r){const{render:a,className:l,style:c,id:u,...f}=t,m=Xl(),h=ds(u);return m.useSyncedValueWithCleanup("titleElementId",h),wt("h2",t,{ref:r,props:[{id:h},f]})});function yn({...e}){return s.jsx(B5,{"data-slot":"dialog",...e})}function HV({...e}){return s.jsx(H1,{"data-slot":"dialog-portal",...e})}function FV({className:e,...t}){return s.jsx($1,{"data-slot":"dialog-overlay",className:Le("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function vn({className:e,children:t,showCloseButton:r=!0,...a}){return s.jsxs(HV,{children:[s.jsx(FV,{}),s.jsxs(U1,{"data-slot":"dialog-content",className:Le("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...a,children:[t,r&&s.jsxs($g,{"data-slot":"dialog-close",render:s.jsx(ue,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[s.jsx(On,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Nn({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:Le("flex flex-col gap-2",e),...t})}function No({className:e,showCloseButton:t=!1,children:r,...a}){return s.jsxs("div",{"data-slot":"dialog-footer",className:Le("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...a,children:[r,t&&s.jsx($g,{render:s.jsx(ue,{variant:"outline"}),children:"Close"})]})}function wn({className:e,...t}){return s.jsx(F1,{"data-slot":"dialog-title",className:Le("font-heading text-base leading-none font-medium",e),...t})}function Hn({className:e,...t}){return s.jsx(V1,{"data-slot":"dialog-description",className:Le("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const $5=x.createContext(void 0);function G1(){const e=x.useContext($5);if(e===void 0)throw new Error(Jt(64));return e}const GV="data-activation-direction",Vg={tabActivationDirection:e=>({[GV]:e})},qV=x.forwardRef(function(t,r){const{className:a,defaultValue:l=0,onValueChange:c,orientation:u="horizontal",render:f,value:m,style:h,...g}=t,p=t.defaultValue!==void 0,b=x.useRef([]),[v,j]=x.useState(()=>new Map),[S,C]=Xr({controlled:m,default:l,name:"Tabs",state:"value"}),N=m!==void 0,[E,T]=x.useState(()=>new Map),A=x.useRef(void 0),k=x.useCallback(le=>rv(E,le),[E]),[M,R]=x.useState(()=>({previousValue:S,tabActivationDirection:"none"})),{previousValue:O,tabActivationDirection:D}=M;let _=D,L=!1;O!==S&&(_=yk(O,S,u,E),L=O!=null&&S!=null&&k(S)==null);const q=L?O:S,P=O!==q||D!==_;Ke(()=>{P&&R({previousValue:q,tabActivationDirection:_})},[q,P,_]);const $=et((le,J)=>{const ne=yk(S,le,u,E);J.activationDirection=ne,c==null||c(le,J),!J.isCanceled&&C(le)}),H=et((le,J)=>{c==null||c(le,bt(J,void 0,void 0,{activationDirection:"none"}))}),F=et((le,J)=>(j(ne=>{const ce=new Map(ne);return ce.set(le,J),ce}),()=>{j(ne=>{if(ne.get(le)!==J)return ne;const ce=new Map(ne);return ce.delete(le),ce})})),V=x.useCallback(le=>v.get(le),[v]),G=x.useCallback(le=>{for(const J of E.values())if(le===J.value)return J.id},[E]),X=x.useMemo(()=>({getTabElementBySelectedValue:k,getTabIdByPanelValue:G,getTabPanelIdByValue:V,onValueChange:$,orientation:u,registerMountedTabPanel:F,setTabMap:T,tabActivationDirection:_,value:S}),[k,G,V,$,u,F,T,_,S]),B=x.useMemo(()=>{for(const le of E.values())if(le.value===S)return le},[E,S]),Z=x.useMemo(()=>{for(const le of E.values())if(!le.disabled)return le.value},[E]),K=x.useRef(!p),se=x.useRef(l),I=x.useRef(p),U=x.useRef(!1);Ke(()=>{var oe;if(N)return;function le(W,de){C(W),R({previousValue:W,tabActivationDirection:"none"}),H(W,de),K.current=!1}if(E.size===0){U.current&&S!==null&&!((oe=A.current)!=null&&oe.isConnected)&&le(null,EC);return}U.current=!0,A.current=E.keys().next().value;const J=B==null?void 0:B.disabled,ne=B==null&&S!==null;if(!J&&S===se.current&&(I.current=!1),I.current&&J&&S===se.current)return;const ce=K.current;if(J||ne){const W=Z??null;if(S===W){K.current=!1;return}let de=EC;ce?de=RC:J&&(de=RA),le(W,de);return}ce&&B!=null&&(H(S,RC),K.current=!1)},[Z,N,H,B,C,E,S]);const te=wt("div",t,{state:{orientation:u,tabActivationDirection:_},ref:r,props:g,stateAttributesMapping:Vg});return s.jsx($5.Provider,{value:X,children:s.jsx(Cf,{elementsRef:b,children:te})})});function rv(e,t){for(const[r,a]of e.entries())if(t===a.value)return r;return null}function yk(e,t,r,a){if(e==null||t==null)return"none";const[l,c,u]=r==="horizontal"?["left","left","right"]:["top","up","down"],f=rv(a,e),m=rv(a,t);if(f==null||m==null)return f!==m&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?t>e?u:c:"none";const h=f.getBoundingClientRect()[l],g=m.getBoundingClientRect()[l];return g<h?c:g>h?u:"none"}const q1="data-composite-item-active";function V5(e={}){const{highlightItemOnHover:t,highlightedIndex:r,onHighlightedIndexChange:a}=og(),{ref:l,index:c}=Kl(e),u=r===c,f=x.useRef(null),m=qr(l,f);return{compositeProps:{tabIndex:u?0:-1,onFocus(){a(c)},onMouseMove(){const g=f.current;if(!t||!g)return;const p=g.hasAttribute("disabled")||g.ariaDisabled==="true";!u&&!p&&g.focus()}},compositeRef:m,index:c}}const U5=x.createContext(void 0);function YV(){const e=x.useContext(U5);if(e===void 0)throw new Error(Jt(65));return e}const KV=x.forwardRef(function(t,r){const{className:a,disabled:l=!1,render:c,value:u,id:f,nativeButton:m=!0,style:h,...g}=t,{value:p,getTabPanelIdByValue:b,onValueChange:v,orientation:j,tabActivationDirection:S}=G1(),{activateOnFocus:C,registerTabResizeObserverElement:N,tabsListElement:E}=YV(),{highlightedIndex:T,onHighlightedIndexChange:A}=og(),k=ds(f),M=x.useMemo(()=>({disabled:l,id:k,value:u}),[l,k,u]),{compositeProps:R,compositeRef:O,index:D}=V5({metadata:M}),_=u===p,L=x.useRef(!1),q=x.useRef(null),P=et(U=>{var Q;(Q=q.current)==null||Q.call(q),q.current=U?N(U):null});Ke(()=>{if(L.current){L.current=!1;return}if(!(_&&D>-1&&T!==D))return;const U=E;if(U!=null){const Q=Is(Ft(U));if(Q&&pt(U,Q))return}l||A(D)},[_,D,T,A,l,E]);const{getButtonProps:$,buttonRef:H}=ro({disabled:l,native:m,focusableWhenDisabled:!0}),F=b(u),V=x.useRef(!1),G=x.useRef(!1);function X(U){v(u,bt(kr,U.nativeEvent,void 0,{activationDirection:"none"}))}function B(U){_||l||X(U)}function Z(U){_||l||C&&(!V.current||G.current)&&X(U)}function K(U){if(_||l)return;V.current=!0,G.current=U.button===0;const Q=Ft(U.currentTarget);function te(){V.current=!1,G.current=!1,Q.removeEventListener("pointerup",te),Q.removeEventListener("pointercancel",te)}Q.addEventListener("pointerup",te),Q.addEventListener("pointercancel",te)}return wt("button",t,{state:{disabled:l,active:_,orientation:j,tabActivationDirection:S},ref:[r,H,O,P],props:[R,{role:"tab","aria-controls":F,"aria-selected":_,id:k,onClick:B,onFocus:Z,onPointerDown:K,[q1]:_?"":void 0,onKeyDownCapture(){L.current=!0}},g,$],stateAttributesMapping:Vg})}),XV="data-index",WV={...Vg,...$a},QV=x.forwardRef(function(t,r){const{className:a,value:l,render:c,keepMounted:u=!1,style:f,...m}=t,{value:h,getTabIdByPanelValue:g,orientation:p,tabActivationDirection:b,registerMountedTabPanel:v}=G1(),j=ds(),{ref:S,index:C}=Kl(),N=l===h,{mounted:E,transitionStatus:T,setMounted:A}=Va(N),k=!E,M=g(l),R={hidden:k,orientation:p,tabActivationDirection:b,transitionStatus:T},O=x.useRef(null),D=wt("div",t,{state:R,ref:[r,S,O],props:[{"aria-labelledby":M,hidden:k,id:j,role:"tabpanel",tabIndex:N?0:-1,inert:Nf(!N),[XV]:C},m],stateAttributesMapping:WV});return lr({open:N,ref:O,onComplete(){N||A(!1)}}),Ke(()=>{if(!(j==null||k&&!u))return v(l,j)},[k,u,l,j,v]),u||E?D:null});function ZV(e){const{loopFocus:t=!0,orientation:r="both",grid:a,onLoop:l,direction:c,highlightedIndex:u,onHighlightedIndexChange:f,rootRef:m,enableHomeAndEndKeys:h=!1,stopEventPropagation:g,disabledIndices:p,modifierKeys:b=Cr}=e,[v,j]=x.useState(0),S=a!=null,C=x.useRef(null),N=qr(C,m),E=x.useRef([]),T=x.useRef(!1),A=x.useRef(null),k=u??v,M=et((L,q=!1)=>{if(A.current=E.current[L]??null,(f??j)(L),q){const P=E.current[L];fk(C.current,P,c,r)}}),R=et(L=>{var H;if(L.size===0)return;if(T.current){const F=E.current,V=F.indexOf(A.current);if(V===-1){const G=F[k];!G||Wc(F,k,p)?M(JV(F,p)):A.current=G}else V!==k&&M(V);return}T.current=!0;const q=Array.from(L.keys()),P=q.find(F=>F==null?void 0:F.hasAttribute(q1))??null,$=P?((H=L.get(P))==null?void 0:H.index)??-1:-1;if($!==-1)M($);else if(Wc(q,k,p)){const F=wa(q,{disabledIndices:p});Pd(q,F)||M(F)}fk(C.current,P,c,r)});Ke(()=>{if(p==null||u!=null||!T.current)return;const L=E.current;if(Wc(L,k,p)){const q=wa(L,{disabledIndices:p});Pd(L,q)||M(q)}},[p,u,k,E,M]);const O=et((L,q,P)=>l?l(L,q,P,E):P),D=et(L=>{const q=L.key===nv||L.key===sv;if(!Tf.has(L.key)||!h&&q||e7(L,b)||!C.current)return;const $=c==="rtl",H=$?ev:tv,F=$?tv:ev,V=r==="vertical"?Jy:H,G=r==="vertical"?Zy:F,X=As(L.nativeEvent);if(X!=null&&dk(X)&&!_A(X)){const U=X.selectionStart,Q=X.selectionEnd,te=X.value;if(U==null||L.shiftKey||U!==Q||L.key!==G&&U<te.length||L.key!==V&&U>0)return}let B=k;const Z=Bh(E,p),K=Vy(E,p);a!=null&&(B=a({disabledIndices:p,elementsRef:E,event:L,highlightedIndex:k,loopFocus:t,maxIndex:K,minIndex:Z,onLoop:O,orientation:r,rtl:$}));const se=r!=="vertical"&&L.key===H||r!=="horizontal"&&L.key===Jy,I=r!=="vertical"&&L.key===F||r!=="horizontal"&&L.key===Zy;h&&(L.key===nv?B=Z:L.key===sv&&(B=K)),B===k&&(se||I)&&(t&&B===K&&se?(B=Z,l&&(B=l(L,k,B,E))):t&&B===Z&&I?(B=K,l&&(B=l(L,k,B,E))):B=wa(E.current,{startingIndex:B,decrement:I,disabledIndices:p})),B!==k&&!Pd(E.current,B)&&(g&&L.stopPropagation(),(S||q||se||I)&&L.preventDefault(),M(B,!0),queueMicrotask(()=>{var U;(U=E.current[B])==null||U.focus()}))});return{props:{ref:N,onFocus(L){const q=C.current,P=As(L.nativeEvent);!q||P==null||!dk(P)||P.setSelectionRange(0,P.value.length)},onKeyDown:D},highlightedIndex:k,onHighlightedIndexChange:M,elementsRef:E,onMapChange:R,relayKeyboardEvent:D}}function JV(e,t){let r=-1;for(let a=0;a<e.length;a+=1){const l=e[a];if(!(!l||Wc(e,a,t))){if(l.hasAttribute(q1))return a;r===-1&&(r=a)}}return Math.max(r,0)}function e7(e,t){for(const r of hV)if(!t.includes(r)&&e.getModifierState(r))return!0;return!1}function H5(e){const{render:t,className:r,style:a,refs:l=Cr,props:c=Cr,state:u=gn,stateAttributesMapping:f,highlightedIndex:m,onHighlightedIndexChange:h,orientation:g,grid:p,loopFocus:b,onLoop:v,enableHomeAndEndKeys:j,onMapChange:S,stopEventPropagation:C=!0,rootRef:N,disabledIndices:E,modifierKeys:T,highlightItemOnHover:A=!1,tag:k="div",...M}=e,R=zg(),{props:O,highlightedIndex:D,onHighlightedIndexChange:_,elementsRef:L,onMapChange:q,relayKeyboardEvent:P}=ZV({grid:p,loopFocus:b,onLoop:v,orientation:g,highlightedIndex:m,onHighlightedIndexChange:h,rootRef:N,stopEventPropagation:C,enableHomeAndEndKeys:j,direction:R,disabledIndices:E,modifierKeys:T}),$=wt(k,e,{state:u,ref:l,props:[O,...c,M],stateAttributesMapping:f}),H=x.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:_,highlightItemOnHover:A,relayKeyboardEvent:P}),[D,_,A,P]);return s.jsx(GR.Provider,{value:H,children:s.jsx(Cf,{elementsRef:L,onMapChange:F=>{S==null||S(F),q(F)},children:$})})}const t7=x.forwardRef(function(t,r){const{activateOnFocus:a=!1,className:l,loopFocus:c=!0,render:u,style:f,...m}=t,{orientation:h,setTabMap:g,tabActivationDirection:p}=G1(),[b,v]=x.useState(0),[j,S]=x.useState(null),C=x.useRef(new Set),N=x.useRef(new Set),E=x.useRef(null);Ke(()=>{if(typeof ResizeObserver>"u")return;const O=new ResizeObserver(()=>{C.current.forEach(D=>{D()})});return E.current=O,j&&O.observe(j),N.current.forEach(D=>{O.observe(D)}),()=>{O.disconnect(),E.current=null}},[j]);const T=et(O=>(C.current.add(O),()=>{C.current.delete(O)})),A=et(O=>{var D;return N.current.add(O),(D=E.current)==null||D.observe(O),()=>{var _;N.current.delete(O),(_=E.current)==null||_.unobserve(O)}}),k={orientation:h,tabActivationDirection:p},M={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},R=x.useMemo(()=>({activateOnFocus:a,registerIndicatorUpdateListener:T,registerTabResizeObserverElement:A,tabsListElement:j}),[a,T,A,j]);return s.jsx(U5.Provider,{value:R,children:s.jsx(H5,{render:u,className:l,style:f,state:k,refs:[r,S],props:[M,m],stateAttributesMapping:Vg,highlightedIndex:b,enableHomeAndEndKeys:!0,loopFocus:c,orientation:h,onHighlightedIndexChange:v,onMapChange:g,disabledIndices:Cr})})});function Ef({className:e,orientation:t="horizontal",...r}){return s.jsx(qV,{"data-slot":"tabs","data-orientation":t,className:Le("group/tabs flex gap-2 data-horizontal:flex-col",e),...r})}const n7=ag("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Rf({className:e,variant:t="default",...r}){return s.jsx(t7,{"data-slot":"tabs-list","data-variant":t,className:Le(n7({variant:t}),e),...r})}function wr({className:e,...t}){return s.jsx(KV,{"data-slot":"tabs-trigger",className:Le("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function bo({className:e,...t}){return s.jsx(QV,{"data-slot":"tabs-content",className:Le("flex-1 text-sm outline-none",e),...t})}const F5=x.createContext(void 0);function G5(){const e=x.useContext(F5);if(e===void 0)throw new Error(Jt(10));return e}const s7={value:()=>null},r7=x.forwardRef(function(t,r){const{render:a,className:l,disabled:c=!1,hiddenUntilFound:u,keepMounted:f,loopFocus:m,onValueChange:h,multiple:g=!1,orientation:p="vertical",value:b,defaultValue:v,style:j,...S}=t,C=v??Cr,N=x.useRef([]),[E,T]=Xr({controlled:b,default:C,name:"Accordion",state:"value"}),A=et((O,D,_)=>{if(g)if(D){const L=E.slice();if(L.push(O),h==null||h(L,_),_.isCanceled)return;T(L)}else{const L=E.filter(q=>q!==O);if(h==null||h(L,_),_.isCanceled)return;T(L)}else{const L=E[0]===O?[]:[O];if(h==null||h(L,_),_.isCanceled)return;T(L)}}),k=x.useMemo(()=>({value:E,disabled:c,orientation:p}),[E,c,p]),M=x.useMemo(()=>({disabled:c,handleValueChange:A,hiddenUntilFound:u??!1,keepMounted:f??!1,state:k,value:E}),[c,A,u,f,k,E]),R=wt("div",t,{state:k,ref:r,props:S,stateAttributesMapping:s7});return s.jsx(F5.Provider,{value:M,children:s.jsx(Cf,{elementsRef:N,children:R})})});function o7(e){const{open:t,defaultOpen:r=!1,onOpenChange:a,disabled:l}=e,[c,u]=Xr({controlled:t,default:r,name:"Collapsible",state:"open"}),{mounted:f,setMounted:m,transitionStatus:h}=Va(c,!0,!0),g=ds(),[p,b]=x.useState(),v=p===null?void 0:p??g,j=et(S=>{const C=!c,N=bt(Wo,S.nativeEvent);a(C,N),!N.isCanceled&&u(C)});return x.useMemo(()=>({defaultPanelId:g,disabled:l,handleTrigger:j,mounted:f,open:c,panelId:v,setMounted:m,setOpen:u,setPanelIdState:b,transitionStatus:h}),[g,l,j,f,c,v,m,u,b,h])}const q5=x.createContext(void 0);function Y5(){const e=x.useContext(q5);if(e===void 0)throw new Error(Jt(15));return e}const K5=x.createContext(void 0);function Y1(){const e=x.useContext(K5);if(e===void 0)throw new Error(Jt(9));return e}const a7="data-open",i7="data-closed",l7=i1,c7="data-panel-open",u7={[a7]:""},d7={[i7]:""},f7={open(e){return e?{[c7]:""}:null}},m7={open(e){return e?u7:d7}},h7="data-index",K1={...m7,index:e=>({[h7]:String(e)}),...$a,value:()=>null},p7=x.forwardRef(function(t,r){const{className:a,disabled:l=!1,onOpenChange:c,render:u,value:f,style:m,...h}=t,{ref:g,index:p}=Kl(),b=qr(r,g),{disabled:v,handleValueChange:j,state:S,value:C}=G5(),N=ds(),E=f??N,T=l||v,A=C.indexOf(E)!==-1,k=et((F,V)=>{c==null||c(F,V),!V.isCanceled&&j(E,F,V)}),M=o7({open:A,onOpenChange:k,disabled:T}),R=x.useMemo(()=>({open:M.open,disabled:M.disabled,transitionStatus:M.transitionStatus}),[M.open,M.disabled,M.transitionStatus]),O=x.useMemo(()=>({...M,onOpenChange:k,state:R}),[M,R,k]),D=x.useMemo(()=>({...S,hidden:!A&&!M.mounted,index:p,disabled:T,open:A}),[M.mounted,T,p,A,S]),_=ds(),[L,q]=x.useState(),P=L===null?void 0:L??_,$=x.useMemo(()=>({defaultTriggerId:_,open:A,state:D,setTriggerId:q,triggerId:P}),[_,A,D,q,P]),H=wt("div",t,{state:D,ref:b,props:h,stateAttributesMapping:K1});return s.jsx(q5.Provider,{value:O,children:s.jsx(K5.Provider,{value:$,children:H})})}),g7=x.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,{state:f}=Y1();return wt("h3",t,{state:f,ref:r,props:u,stateAttributesMapping:K1})}),x7=x.forwardRef(function(t,r){const{disabled:a,className:l,id:c,render:u,nativeButton:f=!0,style:m,...h}=t,{panelId:g,open:p,handleTrigger:b,disabled:v}=Y5(),j=a||v,{getButtonProps:S,buttonRef:C}=ro({disabled:j,focusableWhenDisabled:!0,native:f}),{defaultTriggerId:N,state:E,setTriggerId:T}=Y1(),A=c||void 0,k=A??N;return Ke(()=>(T(O=>A??(O===null?void 0:O)),()=>{T(O=>O===A?null:O)}),[A,T]),wt("button",t,{state:E,ref:[r,C],props:[{"aria-controls":p?g:void 0,"aria-expanded":p,id:k,onClick:b},h,S],stateAttributesMapping:f7})}),Sd={height:void 0,width:void 0};function b7(e){const{externalRef:t,hiddenUntilFound:r,id:a,keepMounted:l,mounted:c,onOpenChange:u,open:f,setMounted:m,setOpen:h,transitionStatus:g}=e,p=x.useRef(null),b=x.useRef(null),[v,j]=x.useState(Sd),S=x.useRef(Sd),C=x.useRef(!1),N=x.useRef(f),E=x.useRef(!1),[T,A]=x.useState(!1),k=x.useRef(null),M=qr(t,p),R=Ln(f),O=xf(p),D=!f&&!c,_=T?"idle":g,L=f&&(N.current||E.current),q=!f&&c&&b.current==="css-animation"&&v.height===void 0&&v.width===void 0?S.current:v,P=r&&D&&b.current!=="css-animation",$=et((X,B=!0)=>{B&&(S.current=X),j(X)}),H=et(()=>{var X;(X=k.current)==null||X.call(k),k.current=null}),F=et(X=>{H(),k.current=()=>{k.current=null,X()}}),V=et(()=>{f&&c&&b.current==="css-animation"&&(E.current=!0)});Ke(()=>{!T||g==="starting"||A(!1)},[T,g]),x.useEffect(()=>()=>{V(),H()},[V,H]),Ke(()=>{const X=p.current;if(!X)return;!f&&k.current&&H();const B=y7(X,L);if(b.current=B,f&&g==="idle"&&N.current&&B==="css-animation"){S.current=Vc(X);return}if(f&&g==="starting"){const se=C.current;if(C.current=!1,B==="none"){$(Vc(X)),A(!0);return}if(B==="css-transition"){const Q=v7(X);if($(Vc(X)),!se)return Q;const te=yh(X,"transition-duration","0s");return F(te),A(!0),Q}$(Vc(X));const I=yh(X,"animation-name","none");if(!se){I();return}const U=yh(X,"animation-duration","0s");I(),F(U),A(!0);return}if(!f&&c&&(g==="idle"||g==="starting")){if(N.current=!1,E.current=!1,B==="none"){$(Sd,!1),m(!1);return}$(Vc(X));return}if(g!=="ending")return;if(B==="none"){m(!1);return}const Z=Vc(X);if(!(Z.height>0||Z.width>0)){m(!1);return}$(Z),B==="css-animation"&&yh(X,"animation-name","none")()},[c,f,H,$,m,F,L,g]),lr({enabled:f&&c&&_==="idle",open:!0,ref:p,onComplete(){f&&$(Sd,!1)}}),x.useEffect(()=>{if(f||!c||_!=="ending"||!p.current)return;const B=new AbortController;let Z=-1;function K(){R.current||(m(!1),$(Sd,!1))}return Z=ir.request(()=>{O(K,B.signal)}),()=>{ir.cancel(Z),B.abort()}},[R,c,f,_,O,$,m]),Ke(()=>{const X=p.current;!X||!r||!D||X.setAttribute("hidden","until-found")},[D,r]),x.useEffect(function(){const B=p.current;if(!B)return;function Z(K){const se=bt(kr,K);u(!0,se),!se.isCanceled&&(C.current=!0,h(!0))}return Lt(B,"beforematch",Z)},[u,h]);const G=l||r||c||f;return{height:q.height,props:{...P?{[l7]:""}:void 0,hidden:D,id:a},ref:M,shouldPreventOpenAnimation:L,shouldRender:G,transitionStatus:_,width:q.width}}function Vc(e){return{height:e.scrollHeight,width:e.scrollWidth}}function y7(e,t){const r=xn(e).getComputedStyle(e),a=(r.animationName.split(",").map(c=>c.trim()).some(c=>c!==""&&c!=="none")||t)&&vk(r.animationDuration),l=vk(r.transitionDuration);return a&&l||l?"css-transition":a?"css-animation":"none"}function vk(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function yh(e,t,r){const a=e.style.getPropertyValue(t),l=e.style.getPropertyPriority(t);return e.style.setProperty(t,r),()=>{if(a===""){e.style.removeProperty(t);return}e.style.setProperty(t,a,l)}}function v7(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(l=>{e.style.setProperty(l,"initial","important")});function r(){Object.entries(t).forEach(([l,c])=>{if(c===""){e.style.removeProperty(l);return}e.style.setProperty(l,c)})}const a=ir.request(r);return()=>{ir.cancel(a),r()}}const w7="--accordion-panel-height",j7="--accordion-panel-width",S7=x.forwardRef(function(t,r){const{className:a,hiddenUntilFound:l,keepMounted:c,id:u,render:f,style:m,...h}=t,{hiddenUntilFound:g,keepMounted:p}=G5(),{defaultPanelId:b,mounted:v,onOpenChange:j,open:S,setMounted:C,setOpen:N,setPanelIdState:E,transitionStatus:T}=Y5(),A=l??g,k=c??p,M=u||void 0,R=u??b;Ke(()=>(E(B=>M??(B===null?void 0:B)),()=>{E(B=>B===M?null:B)}),[M,E]);const{height:O,props:D,ref:_,shouldPreventOpenAnimation:L,shouldRender:q,transitionStatus:P,width:$}=b7({externalRef:r,hiddenUntilFound:A,id:R,keepMounted:k,mounted:v,onOpenChange:j,open:S,setMounted:C,setOpen:N,transitionStatus:T}),{state:H,triggerId:F}=Y1(),V={...H,transitionStatus:P},G=KR(m,V),X=wt("div",{...t,style:void 0},{state:V,ref:_,props:[D,{"aria-labelledby":F,role:"region",style:{[w7]:O===void 0?"auto":`${O}px`,[j7]:$===void 0?"auto":`${$}px`}},h,G?{style:G}:void 0,L?{style:{animationName:"none"}}:void 0],stateAttributesMapping:K1});return q?X:null});function N7({className:e,...t}){return s.jsx(r7,{"data-slot":"accordion",className:Le("flex w-full flex-col",e),...t})}function C7({className:e,...t}){return s.jsx(p7,{"data-slot":"accordion-item",className:Le("not-last:border-b",e),...t})}function k7({className:e,children:t,...r}){return s.jsx(g7,{className:"flex",children:s.jsxs(x7,{"data-slot":"accordion-trigger",className:Le("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",e),...r,children:[t,s.jsx(Xo,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),s.jsx(RR,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function T7({className:e,children:t,...r}){return s.jsx(S7,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...r,children:s.jsx("div",{className:Le("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:t})})}const X1=x.createContext({});function Af(e){const t=x.useRef(null);return t.current===null&&(t.current=e()),t.current}const E7=typeof window<"u",lu=E7?x.useLayoutEffect:x.useEffect,Ug=x.createContext(null);function W1(e,t){e.indexOf(t)===-1&&e.push(t)}function Ep(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}const Co=(e,t,r)=>r>t?t:r<e?e:r;let Hg=()=>{};const Aa={},Q1=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),X5=e=>typeof e=="object"&&e!==null,Z1=e=>/^0[^.\s]+$/u.test(e);function W5(e){let t;return()=>(t===void 0&&(t=e()),t)}const wo=e=>e,Of=(...e)=>e.reduce((t,r)=>a=>r(t(a))),Xd=(e,t,r)=>{const a=t-e;return a?(r-e)/a:1};class Rp{constructor(){this.subscriptions=[]}add(t){return W1(this.subscriptions,t),()=>this.remove(t)}remove(t){Ep(this.subscriptions,t)}notify(t,r,a){const l=this.subscriptions.length;if(l)if(l===1)this.subscriptions[0](t,r,a);else for(let c=0;c<l;c++){const u=this.subscriptions[c];u&&u(t,r,a)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Fr=e=>e*1e3,jr=e=>e/1e3,Q5=(e,t)=>t?e*(1e3/t):0,Z5=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,R7=1e-7,A7=12;function O7(e,t,r,a,l){let c,u,f=0;do u=t+(r-t)/2,c=Z5(u,a,l)-e,c>0?r=u:t=u;while(Math.abs(c)>R7&&++f<A7);return u}function Mf(e,t,r,a){if(e===t&&r===a)return wo;const l=c=>O7(c,0,1,e,r);return c=>c===0||c===1?c:Z5(l(c),t,a)}const J5=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,eO=e=>t=>1-e(1-t),tO=Mf(.33,1.53,.69,.99),J1=eO(tO),nO=J5(J1),sO=e=>e>=1?1:(e*=2)<1?.5*J1(e):.5*(2-Math.pow(2,-10*(e-1))),ew=e=>1-Math.sin(Math.acos(e)),rO=eO(ew),oO=J5(ew),M7=Mf(.42,0,1,1),D7=Mf(0,0,.58,1),tw=Mf(.42,0,.58,1),z7=e=>Array.isArray(e)&&typeof e[0]!="number",aO=e=>Array.isArray(e)&&typeof e[0]=="number",P7={linear:wo,easeIn:M7,easeInOut:tw,easeOut:D7,circIn:ew,circInOut:oO,circOut:rO,backIn:J1,backInOut:nO,backOut:tO,anticipate:sO},I7=e=>typeof e=="string",wk=e=>{if(aO(e)){Hg(e.length===4);const[t,r,a,l]=e;return Mf(t,r,a,l)}else if(I7(e))return P7[e];return e},vh=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function _7(e){let t=new Set,r=new Set,a=!1,l=!1;const c=new Set;let u={delta:0,timestamp:0,isProcessing:!1};function f(h){c.has(h)&&(r.add(h),e()),h(u)}const m={schedule:(h,g=!1,p=!1)=>{const v=p&&a?t:r;return g&&c.add(h),v.add(h),h},cancel:h=>{r.delete(h),c.delete(h)},process:h=>{if(u=h,a){l=!0;return}a=!0;const g=t;t=r,r=g,t.forEach(f),t.clear(),a=!1,l&&(l=!1,m.process(h))}};return m}const L7=40;function iO(e,t){let r=!1,a=!0;const l={delta:0,timestamp:0,isProcessing:!1},c=()=>r=!0,u=vh.reduce((T,A)=>(T[A]=_7(c),T),{}),{setup:f,read:m,resolveKeyframes:h,preUpdate:g,update:p,preRender:b,render:v,postRender:j}=u,S=()=>{const T=Aa.useManualTiming,A=T?l.timestamp:performance.now();r=!1,T||(l.delta=a?1e3/60:Math.max(Math.min(A-l.timestamp,L7),1)),l.timestamp=A,l.isProcessing=!0,f.process(l),m.process(l),h.process(l),g.process(l),p.process(l),b.process(l),v.process(l),j.process(l),l.isProcessing=!1,r&&t&&(a=!1,e(S))},C=()=>{r=!0,a=!0,l.isProcessing||e(S)};return{schedule:vh.reduce((T,A)=>{const k=u[A];return T[A]=(M,R=!1,O=!1)=>(r||C(),k.schedule(M,R,O)),T},{}),cancel:T=>{for(let A=0;A<vh.length;A++)u[vh[A]].cancel(T)},state:l,steps:u}}const{schedule:un,cancel:Qo,state:ys,steps:q0}=iO(typeof requestAnimationFrame<"u"?requestAnimationFrame:wo,!0);let Yh;function B7(){Yh=void 0}const vs={now:()=>(Yh===void 0&&vs.set(ys.isProcessing||Aa.useManualTiming?ys.timestamp:performance.now()),Yh),set:e=>{Yh=e,queueMicrotask(B7)}},eu=e=>Math.round(e*1e5)/1e5,lO=e=>t=>typeof t=="string"&&t.startsWith(e),cO=lO("--"),$7=lO("var(--"),nw=e=>$7(e)?V7.test(e.split("/*")[0].trim()):!1,V7=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function jk(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const yu={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Wd={...yu,transform:e=>Co(0,1,e)},wh={...yu,default:1},sw=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function U7(e){return e==null}const H7=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,rw=(e,t)=>r=>!!(typeof r=="string"&&H7.test(r)&&r.startsWith(e)||t&&!U7(r)&&Object.prototype.hasOwnProperty.call(r,t)),uO=(e,t,r)=>a=>{if(typeof a!="string")return a;const[l,c,u,f]=a.match(sw);return{[e]:parseFloat(l),[t]:parseFloat(c),[r]:parseFloat(u),alpha:f!==void 0?parseFloat(f):1}},F7=e=>Co(0,255,e),Y0={...yu,transform:e=>Math.round(F7(e))},Tl={test:rw("rgb","red"),parse:uO("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:a=1})=>"rgba("+Y0.transform(e)+", "+Y0.transform(t)+", "+Y0.transform(r)+", "+eu(Wd.transform(a))+")"};function G7(e){let t="",r="",a="",l="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),a=e.substring(5,7),l=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),a=e.substring(3,4),l=e.substring(4,5),t+=t,r+=r,a+=a,l+=l),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(a,16),alpha:l?parseInt(l,16)/255:1}}const ov={test:rw("#"),parse:G7,transform:Tl.transform},Df=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),xa=Df("deg"),Go=Df("%"),mt=Df("px"),q7=Df("vh"),Y7=Df("vw"),Sk={...Go,parse:e=>Go.parse(e)/100,transform:e=>Go.transform(e*100)},Gc={test:rw("hsl","hue"),parse:uO("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:a=1})=>"hsla("+Math.round(e)+", "+Go.transform(eu(t))+", "+Go.transform(eu(r))+", "+eu(Wd.transform(a))+")"},as={test:e=>Tl.test(e)||ov.test(e)||Gc.test(e),parse:e=>Tl.test(e)?Tl.parse(e):Gc.test(e)?Gc.parse(e):ov.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Tl.transform(e):Gc.transform(e),getAnimatableNone:e=>{const t=as.parse(e);return t.alpha=0,as.transform(t)}},K7=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,dO=new RegExp(sw.source),fO=new RegExp(K7.source,"i");function X7(e){return isNaN(e)&&typeof e=="string"&&(dO.test(e)||fO.test(e))}const mO="number",hO="color",W7="var",Q7="var(",Nk="${}",Z7=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function J7(e){const t=e.toString();return dO.test(t)||fO.test(t)}function Qd(e){const t=e.toString(),r=[],a={color:[],number:[],var:[]},l=[];let c=0;const f=t.replace(Z7,m=>(as.test(m)?(a.color.push(c),l.push(hO),r.push(as.parse(m))):m.startsWith(Q7)?(a.var.push(c),l.push(W7),r.push(m)):(a.number.push(c),l.push(mO),r.push(parseFloat(m))),++c,Nk)).split(Nk);return{values:r,split:f,indexes:a,types:l}}function eU(e){return Qd(e).values}function pO({split:e,types:t}){const r=e.length;return a=>{let l="";for(let c=0;c<r;c++)if(l+=e[c],a[c]!==void 0){const u=t[c];u===mO?l+=eu(a[c]):u===hO?l+=as.transform(a[c]):l+=a[c]}return l}}function tU(e){return pO(Qd(e))}const nU=e=>typeof e=="number"?0:as.test(e)?as.getAnimatableNone(e):e,sU=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:nU(e);function rU(e){const t=Qd(e);return pO(t)(t.values.map((a,l)=>sU(a,t.split[l])))}const Sr={test:X7,parse:eU,createTransformer:tU,getAnimatableNone:rU};function K0(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function oU({hue:e,saturation:t,lightness:r,alpha:a}){e/=360,t/=100,r/=100;let l=0,c=0,u=0;if(!t)l=c=u=r;else{const f=r<.5?r*(1+t):r+t-r*t,m=2*r-f;l=K0(m,f,e+1/3),c=K0(m,f,e),u=K0(m,f,e-1/3)}return{red:Math.round(l*255),green:Math.round(c*255),blue:Math.round(u*255),alpha:a}}function Ap(e,t){return r=>r>0?t:e}const pn=(e,t,r)=>e+(t-e)*r,X0=(e,t,r)=>{const a=e*e,l=r*(t*t-a)+a;return l<0?0:Math.sqrt(l)},aU=[ov,Tl,Gc],iU=e=>aU.find(t=>t.test(e));function Ck(e){const t=iU(e);if(!t)return!1;let r=t.parse(e);return t===Gc&&(r=oU(r)),r}const kk=(e,t)=>{const r=Ck(e),a=Ck(t);if(!r||!a)return Ap(e,t);const l={...r};return c=>(l.red=X0(r.red,a.red,c),l.green=X0(r.green,a.green,c),l.blue=X0(r.blue,a.blue,c),l.alpha=pn(r.alpha,a.alpha,c),Tl.transform(l))},av=new Set(["none","hidden"]);function lU(e,t){return av.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function cU(e,t){return r=>pn(e,t,r)}function ow(e){return typeof e=="number"?cU:typeof e=="string"?nw(e)?Ap:as.test(e)?kk:fU:Array.isArray(e)?gO:typeof e=="object"?as.test(e)?kk:uU:Ap}function gO(e,t){const r=[...e],a=r.length,l=e.map((c,u)=>ow(c)(c,t[u]));return c=>{for(let u=0;u<a;u++)r[u]=l[u](c);return r}}function uU(e,t){const r={...e,...t},a={};for(const l in r)e[l]!==void 0&&t[l]!==void 0&&(a[l]=ow(e[l])(e[l],t[l]));return l=>{for(const c in a)r[c]=a[c](l);return r}}function dU(e,t){const r=[],a={color:0,var:0,number:0};for(let l=0;l<t.values.length;l++){const c=t.types[l],u=e.indexes[c][a[c]],f=e.values[u]??0;r[l]=f,a[c]++}return r}const fU=(e,t)=>{const r=Sr.createTransformer(t),a=Qd(e),l=Qd(t);return a.indexes.var.length===l.indexes.var.length&&a.indexes.color.length===l.indexes.color.length&&a.indexes.number.length>=l.indexes.number.length?av.has(e)&&!l.values.length||av.has(t)&&!a.values.length?lU(e,t):Of(gO(dU(a,l),l.values),r):Ap(e,t)},Tk=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function mU(e,t){const r=Tk.exec(e);if(!r)return;const a=Tk.exec(t);if(!a||r[2]!==a[2])return;const l=r[2],c=parseFloat(r[1]),u=parseFloat(a[1]);return f=>eu(pn(c,u,f))+l}function aw(e,t,r){if(typeof e=="number"&&typeof t=="number"&&typeof r=="number")return pn(e,t,r);if(typeof e=="string"&&typeof t=="string"){const l=mU(e,t);if(l)return l}return ow(e)(e,t)}const hU=e=>{const t=({timestamp:r})=>e(r);return{start:(r=!0)=>un.update(t,r),stop:()=>Qo(t),now:()=>ys.isProcessing?ys.timestamp:vs.now()}},xO=(e,t,r=10)=>{let a="";const l=Math.max(Math.round(t/r),2);for(let c=0;c<l;c++)a+=Math.round(e(c/(l-1))*1e4)/1e4+", ";return`linear(${a.substring(0,a.length-2)})`},iw=2e4;function lw(e,t=50,r=iw,a){let l=0,c=e.next(l);for(;!c.done&&l<r;)l+=t,c=e.next(l);return l>=r?1/0:l}function pU(e,t=100,r){const a=r({...e,keyframes:[0,t]}),l=Math.min(lw(a),iw);return{type:"keyframes",ease:c=>a.next(l*c).value/t,duration:jr(l)}}const _n={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function iv(e,t){return e*Math.sqrt(1-t*t)}const gU=12;function xU(e,t,r){let a=r;for(let l=1;l<gU;l++)a=a-e(a)/t(a);return a}const W0=.001;function bU({duration:e=_n.duration,bounce:t=_n.bounce,velocity:r=_n.velocity,mass:a=_n.mass}){let l,c,u=1-t;u=Co(_n.minDamping,_n.maxDamping,u),e=Co(_n.minDuration,_n.maxDuration,jr(e)),u<1?(l=h=>{const g=h*u,p=g*e,b=g-r,v=iv(h,u),j=Math.exp(-p);return W0-b/v*j},c=h=>{const p=h*u*e,b=p*r+r,v=u*u*h*h*e,j=Math.exp(-p),S=iv(h*h,u);return(-l(h)+W0>0?-1:1)*((b-v)*j)/S}):(l=h=>{const g=Math.exp(-h*e),p=(h-r)*e+1;return-W0+g*p},c=h=>{const g=Math.exp(-h*e),p=(r-h)*(e*e);return g*p});const f=5/e,m=xU(l,c,f);if(e=Fr(e),isNaN(m))return{stiffness:_n.stiffness,damping:_n.damping,duration:e};{const h=m*m*a;return{stiffness:h,damping:u*2*Math.sqrt(a*h),duration:e}}}const yU=["duration","bounce"];function vU(e,t){return t.some(r=>e[r]!==void 0)}const lv=(e,t)=>(t?e>=0:e>0)&&e<1/0;function Q0(e,t){if(lv(e,t))return e}function wU(e){const t=Q0(e.stiffness),r=Q0(e.damping,!0),a=Q0(e.mass);let l={...e,stiffness:t??_n.stiffness,damping:r??_n.damping,mass:a??_n.mass,isResolvedFromDuration:!1,isTimeDefined:(t??r??a)===void 0&&vU(e,yU)};if(l.isTimeDefined){if(l.velocity=0,e.visualDuration){const c=e.visualDuration,u=2*Math.PI/(c*1.2),f=u*u,m=2*Co(.05,1,1-(e.bounce||0))*Math.sqrt(f);l={...l,mass:_n.mass,stiffness:f,damping:m}}else{const c=bU(l);l={...l,...c,mass:_n.mass},l.isResolvedFromDuration=!0}(!lv(l.stiffness)||!lv(l.damping,!0))&&(l.stiffness=_n.stiffness,l.damping=_n.damping)}return l}function Op(e=_n.visualDuration,t=_n.bounce){const r=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e,a=r.keyframes[0],l=r.keyframes[r.keyframes.length-1],c={done:!1,value:a},{stiffness:u,damping:f,mass:m,duration:h,velocity:g,isResolvedFromDuration:p,isTimeDefined:b}=wU({...r,velocity:-jr(r.velocity||0)}),v=f/(2*Math.sqrt(u*m)),j=jr(Math.sqrt(u/m)),S=v*j,C={target:l,delta:l-a,velocity:g||0,restSpeed:0,restDelta:0},N=()=>{const R=Math.abs(C.delta)<5;C.restSpeed=r.restSpeed||(R?_n.restSpeed.granular:_n.restSpeed.default),C.restDelta=r.restDelta||(R?_n.restDelta.granular:_n.restDelta.default)};N();let E,T,A;if(v<1){const R=iv(j,v),O={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};A=()=>{O.A=(C.velocity+S*C.delta)/R,O.sinC=S*O.A+C.delta*R,O.cosC=S*C.delta-O.A*R};const D=_=>{_!==O.t&&(O.t=_,O.env=Math.exp(-S*_),O.sin=Math.sin(R*_),O.cos=Math.cos(R*_))};E=_=>(D(_),C.target-O.env*(O.A*O.sin+C.delta*O.cos)),T=_=>(D(_),O.env*(O.sinC*O.sin+O.cosC*O.cos))}else if(v===1){E=O=>C.target-Math.exp(-j*O)*(C.delta+(C.velocity+j*C.delta)*O);const R={C:0};A=()=>{R.C=C.velocity+j*C.delta},T=O=>Math.exp(-j*O)*(j*R.C*O-C.velocity)}else{const R=j*Math.sqrt(v*v-1);E=D=>{const _=Math.exp(-S*D),L=Math.min(R*D,300);return C.target-_*((C.velocity+S*C.delta)*Math.sinh(L)+R*C.delta*Math.cosh(L))/R};const O={P:0,sinh:0,cosh:0};A=()=>{O.P=(C.velocity+S*C.delta)/R,O.sinh=S*O.P-C.delta*R,O.cosh=S*C.delta-O.P*R},T=D=>{const _=Math.exp(-S*D),L=Math.min(R*D,300);return _*(O.sinh*Math.sinh(L)+O.cosh*Math.cosh(L))}}A();const k=p&&h||null,M={calculatedDuration:k,retarget:(R,O)=>{C.target=R[R.length-1],C.delta=C.target-R[0],C.velocity=b?0:-jr(O),r.restSpeed&&r.restDelta||N(),M.calculatedDuration=k,c.done=!1,A()},velocity:R=>Fr(T(R)),next:R=>{const O=E(R);if(p)c.done=R>=h;else{const D=Fr(T(R));c.done=Math.abs(D)<=C.restSpeed&&Math.abs(C.target-O)<=C.restDelta}return c.value=c.done?C.target:O,c},toString:()=>{const R=Math.min(lw(M),iw),O=xO(D=>M.next(R*D).value,R,30);return R+"ms "+O},toTransition:()=>{}};return M}Op.applyToOptions=e=>{const t=pU(e,100,Op);return e.ease=t.ease,e.duration=Fr(t.duration),e.type="keyframes",e};function cv({keyframes:e,velocity:t=0,power:r=.8,timeConstant:a=325,bounceDamping:l=10,bounceStiffness:c=500,modifyTarget:u,min:f,max:m,restDelta:h=.5,restSpeed:g}){const p=e[0],b={done:!1,value:p},v=R=>R<f||R>m,j=R=>f===void 0?m:m===void 0||Math.abs(f-R)<Math.abs(m-R)?f:m;let S=r*t;const C=p+S,N=u===void 0?C:u(C);N!==C&&(S=N-p);const E=R=>-S*Math.exp(-R/a),T=R=>{const O=E(R);b.done=Math.abs(O)<=h,b.value=b.done?N:N+O};let A,k;const M=R=>{v(b.value)&&(A=R,k=Op({keyframes:[b.value,j(b.value)],velocity:-E(R)/a*1e3,damping:l,stiffness:c,restDelta:h,restSpeed:g}))};return M(0),{calculatedDuration:null,next:R=>{let O=!1;return!k&&A===void 0&&(O=!0,T(R),M(R)),A!==void 0&&R>=A?k.next(R-A):(!O&&T(R),b)}}}function jU(e,t,r){const a=[],l=r||Aa.mix||aw,c=e.length-1;for(let u=0;u<c;u++){let f=l(e[u],e[u+1]);if(t){const m=Array.isArray(t)?t[u]||wo:t;f=Of(m,f)}a.push(f)}return a}function bO(e,t,{clamp:r=!0,ease:a,mixer:l}={}){const c=e.length;if(Hg(c===t.length),c===1)return()=>t[0];if(c===2&&t[0]===t[1])return()=>t[1];const u=e[0]===e[1];e[0]>e[c-1]&&(e=[...e].reverse(),t=[...t].reverse());const f=jU(t,a,l),m=f.length,h=g=>{if(u&&g<e[0])return t[0];let p=0;if(m>1)for(;p<e.length-2&&!(g<e[p+1]);p++);const b=Xd(e[p],e[p+1],g);return f[p](b)};return r?g=>h(Co(e[0],e[c-1],g)):h}function SU(e,t){const r=e[e.length-1];for(let a=1;a<=t;a++){const l=Xd(0,t,a);e.push(pn(r,1,l))}}function NU(e){const t=[0];return SU(t,e.length-1),t}function CU(e,t){return e.map(r=>r*t)}function kU(e,t){return e.map(()=>t||tw).splice(0,e.length-1)}function tu({duration:e=300,keyframes:t,times:r,ease:a="easeInOut"}){const l=z7(a)?a.map(wk):wk(a)||tw,c={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(l)&&(!r||r.length!==2||r[0]===0&&r[1]===1)){const[m,h]=t,g=m===h?void 0:(Aa.mix||aw)(m,h);return{calculatedDuration:e,next:p=>(c.value=g?g(l(e>0?Co(0,1,p/e):1)):h,c.done=p>=e,c)}}const u=CU(r&&r.length===t.length?r:NU(t),e),f=bO(u,t,{ease:Array.isArray(l)?l:kU(t,l)});return{calculatedDuration:e,next:m=>(c.value=f(m),c.done=m>=e,c)}}const TU=5;function EU(e,t,r){const a=Math.max(t-TU,0);return Q5(r-e(a),t-a)}function yO(e,t,r=0){return t<=0?r:e.velocity?e.velocity(t):EU(a=>e.next(a).value,t,e.next(t).value)}const RU=e=>e!==null;function Fg(e,{repeat:t,repeatType:r="loop"},a,l=1){const c=e.filter(RU),f=l<0||t&&r!=="loop"&&t%2===1?0:c.length-1;return!f||a===void 0?c[f]:a}const AU={decay:cv,inertia:cv,tween:tu,keyframes:tu,spring:Op};function cw(e){typeof e.type=="string"&&(e.type=AU[e.type])}function vO(e,t){return{kind:e,animation:t,timestamp:vs.now(),frameTimestamp:ys.timestamp,frameIsProcessing:ys.isProcessing}}function wO(e,t,r){const a=globalThis.__MOTION_INSPECT__;if(a)try{a({...vO("animation-start",e),options:r?{...t,...r}:t})}catch{}}function OU(e,t){const r=globalThis.__MOTION_INSPECT__;if(r)try{r({...vO("layout-animation-start",e),node:t})}catch{}}class Gg{constructor(){this.isResolved=!1}get finished(){return this._finished||(this._finished=this.isResolved?Promise.resolve():new Promise(t=>{this._resolve=t})),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){var t;this.isResolved=!0,(t=this._resolve)==null||t.call(this)}then(t,r){return this.finished.then(t,r)}}const MU=e=>e/100;class Mp extends Gg{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var a,l;const{motionValue:r}=this.options;r&&r.updatedAt!==vs.now()&&this.tick(vs.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(l=(a=this.options).onStop)==null||l.call(a))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause(),wO(this,this.options)}initAnimation(){const{options:t}=this;cw(t);const{type:r=tu,repeat:a=0,repeatDelay:l=0,repeatType:c,velocity:u=0}=t;let{keyframes:f}=t;const m=r||tu;m!==tu&&typeof f[0]!="number"&&(this.mixKeyframes=Of(MU,aw(f[0],f[1])),f=[0,100]);const h=m(f===t.keyframes?t:{...t,keyframes:f});c==="mirror"&&(this.mirroredGenerator=m({...t,keyframes:[...f].reverse(),velocity:-u})),h.calculatedDuration===null&&(h.calculatedDuration=lw(h));const{calculatedDuration:g}=h;this.calculatedDuration=g,this.resolvedDuration=g+l,this.totalDuration=this.resolvedDuration*(a+1)-l,this.generator=h}updateTime(t){const r=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(t,r=!1){const{generator:a,totalDuration:l,mixKeyframes:c,mirroredGenerator:u,resolvedDuration:f,calculatedDuration:m}=this;if(this.startTime===null)return a.next(0);const{delay:h=0,keyframes:g,repeat:p,repeatType:b,repeatDelay:v,type:j,onUpdate:S,finalKeyframe:C}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-l/this.speed,this.startTime)),r?this.currentTime=t:this.updateTime(t);const N=this.currentTime-h*(this.playbackSpeed>=0?1:-1),E=this.playbackSpeed>=0?N<0:N>l;this.currentTime=Math.max(N,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=l);let T=this.currentTime,A=a;if(p){const O=Math.min(this.currentTime,l)/f;let D=Math.floor(O),_=O%1;!_&&O>=1&&(_=1),_===1&&D--,D=Math.min(D,p+1),!!(D%2)&&(b==="reverse"?(_=1-_,v&&(_-=v/f)):b==="mirror"&&(A=u)),T=Co(0,1,_)*f}let k;E?(this.delayState.value=g[0],k=this.delayState):k=A.next(T),c&&!E&&(k.value=c(k.value));let{done:M}=k;!E&&m!==null&&(M=this.playbackSpeed>=0?this.currentTime>=l:this.currentTime<=0);const R=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&M);return R&&j!==cv&&(k.value=Fg(g,this.options,C,this.speed)),S&&S(k.value),R&&this.finish(),k}then(t,r){return this.finished.then(t,r)}get duration(){return jr(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+jr(t)}get time(){return jr(this.currentTime)}set time(t){t=Fr(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){return yO(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(t){const r=this.playbackSpeed!==t;r&&this.driver&&this.updateTime(vs.now()),this.playbackSpeed=t,r&&this.driver&&(this.time=jr(this.currentTime))}play(){var l,c;if(this.isStopped)return;const{driver:t=hU,startTime:r}=this.options;this.driver||(this.driver=t(u=>this.tick(u))),(c=(l=this.options).onPlay)==null||c.call(l);const a=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=a):this.holdTime!==null?this.startTime=a-this.holdTime:this.startTime||(this.startTime=r??a),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(vs.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,r;this.notifyFinished(),this.teardown(),this.state="finished",(r=(t=this.options).onComplete)==null||r.call(t)}cancel(){var t,r;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(r=(t=this.options).onCancel)==null||r.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var r;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(r=this.driver)==null||r.stop(),t.observe(this)}}const DU=new Set(["brightness","contrast","saturate","opacity"]);function zU(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[a]=r.match(sw)||[];if(!a)return e;const l=r.replace(a,"");let c=DU.has(t)?1:0;return a!==r&&(c*=100),t+"("+c+l+")"}const PU=/\b([a-z-]*)\(.*?\)/gu,uv={...Sr,getAnimatableNone:e=>{const t=e.match(PU);return t?t.map(zU).join(" "):e}},dv={...Sr,getAnimatableNone:e=>{const t=Sr.parse(e);return Sr.createTransformer(e)(t.map(a=>typeof a=="number"?0:typeof a=="object"?{...a,alpha:1}:a))}},Ek={...yu,transform:Math.round},IU={rotate:xa,pathRotation:xa,rotateX:xa,rotateY:xa,rotateZ:xa,scale:wh,scaleX:wh,scaleY:wh,scaleZ:wh,skew:xa,skewX:xa,skewY:xa,distance:mt,translateX:mt,translateY:mt,translateZ:mt,x:mt,y:mt,z:mt,perspective:mt,transformPerspective:mt,opacity:Wd,originX:Sk,originY:Sk,originZ:mt},Dp={borderWidth:mt,borderTopWidth:mt,borderRightWidth:mt,borderBottomWidth:mt,borderLeftWidth:mt,borderRadius:mt,borderTopLeftRadius:mt,borderTopRightRadius:mt,borderBottomRightRadius:mt,borderBottomLeftRadius:mt,width:mt,maxWidth:mt,height:mt,maxHeight:mt,top:mt,right:mt,bottom:mt,left:mt,inset:mt,insetBlock:mt,insetBlockStart:mt,insetBlockEnd:mt,insetInline:mt,insetInlineStart:mt,insetInlineEnd:mt,padding:mt,paddingTop:mt,paddingRight:mt,paddingBottom:mt,paddingLeft:mt,paddingBlock:mt,paddingBlockStart:mt,paddingBlockEnd:mt,paddingInline:mt,paddingInlineStart:mt,paddingInlineEnd:mt,margin:mt,marginTop:mt,marginRight:mt,marginBottom:mt,marginLeft:mt,marginBlock:mt,marginBlockStart:mt,marginBlockEnd:mt,marginInline:mt,marginInlineStart:mt,marginInlineEnd:mt,fontSize:mt,backgroundPositionX:mt,backgroundPositionY:mt,...IU,zIndex:Ek,fillOpacity:Wd,strokeOpacity:Wd,numOctaves:Ek},_U={...Dp,color:as,backgroundColor:as,outlineColor:as,fill:as,stroke:as,borderColor:as,borderTopColor:as,borderRightColor:as,borderBottomColor:as,borderLeftColor:as,filter:uv,WebkitFilter:uv,mask:dv,WebkitMask:dv},jO=e=>_U[e],LU=new Set([uv,dv]);function uw(e,t){let r=jO(e);return LU.has(r)||(r=Sr),r.getAnimatableNone?r.getAnimatableNone(t):void 0}function BU(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const El=e=>e*180/Math.PI,fv=e=>{const t=El(Math.atan2(e[1],e[0]));return mv(t)},$U={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:fv,rotateZ:fv,skewX:e=>El(Math.atan(e[1])),skewY:e=>El(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},mv=e=>(e=e%360,e<0&&(e+=360),e),Rk=fv,Ak=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Ok=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),VU={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ak,scaleY:Ok,scale:e=>(Ak(e)+Ok(e))/2,rotateX:e=>mv(El(Math.atan2(e[6],e[5]))),rotateY:e=>mv(El(Math.atan2(-e[2],e[0]))),rotateZ:Rk,rotate:Rk,skewX:e=>El(Math.atan(e[4])),skewY:e=>El(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function hv(e){return e.includes("scale")?1:0}function pv(e,t){if(!e||e==="none")return hv(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let a,l;if(r)a=VU,l=r;else{const f=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);a=$U,l=f}if(!l)return hv(t);const c=a[t],u=l[1].split(",").map(HU);return typeof c=="function"?c(u):u[c]}const UU=(e,t)=>{const{transform:r="none"}=getComputedStyle(e);return pv(r,t)};function HU(e){return parseFloat(e.trim())}const vu=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],wu=new Set([...vu,"pathRotation"]),Mk=e=>e===yu||e===mt,FU=new Set(["x","y","z"]),GU=vu.filter(e=>!FU.has(e));function qU(e){const t=[];return GU.forEach(r=>{const a=e.getValue(r);if(a!==void 0){const l=a.get(),c=r.startsWith("scale")?1:0;if(l===c)return;t.push([r,l]),a.set(c)}}),t}const YU=new Set(["bottom","right"]);function Dk(e,t,r,a,l,c){const u=parseFloat(e);if(!isNaN(u))return u;const{min:f,max:m}=t()[r],h=m-f;return c==="border-box"?h:h-parseFloat(a)-parseFloat(l)}const Ol={width:({width:e,paddingLeft:t="0",paddingRight:r="0",boxSizing:a},l)=>Dk(e,l,"x",t,r,a),height:({height:e,paddingTop:t="0",paddingBottom:r="0",boxSizing:a},l)=>Dk(e,l,"y",t,r,a),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{const{y:r}=t();return parseFloat(e)+(r.max-r.min)},right:({left:e},t)=>{const{x:r}=t();return parseFloat(e)+(r.max-r.min)},x:({transform:e})=>pv(e,"x"),y:({transform:e})=>pv(e,"y")};Ol.translateX=Ol.x;Ol.translateY=Ol.y;const Ml=new Set;let gv=!1,xv=!1,bv=!1;function SO(){if(xv){const e=[],t=new Set,r=new Set;Ml.forEach(l=>{l.needsMeasurement&&(e.push(l),t.add(l.element),YU.has(l.name)&&r.add(l.element))});const a=new Map;r.forEach(l=>{const c=qU(l);c.length&&(a.set(l,c),l.render())}),e.forEach(l=>l.measureInitialState()),t.forEach(l=>{l.render();const c=a.get(l);c&&c.forEach(([u,f])=>{var m;(m=l.getValue(u))==null||m.set(f)})}),e.forEach(l=>l.measureEndState()),e.forEach(l=>{l.suspendedScrollY!==void 0&&window.scrollTo(0,l.suspendedScrollY)})}xv=!1,gv=!1,Ml.forEach(e=>e.complete(bv)),Ml.clear()}function NO(){Ml.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(xv=!0)})}function KU(){bv=!0,NO(),SO(),bv=!1}function XU(e,t,r){if(typeof e=="string"){if(Q1(e)||Z1(e))return parseFloat(e);if(!Sr.test(e)&&Sr.test(r))return uw(t,r)}return e??void 0}class dw{constructor(t,r,a,l,c,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=r,this.name=a,this.motionValue=l,this.element=c,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(Ml.add(this),gv||(gv=!0,un.read(NO),un.resolveKeyframes(SO))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:r,element:a,motionValue:l}=this;if(t[0]===null){const c=l==null?void 0:l.get(),u=t[t.length-1];if(c!==void 0)t[0]=c;else if(a&&r){const f=XU(a.readValue(r,u),r,u);f!==void 0&&(t[0]=f)}t[0]===void 0&&(t[0]=u),l&&c===void 0&&l.set(t[0])}BU(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ml.delete(this)}cancel(){this.state==="scheduled"&&(Ml.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const WU=e=>e.startsWith("--");function CO(e,t,r){WU(t)?e.style.setProperty(t,r):e.style[t]=r}const QU={};function kO(e,t){const r=W5(e);return()=>QU[t]??r()}const ZU=kO(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),TO=kO(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Od=([e,t,r,a])=>`cubic-bezier(${e}, ${t}, ${r}, ${a})`,zk={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Od([0,.65,.55,1]),circOut:Od([.55,0,1,.45]),backIn:Od([.31,.01,.66,-.59]),backOut:Od([.33,1.53,.69,.99])};function EO(e,t){if(e)return typeof e=="function"?TO()?xO(e,t):"ease-out":aO(e)?Od(e):Array.isArray(e)?e.map(r=>EO(r,t)||zk.easeOut):zk[e]}function JU(e,t,r,{delay:a=0,duration:l=300,repeat:c=0,repeatType:u="loop",ease:f="easeOut",times:m}={},h=void 0){const g={[t]:r};m&&(g.offset=m);const p=EO(f,l);Array.isArray(p)&&(g.easing=p);const b={delay:a,duration:l,easing:Array.isArray(p)?"linear":p,fill:"both",iterations:c+1,direction:u==="reverse"?"alternate":"normal"};return h&&(b.pseudoElement=h),e.animate(g,b)}function RO(e){return typeof e=="function"&&"applyToOptions"in e}function eH({type:e,...t}){return RO(e)&&TO()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class AO extends Gg{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:r,name:a,keyframes:l,pseudoElement:c,allowFlatten:u=!1,finalKeyframe:f,onComplete:m}=t;this.isPseudoElement=!!c,this.allowFlatten=u,this.options=t,Hg(typeof t.type!="string");const h=eH(t);this.animation=JU(r,a,l,h,c),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const g=Fg(l,this.options,f,this.speed);this.updateMotionValue&&this.updateMotionValue(g),CO(r,a,g),this.animation.cancel()}m==null||m(),this.notifyFinished()},wO(this,t,h)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,r;(r=(t=this.animation).finish)==null||r.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var r,a,l;const t=(r=this.options)==null?void 0:r.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((l=(a=this.animation).commitStyles)==null||l.call(a))}get duration(){var r,a;const t=((a=(r=this.animation.effect)==null?void 0:r.getComputedTiming)==null?void 0:a.call(r).duration)||0;return jr(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+jr(t)}get time(){return jr(Number(this.animation.currentTime)||0)}set time(t){const r=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Fr(t),r&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:r,rangeEnd:a,observe:l}){var c;return this.allowFlatten&&((c=this.animation.effect)==null||c.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&ZU()?(this.animation.timeline=t,r&&(this.animation.rangeStart=r),a&&(this.animation.rangeEnd=a),wo):l(this)}}const OO={anticipate:sO,backInOut:nO,circInOut:oO};function tH(e){return e in OO}function nH(e){typeof e.ease=="string"&&tH(e.ease)&&(e.ease=OO[e.ease])}const Z0=10;class sH extends AO{constructor(t){nH(t),cw(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:r,onUpdate:a,onComplete:l,element:c,...u}=this.options;if(!r)return;if(t!==void 0){r.set(t);return}const f=new Mp({...u,autoplay:!1}),m=Math.max(Z0,vs.now()-this.startTime),h=Co(0,Z0,m-Z0),g=f.sample(m).value,{name:p}=this.options;c&&p&&CO(c,p,g),r.setWithVelocity(f.sample(Math.max(0,m-h)).value,g,h),f.stop()}}const Pk=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Sr.test(e)||e==="0")&&!e.startsWith("url("));function rH(e){const t=e[0];if(e.length===1)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}function oH(e,t,r,a){const l=e[0];if(l===null)return!1;if(t==="display"||t==="visibility")return!0;const c=e[e.length-1],u=Pk(l,t),f=Pk(c,t);return!u||!f?!1:rH(e)||(r==="spring"||RO(r))&&a}function yv(e){e.duration=0,e.type="keyframes"}const vv=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),aH=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function iH(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&aH.test(e[t]))return!0;return!1}const Ik=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),lH=W5(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function cH(e){var p;const{motionValue:t,name:r,repeatDelay:a,repeatType:l,damping:c,type:u,keyframes:f}=e;if(!r||!(vv.has(r)||Ik.has(r)))return!1;const m=(p=t==null?void 0:t.owner)==null?void 0:p.current;if(!(m instanceof HTMLElement)&&!(m instanceof SVGElement))return!1;const{onUpdate:h,transformTemplate:g}=t.owner.getProps();return lH()&&(vv.has(r)||Ik.has(r)&&iH(f))&&(r!=="transform"||!g)&&!h&&!a&&l!=="mirror"&&c!==0&&u!=="inertia"}const uH=40;class dH extends Gg{constructor(t){var m;super(),this.stop=()=>{var h,g;this._animation&&(this._animation.stop(),(h=this.stopTimeline)==null||h.call(this)),(g=this.keyframeResolver)==null||g.cancel()},this.createdAt=vs.now();const{keyframes:r,name:a,motionValue:l,element:c}=t,u=t;u.autoplay??(u.autoplay=!0),u.delay??(u.delay=0),u.type??(u.type="keyframes"),u.repeat??(u.repeat=0),u.repeatDelay??(u.repeatDelay=0),u.repeatType??(u.repeatType="loop");const f=(c==null?void 0:c.KeyframeResolver)||dw;this.keyframeResolver=new f(r,(h,g,p)=>this.onKeyframesResolved(h,g,u,!p),a,l,c),(m=this.keyframeResolver)==null||m.scheduleResolve()}onKeyframesResolved(t,r,a,l){var C,N;this.keyframeResolver=void 0;const{name:c,type:u,velocity:f,delay:m,isHandoff:h,onUpdate:g}=a;this.resolvedAt=vs.now();let p=!0;oH(t,c,u,f)||(p=!1,(Aa.instantAnimations||!m)&&(g==null||g(Fg(t,a,r))),t[0]=t[t.length-1],yv(a),a.repeat=0);const b=l?this.resolvedAt?this.resolvedAt-this.createdAt>uH?this.resolvedAt:this.createdAt:this.createdAt:void 0,{onComplete:v}=a;a.startTime??(a.startTime=b),a.finalKeyframe=r,a.keyframes=t,a.onComplete=()=>{v==null||v(),this.notifyFinished()};const j=p&&!h&&cH(a);let S;if(j){a.element=(N=(C=a.motionValue)==null?void 0:C.owner)==null?void 0:N.current;try{S=new sH(a)}catch{S=new Mp(a)}}else S=new Mp(a);this.pendingTimeline&&(this.stopTimeline=S.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=S}get finished(){return this._animation?this._animation.finished:super.finished}then(t,r){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),KU()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function MO(e,t,r,a=0,l=1){const c=Array.from(e).sort((h,g)=>h.sortNodePosition(g)).indexOf(t),u=e.size,f=(u-1)*a;return typeof r=="function"?r(c,u):l===1?c*a:f-c*a}const _k=30,fH=e=>!isNaN(parseFloat(e)),_d={current:void 0};class mH{constructor(t,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{const l=vs.now();if(this.updatedAt!==l&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(const c of this.dependents)c.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=r.owner}setCurrent(t){this.current=t,this.updatedAt=vs.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=fH(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,r){var a;return t==="change"?this.onChangeSubscribe(r):((a=this.events)[t]||(a[t]=new Rp)).add(r)}onChangeSubscribe(t){const{events:r}=this;return!r.change&&!this.changeSubscriber?this.changeSubscriber=t:(r.change||(r.change=new Rp,r.change.add(this.changeSubscriber),this.changeSubscriber=void 0),r.change.add(t)),()=>{var a;this.changeSubscriber===t?this.changeSubscriber=void 0:(a=r.change)==null||a.remove(t),this.stopIfUnobserved()}}stopIfUnobserved(){un.read(()=>{var t;!this.changeSubscriber&&!((t=this.events.change)!=null&&t.getSize())&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,r,a){this.set(r),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-a}jump(t,r=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.notifyChange()}notifyChange(){var a;const{current:t,changeSubscriber:r}=this;r?r(t):(a=this.events.change)==null||a.notify(t)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return _d.current&&_d.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=vs.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>_k)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,_k);return Q5(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(t){return this.stop(),new Promise(r=>{var c;this.hasAnimated=!0;let a=!1,l;l=t(()=>{var u;a=!0,(u=this.events.animationComplete)==null||u.notify(),this.animation===l&&this.clearAnimation(),r()}),a||(this.animation=l),(c=this.events.animationStart)==null||c.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){var t,r;(t=this.dependents)==null||t.clear(),(r=this.events.destroy)==null||r.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function $l(e,t){return new mH(e,t)}function DO(e,t){if(e!=null&&e.inherit&&t){const{inherit:r,...a}=e;return{...t,...a}}return e}function fw(e,t){const r=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return r!==e?DO(r,e):r}const hH={type:"spring",stiffness:500,damping:25,restSpeed:10},pH=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),gH={type:"keyframes",duration:.8},xH={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},bH=(e,{keyframes:t})=>t.length>2?gH:wu.has(e)?e.startsWith("scale")?pH(t[1]):hH:xH,yH=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function vH(e){for(const t in e)if(!yH.has(t))return!0;return!1}const mw=(e,t,r,a={},l,c)=>u=>{const f=fw(a,e)||{},m=f.delay||a.delay||0;let{elapsed:h=0}=a;h=h-Fr(m);const g={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...f,delay:-h,onUpdate:b=>{t.set(b),f.onUpdate&&f.onUpdate(b)},onComplete:()=>{u(),f.onComplete&&f.onComplete()},name:e,motionValue:t,element:c?void 0:l};vH(f)||Object.assign(g,bH(e,g)),g.duration&&(g.duration=Fr(g.duration)),g.repeatDelay&&(g.repeatDelay=Fr(g.repeatDelay)),g.from!==void 0&&(g.keyframes[0]=g.from);let p=!1;if((g.type===!1||g.duration===0&&!g.repeatDelay)&&(yv(g),g.delay===0&&(p=!0)),(Aa.instantAnimations||Aa.skipAnimations||l!=null&&l.shouldSkipAnimations||f.skipAnimations)&&(p=!0,yv(g),g.delay=0),g.allowFlatten=!f.type&&!f.ease,p&&!c&&t.get()!==void 0){const b=Fg(g.keyframes,f);if(b!==void 0){un.update(()=>{g.onUpdate(b),g.onComplete()});return}}return f.isSync?new Mp(g):new dH(g)},wH=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function jH(e){const t=wH.exec(e);if(!t)return[,];const[,r,a,l]=t;return[`--${r??a}`,l]}function zO(e,t,r=1){const[a,l]=jH(e);if(!a)return;const c=window.getComputedStyle(t).getPropertyValue(a);if(c){const u=c.trim();return Q1(u)?parseFloat(u):u}return nw(l)?zO(l,t,r+1):l}function Lk(e){const t=[{},{}];return e==null||e.values.forEach((r,a)=>{t[0][a]=r.get(),t[1][a]=r.getVelocity()}),t}function hw(e,t,r,a){if(typeof t=="function"){const[l,c]=Lk(a);t=t(r!==void 0?r:e.custom,l,c)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[l,c]=Lk(a);t=t(r!==void 0?r:e.custom,l,c)}return t}function Dl(e,t,r){const a=e.getProps();return hw(a,t,r!==void 0?r:a.custom,e)}const PO=new Set(["width","height","top","left","right","bottom",...vu]),wv=e=>Array.isArray(e);function SH(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,$l(r))}function NH(e){return wv(e)?e[e.length-1]||0:e}function CH(e,t){const r=Dl(e,t);let{transitionEnd:a={},transition:l={},...c}=r||{};c={...c,...a};for(const u in c){const f=NH(c[u]);SH(e,u,f)}}const ls=e=>!!(e&&e.getVelocity);function kH(e){return!!(ls(e)&&e.add)}function jv(e,t){const r=e.getValue("willChange");if(kH(r))return r.add(t);if(!r&&Aa.WillChange){const a=new Aa.WillChange("auto");e.addValue("willChange",a),a.add(t)}}function pw(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const TH="framerAppearId",IO="data-"+pw(TH);function _O(e){return e.props[IO]}const EH=typeof window<"u";function RH({protectedKeys:e,needsAnimating:t},r){const a=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,a}function LO(e,t,{delay:r=0,transitionOverride:a,type:l}={}){let{transition:c,transitionEnd:u,...f}=t;const m=e.getDefaultTransition();c=c?DO(c,m):m;const h=c==null?void 0:c.reduceMotion,g=c==null?void 0:c.skipAnimations;a&&(c=a);const p=[],b=l&&e.animationState&&e.animationState.getState()[l],v=c==null?void 0:c.path;v&&v.animateVisualElement(e,f,c,r,p);for(const j in f){const S=e.getValue(j,e.latestValues[j]??null),C=f[j];if(C===void 0||b&&RH(b,j))continue;const N={delay:r,...fw(c||{},j)};g&&(N.skipAnimations=!0);const E=S.get();if(E!==void 0&&!S.isAnimating()&&!Array.isArray(C)&&C===E&&!N.velocity){un.update(()=>S.set(C));continue}let T=!1;if(EH&&window.MotionHandoffAnimation){const M=_O(e);if(M){const R=window.MotionHandoffAnimation(M,j,un);R!==null&&(N.startTime=R,T=!0)}}jv(e,j);const A=h??e.shouldReduceMotion;S.start(mw(j,S,C,A&&PO.has(j)?{type:!1}:N,e,T));const k=S.animation;k&&p.push(k)}if(u){const j=()=>un.update(()=>{u&&CH(e,u)});p.length?Promise.all(p).then(j):j()}return p}function Sv(e,t,r={}){var m;const a=Dl(e,t,r.type==="exit"?(m=e.presenceContext)==null?void 0:m.custom:void 0);let{transition:l=e.getDefaultTransition()||{}}=a||{};r.transitionOverride&&(l=r.transitionOverride);const c=a?()=>Promise.all(LO(e,a,r)):()=>Promise.resolve(),u=e.variantChildren&&e.variantChildren.size?(h=0)=>{const{delayChildren:g=0,staggerChildren:p,staggerDirection:b}=l;return AH(e,t,h,g,p,b,r)}:()=>Promise.resolve(),{when:f}=l;if(f){const[h,g]=f==="beforeChildren"?[c,u]:[u,c];return h().then(()=>g())}else return Promise.all([c(),u(r.delay)])}function AH(e,t,r=0,a=0,l=0,c=1,u){const f=[];for(const m of e.variantChildren)m.notify("AnimationStart",t),f.push(Sv(m,t,{...u,delay:r+(typeof a=="function"?0:a)+MO(e.variantChildren,m,a,l,c)}).then(()=>m.notify("AnimationComplete",t)));return Promise.all(f)}function OH(e,t,r={}){e.notify("AnimationStart",t);let a;if(Array.isArray(t)){const l=t.map(c=>Sv(e,c,r));a=Promise.all(l)}else if(typeof t=="string")a=Sv(e,t,r);else{const l=typeof t=="function"?Dl(e,t,r.custom):t;a=Promise.all(LO(e,l,r))}return a.then(()=>{e.notify("AnimationComplete",t)})}const MH={test:e=>e==="auto",parse:e=>e},DH=e=>t=>t.test(e),zH=[yu,mt,Go,xa,Y7,q7,MH],Bk=e=>zH.find(DH(e));function PH(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Z1(e):!0}const IH=new Set(["auto","none","0"]);function _H(e,t,r){let a=0,l;for(;a<e.length&&!l;){const c=e[a];typeof c=="string"&&!IH.has(c)&&J7(c)&&(l=e[a]),a++}if(l&&r)for(const c of t)e[c]!==l&&(e[c]=uw(r,l))}class LH extends dw{constructor(t,r,a,l,c){super(t,r,a,l,c,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:r,name:a}=this;if(!r||!r.current)return;super.readKeyframes();for(let g=0;g<t.length;g++){let p=t[g];if(typeof p=="string"&&(p=p.trim(),nw(p))){const b=zO(p,r.current);b!==void 0&&(t[g]=b),g===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!PO.has(a)||t.length!==2)return;const[l,c]=t;if(typeof l=="number"&&typeof c=="number")return;const u=Bk(l),f=Bk(c),m=jk(l),h=jk(c);if(m!==h&&Ol[a]){this.needsMeasurement=!0;return}if(u!==f)if(Mk(u)&&Mk(f))for(let g=0;g<t.length;g++){const p=t[g];typeof p=="string"&&(t[g]=parseFloat(p))}else Ol[a]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:r}=this,a=[];for(let l=0;l<t.length;l++)(t[l]===null||PH(t[l]))&&a.push(l);a.length&&_H(t,a,r)}measure(){const{element:t,name:r}=this;return Ol[r](window.getComputedStyle(t.current),()=>t.measureViewportBox())}measureInitialState(){var c;const{element:t,unresolvedKeyframes:r,name:a}=this;if(!t||!t.current)return;a==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),r[0]=this.measuredOrigin;const l=r[r.length-1];l!==void 0&&((c=this.motionValue)==null||c.jump(l,!1))}measureEndState(){var c,u;const{element:t,unresolvedKeyframes:r}=this;if(!t||!t.current)return;(c=this.motionValue)==null||c.jump(this.measuredOrigin,!1);const a=r.length-1,l=r[a];r[a]=this.measure(),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),(u=this.removedTransforms)!=null&&u.length&&this.removedTransforms.forEach(([f,m])=>{t.getValue(f).set(m)}),this.resolveNoneKeyframes()}}const gw=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Kh(e){return X5(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function xw(e){return X5(e)&&"ownerSVGElement"in e}const Nv=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function bw(e,t,r){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){const l=document.querySelectorAll(e);return l?Array.from(l):[]}return Array.from(e).filter(a=>a!=null)}const BH={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$H=vu.length;function VH(e,t,r){let a="",l=!0;for(let u=0;u<$H;u++){const f=vu[u],m=e[f];if(m===void 0)continue;let h=!0;if(typeof m=="number")h=m===(f.startsWith("scale")?1:0);else{const g=parseFloat(m);h=f.startsWith("scale")?g===1:g===0}if(!h||r){const g=Nv(m,Dp[f]);if(!h){l=!1;const p=BH[f]||f;a+=`${p}(${g}) `}r&&(t[f]=g)}}const c=e.pathRotation;return c&&(l=!1,a+=`rotate(${Nv(c,Dp.pathRotation)}) `),a=a.trim(),r?a=r(t,l?"":a):l&&(a="none"),a}function yw(e,t,r){const{style:a,vars:l,transformOrigin:c}=e;let u=!1,f=!1;for(const m in t){const h=t[m];if(wu.has(m)){u=!0;continue}else if(cO(m)){l[m]=h;continue}else{const g=Nv(h,Dp[m]);m.startsWith("origin")?(f=!0,c[m]=g):a[m]=g}}if(t.transform||(u||r?a.transform=VH(t,e.transform,r):a.transform&&(a.transform="none")),f){const{originX:m="50%",originY:h="50%",originZ:g=0}=c;a.transformOrigin=`${m} ${h} ${g}`}}const UH={offset:"stroke-dashoffset",array:"stroke-dasharray"},HH={offset:"strokeDashoffset",array:"strokeDasharray"};function FH(e,t,r=1,a=0,l=!0){e.pathLength=1;const c=l?UH:HH;e[c.offset]=`${-a}`,e[c.array]=`${t} ${r}`}const BO=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function $O(e,{attrX:t,attrY:r,attrScale:a,pathLength:l,pathSpacing:c=1,pathOffset:u=0,...f},m,h,g){if(yw(e,f,h),m){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:p,style:b}=e;for(const v of BO)p[v]!==void 0&&(b[v]=p[v],delete p[v]);(b.transform||p.transformOrigin)&&(b.transformOrigin=p.transformOrigin??"50% 50%",delete p.transformOrigin),b.transform&&(b.transformBox=(g==null?void 0:g.transformBox)??"fill-box",delete p.transformBox),t!==void 0&&(p.x=t),r!==void 0&&(p.y=r),a!==void 0&&(p.scale=a),l!==void 0&&FH(p,l,c,u,!1)}function VO({top:e,left:t,right:r,bottom:a}){return{x:{min:t,max:r},y:{min:e,max:a}}}function GH({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function qH(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),a=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:a.y,right:a.x}}function J0(e){return e===void 0||e===1}function Cv({scale:e,scaleX:t,scaleY:r}){return!J0(e)||!J0(t)||!J0(r)}function jl(e){return Cv(e)||UO(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function UO(e){return $k(e.x)||$k(e.y)}function $k(e){return e&&e!=="0%"}function zp(e,t,r){const a=e-r,l=t*a;return r+l}function Vk(e,t,r,a,l){return l!==void 0&&(e=zp(e,l,a)),zp(e,r,a)+t}function kv(e,t=0,r=1,a,l){e.min=Vk(e.min,t,r,a,l),e.max=Vk(e.max,t,r,a,l)}function HO(e,{x:t,y:r}){kv(e.x,t.translate,t.scale,t.originPoint),kv(e.y,r.translate,r.scale,r.originPoint)}const Uk=.999999999999,Hk=1.0000000000001;function YH(e,t,r,a=!1){var f;const l=r.length;if(!l)return;t.x=t.y=1;let c,u;for(let m=0;m<l;m++){c=r[m],u=c.projectionDelta;const{visualElement:h}=c.options;h&&h.props.style&&h.props.style.display==="contents"||(a&&c.options.layoutScroll&&c.scroll&&c!==c.root&&(Uo(e.x,-c.scroll.offset.x),Uo(e.y,-c.scroll.offset.y)),u&&(t.x*=u.x.scale,t.y*=u.y.scale,HO(e,u)),a&&jl(c.latestValues)&&Xh(e,c.latestValues,(f=c.layout)==null?void 0:f.layoutBox))}t.x<Hk&&t.x>Uk&&(t.x=1),t.y<Hk&&t.y>Uk&&(t.y=1)}function Uo(e,t){e.min+=t,e.max+=t}function Fk(e,t,r,a,l=.5){const c=pn(e.min,e.max,l);kv(e,t,r,c,a)}function Gk(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Xh(e,t,r){const a=r??e;Fk(e.x,Gk(t.x,a.x),t.scaleX,t.scale,t.originX),Fk(e.y,Gk(t.y,a.y),t.scaleY,t.scale,t.originY)}function FO(e,t){return VO(qH(e.getBoundingClientRect(),t))}function KH(e,t,r){const a=FO(e,r),{scroll:l}=t;return l&&(Uo(a.x,l.offset.x),Uo(a.y,l.offset.y)),a}const{schedule:vw}=iO(queueMicrotask,!1),po={x:!1,y:!1};function GO(){return po.x||po.y}function XH(e){return e==="x"||e==="y"?po[e]?null:(po[e]=!0,()=>{po[e]=!1}):po.x||po.y?null:(po.x=po.y=!0,()=>{po.x=po.y=!1})}function qO(e,t){const r=bw(e),a=new AbortController,l={passive:!0,...t,signal:a.signal};return[r,l,()=>a.abort()]}function WH(e){return!(e.pointerType==="touch"||GO())}function QH(e,t,r={}){const[a,l,c]=qO(e,r);return a.forEach(u=>{let f=!1,m=!1,h;const g=()=>{u.removeEventListener("pointerleave",j)},p=C=>{h&&(h(C),h=void 0),g()},b=C=>{f=!1,window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b),m&&(m=!1,p(C))},v=()=>{f=!0,window.addEventListener("pointerup",b,l),window.addEventListener("pointercancel",b,l)},j=C=>{if(C.pointerType!=="touch"){if(f){m=!0;return}p(C)}},S=C=>{if(!WH(C))return;m=!1;const N=t(u,C);typeof N=="function"&&(h=N,u.addEventListener("pointerleave",j,l))};u.addEventListener("pointerenter",S,l),u.addEventListener("pointerdown",v,l)}),c}const YO=(e,t)=>t?e===t?!0:YO(e,t.parentElement):!1,ww=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,ZH=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function JH(e){return ZH.has(e.tagName)||e.isContentEditable===!0}const e9=new Set(["INPUT","SELECT","TEXTAREA"]);function t9(e){return e9.has(e.tagName)||e.isContentEditable===!0}const Wh=new WeakSet;function qk(e){return t=>{t.key==="Enter"&&e(t)}}function ey(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const n9=(e,t)=>{const r=e.currentTarget;if(!r)return;const a=qk(()=>{if(Wh.has(r))return;ey(r,"down");const l=qk(()=>{ey(r,"up")}),c=()=>ey(r,"cancel");r.addEventListener("keyup",l,t),r.addEventListener("blur",c,t)});r.addEventListener("keydown",a,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",a),t)};function Yk(e){return ww(e)&&!GO()}const Kk=new WeakSet;function s9(e,t,r={}){const[a,l,c]=qO(e,r),u=f=>{const m=f.currentTarget;if(!Yk(f)||Kk.has(f))return;Wh.add(m),r.stopPropagation&&Kk.add(f);const h=t(m,f),g={...l,capture:!0},p=(j,S)=>{window.removeEventListener("pointerup",b,g),window.removeEventListener("pointercancel",v,g),Wh.has(m)&&Wh.delete(m),Yk(j)&&typeof h=="function"&&h(j,{success:S})},b=j=>{p(j,m===window||m===document||r.useGlobalTarget||YO(m,j.target))},v=j=>{p(j,!1)};window.addEventListener("pointerup",b,g),window.addEventListener("pointercancel",v,g)};return a.forEach(f=>{(r.useGlobalTarget?window:f).addEventListener("pointerdown",u,l),Kh(f)&&(f.addEventListener("focus",h=>n9(h,l)),!JH(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),c}const Qh=new WeakMap;let wi;const KO=(e,t,r)=>(a,l)=>l&&l[0]?l[0][e+"Size"]:xw(a)&&"getBBox"in a?a.getBBox()[t]:a[r],r9=KO("inline","width","offsetWidth"),o9=KO("block","height","offsetHeight");function a9({target:e,borderBoxSize:t}){var r;(r=Qh.get(e))==null||r.forEach(a=>{a(e,{get width(){return r9(e,t)},get height(){return o9(e,t)}})})}function i9(e){e.forEach(a9)}function l9(){typeof ResizeObserver>"u"||(wi=new ResizeObserver(i9))}function c9(e,t){wi||l9();const r=bw(e);return r.forEach(a=>{let l=Qh.get(a);l||(l=new Set,Qh.set(a,l)),l.add(t),wi==null||wi.observe(a)}),()=>{r.forEach(a=>{const l=Qh.get(a);l==null||l.delete(t),l!=null&&l.size||wi==null||wi.unobserve(a)})}}const Zh=new Set;let qc;function u9(){qc=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Zh.forEach(t=>t(e))},window.addEventListener("resize",qc)}function d9(e){return Zh.add(e),qc||u9(),()=>{Zh.delete(e),!Zh.size&&typeof qc=="function"&&(window.removeEventListener("resize",qc),qc=void 0)}}function Xk(e,t){return typeof e=="function"?d9(e):c9(e,t)}function f9(e){return xw(e)&&e.tagName==="svg"}function m9(...e){const t=!Array.isArray(e[0]),r=t?0:-1,a=e[0+r],l=e[1+r],c=e[2+r],u=e[3+r],f=bO(l,c,u);return t?f(a):f}const Md=new Set,Wk=({timestamp:e})=>{Md.forEach(t=>t.tick(e))};class h9 extends Gg{constructor(t){super(),this.state="idle",this.startTime=0,this.currentTime=0,this.started=!1,this.hasNextTarget=!1,this.nextTarget=0,this.stop=()=>{var a,l;this.state!=="idle"&&(this.teardown(),(l=(a=this.options).onStop)==null||l.call(a))},this.options=t,cw(t),this.factory=t.type||tu,this.generator=this.factory(t);const{driver:r}=t;r&&(this.driver=r(a=>this.tick(a))),this.startTime=this.now(),this.state="running",this.driver?this.driver.start():(Md.size||un.update(Wk,!0),Md.add(this))}setTarget(t,r){this.nextTarget=t,this.nextVelocity=r,this.hasNextTarget=!0}retarget(t,r){const{options:a,generator:l}=this;a.keyframes=t,a.velocity=r,this.startTime=this.now(),this.currentTime=0,l.retarget?l.retarget(t,r):this.generator=this.factory(a)}tick(t){var p;const{options:r,hasNextTarget:a}=this,{delay:l=0,onUpdate:c,onPlay:u}=r,f=Math.round(t-this.startTime)-l,m=this.currentTime=Math.max(0,f),h=this.generator.next(m),g=f<0?r.keyframes[0]:h.value;if(a){this.hasNextTarget=!1;const{keyframes:b}=r;b[0]=g,b[1]=this.nextTarget,this.retarget(b,this.nextVelocity??this.getGeneratorVelocity())}(a||!this.started)&&(this.started=!0,u==null||u()),this.state==="running"&&(c==null||c(g),h.done&&f>=0&&!a&&!this.hasNextTarget&&this.state==="running"&&(this.notifyFinished(),this.teardown(),this.state="finished",(p=r.onComplete)==null||p.call(r)))}getGeneratorVelocity(){return yO(this.generator,this.currentTime,this.options.velocity)}now(){return this.driver?this.driver.now():vs.now()}teardown(){this.state="idle",this.driver?this.driver.stop():(Md.delete(this),Md.size||Qo(Wk))}}function p9(e,t,r={}){const a=e.get();let l=null,c;const u=typeof a=="string"?a.replace(/[\d.-]/g,""):void 0,f=g=>c(u?g+u:g),m=()=>{var g;return(g=e.events.animationStart)==null?void 0:g.notify()},h=()=>{l&&(l.stop(),l=null),e.animation=void 0};if(e.attach((g,p)=>{c=p;const b=Zk(g);if((l==null?void 0:l.state)==="running"){l.setTarget(b,r.velocity);return}const v=Zk(e.get()),j=l?l.getGeneratorVelocity():e.getVelocity();if(h(),v===b)return;const S={keyframes:[v,b],velocity:j,type:"spring",restDelta:.001,restSpeed:.01,...r,onUpdate:f},C=l=new h9({...S,onPlay:m});e.animation=C,C.then(()=>{var N;l===C&&(l=null,e.animation=void 0,(N=e.events.animationComplete)==null||N.notify())})},h),ls(t)){let g=r.skipInitialAnimation===!0;const p=t.on("change",v=>{g?(g=!1,e.jump(Qk(v,u),!1)):e.set(Qk(v,u))}),b=e.on("destroy",p);return()=>{p(),b()}}return h}function Qk(e,t){return t?e+t:e}function Zk(e){return typeof e=="number"?e:parseFloat(e)}const Jk=()=>({translate:0,scale:1,origin:0,originPoint:0}),Yc=()=>({x:Jk(),y:Jk()}),eT=()=>({min:0,max:0}),os=()=>({x:eT(),y:eT()}),g9=new WeakMap;function qg(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Zd(e){return typeof e=="string"||Array.isArray(e)}const jw=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Pp=["initial",...jw];function Yg(e){if(qg(e.animate))return!0;for(let t=0;t<Pp.length;t++)if(Zd(e[Pp[t]]))return!0;return!1}function XO(e){return!!(Yg(e)||e.variants)}function x9(e,t,r){for(const a in t){const l=t[a],c=r[a];if(ls(l))e.addValue(a,l);else if(ls(c))e.addValue(a,$l(l,{owner:e}));else if(c!==l)if(e.hasValue(a)){const u=e.getValue(a);u.liveStyle===!0?u.jump(l):u.hasAnimated||u.set(l)}else{const u=e.getStaticValue(a);e.addValue(a,$l(u!==void 0?u:l,{owner:e}))}}for(const a in r)t[a]===void 0&&e.removeValue(a);return t}const Ip={current:null},Sw={current:!1},b9=typeof window<"u";function WO(){if(Sw.current=!0,!!b9)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Ip.current=e.matches;e.addEventListener("change",t),t()}else Ip.current=!1}const tT=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let _p={};function QO(e){_p=e}function y9(){return _p}class v9{scrapeMotionValuesFromProps(t,r,a){return{}}constructor({parent:t,props:r,presenceContext:a,reducedMotionConfig:l,skipAnimations:c,blockInitialAnimation:u,visualState:f},m={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=dw,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const v=vs.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,un.render(this.render,!1,!0))};const{latestValues:h,renderState:g}=f;this.latestValues=h,this.baseTarget={...h},this.initialValues=r.initial?{...h}:{},this.renderState=g,this.parent=t,this.props=r,this.presenceContext=a,this.depth=t?t.depth+1:0,this.reducedMotionConfig=l,this.skipAnimationsConfig=c,this.options=m,this.blockInitialAnimation=!!u,this.isControllingVariants=Yg(r),this.isVariantNode=XO(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:p,...b}=this.scrapeMotionValuesFromProps(r,{},this);for(const v in b){const j=b[v];h[v]!==void 0&&ls(j)&&j.set(h[v])}}mount(t){var r,a;if(this.hasBeenMounted)for(const l in this.initialValues)(r=this.values.get(l))==null||r.jump(this.initialValues[l]),this.latestValues[l]=this.initialValues[l];this.current=t,g9.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((l,c)=>this.bindToMotionValue(c,l)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Sw.current||WO(),this.shouldReduceMotion=Ip.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(a=this.parent)==null||a.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),Qo(this.notifyUpdate),Qo(this.render),this.valueSubscriptions.forEach(r=>r()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const r in this.events)this.events[r].clear();for(const r in this.features){const a=this.features[r];a&&(a.unmount(),a.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,r){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),r.accelerate&&vv.has(t)&&this.current instanceof HTMLElement){const{factory:u,keyframes:f,times:m,ease:h,duration:g}=r.accelerate,p=new AO({element:this.current,name:t,keyframes:f,times:m,ease:h,duration:Fr(g)}),b=u(p);this.valueSubscriptions.set(t,()=>{b(),p.cancel()});return}const a=wu.has(t);a&&this.onBindTransform&&this.onBindTransform();const l=r.on("change",u=>{this.latestValues[t]=u,this.props.onUpdate&&un.preRender(this.notifyUpdate),a&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let c;typeof window<"u"&&window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,t,r)),this.valueSubscriptions.set(t,()=>{l(),c&&c()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in _p){const r=_p[t];if(!r)continue;const{isEnabled:a,Feature:l}=r;if(!this.features[t]&&l&&a(this.props)&&(this.features[t]=new l(this)),this.features[t]){const c=this.features[t];c.isMounted?c.update():(c.mount(),c.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):os()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let a=0;a<tT.length;a++){const l=tT[a];this.propEventSubscriptions[l]&&(this.propEventSubscriptions[l](),delete this.propEventSubscriptions[l]);const c="on"+l,u=t[c];u&&(this.propEventSubscriptions[l]=this.on(l,u))}this.prevMotionValues=x9(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(t),()=>r.variantChildren.delete(t)}addValue(t,r){const a=this.values.get(t);r!==a&&(a&&this.removeValue(t),this.bindToMotionValue(t,r),this.values.set(t,r),this.latestValues[t]=r.get())}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let a=this.values.get(t);return a===void 0&&r!==void 0&&(a=$l(r===null?void 0:r,{owner:this}),this.addValue(t,a)),a}readValue(t,r){let a=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return a!=null&&(typeof a=="string"&&(Q1(a)||Z1(a))?a=parseFloat(a):typeof a!="number"&&!Sr.test(a)&&Sr.test(r)&&(a=uw(t,r)),this.setBaseTarget(t,ls(a)?a.get():a)),ls(a)?a.get():a}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var c;const{initial:r}=this.props;let a;if(typeof r=="string"||typeof r=="object"){const u=hw(this.props,r,(c=this.presenceContext)==null?void 0:c.custom);u&&(a=u[t])}if(r&&a!==void 0)return a;const l=this.getBaseTargetFromProps(this.props,t);return l!==void 0&&!ls(l)?l:this.initialValues[t]!==void 0&&a===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new Rp),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}scheduleRenderMicrotask(){vw.render(this.render)}}class ZO extends v9{constructor(){super(...arguments),this.KeyframeResolver=LH}sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){const a=t.style;return a?a[r]:void 0}removeValueFromRenderState(t,{vars:r,style:a}){delete r[t],delete a[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ls(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}class Bi{constructor(t){this.isMounted=!1,this.node=t}update(){}}function JO(e,{style:t,vars:r},a,l){const c=e.style;let u;for(u in t)c[u]=t[u];l==null||l.applyProjectionStyles(c,a);for(u in r)c.setProperty(u,r[u])}function nT(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Nd={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(mt.test(e))e=parseFloat(e);else return e;const r=nT(e,t.target.x),a=nT(e,t.target.y);return`${r}% ${a}%`}},w9={correct:(e,{treeScale:t,projectionDelta:r})=>{const a=e,l=Sr.parse(e);if(l.length>5)return a;const c=Sr.createTransformer(e),u=typeof l[0]!="number"?1:0,f=r.x.scale*t.x,m=r.y.scale*t.y;l[0+u]/=f,l[1+u]/=m;const h=pn(f,m,.5);return typeof l[2+u]=="number"&&(l[2+u]/=h),typeof l[3+u]=="number"&&(l[3+u]/=h),c(l)}},Tv={borderRadius:{...Nd,applyTo:[...gw]},borderTopLeftRadius:Nd,borderTopRightRadius:Nd,borderBottomLeftRadius:Nd,borderBottomRightRadius:Nd,boxShadow:w9};function eM(e,{layout:t,layoutId:r}){return wu.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!Tv[e]||e==="opacity")}function Nw(e,t,r){var u;const a=e.style,l=t==null?void 0:t.style,c={};if(!a)return c;for(const f in a)(ls(a[f])||l&&ls(l[f])||eM(f,e)||((u=r==null?void 0:r.getValue(f))==null?void 0:u.liveStyle)!==void 0)&&(c[f]=a[f]);return c}function j9(e){return window.getComputedStyle(e)}class S9 extends ZO{constructor(){super(...arguments),this.type="html",this.renderInstance=JO}mount(t){Hg(!!t.style),super.mount(t)}readValueFromInstance(t,r){var a;if(wu.has(r))return(a=this.projection)!=null&&a.isProjecting?hv(r):UU(t,r);{const l=j9(t),c=(cO(r)?l.getPropertyValue(r):l[r])||0;return typeof c=="string"?c.trim():c}}measureInstanceViewportBox(t,{transformPagePoint:r}){return FO(t,r)}build(t,r,a){yw(t,r,a.transformTemplate)}scrapeMotionValuesFromProps(t,r,a){return Nw(t,r,a)}}const tM=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),nM=e=>typeof e=="string"&&e.toLowerCase()==="svg";function N9(e,t,r,a){JO(e,t,void 0,a);for(const l in t.attrs)e.setAttribute(tM.has(l)?l:pw(l),t.attrs[l])}function sM(e,t,r){const a=Nw(e,t,r);for(const l in e)if(ls(e[l])||ls(t[l])){const c=vu.indexOf(l)!==-1?"attr"+l.charAt(0).toUpperCase()+l.substring(1):l;a[c]=e[l]}return a}class C9 extends ZO{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=os}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(wu.has(r)){const a=jO(r);return a&&a.default||0}if(BO.includes(r)){const l=getComputedStyle(t)[r];if(typeof l=="string"&&l)return l.trim()}return r=tM.has(r)?r:pw(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,a){return sM(t,r,a)}build(t,r,a){$O(t,r,this.isSVGTag,a.transformTemplate,a.style)}renderInstance(t,r,a,l){N9(t,r,a,l)}mount(t){this.isSVGTag=nM(t.tagName),super.mount(t)}}const k9=Pp.length;function rM(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?rM(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;r<k9;r++){const a=Pp[r],l=e.props[a];(Zd(l)||l===!1)&&(t[a]=l)}return t}function oM(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let a=0;a<r;a++)if(t[a]!==e[a])return!1;return!0}const T9=[...jw].reverse(),E9=jw.length;function R9(e){return t=>Promise.all(t.map(({animation:r,options:a})=>OH(e,r,a)))}function A9(e){let t=R9(e),r=sT(),a=!0,l=!1;const c=h=>(g,p)=>{var v;const b=Dl(e,p,h==="exit"?(v=e.presenceContext)==null?void 0:v.custom:void 0);if(b){const{transition:j,transitionEnd:S,...C}=b;g={...g,...C,...S}}return g};function u(h){t=h(e)}function f(h){const{props:g}=e,p=rM(e.parent)||{},b=[],v=new Set;let j={},S=1/0;for(let N=0;N<E9;N++){const E=T9[N],T=r[E],A=g[E]!==void 0?g[E]:p[E],k=Zd(A),M=E===h?T.isActive:null;M===!1&&(S=N);let R=A===p[E]&&A!==g[E]&&k;if(R&&(a||l)&&e.manuallyAnimateOnMount&&(R=!1),T.protectedKeys={...j},!T.isActive&&M===null||!A&&!T.prevProp||qg(A)||typeof A=="boolean")continue;if(E==="exit"&&T.isActive&&M!==!0){T.prevResolvedValues&&(j={...j,...T.prevResolvedValues});continue}const O=O9(T.prevProp,A);let D=O||E===h&&T.isActive&&!R&&k||N>S&&k,_=!1;const L=Array.isArray(A)?A:[A];let q=L.reduce(c(E),{});M===!1&&(q={});const{prevResolvedValues:P={}}=T,$={...P,...q},H=G=>{D=!0,v.has(G)&&(_=!0,v.delete(G)),T.needsAnimating[G]=!0;const X=e.getValue(G);X&&(X.liveStyle=!1)};for(const G in $){const X=q[G],B=P[G];if(j.hasOwnProperty(G))continue;let Z=!1;wv(X)&&wv(B)?Z=!oM(X,B)||O:Z=X!==B,Z?X!=null?H(G):v.add(G):X!==void 0&&v.has(G)?H(G):T.protectedKeys[G]=!0}T.prevProp=A,T.prevResolvedValues=q,T.isActive&&(j={...j,...q}),(a||l)&&e.blockInitialAnimation&&(D=!1);const F=R&&O;D&&(!F||_)&&b.push(...L.map(G=>{const X={type:E};if(typeof G=="string"&&(a||l)&&!F&&e.manuallyAnimateOnMount&&e.parent){const{parent:B}=e,Z=Dl(B,G);if(B.enteringChildren&&Z){const{delayChildren:K}=Z.transition||{};X.delay=MO(B.enteringChildren,e,K)}}return{animation:G,options:X}}))}if(v.size){const N={};if(typeof g.initial!="boolean"){const E=Dl(e,Array.isArray(g.initial)?g.initial[0]:g.initial);E&&E.transition&&(N.transition=E.transition)}v.forEach(E=>{const T=e.getBaseTarget(E),A=e.getValue(E);A&&(A.liveStyle=!0),N[E]=T??null}),b.push({animation:N})}let C=!!b.length;return a&&(g.initial===!1||g.initial===g.animate)&&!e.manuallyAnimateOnMount&&(C=!1),a=!1,l=!1,C?t(b):Promise.resolve()}function m(h,g){var b;if(r[h].isActive===g)return Promise.resolve();(b=e.variantChildren)==null||b.forEach(v=>{var j;return(j=v.animationState)==null?void 0:j.setActive(h,g)}),r[h].isActive=g;const p=f(h);for(const v in r)r[v].protectedKeys={};return p}return{animateChanges:f,setActive:m,setAnimateFunction:u,getState:()=>r,reset:()=>{r=sT(),l=!0}}}function O9(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!oM(t,e):!1}function yl(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function sT(){return{animate:yl(!0),whileInView:yl(),whileHover:yl(),whileTap:yl(),whileDrag:yl(),whileFocus:yl(),exit:yl()}}function Ev(e,t){e.min=t.min,e.max=t.max}function ho(e,t){Ev(e.x,t.x),Ev(e.y,t.y)}function rT(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const aM=1e-4,M9=1-aM,D9=1+aM,iM=.01,z9=0-iM,P9=0+iM;function Ks(e){return e.max-e.min}function I9(e,t,r){return Math.abs(e-t)<=r}function oT(e,t,r,a=.5){e.origin=a,e.originPoint=pn(t.min,t.max,e.origin),e.scale=Ks(r)/Ks(t),e.translate=pn(r.min,r.max,e.origin)-e.originPoint,(e.scale>=M9&&e.scale<=D9||isNaN(e.scale))&&(e.scale=1),(e.translate>=z9&&e.translate<=P9||isNaN(e.translate))&&(e.translate=0)}function Ld(e,t,r,a){oT(e.x,t.x,r.x,a?a.originX:void 0),oT(e.y,t.y,r.y,a?a.originY:void 0)}function aT(e,t,r,a=0){const l=a?pn(r.min,r.max,a):r.min;e.min=l+t.min,e.max=e.min+Ks(t)}function _9(e,t,r,a){aT(e.x,t.x,r.x,a==null?void 0:a.x),aT(e.y,t.y,r.y,a==null?void 0:a.y)}function iT(e,t,r,a=0){const l=a?pn(r.min,r.max,a):r.min;e.min=t.min-l,e.max=e.min+Ks(t)}function Lp(e,t,r,a){iT(e.x,t.x,r.x,a==null?void 0:a.x),iT(e.y,t.y,r.y,a==null?void 0:a.y)}function lT(e,t,r,a,l){return e-=t,e=zp(e,1/r,a),l!==void 0&&(e=zp(e,1/l,a)),e}function L9(e,t=0,r=1,a=.5,l,c=e,u=e){if(Go.test(t)&&(t=parseFloat(t),t=pn(u.min,u.max,t/100)-u.min),typeof t!="number")return;let f=pn(c.min,c.max,a);e===c&&(f-=t),e.min=lT(e.min,t,r,f,l),e.max=lT(e.max,t,r,f,l)}function cT(e,t,[r,a,l],c,u){L9(e,t[r],t[a],t[l],t.scale,c,u)}const B9=["x","scaleX","originX"],$9=["y","scaleY","originY"];function uT(e,t,r,a){cT(e.x,t,B9,r?r.x:void 0,a?a.x:void 0),cT(e.y,t,$9,r?r.y:void 0,a?a.y:void 0)}function dT(e){return e.translate===0&&e.scale===1}function lM(e){return dT(e.x)&&dT(e.y)}function fT(e,t){return e.min===t.min&&e.max===t.max}function V9(e,t){return fT(e.x,t.x)&&fT(e.y,t.y)}function mT(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function cM(e,t){return mT(e.x,t.x)&&mT(e.y,t.y)}function hT(e){return Ks(e.x)/Ks(e.y)}function pT(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Bo(e){return[e("x"),e("y")]}function U9(e,t,r){let a="";const l=e.x.translate/t.x,c=e.y.translate/t.y,u=(r==null?void 0:r.z)||0;if((l||c||u)&&(a=`translate3d(${l}px, ${c}px, ${u}px) `),(t.x!==1||t.y!==1)&&(a+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:h,rotate:g,pathRotation:p,rotateX:b,rotateY:v,skewX:j,skewY:S}=r;h&&(a=`perspective(${h}px) ${a}`),g&&(a+=`rotate(${g}deg) `),p&&(a+=`rotate(${p}deg) `),b&&(a+=`rotateX(${b}deg) `),v&&(a+=`rotateY(${v}deg) `),j&&(a+=`skewX(${j}deg) `),S&&(a+=`skewY(${S}deg) `)}const f=e.x.scale*t.x,m=e.y.scale*t.y;return(f!==1||m!==1)&&(a+=`scale(${f}, ${m})`),a||"none"}const H9=gw.length,gT=e=>typeof e=="string"?parseFloat(e):e,xT=e=>typeof e=="number"||mt.test(e);function F9(e,t,r,a,l,c){l?(e.opacity=pn(0,r.opacity??1,G9(a)),e.opacityExit=pn(t.opacity??1,0,q9(a))):c&&(e.opacity=pn(t.opacity??1,r.opacity??1,a));for(let u=0;u<H9;u++){const f=gw[u];let m=bT(t,f),h=bT(r,f);if(m===void 0&&h===void 0)continue;m||(m=0),h||(h=0),m===0||h===0||xT(m)===xT(h)?(e[f]=Math.max(pn(gT(m),gT(h),a),0),(Go.test(h)||Go.test(m))&&(e[f]+="%")):e[f]=h}(t.rotate||r.rotate)&&(e.rotate=pn(t.rotate||0,r.rotate||0,a))}function bT(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const G9=uM(0,.5,rO),q9=uM(.5,.95,wo);function uM(e,t,r){return a=>a<e?0:a>t?1:r(Xd(e,t,a))}function Y9(e,t,r){const a=ls(e)?e:$l(e);return a.start(mw("",a,t,r)),a.animation}function Jd(e,t,r,a={passive:!0}){return e.addEventListener(t,r,a),()=>e.removeEventListener(t,r,a)}const K9=(e,t)=>e.depth-t.depth;class X9{constructor(){this.children=[],this.isDirty=!1}add(t){W1(this.children,t),this.isDirty=!0}remove(t){Ep(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(K9),this.isDirty=!1,this.children.forEach(t)}}function W9(e,t){const r=vs.now(),a=({timestamp:l})=>{const c=l-r;c>=t&&(Qo(a),e(c-t))};return un.setup(a,!0),()=>Qo(a)}function Jh(e){return ls(e)?e.get():e}class Q9{constructor(){this.members=[]}add(t){W1(this.members,t);for(let r=this.members.length-1;r>=0;r--){const a=this.members[r];if(a===t||a===this.lead||a===this.prevLead)continue;const l=a.instance;(!l||l.isConnected===!1)&&!a.snapshot&&(Ep(this.members,a),a.unmount())}t.scheduleRender()}remove(t){if(Ep(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){var r;for(let a=this.members.indexOf(t)-1;a>=0;a--){const l=this.members[a];if(l.isPresent!==!1&&((r=l.instance)==null?void 0:r.isConnected)!==!1)return this.promote(l),!0}return!1}promote(t,r){var l;const a=this.lead;if(t!==a&&(this.prevLead=a,this.lead=t,t.show(),a)){a.updateSnapshot(),t.scheduleRender();const{layoutDependency:c}=a.options,{layoutDependency:u}=t.options;(c===void 0||c!==u)&&(t.resumeFrom=a,r&&(a.preserveOpacity=!0),a.snapshot&&(t.snapshot=a.snapshot,t.snapshot.latestValues=a.animationValues||a.latestValues),(l=t.root)!=null&&l.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&a.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var r,a,l,c,u;(a=(r=t.options).onExitComplete)==null||a.call(r),(u=(l=t.resumingFrom)==null?void 0:(c=l.options).onExitComplete)==null||u.call(c)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const ep={hasAnimatedSinceResize:!0,hasEverUpdated:!1},ty=["","X","Y","Z"],Z9=1e3;let J9=0;function ny(e,t,r,a){const{latestValues:l}=t;l[e]&&(r[e]=l[e],t.setStaticValue(e,0),a&&(a[e]=0))}function dM(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=_O(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:l,layoutId:c}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",un,!(l||c))}const{parent:a}=e;a&&!a.hasCheckedOptimisedAppear&&dM(a)}function fM({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:a,resetTransform:l}){return class{constructor(u={},f=t==null?void 0:t()){this.id=J9++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(nF),this.nodes.forEach(lF),this.nodes.forEach(cF),this.nodes.forEach(sF)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let m=0;m<this.path.length;m++)this.path[m].shouldResetTransform=!0;this.root===this&&(this.nodes=new X9)}addEventListener(u,f){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Rp),this.eventHandlers.get(u).add(f)}notifyListeners(u,...f){const m=this.eventHandlers.get(u);m&&m.notify(...f)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=xw(u)&&!f9(u),this.instance=u;const{layoutId:f,layout:m,visualElement:h}=this.options;if(h&&!h.current&&h.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(m||f)&&(this.isLayoutDirty=!0),e){let g,p=0;const b=()=>this.root.updateBlockedByResize=!1;un.read(()=>{p=window.innerWidth}),e(u,()=>{const v=window.innerWidth;v!==p&&(p=v,this.root.updateBlockedByResize=!0,g&&g(),g=W9(b,250),ep.hasAnimatedSinceResize&&(ep.hasAnimatedSinceResize=!1,this.nodes.forEach(wT)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&h&&(f||m)&&this.addEventListener("didUpdate",({delta:g,hasLayoutChanged:p,hasRelativeLayoutChanged:b,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const j=this.options.transition||h.getDefaultTransition()||hF,{onLayoutAnimationStart:S,onLayoutAnimationComplete:C}=h.getProps(),N=!this.targetLayout||!cM(this.targetLayout,v),E=!p&&b;if(this.options.layoutRoot||this.resumeFrom||E||p&&(N||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...fw(j,"layout"),onPlay:S,onComplete:C};(h.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(g,E,T.path)}else p||wT(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Qo(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(uF),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&dM(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let g=0;g<this.path.length;g++){const p=this.path[g];p.shouldResetTransform=!0,(typeof p.latestValues.x=="string"||typeof p.latestValues.y=="string")&&(p.isLayoutDirty=!0),p.updateScroll("snapshot"),p.options.layoutRoot&&p.willUpdate(!1)}const{layoutId:f,layout:m}=this.options;if(f===void 0&&!m)return;const h=this.getTransformTemplate();this.prevTransformTemplateValue=h?h(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const m=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),m&&this.nodes.forEach(oF),this.nodes.forEach(yT);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(vT);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(aF),this.nodes.forEach(iF),this.nodes.forEach(eF),this.nodes.forEach(tF)):this.nodes.forEach(vT),this.clearAllSnapshots();const f=vs.now();ys.delta=Co(0,1e3/60,f-ys.timestamp),ys.timestamp=f,ys.isProcessing=!0,q0.update.process(ys),q0.preRender.process(ys),q0.render.process(ys),ys.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,vw.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(rF),this.sharedNodes.forEach(dF)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,un.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){un.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ks(this.snapshot.measuredBox.x)&&!Ks(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let m=0;m<this.path.length;m++)this.path[m].updateScroll();const u=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=os()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(f=!1),f&&this.instance){const m=a(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:m,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:m}}}resetTransform(){if(!l)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!lM(this.projectionDelta),m=this.getTransformTemplate(),h=m?m(this.latestValues,""):void 0,g=h!==this.prevTransformTemplateValue;u&&this.instance&&(f||jl(this.latestValues)||g)&&(l(this.instance,h),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const f=this.measurePageBox();let m=this.removeElementScroll(f);return u&&(m=this.removeTransform(m)),pF(m),{animationId:this.root.animationId,measuredBox:f,layoutBox:m,latestValues:{},source:this.id}}measurePageBox(){var h;const{visualElement:u}=this.options;if(!u)return os();const f=u.measureViewportBox();if(!(((h=this.scroll)==null?void 0:h.wasRoot)||this.path.some(gF))){const{scroll:g}=this.root;g&&(Uo(f.x,g.offset.x),Uo(f.y,g.offset.y))}return f}removeElementScroll(u){var m;const f=os();if(ho(f,u),(m=this.scroll)!=null&&m.wasRoot)return f;for(let h=0;h<this.path.length;h++){const g=this.path[h],{scroll:p,options:b}=g;g!==this.root&&p&&b.layoutScroll&&(p.wasRoot&&ho(f,u),Uo(f.x,p.offset.x),Uo(f.y,p.offset.y))}return f}applyTransform(u,f=!1,m){var g,p;const h=m||os();ho(h,u);for(let b=0;b<this.path.length;b++){const v=this.path[b];!f&&v.options.layoutScroll&&v.scroll&&v!==v.root&&(Uo(h.x,-v.scroll.offset.x),Uo(h.y,-v.scroll.offset.y)),jl(v.latestValues)&&Xh(h,v.latestValues,(g=v.layout)==null?void 0:g.layoutBox)}return jl(this.latestValues)&&Xh(h,this.latestValues,(p=this.layout)==null?void 0:p.layoutBox),h}removeTransform(u){var m;const f=os();ho(f,u);for(let h=0;h<this.path.length;h++){const g=this.path[h];if(!jl(g.latestValues))continue;let p;g.instance&&(Cv(g.latestValues)&&g.updateSnapshot(),p=os(),ho(p,g.measurePageBox())),uT(f,g.latestValues,(m=g.snapshot)==null?void 0:m.layoutBox,p)}return jl(this.latestValues)&&uT(f,this.latestValues),f}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==ys.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){var v;const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const m=!!this.resumingFrom||this!==f;if(!(u||m&&this.isSharedProjectionDirty||this.isProjectionDirty||(v=this.parent)!=null&&v.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:g,layoutId:p}=this.options;if(!this.layout||!(g||p))return;this.resolvedRelativeTargetAt=ys.timestamp;const b=this.getClosestProjectingParent();b&&this.linkedParentVersion!==b.layoutVersion&&!b.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&b&&b.layout?this.createRelativeTarget(b,this.layout.layoutBox,b.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=os(),this.targetWithTransforms=os()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),_9(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ho(this.target,this.layout.layoutBox),HO(this.target,this.targetDelta)):ho(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?this.createRelativeTarget(b,this.target,b.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Cv(this.parent.latestValues)||UO(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(u,f,m){this.relativeParent=u,this.linkedParentVersion=u.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=os(),this.relativeTargetOrigin=os(),Lp(this.relativeTargetOrigin,f,m,this.options.layoutAnchor||void 0),ho(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var j;const u=this.getLead(),f=!!this.resumingFrom||this!==u;let m=!0;if((this.isProjectionDirty||(j=this.parent)!=null&&j.isProjectionDirty)&&(m=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(m=!1),this.resolvedRelativeTargetAt===ys.timestamp&&(m=!1),m)return;const{layout:h,layoutId:g}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(h||g))return;ho(this.layoutCorrected,this.layout.layoutBox);const p=this.treeScale.x,b=this.treeScale.y;YH(this.layoutCorrected,this.treeScale,this.path,f),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=os());const{target:v}=u;if(!v){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(rT(this.prevProjectionDelta.x,this.projectionDelta.x),rT(this.prevProjectionDelta.y,this.projectionDelta.y)),Ld(this.projectionDelta,this.layoutCorrected,v,this.latestValues),(this.treeScale.x!==p||this.treeScale.y!==b||!pT(this.projectionDelta.x,this.prevProjectionDelta.x)||!pT(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",v))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){var f;if((f=this.options.visualElement)==null||f.scheduleRender(),u){const m=this.getStack();m&&m.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Yc(),this.projectionDelta=Yc(),this.projectionDeltaWithTransform=Yc()}setAnimationOrigin(u,f=!1,m){const h=this.snapshot,g=h?h.latestValues:{},p={...this.latestValues},b=Yc();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const v=os(),j=h?h.source:void 0,S=this.layout?this.layout.source:void 0,C=j!==S,N=this.getStack(),E=!N||N.members.length<=1,T=!!(C&&!E&&this.options.crossfade===!0&&!this.path.some(mF));this.animationProgress=0;let A;const k=m==null?void 0:m.interpolateProjection(u);this.mixTargetDelta=M=>{const R=M/1e3,O=k==null?void 0:k(R);O?(b.x.translate=O.x,b.x.scale=pn(u.x.scale,1,R),b.x.origin=u.x.origin,b.x.originPoint=u.x.originPoint,b.y.translate=O.y,b.y.scale=pn(u.y.scale,1,R),b.y.origin=u.y.origin,b.y.originPoint=u.y.originPoint):(jT(b.x,u.x,R),jT(b.y,u.y,R)),this.setTargetDelta(b),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Lp(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),fF(this.relativeTarget,this.relativeTargetOrigin,v,R),A&&V9(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=os()),ho(A,this.relativeTarget)),C&&(this.animationValues=p,F9(p,g,this.latestValues,R,T,E)),O&&O.rotate!==void 0&&(this.animationValues||(this.animationValues=p),this.animationValues.pathRotation=O.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){var f,m,h;this.notifyListeners("animationStart"),(f=this.currentAnimation)==null||f.stop(),(h=(m=this.resumingFrom)==null?void 0:m.currentAnimation)==null||h.stop(),this.pendingAnimation&&(Qo(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=un.update(()=>{ep.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=$l(0)),this.motionValue.jump(0,!1),this.currentAnimation=Y9(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:g=>{this.mixTargetDelta(g),u.onUpdate&&u.onUpdate(g)},onComplete:()=>{u.onComplete&&u.onComplete(),this.completeAnimation()}}),OU(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Z9),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead(),{targetWithTransforms:f,layout:m,latestValues:h}=u;let{target:g}=u;if(!(!f||!g||!m)){if(this!==u&&this.layout&&m&&mM(this.options.animationType,this.layout.layoutBox,m.layoutBox)){g=this.target||os();const p=Ks(this.layout.layoutBox.x);g.x.min=u.target.x.min,g.x.max=g.x.min+p;const b=Ks(this.layout.layoutBox.y);g.y.min=u.target.y.min,g.y.max=g.y.min+b}ho(f,g),Xh(f,h),Ld(this.projectionDeltaWithTransform,this.layoutCorrected,f,h)}}registerSharedNode(u,f){this.sharedNodes.has(u)||this.sharedNodes.set(u,new Q9),this.sharedNodes.get(u).add(f);const h=f.options.initialPromotionConfig;f.promote({transition:h?h.transition:void 0,preserveFollowOpacity:h&&h.shouldPreserveFollowOpacity?h.shouldPreserveFollowOpacity(f):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){var f;const{layoutId:u}=this.options;return u?((f=this.getStack())==null?void 0:f.lead)||this:this}getPrevLead(){var f;const{layoutId:u}=this.options;return u?(f=this.getStack())==null?void 0:f.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:f,preserveFollowOpacity:m}={}){const h=this.getStack();h&&h.promote(this,m),u&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let f=!1;const{latestValues:m}=u;if((m.z||m.rotate||m.rotateX||m.rotateY||m.rotateZ||m.skewX||m.skewY)&&(f=!0),!f)return;const h={};m.z&&ny("z",u,h,this.animationValues);for(let g=0;g<ty.length;g++)ny(`rotate${ty[g]}`,u,h,this.animationValues),ny(`skew${ty[g]}`,u,h,this.animationValues);u.render();for(const g in h)u.setStaticValue(g,h[g]),this.animationValues&&(this.animationValues[g]=h[g]);u.scheduleRender()}applyProjectionStyles(u,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const m=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=Jh(f==null?void 0:f.pointerEvents)||"",u.transform=m?m(this.latestValues,""):"none";return}const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=Jh(f==null?void 0:f.pointerEvents)||""),this.hasProjected&&!jl(this.latestValues)&&(u.transform=m?m({},""):"none",this.hasProjected=!1);return}u.visibility="";const g=h.animationValues||h.latestValues;this.applyTransformsToTarget();let p=U9(this.projectionDeltaWithTransform,this.treeScale,g);m&&(p=m(g,p)),u.transform=p;const{x:b,y:v}=this.projectionDelta;u.transformOrigin=`${b.origin*100}% ${v.origin*100}% 0`,h.animationValues?u.opacity=h===this?g.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:g.opacityExit:u.opacity=h===this?g.opacity!==void 0?g.opacity:"":g.opacityExit!==void 0?g.opacityExit:0;for(const j in Tv){if(g[j]===void 0)continue;const{correct:S,applyTo:C,isCSSVariable:N}=Tv[j],E=p==="none"?g[j]:S(g[j],h);if(C){const T=C.length;for(let A=0;A<T;A++)u[C[A]]=E}else N?this.options.visualElement.renderState.vars[j]=E:u[j]=E}this.options.layoutId&&(u.pointerEvents=h===this?Jh(f==null?void 0:f.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>{var f;return(f=u.currentAnimation)==null?void 0:f.stop()}),this.root.nodes.forEach(yT),this.root.sharedNodes.clear()}}}function eF(e){e.updateLayout()}function tF(e){var r;const t=((r=e.resumeFrom)==null?void 0:r.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:a,measuredBox:l}=e.layout,{animationType:c}=e.options,u=t.source!==e.layout.source;if(c==="size")Bo(p=>{const b=u?t.measuredBox[p]:t.layoutBox[p],v=Ks(b);b.min=a[p].min,b.max=b.min+v});else if(c==="x"||c==="y"){const p=c==="x"?"y":"x";Ev(u?t.measuredBox[p]:t.layoutBox[p],a[p])}else mM(c,t.layoutBox,a)&&Bo(p=>{const b=u?t.measuredBox[p]:t.layoutBox[p],v=Ks(a[p]);b.max=b.min+v,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[p].max=e.relativeTarget[p].min+v)});const f=Yc();Ld(f,a,t.layoutBox);const m=Yc();u?Ld(m,e.applyTransform(l,!0),t.measuredBox):Ld(m,a,t.layoutBox);const h=!lM(f);let g=!1;if(!e.resumeFrom){const p=e.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:b,layout:v}=p;if(b&&v){const j=e.options.layoutAnchor||void 0,S=os();Lp(S,t.layoutBox,b.layoutBox,j);const C=os();Lp(C,a,v.layoutBox,j),cM(S,C)||(g=!0),p.options.layoutRoot&&(e.relativeTarget=C,e.relativeTargetOrigin=S,e.relativeParent=p)}}}e.notifyListeners("didUpdate",{layout:a,snapshot:t,delta:m,layoutDelta:f,hasLayoutChanged:h,hasRelativeLayoutChanged:g})}else if(e.isLead()){const{onExitComplete:a}=e.options;a&&a()}e.options.transition=void 0}function nF(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function sF(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function rF(e){e.clearSnapshot()}function yT(e){e.clearMeasurements()}function oF(e){e.isLayoutDirty=!0,e.updateLayout()}function vT(e){e.isLayoutDirty=!1}function aF(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function iF(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function wT(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function lF(e){e.resolveTargetDelta()}function cF(e){e.calcProjection()}function uF(e){e.resetSkewAndRotation()}function dF(e){e.removeLeadSnapshot()}function jT(e,t,r){e.translate=pn(t.translate,0,r),e.scale=pn(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function ST(e,t,r,a){e.min=pn(t.min,r.min,a),e.max=pn(t.max,r.max,a)}function fF(e,t,r,a){ST(e.x,t.x,r.x,a),ST(e.y,t.y,r.y,a)}function mF(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const hF={duration:.45,ease:[.4,0,.1,1]},NT=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),CT=NT("applewebkit/")&&!NT("chrome/")?Math.round:wo;function kT(e){e.min=CT(e.min),e.max=CT(e.max)}function pF(e){kT(e.x),kT(e.y)}function mM(e,t,r){return e==="position"||e==="preserve-aspect"&&!I9(hT(t),hT(r),.2)}function gF(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const xF=fM({attachResizeListener:(e,t)=>Jd(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),sy={current:void 0},hM=fM({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!sy.current){const e=new xF({});e.mount(window),e.setOptions({layoutScroll:!0}),sy.current=e}return sy.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),zf=x.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function TT(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function bF(...e){return t=>{let r=!1;const a=e.map(l=>{const c=TT(l,t);return!r&&typeof c=="function"&&(r=!0),c});if(r)return()=>{for(let l=0;l<a.length;l++){const c=a[l];typeof c=="function"?c():TT(e[l],null)}}}}function yF(...e){return x.useCallback(bF(...e),e)}class vF extends x.Component{getSnapshotBeforeUpdate(t){const r=this.props.childRef.current;if(Kh(r)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const a=r.offsetParent,l=Kh(a)&&a.offsetWidth||0,c=Kh(a)&&a.offsetHeight||0,u=getComputedStyle(r),f=this.props.sizeRef.current;f.height=parseFloat(u.height),f.width=parseFloat(u.width),f.top=r.offsetTop,f.left=r.offsetLeft,f.right=l-f.width-f.left,f.bottom=c-f.height-f.top,f.direction=u.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function wF({children:e,isPresent:t,anchorX:r,anchorY:a,root:l,pop:c}){var b;const u=x.useId(),f=x.useRef(null),m=x.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:h}=x.useContext(zf),g=c!==!1?((b=e.props)==null?void 0:b.ref)??(e==null?void 0:e.ref):void 0,p=yF(f,g);return x.useInsertionEffect(()=>{const{width:v,height:j,top:S,left:C,right:N,bottom:E,direction:T}=m.current;if(t||c===!1||!f.current||!v||!j)return;const A=T==="rtl",k=r==="left"?A?`right: ${N}`:`left: ${C}`:A?`left: ${C}`:`right: ${N}`,M=a==="bottom"?`bottom: ${E}`:`top: ${S}`;f.current.dataset.motionPopId=u;const R=document.createElement("style");h&&(R.nonce=h);const O=l??document.head;return O.appendChild(R),R.sheet&&R.sheet.insertRule(`
497
- [data-motion-pop-id="${u}"] {
498
- position: absolute !important;
499
- width: ${v}px !important;
500
- height: ${j}px !important;
501
- ${k}px !important;
502
- ${M}px !important;
503
- }
504
- `),()=>{var D;(D=f.current)==null||D.removeAttribute("data-motion-pop-id"),O.contains(R)&&O.removeChild(R)}},[t]),s.jsx(vF,{isPresent:t,childRef:f,sizeRef:m,pop:c,children:c===!1?e:x.cloneElement(e,{ref:p})})}const jF=({children:e,initial:t,isPresent:r,onExitComplete:a,custom:l,presenceAffectsLayout:c,mode:u,anchorX:f,anchorY:m,root:h})=>{const g=Af(SF),p=x.useId(),b=x.useRef(r),v=x.useRef(a);lu(()=>{b.current=r,v.current=a});let j=!0,S=x.useMemo(()=>(j=!1,{id:p,initial:t,isPresent:r,custom:l,onExitComplete:C=>{g.set(C,!0);for(const N of g.values())if(!N)return;a&&a()},register:C=>(g.set(C,!1),()=>{var N;g.delete(C),!b.current&&!g.size&&((N=v.current)==null||N.call(v))})}),[r,g,a]);return c&&j&&(S={...S}),x.useMemo(()=>{g.forEach((C,N)=>g.set(N,!1))},[r]),x.useEffect(()=>{!r&&!g.size&&a&&a()},[r]),e=s.jsx(wF,{pop:u==="popLayout",isPresent:r,anchorX:f,anchorY:m,root:h,children:e}),s.jsx(Ug.Provider,{value:S,children:e})};function SF(){return new Map}function pM(e=!0){const t=x.useContext(Ug);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:a,register:l}=t,c=x.useId();x.useEffect(()=>{if(e)return l(c)},[e]);const u=x.useCallback(()=>e&&a&&a(c),[c,a,e]);return!r&&a?[!1,u]:[!0]}const jh=e=>e.key||"";function ET(e){const t=[];return x.Children.forEach(e,r=>{x.isValidElement(r)&&t.push(r)}),t}const Vl=({children:e,custom:t,initial:r=!0,onExitComplete:a,presenceAffectsLayout:l=!0,mode:c="sync",propagate:u=!1,anchorX:f="left",anchorY:m="top",root:h})=>{const[g,p]=pM(u),b=x.useMemo(()=>ET(e),[e]),v=u&&!g?[]:b.map(jh),j=x.useRef(!0),S=x.useRef(b),C=Af(()=>new Map),N=x.useRef(new Set),[E,T]=x.useState(b),[A,k]=x.useState(b);lu(()=>{u&&!g&&!A.length&&(p==null||p())},[g,u,A.length,p]),lu(()=>{j.current=!1,S.current=b;for(let O=0;O<A.length;O++){const D=jh(A[O]);v.includes(D)?(C.delete(D),N.current.delete(D)):C.get(D)!==!0&&C.set(D,!1)}},[A,v.length,v.join("-")]);const M=[];if(b!==E){let O=[...b],D=0;for(const _ of A){const L=v.indexOf(jh(_));L===-1?(O.splice(D++,0,_),M.push(_)):D=L+M.length+1}return c==="wait"&&M.length&&(O=M),k(ET(O)),T(b),null}const{forceRender:R}=x.useContext(X1);return s.jsx(s.Fragment,{children:A.map(O=>{const D=jh(O),_=u&&!g?!1:b===A||v.includes(D),L=()=>{if(N.current.has(D))return;if(C.has(D))N.current.add(D),C.set(D,!0);else return;let q=!0;C.forEach(P=>{P||(q=!1)}),q&&(R==null||R(),k(S.current),u&&(p==null||p()),a&&a())};return s.jsx(jF,{isPresent:_,initial:!j.current||r?void 0:!1,custom:t,presenceAffectsLayout:l,mode:c,root:h,onExitComplete:_?void 0:L,anchorX:f,anchorY:m,children:O},D)})})},gM=x.createContext({strict:!1}),RT={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let AT=!1;function NF(){if(AT)return;const e={};for(const t in RT)e[t]={isEnabled:r=>RT[t].some(a=>!!r[a])};QO(e),AT=!0}function xM(){return NF(),y9()}function CF(e){const t=xM();for(const r in e)t[r]={...t[r],...e[r]};QO(t)}const Kg=x.createContext({});function kF(e,t){if(Yg(e)){const{initial:r,animate:a}=e;return{initial:r===!1||Zd(r)?r:void 0,animate:Zd(a)?a:void 0}}return e.inherit!==!1?t:{}}function TF(e){const{initial:t,animate:r}=kF(e,x.useContext(Kg));return x.useMemo(()=>({initial:t,animate:r}),[OT(t),OT(r)])}function OT(e){return Array.isArray(e)?e.join(" "):e}const Cw=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function bM(e,t,r){for(const a in t)!ls(t[a])&&!eM(a,r)&&(e[a]=t[a])}function EF({transformTemplate:e},t){return x.useMemo(()=>{const r=Cw();return yw(r,t,e),Object.assign({},r.vars,r.style)},[t])}function RF(e,t){const r=e.style||{},a={};return bM(a,r,e),Object.assign(a,EF(e,t)),a}function AF(e,t){const r={},a=RF(e,t);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,a.userSelect=a.WebkitUserSelect=a.WebkitTouchCallout="none",a.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=a,r}const yM=()=>({...Cw(),attrs:{}});function OF(e,t,r,a){const l=x.useMemo(()=>{const c=yM();return $O(c,t,nM(a),e.transformTemplate,e.style),{...c.attrs,style:{...c.style}}},[t]);if(e.style){const c={};bM(c,e.style,e),l.style={...c,...l.style}}return l}const MF=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Bp(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||MF.has(e)}function DF(e,t){return e.startsWith("on")?!Bp(e):(t==null?void 0:t(e))??!Bp(e)}function zF(e,t,r,a){const l={};for(const c in e)c==="values"&&typeof e.values=="object"||ls(e[c])||(DF(c,a)||r===!0&&Bp(c)||!t&&!Bp(c)||e.draggable&&c.startsWith("onDrag"))&&(l[c]=e[c]);return l}const PF=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function kw(e){return typeof e!="string"||e.includes("-")?!1:!!(PF.indexOf(e)>-1||/[A-Z]/u.test(e))}function IF(e,t,r,{latestValues:a},l,c=!1,u,f){const h=(u??kw(e)?OF:AF)(t,a,l,e),g=zF(t,typeof e=="string",c,f),p=e!==x.Fragment?{...g,...h,ref:r}:{},{children:b}=t,v=x.useMemo(()=>ls(b)?b.get():b,[b]);return x.createElement(e,{...p,children:v})}function _F({scrapeMotionValuesFromProps:e,createRenderState:t},r,a,l){return{latestValues:LF(r,a,l,e),renderState:t()}}function LF(e,t,r,a){const l={},c=a(e,{});for(const b in c)l[b]=Jh(c[b]);let{initial:u,animate:f}=e;const m=Yg(e),h=XO(e);t&&h&&!m&&e.inherit!==!1&&(u===void 0&&(u=t.initial),f===void 0&&(f=t.animate));let g=r?r.initial===!1:!1;g=g||u===!1;const p=g?f:u;if(p&&typeof p!="boolean"&&!qg(p)){const b=Array.isArray(p)?p:[p];for(let v=0;v<b.length;v++){const j=hw(e,b[v]);if(j){const{transitionEnd:S,transition:C,...N}=j;for(const E in N){let T=N[E];if(Array.isArray(T)){const A=g?T.length-1:0;T=T[A]}T!==null&&(l[E]=T)}for(const E in S)l[E]=S[E]}}}return l}const vM=e=>(t,r)=>{const a=x.useContext(Kg),l=x.useContext(Ug),c=()=>_F(e,t,a,l);return r?c():Af(c)},BF=vM({scrapeMotionValuesFromProps:Nw,createRenderState:Cw}),$F=vM({scrapeMotionValuesFromProps:sM,createRenderState:yM}),VF=Symbol.for("motionComponentSymbol");function UF(e,t,r){const a=x.useRef(r);x.useInsertionEffect(()=>{a.current=r});const l=x.useRef(null);return x.useCallback(c=>{var f;c&&((f=e.onMount)==null||f.call(e,c)),t&&(c?t.mount(c):t.unmount());const u=a.current;if(typeof u=="function")if(c){const m=u(c);typeof m=="function"&&(l.current=m)}else l.current?(l.current(),l.current=null):u(c);else u&&(u.current=c)},[t])}const wM=x.createContext({});function Fc(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function HF(e,t,r,a,l,c){var T,A;const{visualElement:u}=x.useContext(Kg),f=x.useContext(gM),m=x.useContext(Ug),h=x.useContext(zf),g=h.reducedMotion,p=h.skipAnimations,b=x.useRef(null),v=x.useRef(!1);a=a||f.renderer,!b.current&&a&&(b.current=a(e,{visualState:t,parent:u,props:r,presenceContext:m,blockInitialAnimation:m?m.initial===!1:!1,reducedMotionConfig:g,skipAnimations:p,isSVG:c}),v.current&&b.current&&(b.current.manuallyAnimateOnMount=!0));const j=b.current,S=x.useContext(wM);j&&!j.projection&&l&&(j.type==="html"||j.type==="svg")&&FF(b.current,r,l,S);const C=x.useRef(!1);x.useInsertionEffect(()=>{j&&C.current&&j.update(r,m)});const N=r[IO],E=x.useRef(!!N&&typeof window<"u"&&!((T=window.MotionHandoffIsComplete)!=null&&T.call(window,N))&&((A=window.MotionHasOptimisedAnimation)==null?void 0:A.call(window,N)));return lu(()=>{var k;!v.current||!j||((k=j.animationState)==null||k.animateChanges(),j.enteringChildren=void 0)},[]),lu(()=>{v.current=!0,j&&(C.current=!0,window.MotionIsMounted=!0,j.updateFeatures(),j.scheduleRenderMicrotask(),E.current&&j.animationState&&j.animationState.animateChanges())}),x.useEffect(()=>{j&&(!E.current&&j.animationState&&j.animationState.animateChanges(),E.current&&(queueMicrotask(()=>{var k;(k=window.MotionHandoffMarkAsComplete)==null||k.call(window,N)}),E.current=!1),j.enteringChildren=void 0)}),j}function FF(e,t,r,a){const{layoutId:l,layout:c,drag:u,dragConstraints:f,layoutScroll:m,layoutRoot:h,layoutAnchor:g,layoutCrossfade:p}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:jM(e.parent)),e.projection.setOptions({layoutId:l,layout:c,alwaysMeasureLayout:!!u||f&&Fc(f),visualElement:e,animationType:typeof c=="string"?c:"both",initialPromotionConfig:a,crossfade:p,layoutScroll:m,layoutRoot:h,layoutAnchor:g})}function jM(e){if(e)return e.options.allowProjection!==!1?e.projection:jM(e.parent)}function ry(e,{forwardMotionProps:t=!1,type:r}={},a,l){a&&CF(a);const c=r?r==="svg":kw(e),u=c?$F:BF;function f(h,g){let p;const b={...x.useContext(zf),...h,layoutId:GF(h)},{isStatic:v,isValidProp:j}=b,S=TF(h),C=u(h,v);if(!v&&typeof window<"u"){qF();const N=YF(b);p=N.MeasureLayout,S.visualElement=HF(e,C,b,l,N.ProjectionNode,c)}return s.jsxs(Kg.Provider,{value:S,children:[p&&S.visualElement?s.jsx(p,{visualElement:S.visualElement,...b}):null,IF(e,h,UF(C,S.visualElement,g),C,v,t,c,j)]})}f.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const m=x.forwardRef(f);return m[VF]=e,m}function GF({layoutId:e}){const t=x.useContext(X1).id;return t&&e!==void 0?t+"-"+e:e}function qF(e,t){x.useContext(gM).strict}function YF(e){const t=xM(),{drag:r,layout:a}=t;if(!r&&!a)return{};const l={...r,...a};return{MeasureLayout:r!=null&&r.isEnabled(e)||a!=null&&a.isEnabled(e)?l.MeasureLayout:void 0,ProjectionNode:l.ProjectionNode}}function KF(e,t){if(typeof Proxy>"u")return ry;const r=new Map,a=(c,u)=>ry(c,u,e,t),l=(c,u)=>a(c,u);return new Proxy(l,{get:(c,u)=>u==="create"?a:(r.has(u)||r.set(u,ry(u,void 0,e,t)),r.get(u))})}const XF=(e,t)=>t.isSVG??kw(e)?new C9(t):new S9(t,{allowProjection:e!==x.Fragment});class WF extends Bi{constructor(t){super(t),t.animationState||(t.animationState=A9(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();qg(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let QF=0;class ZF extends Bi{constructor(){super(...arguments),this.id=QF++,this.isExitComplete=!1}update(){var c;if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r}=this.node.presenceContext,{isPresent:a}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===a)return;if(t&&a===!1){if(this.isExitComplete){const{initial:u,custom:f}=this.node.getProps();if(typeof u=="string"||typeof u=="object"&&u!==null&&!Array.isArray(u)){const m=Dl(this.node,u,f);if(m){const{transition:h,transitionEnd:g,...p}=m;for(const b in p)(c=this.node.getValue(b))==null||c.jump(p[b])}}this.node.blockInitialAnimation=!1,this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1,this.exitAnimation=void 0;return}const l=this.exitAnimation=this.node.animationState.setActive("exit",!t);r&&!t&&l.then(()=>{this.exitAnimation===l&&(this.isExitComplete=!0,r(this.id))})}mount(){const{register:t,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const JF={animation:{Feature:WF},exit:{Feature:ZF}};function Xg(e){return{point:{x:e.pageX,y:e.pageY}}}const eG=e=>t=>ww(t)&&e(t,Xg(t));function Bd(e,t,r,a){return Jd(e,t,eG(r),a)}const SM=({current:e})=>e?e.ownerDocument.defaultView:null,MT=(e,t)=>Math.abs(e-t);function tG(e,t){const r=MT(e.x,t.x),a=MT(e.y,t.y);return Math.sqrt(r**2+a**2)}const DT=new Set(["auto","scroll"]);class NM{constructor(t,r,{transformPagePoint:a,contextWindow:l=window,dragSnapToOrigin:c=!1,distanceThreshold:u=3,element:f}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=j=>{this.handleScroll(j.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Sh(this.lastRawMoveEventInfo,this.transformPagePoint));const j=oy(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,C=tG(j.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!C)return;const{point:N}=j;this.history.push({...N,timestamp:vs.now()});const{onStart:E,onMove:T}=this.handlers;S||(E&&E(this.lastMoveEvent,j),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,j)},this.handlePointerMove=(j,S)=>{this.lastMoveEvent=j,this.lastRawMoveEventInfo=S,this.lastMoveEventInfo=Sh(S,this.transformPagePoint),this.hasPendingMove=!0,un.update(this.updatePoint,!0)},this.handlePointerUp=(j,S)=>{this.hasPendingMove&&this.updatePoint(),this.end();const{onEnd:C,onSessionEnd:N,resumeAnimation:E}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=oy(j.type==="pointercancel"?this.lastMoveEventInfo:Sh(S,this.transformPagePoint),this.history);this.startEvent&&C&&C(j,T),N&&N(j,T)},!ww(t))return;this.dragSnapToOrigin=c,this.handlers=r,this.transformPagePoint=a,this.distanceThreshold=u,this.contextWindow=l||window;const m=Xg(t),h=Sh(m,this.transformPagePoint),{point:g}=h,{timestamp:p}=ys;this.history=[{...g,timestamp:p}];const{onSessionStart:b}=r;b&&b(t,oy(h,this.history));const v={passive:!0,capture:!0};this.removeListeners=Of(Bd(this.contextWindow,"pointermove",this.handlePointerMove,v),Bd(this.contextWindow,"pointerup",this.handlePointerUp,v),Bd(this.contextWindow,"pointercancel",this.handlePointerUp,v)),f&&this.startScrollTracking(f)}startScrollTracking(t){let r=t.parentElement;for(;r;){const a=getComputedStyle(r);(DT.has(a.overflowX)||DT.has(a.overflowY))&&this.scrollPositions.set(r,{x:r.scrollLeft,y:r.scrollTop}),r=r.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const r=this.scrollPositions.get(t);if(!r)return;const a=t===window,l=a?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},c={x:l.x-r.x,y:l.y-r.y};c.x===0&&c.y===0||(a?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=c.x,this.lastMoveEventInfo.point.y+=c.y):this.history.length>0&&(this.history[0].x-=c.x,this.history[0].y-=c.y),this.scrollPositions.set(t,l),un.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Qo(this.updatePoint)}}function Sh(e,t){return t?{point:t(e.point)}:e}function zT(e,t){return{x:e.x-t.x,y:e.y-t.y}}function oy({point:e},t){return{point:e,delta:zT(e,CM(t)),offset:zT(e,nG(t)),velocity:sG(t,.1)}}function nG(e){return e[0]}function CM(e){return e[e.length-1]}function sG(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,a=null;const l=CM(e);for(;r>=0&&(a=e[r],!(l.timestamp-a.timestamp>Fr(t)));)r--;if(!a)return{x:0,y:0};a===e[0]&&e.length>2&&l.timestamp-a.timestamp>Fr(t)*2&&(a=e[1]);const c=jr(l.timestamp-a.timestamp);if(c===0)return{x:0,y:0};const u={x:(l.x-a.x)/c,y:(l.y-a.y)/c};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function rG(e,{min:t,max:r},a){return t!==void 0&&e<t?e=a?pn(t,e,a.min):Math.max(e,t):r!==void 0&&e>r&&(e=a?pn(r,e,a.max):Math.min(e,r)),e}function PT(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function oG(e,{top:t,left:r,bottom:a,right:l}){return{x:PT(e.x,r,l),y:PT(e.y,t,a)}}function IT(e,t){let r=t.min-e.min,a=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,a]=[a,r]),{min:r,max:a}}function aG(e,t){return{x:IT(e.x,t.x),y:IT(e.y,t.y)}}function iG(e,t){let r=.5;const a=Ks(e),l=Ks(t);return l>a?r=Xd(t.min,t.max-a,e.min):a>l&&(r=Xd(e.min,e.max-l,t.min)),Co(0,1,r)}function lG(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const Rv=.35;function cG(e=Rv){return e===!1?e=0:e===!0&&(e=Rv),{x:_T(e,"left","right"),y:_T(e,"top","bottom")}}function _T(e,t,r){return{min:LT(e,t),max:LT(e,r)}}function LT(e,t){return typeof e=="number"?e:e[t]||0}const uG=new WeakMap;class dG{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=os(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:r=!1,distanceThreshold:a}={}){const{presenceContext:l}=this.visualElement;if(l&&l.isPresent===!1)return;const c=p=>{r&&this.snapToCursor(p),this.stopAnimation()},u=(p,b)=>{const{drag:v,dragPropagation:j,onDragStart:S}=this.getProps();if(v&&!j&&(this.openDragLock&&this.openDragLock(),this.openDragLock=XH(v),!this.openDragLock))return;this.latestPointerEvent=p,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Bo(N=>{let E=this.getAxisMotionValue(N).get()||0;if(Go.test(E)){const{projection:T}=this.visualElement;if(T&&T.layout){const A=T.layout.layoutBox[N];A&&(E=Ks(A)*(parseFloat(E)/100))}}this.originPoint[N]=E}),S&&un.update(()=>S(p,b),!1,!0),jv(this.visualElement,"transform");const{animationState:C}=this.visualElement;C&&C.setActive("whileDrag",!0)},f=(p,b)=>{this.latestPointerEvent=p,this.latestPanInfo=b;const{dragPropagation:v,dragDirectionLock:j,onDirectionLock:S,onDrag:C}=this.getProps();if(!v&&!this.openDragLock)return;const{offset:N}=b;if(j&&this.currentDirection===null){this.currentDirection=mG(N),this.currentDirection!==null&&S&&S(this.currentDirection);return}this.updateAxis("x",b.point,N),this.updateAxis("y",b.point,N),this.visualElement.render(),C&&un.update(()=>C(p,b),!1,!0)},m=(p,b)=>{this.latestPointerEvent=p,this.latestPanInfo=b,this.stop(p,b),this.latestPointerEvent=null,this.latestPanInfo=null},h=()=>{const{dragSnapToOrigin:p}=this.getProps();(p||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:g}=this.getProps();this.panSession=new NM(t,{onSessionStart:c,onStart:u,onMove:f,onSessionEnd:m,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:g,distanceThreshold:a,contextWindow:SM(this.visualElement),element:this.visualElement.current})}stop(t,r){const a=t||this.latestPointerEvent,l=r||this.latestPanInfo,c=this.isDragging;if(this.cancel(),!c||!l||!a)return;const{velocity:u}=l;this.startAnimation(u);const{onDragEnd:f}=this.getProps();f&&un.postRender(()=>f(a,l))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:a}=this.getProps();!a&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,r,a){const{drag:l}=this.getProps();if(!a||!Nh(t,l,this.currentDirection))return;const c=this.getAxisMotionValue(t);let u=this.originPoint[t]+a[t];this.constraints&&this.constraints[t]&&(u=rG(u,this.constraints[t],this.elastic[t])),c.set(u)}resolveConstraints(){var c;const{dragConstraints:t,dragElastic:r}=this.getProps(),a=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(c=this.visualElement.projection)==null?void 0:c.layout,l=this.constraints;t&&Fc(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&a?this.constraints=oG(a.layoutBox,t):this.constraints=!1,this.elastic=cG(r),l!==this.constraints&&!Fc(t)&&a&&this.constraints&&!this.hasMutatedConstraints&&Bo(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=lG(a.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!Fc(t))return!1;const a=t.current,{projection:l}=this.visualElement;if(!l||!l.layout)return!1;l.root&&(l.root.scroll=void 0,l.root.updateScroll());const c=KH(a,l.root,this.visualElement.getTransformPagePoint());let u=aG(l.layout.layoutBox,c);if(r){const f=r(GH(u));this.hasMutatedConstraints=!!f,f&&(u=VO(f))}return u}startAnimation(t){const{drag:r,dragMomentum:a,dragElastic:l,dragTransition:c,dragSnapToOrigin:u,onDragTransitionEnd:f}=this.getProps(),m=this.constraints||{},h=Bo(g=>{if(!Nh(g,r,this.currentDirection))return;let p=m&&m[g]||{};(u===!0||u===g)&&(p={min:0,max:0});const b=l?200:1e6,v=l?40:1e7,j={type:"inertia",velocity:a?t[g]:0,bounceStiffness:b,bounceDamping:v,timeConstant:750,restDelta:1,restSpeed:10,...c,...p};return this.startAxisValueAnimation(g,j)});return Promise.all(h).then(f)}startAxisValueAnimation(t,r){const a=this.getAxisMotionValue(t);return jv(this.visualElement,t),a.start(mw(t,a,0,r,this.visualElement,!1))}stopAnimation(){Bo(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const r=`_drag${t.toUpperCase()}`,l=this.visualElement.getProps()[r];return l||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor({clientX:t,clientY:r}){var f;const{drag:a}=this.getProps(),l={x:t,y:r},c=((f=this.visualElement.getTransformPagePoint())==null?void 0:f(l))||l,u=this.visualElement.measureViewportBox();Bo(m=>{if(!Nh(m,a,this.currentDirection))return;const h=this.getAxisMotionValue(m),{min:g,max:p}=u[m];h.set((h.get()||0)+c[m]-pn(g,p,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:a}=this.visualElement;if(!Fc(r)||!a||!this.constraints)return;this.stopAnimation();const l=this.constraints,c={x:0,y:0};Bo(f=>{const m=this.getAxisMotionValue(f).get();c[f]=iG({min:m,max:m},l[f])});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",a.root&&a.root.updateScroll(),a.updateLayout(),this.constraints=!1,this.resolveConstraints(),Bo(f=>{const m=this.getAxisMotionValue(f);if(!Nh(f,t,null)||!m.get())return;const{min:h,max:g}=this.constraints[f];m.set(pn(h,g,c[f]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;uG.set(this.visualElement,this);const t=this.visualElement.current,r=Bd(t,"pointerdown",h=>{const{drag:g,dragListener:p=!0}=this.getProps(),b=h.target,v=b!==t&&t9(b);g&&p&&!v&&this.start(h)});let a;const l=()=>{const{dragConstraints:h}=this.getProps();Fc(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),a||(a=fG(t,h.current,()=>this.scalePositionWithinConstraints())))},{projection:c}=this.visualElement,u=c.addEventListener("measure",l);c&&!c.layout&&(c.root&&c.root.updateScroll(),c.updateLayout()),un.read(l);const f=Jd(window,"resize",()=>this.scalePositionWithinConstraints()),m=c.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:g})=>{this.isDragging&&g&&(Bo(p=>{const b=this.getAxisMotionValue(p);b&&(this.originPoint[p]+=h[p].translate,b.set(b.get()+h[p].translate))}),this.visualElement.render())}));return()=>{f(),r(),u(),m&&m(),a&&a()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:a=!1,dragPropagation:l=!1,dragConstraints:c=!1,dragElastic:u=Rv,dragMomentum:f=!0}=t;return{...t,drag:r,dragDirectionLock:a,dragPropagation:l,dragConstraints:c,dragElastic:u,dragMomentum:f}}}function BT(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function fG(e,t,r){const a=Xk(e,BT(r)),l=Xk(t,BT(r));return()=>{a(),l()}}function Nh(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function mG(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class hG extends Bi{constructor(t){super(t),this.removeGroupControls=wo,this.removeListeners=wo,this.controls=new dG(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||wo}update(){const{dragControls:t}=this.node.getProps(),{dragControls:r}=this.node.prevProps||{};t!==r&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const ay=e=>(t,r)=>{e&&un.update(()=>e(t,r),!1,!0)};class pG extends Bi{constructor(){super(...arguments),this.removePointerDownListener=wo}onPointerDown(t){this.session=new NM(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:SM(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:a,onPanEnd:l}=this.node.getProps();return{onSessionStart:ay(t),onStart:ay(r),onMove:ay(a),onEnd:(c,u)=>{delete this.session,l&&un.postRender(()=>l(c,u))}}}mount(){this.removePointerDownListener=Bd(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let iy=!1;class gG extends x.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:a,layoutId:l}=this.props,{projection:c}=t;c&&(r.group&&r.group.add(c),a&&a.register&&l&&a.register(c),iy&&c.root.didUpdate(),c.addEventListener("animationComplete",()=>{this.safeToRemove()}),c.setOptions({...c.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ep.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:a,drag:l,isPresent:c}=this.props,{projection:u}=a;return u&&(u.isPresent=c,t.layoutDependency!==r&&u.setOptions({...u.options,layoutDependency:r}),iy=!0,l||t.layoutDependency!==r||r===void 0||t.isPresent!==c?u.willUpdate():this.safeToRemove(),t.isPresent!==c&&(c?u.promote():u.relegate()||un.postRender(()=>{const f=u.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:t,layoutAnchor:r}=this.props,{projection:a}=t;a&&(a.options.layoutAnchor=r,a.root.didUpdate(),vw.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:a}=this.props,{projection:l}=t;iy=!0,l&&(l.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(l),a&&a.deregister&&a.deregister(l))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function kM(e){const[t,r]=pM(),a=x.useContext(X1);return s.jsx(gG,{...e,layoutGroup:a,switchLayoutGroup:x.useContext(wM),isPresent:t,safeToRemove:r})}const xG={pan:{Feature:pG},drag:{Feature:hG,ProjectionNode:hM,MeasureLayout:kM}};function $T(e,t,r){const{props:a}=e;e.animationState&&a.whileHover&&e.animationState.setActive("whileHover",r==="Start");const l="onHover"+r,c=a[l];c&&un.postRender(()=>c(t,Xg(t)))}class bG extends Bi{mount(){const{current:t}=this.node;t&&(this.unmount=QH(t,(r,a)=>($T(this.node,a,"Start"),l=>$T(this.node,l,"End"))))}unmount(){}}class yG extends Bi{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Of(Jd(this.node.current,"focus",()=>this.onFocus()),Jd(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function VT(e,t,r){const{props:a}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&a.whileTap&&e.animationState.setActive("whileTap",r==="Start");const l="onTap"+(r==="End"?"":r),c=a[l];c&&un.postRender(()=>c(t,Xg(t)))}class vG extends Bi{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:r,propagate:a}=this.node.props;this.unmount=s9(t,(l,c)=>(VT(this.node,c,"Start"),(u,{success:f})=>VT(this.node,u,f?"End":"Cancel")),{useGlobalTarget:r,stopPropagation:(a==null?void 0:a.tap)===!1})}unmount(){}}const Av=new WeakMap,ly=new WeakMap,wG=e=>{const t=Av.get(e.target);t&&t(e)},jG=e=>{e.forEach(wG)};function SG({root:e,...t}){const r=e||document;ly.has(r)||ly.set(r,{});const a=ly.get(r),l=JSON.stringify(t);return a[l]||(a[l]=new IntersectionObserver(jG,{root:e,...t})),a[l]}function NG(e,t,r){const a=SG(t);return Av.set(e,r),a.observe(e),()=>{Av.delete(e),a.unobserve(e)}}const CG={some:0,all:1};class kG extends Bi{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var m;(m=this.stopObserver)==null||m.call(this);const{viewport:t={}}=this.node.getProps(),{root:r,margin:a,amount:l="some",once:c}=t,u={root:r?r.current:void 0,rootMargin:a,threshold:typeof l=="number"?l:CG[l]},f=h=>{const{isIntersecting:g}=h;if(this.isInView===g||(this.isInView=g,c&&!g&&this.hasEnteredView))return;g&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",g);const{onViewportEnter:p,onViewportLeave:b}=this.node.getProps(),v=g?p:b;v&&v(h)};this.stopObserver=NG(this.node.current,u,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some(TG(t,r))&&this.startObserver()}unmount(){var t;(t=this.stopObserver)==null||t.call(this),this.hasEnteredView=!1,this.isInView=!1}}function TG({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const EG={inView:{Feature:kG},tap:{Feature:vG},focus:{Feature:yG},hover:{Feature:bG}},RG={layout:{ProjectionNode:hM,MeasureLayout:kM}},AG={...JF,...EG,...xG,...RG},OG=KF(AG,XF);function Tw(e){const t=Af(()=>$l(e)),{isStatic:r}=x.useContext(zf);if(r){const[,a]=x.useState(e);x.useEffect(()=>t.on("change",a),[])}return t}function TM(e,t){const r=Tw(t()),a=()=>r.set(t());return a(),lu(()=>{const l=()=>un.preRender(a,!1,!0),c=e.map(u=>u.on("change",l));return()=>{c.forEach(u=>u()),Qo(a)}}),r}function MG(e){_d.current=[],e();const t=TM(_d.current,e);return _d.current=void 0,t}function DG(e,t,r,a){if(typeof e=="function")return MG(e);const c=m9(t,r,a),u=Array.isArray(e)?UT(e,c):UT([e],([m])=>c(m)),f=Array.isArray(e)?void 0:e.accelerate;return f&&!f.isTransformed&&typeof t!="function"&&Array.isArray(r)&&(a==null?void 0:a.clamp)!==!1&&(u.accelerate={...f,times:t,keyframes:r,isTransformed:!0}),u}function UT(e,t){const r=Af(()=>[]);return TM(e,()=>{r.length=0;const a=e.length;for(let l=0;l<a;l++)r[l]=e[l].get();return t(r)})}function zG(e,t={}){const{isStatic:r}=x.useContext(zf),a=()=>ls(e)?e.get():e;if(r)return DG(a);const l=Tw(a());return x.useInsertionEffect(()=>p9(l,e,t),[l,JSON.stringify(t)]),l}function PG(e,t={}){return zG(e,{type:"spring",...t})}function Bs(){!Sw.current&&WO();const[e]=x.useState(Ip.current);return e}const IG={some:0,all:1};function _G(e,t,{root:r,margin:a,amount:l="some"}={}){const c=bw(e),u=new WeakMap,f=h=>{h.forEach(g=>{const p=u.get(g.target);if(g.isIntersecting!==!!p)if(g.isIntersecting){const b=t(g.target,g);typeof b=="function"?u.set(g.target,b):m.unobserve(g.target)}else typeof p=="function"&&(p(g),u.delete(g.target))})},m=new IntersectionObserver(f,{root:r,rootMargin:a,threshold:typeof l=="number"?l:IG[l]});return c.forEach(h=>m.observe(h)),()=>m.disconnect()}function EM(e,{root:t,margin:r,amount:a,once:l=!1,initial:c=!1}={}){const[u,f]=x.useState(c);return x.useEffect(()=>{if(!e.current||l&&u)return;const m=()=>(f(!0),l?void 0:()=>f(!1)),h={root:t&&t.current||void 0,margin:r,amount:a};return _G(e.current,m,h)},[t,e,r,l,a]),u}const Rn=OG,HT=e=>typeof e=="function"?void 0:e.filter;function qo({children:e,className:t,variant:r,duration:a=.4,delay:l=0,offset:c=6,direction:u="down",inView:f=!1,inViewMargin:m="-50px",blur:h="6px",...g}){const p=x.useRef(null),b=EM(p,{once:!0,margin:m}),v=!f||b,j=Bs(),S={hidden:{[u==="left"||u==="right"?"x":"y"]:u==="right"||u==="down"?-c:c,opacity:0,filter:`blur(${h})`},visible:{[u==="left"||u==="right"?"x":"y"]:0,opacity:1,filter:"blur(0px)"}},C=r??S,N=HT(C.hidden),E=HT(C.visible),T=N!=null&&E!=null&&N!==E;return s.jsx(Vl,{children:s.jsx(Rn.div,{ref:p,initial:j?!1:"hidden",animate:v?"visible":"hidden",exit:"hidden",variants:C,transition:{delay:.04+l,duration:j?0:a,ease:"easeOut",...T?{filter:{duration:a}}:{}},className:t,...g,children:e})})}function zt({className:e,...t}){return s.jsx(zl,{"data-slot":"spinner",role:"status","aria-label":"Loading",className:fs("size-4 animate-spin motion-reduce:animate-none",e),...t})}const Wg=[{name:"Claude Code",logo:"claudecode",commands:["claude","claude-code"]},{name:"Codex",logo:"codex",commands:["codex"]},{name:"GitHub Copilot",logo:"copilot",commands:["copilot"]},{name:"Cursor",logo:"cursor",commands:["cursor-agent","agent"],aliases:["Cursor CLI"]},{name:"Gemini CLI",logo:"gemini",commands:["gemini"]},{name:"OpenCode",logo:"opencode",commands:["opencode"]},{name:"OpenClaw",logo:"openclaw-color",commands:["openclaw"]},{name:"Pi",logo:"pi",commands:["pi"]},{name:"Antigravity CLI",logo:"antigravity",commands:["agy"],aliases:["Antigravity"]},{name:"Kiro CLI",logo:"kiro",commands:["kiro-cli"],aliases:["Kiro"]},{name:"Factory Droid",logo:"factory",commands:["droid"],aliases:["Droid","Factory"]},{name:"Aider",logo:"aider",commands:["aider"]}];function RM(e){var h,g;const t=(e==null?void 0:e.labels)??{},r=t["openshell.console/agents"]||t["openshell.console/agent"],a=typeof r=="string"?r.split(/[,\n]/).map(p=>p.trim()).filter(Boolean):[],l=Array.isArray(e==null?void 0:e.command)?(h=e.command[0])==null?void 0:h.split("/").pop():null,c=(g=e==null?void 0:e.agentInventory)==null?void 0:g.agents,u=a.length>0,m=(Array.isArray(c)?c:u?a:l&&l!=="agent"?[l]:[]).flatMap(p=>{var v,j;const b=Wg.find(S=>{var C;return S.name.toLowerCase()===p.toLowerCase()||S.commands.includes(p.toLowerCase())||((C=S.aliases)==null?void 0:C.some(N=>N.toLowerCase()===p.toLowerCase()))});return b?[{resources:(j=(v=e==null?void 0:e.agentInventory)==null?void 0:v.resources)==null?void 0:j[b.name],name:b.name,logo:`/logos/agents/${b.logo}.svg`}]:u?[{name:p,logo:null}]:[]});return m.filter((p,b)=>m.findIndex(v=>v.name.toLowerCase()===p.name.toLowerCase())===b)}function cy(e){const t=e==null?void 0:e.agentInventory;return(t==null?void 0:t.status)==="checked"?t.agents.length?"Installed agents":"No supported agents found":t!=null&&t.checkedAt?"Last detected agents · scan unavailable":(t==null?void 0:t.status)==="unavailable"?"Agent scan unavailable":"Agent inventory not checked"}const LG=`
505
- ## OpenShell website access
506
-
507
- Network access is restricted per destination, not globally offline. A denied website or hosted search request does not mean another website is blocked.
508
- For a user-requested website, call read_url_content for that website. Hosted URL fetch and search services are deliberately blocked because they bypass the sandbox destination policy. read_url_content can fall back to a direct request from this sandbox, where the website policy applies.
509
- If a request is denied, report that specific destination or service as blocked. On a later request for a different website, try that website independently; do not reuse an earlier denial as evidence that all internet access is unavailable. Do not claim to have fetched current content without a successful tool result.
510
- Do not use hosted search, external proxies, or other relay services to bypass a blocked destination. Never change network policy to complete a browsing request.
511
- `,$p=[{id:"ubuntu:24.04",name:"Ubuntu 24.04"},{id:"debian:12-slim",name:"Debian 12 slim"}],BG=["git","curl","ripgrep"],Ch=(e,t="bash")=>`curl -fsSL ${e} -o /tmp/install-agent.sh && ${t} /tmp/install-agent.sh && rm /tmp/install-agent.sh`,$G=[{id:"claude",command:"claude",featured:!0},{id:"codex",command:"codex",featured:!0,npm:"@openai/codex"},{id:"opencode",command:"opencode",featured:!0,npm:"opencode-ai"},{id:"pi",command:"pi",npm:"@earendil-works/pi-coding-agent",ignoreScripts:!0,packages:["fd-find","ripgrep"]},{id:"cursor",command:"cursor-agent",featured:!0,install:Ch("https://cursor.com/install")},{id:"antigravity",command:"agy",install:Ch("https://antigravity.google/cli/install.sh")},{id:"copilot",command:"copilot",npm:"@github/copilot"},{id:"kiro",command:"kiro-cli",packages:["unzip"],install:Ch("https://cli.kiro.dev/install")},{id:"droid",command:"droid",install:Ch("https://app.factory.ai/cli","sh")},{id:"aider",command:"aider",python:!0}],Ls=$G.map(e=>{const t=Wg.find(r=>r.commands.includes(e.command));return{...e,name:t.name,logo:`/logos/agents/${t.logo}.svg`}}),Ov=e=>Ls.filter(t=>e.agents.includes(t.id)),Mv=[{id:"node",name:"Node.js 22",logo:"/logos/templates/nodejs.svg"},{id:"python",name:"Python 3",logo:"/logos/templates/python.svg"},{id:"vscode",name:"VS Code Server",logo:"/logos/vscode.svg",retired:!0}],VG="/run/openshell-supervisor-ca/material/ca-bundle.crt",Vp=[...Ls.map(e=>({id:e.command,name:e.name})),{id:"",name:"Shell"}],UG=/^[a-z0-9]([a-z0-9-]{0,17}[a-z0-9])?$/,HG=8e3,Qg=e=>e.source==="build"&&Array.isArray(e.agents)&&new Set(e.agents).size+(Array.isArray(e.customAgents)?e.customAgents.length:0)>1;function ba(e={}){const t={name:"",source:"build",agents:["claude"],customAgents:[],repository:"",runtimes:[],base:$p[0].id,packages:[...BG],setup:"",image:"",environment:[],command:"claude",setups:[],setupRevisions:{},...e};return Qg(t)&&(t.command=""),t}const FT=e=>e.split(/[\s,]+/).filter(Boolean),uy=e=>`openshell-image-recipe-v3:${e}`;function GT(e){try{const t=JSON.parse(sessionStorage.getItem(e));return t!=null&&t.recipe&&typeof t.recipe.name=="string"?t:null}catch{return null}}function FG(e){var t,r,a;return e.source==="image"?{source:"image",image:e.image,command:e.command,...(t=e.setups)!=null&&t.length?{setups:e.setups,setupRevisions:e.setupRevisions||{}}:{}}:{source:"build",agents:e.agents,...(r=e.setups)!=null&&r.length?{setups:e.setups,setupRevisions:e.setupRevisions||{}}:{},...(a=e.customAgents)!=null&&a.length?{customAgents:e.customAgents}:{},repository:e.repository,runtimes:e.runtimes,base:e.base,packages:e.packages,setup:e.setup,command:e.command}}function GG(e){let t=2166136261;for(const r of Dv(e))t=Math.imul(t^r.charCodeAt(0),16777619);return(t>>>0).toString(16).padStart(8,"0")}const dy=e=>"'"+e.replaceAll("'","'\\''")+"'",qG=/^[a-zA-Z0-9][a-zA-Z0-9._/:@-]{0,255}$/;function YG(e){const t={};if((!Array.isArray(e.setups)||e.setups.length>8||e.setups.some(r=>typeof r!="string"||!/^[a-f0-9]{24}$/.test(r))||new Set(e.setups).size!==e.setups.length)&&(t.setups="Choose up to eight unique saved Setups."),e.setupRevisions&&(typeof e.setupRevisions!="object"||Array.isArray(e.setupRevisions)||Object.entries(e.setupRevisions).some(([r,a])=>{var l;return!((l=e.setups)!=null&&l.includes(r))||!/^[a-f0-9]{64}$/.test(a)}))&&(t.setups="Invalid pinned Setup revision."),UG.test(e.name||"")||(t.name="Use lowercase letters, digits and dashes for the name, up to 19 characters."),e.source==="build"){if((!Array.isArray(e.agents)||e.agents.some(r=>!Ls.some(a=>a.id===r)))&&(t.agents="Choose a supported agent."),(!Array.isArray(e.runtimes)||e.runtimes.some(r=>!Mv.some(a=>a.id===r)))&&(t.runtimes="Choose a supported runtime."),typeof e.repository!="string")t.repository="Invalid repository.";else if(e.repository)try{const r=new URL(e.repository);if(/[\r\n\0]/.test(e.repository)||r.protocol!=="https:"||r.username||r.password||r.search||r.hash)throw new Error}catch{t.repository="Use a public HTTPS repository URL without credentials or query parameters."}$p.some(r=>r.id===e.base)||(t.base="Choose a supported base image."),(!Array.isArray(e.packages)||e.packages.length>80||e.packages.some(r=>typeof r!="string"||!/^[a-z0-9][a-z0-9+.-]*(=[a-zA-Z0-9:.+~_-]+)?$/.test(r)))&&(t.packages="Add up to 80 valid apt package names, such as jq or build-essential."),(!Array.isArray(e.customAgents)||e.customAgents.length>10||e.customAgents.some(r=>!r||typeof r.name!="string"||!r.name.trim()||r.name.length>80||/[\x00-\x1f\x7f]/.test(r.name)||typeof r.install!="string"||!r.install.trim()||r.install.length>6e3||/[\x00\r]/.test(r.install)))&&(t.customAgents="Enter valid custom agent install commands, up to 6,000 characters."),(typeof e.setup!="string"||e.setup.length>6e3)&&(t.setup="Setup commands must be under 6 KB.")}else e.source==="image"?qG.test(e.image||"")||(t.image="Enter a valid image reference, such as team/workspace:latest."):t.source="Choose an image source.";return!Array.isArray(e.environment)||e.environment.length>40||e.environment.some(r=>!r||typeof r.name!="string"||typeof r.value!="string"||r.name.length>128||!/^[A-Za-z_][A-Za-z0-9_]*$/.test(r.name)||/[\x00-\x1f\x7f]/.test(r.value)||r.value.length>1e3)?t.environment="Use variable names of letters, digits and underscores (up to 128) and single-line values (up to 1,000 characters).":e.environment.some(r=>r.name.startsWith("OPENSHELL_"))?t.environment="Variable names starting with OPENSHELL_ are reserved by OpenShell.":e.environment.some(r=>/secret|token|password|api_?key|credential|auth/i.test(r.name))?t.environment="Keep credentials out of templates. Attach them through Secrets when you launch.":new Set(e.environment.map(r=>r.name)).size!==e.environment.length&&(t.environment="Environment variable names must be unique."),(typeof e.command!="string"||e.command.length>512||/[\r\n\0]/.test(e.command))&&(t.command="Use a single-line start command, up to 512 characters."),Qg(e)&&e.command!==""&&(t.command="Templates with multiple agents must start in Shell."),!Object.keys(t).length&&new TextEncoder().encode(JSON.stringify(FG(e))).length>HG&&(t.setup="This recipe is too large to store with the template. Shorten the setup commands or package list."),t}function Dv(e){var u,f,m;const t=Ov(e),r=!!((u=e.setups)!=null&&u.length)||e.runtimes.includes("node")||t.some(h=>h.npm),a=!!((f=e.setups)!=null&&f.length)||e.runtimes.includes("python")||t.some(h=>h.python),l=[...new Set(["ca-certificates","curl","iproute2","tmux",...e.packages,...t.flatMap(h=>h.packages??[]),...e.repository?["git"]:[],...a?["python3","python3-venv"]:[]])],c=[`FROM ${e.base}`,"","USER root","ENV DEBIAN_FRONTEND=noninteractive",`RUN apt-get update --error-on=any && apt-get install -y --no-install-recommends ${l.map(dy).join(" ")} && rm -rf /var/lib/apt/lists/*`,'RUN if getent passwd 1000 >/dev/null; then usermod --login sandbox --home /sandbox --move-home --shell /bin/bash "$(getent passwd 1000 | cut -d: -f1)"; else useradd --uid 1000 --create-home --home-dir /sandbox --shell /bin/bash sandbox; fi && chown -R 1000:1000 /sandbox'];r&&c.push("","COPY --from=node:22-bookworm-slim /usr/local/ /usr/local/"),a&&c.push("","RUN python3 -m venv /usr/local/venv",'ENV PATH="/usr/local/venv/bin:${PATH}"'),e.runtimes.includes("vscode")&&c.push(`RUN echo 'ca_certificate = ${VG}' >> /etc/wgetrc`);for(const h of t.filter(g=>g.npm))c.push(`RUN npm install --global ${h.ignoreScripts?"--ignore-scripts ":""}${h.npm}`);e.agents.includes("pi")&&c.push("RUN ln -sf /usr/bin/fdfind /usr/local/bin/fd"),e.agents.includes("aider")&&c.push("RUN python3 -m venv /opt/aider && /opt/aider/bin/pip install --no-cache-dir aider-chat && ln -s /opt/aider/bin/aider /usr/local/bin/aider"),e.agents.includes("claude")&&c.push("RUN curl -fsSL https://claude.ai/install.sh -o /tmp/install-claude.sh && bash /tmp/install-claude.sh && cp -L /root/.local/bin/claude /usr/local/bin/claude && chmod 0755 /usr/local/bin/claude && rm -rf /root/.local /root/.claude* /tmp/install-claude.sh"),c.push("","ENV HOME=/sandbox",'ENV PATH="/sandbox/.local/bin:/sandbox/.npm-global/bin:/sandbox/.opencode/bin:${PATH}"',"ENV NPM_CONFIG_PREFIX=/sandbox/.npm-global","USER sandbox","WORKDIR /sandbox");for(const h of t.filter(g=>g.install))c.push(`RUN ${h.install} && command -v ${h.command}`);for(const h of e.customAgents??[])c.push(`RUN ${JSON.stringify(["/bin/bash","-euo","pipefail","-c",h.install])}`);return e.repository&&c.push(`RUN git clone -- ${dy(e.repository)} /sandbox/project`,"WORKDIR /sandbox/project"),e.setup.trim()&&c.push("COPY --chown=1000:1000 setup.sh /tmp/template-setup.sh","RUN bash -eu /tmp/template-setup.sh"),e.agents.includes("antigravity")&&c.push(`RUN printf '%s\\n' ${LG.split(`
512
- `).map(dy).join(" ")} >> ${e.repository?"/sandbox/project":"/sandbox"}/GEMINI.md`),(m=e.setups)!=null&&m.length&&c.push("COPY --chown=1000:1000 setup-bundles/ /sandbox/.openshell/bundles/"),c.push("",'CMD ["/bin/bash"]',""),c.join(`
513
- `)}const qT="openshell.console/session",KG="openshell.console/project",tp=e=>!!(e!=null&&e.remote&&/^console-ssh-[a-f0-9]{24}$/.test(e.name??e.gateway??"")),XG=e=>{var r;const t=(r=e==null?void 0:e.labels)==null?void 0:r[KG];return typeof t=="string"&&/^[A-Za-z0-9]([A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/.test(t)?t:null},WG={shell:"/bin/bash -l",...Object.fromEntries(Ls.map(e=>[e.command,e.command]))},QG=e=>Object.hasOwn(WG,e??""),ZG=e=>{var t;return QG((t=e==null?void 0:e.labels)==null?void 0:t[qT])?e.labels[qT]:"shell"},AM=e=>{var t;return e==="shell"?"Shell":((t=Ls.find(r=>r.command===e))==null?void 0:t.name)??e};function IZ(e){const t=ZG(e),r=RM(e).flatMap(l=>Ls.filter(c=>c.name===l.name).map(c=>c.command)),a=[...new Set([...t==="shell"?[]:[t],...r])];return[{id:"shell",name:"Shell"},...a.map(l=>({id:l,name:AM(l)}))]}function Up(e,t,r,a=typeof r=="string"?r:(r==null?void 0:r.target)??wR()){var m,h;const l=new URLSearchParams;t&&l.set("session",t);const c=typeof(r==null?void 0:r.gateway)=="string"?r.gateway:((m=r==null?void 0:r.gateway)==null?void 0:m.name)??(r==null?void 0:r.name),u=(r==null?void 0:r.workspace)??((h=r==null?void 0:r.gateway)==null?void 0:h.workspace);c&&u&&(l.set("gateway",c),l.set("workspace",u),r!=null&&r.remote&&l.set("remote","1"));const f=l.toString();return`?target=${a}#terminal/${encodeURIComponent(e)}${f?`?${f}`:""}`}const Ew=x.createContext(null);function Oa({location:e,children:t}){const r=eg(),a=Tr(),l=a!=null&&a.localViewer&&(e!=null&&e.target)?e.target:r.target,c=x.useMemo(()=>Gr(l,r.signal,e==null?void 0:e.context),[l,r.signal,e==null?void 0:e.context]),u=x.useMemo(()=>({location:e,api:c}),[e,c]);return s.jsx(vP,{target:e==null?void 0:e.target,children:s.jsx(Ew.Provider,{value:u,children:t})})}function $t(){var t;const e=eg();return((t=x.useContext(Ew))==null?void 0:t.api)??e}function Cn(){var e;return((e=x.useContext(Ew))==null?void 0:e.location)??null}function Rw(e){if(e==null)return[];const t=Array.isArray(e)?e:[e];if(t.some(r=>typeof r!="string"||!r))throw new Error("Groups must be a list of group IDs.");return[...new Set(t)]}const Zg=(e,t)=>e.appliesTo.everyone||Rw(t.groups??t.group).some(r=>e.appliesTo.groups.includes(r))||e.appliesTo.sandboxes.includes(t.name)||(e.appliesTo.setups??[]).some(r=>(t.setups??[]).includes(r)),JG=e=>e.startsWith("*")||!e.includes(".")?[e]:[e,`**.${e}`],eq=e=>e.flatMap(JG);function OM(e,t){if(t=String(t??"").toLowerCase(),e.startsWith("**."))return t.endsWith(e.slice(2));if(e.startsWith("*.")){const r=e.slice(1);return t.endsWith(r)&&!t.slice(0,-r.length).includes(".")&&t.length>r.length}return t===e}const MM=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,48).replace(/-$/,""),jo=(e,t)=>{var r;return Rw((r=e==null?void 0:e.assignments)==null?void 0:r[t])},tq=(e,t)=>(e??[]).filter(r=>Zg(r,t)),DM=(e,t)=>(e??[]).filter(r=>!r.appliesTo.everyone&&r.appliesTo.groups.includes(t));function YT({pressed:e,onClick:t,children:r,count:a,muted:l}){return s.jsxs("button",{type:"button","aria-pressed":e,onClick:t,className:Le("flex items-center gap-1.5 rounded-md border px-3 py-2 text-xs outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",e?"border-foreground/50 bg-accent font-medium text-foreground":"border-foreground/20 bg-background text-foreground hover:border-foreground/40 hover:bg-accent/50"),children:[e?s.jsx(Fn,{className:"size-3","aria-hidden":"true"}):!l&&s.jsx(Ta,{className:"size-3 text-muted-foreground","aria-hidden":"true"}),r,a!=null&&s.jsx("span",{className:"font-mono text-[10px] tabular-nums text-faint",children:a})]})}function nq({onCreated:e,existing:t}){const r=$t(),[a,l]=x.useState(!1),[c,u]=x.useState(""),[f,m]=x.useState(!1),[h,g]=x.useState(null),p=MM(c),b=t.some(j=>j.id===p);async function v(){if(!(!p||b)){m(!0),g(null);try{const{group:j}=await r.saveGroup({id:p,name:c.trim(),description:"",isNew:!0});l(!1),u(""),e(j)}catch(j){g(j.message)}finally{m(!1)}}}return a?s.jsxs("div",{className:"grid w-full gap-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Rt,{value:c,onChange:j=>u(j.target.value),autoFocus:!0,placeholder:"Frontend","aria-label":"New group name",className:"h-7 max-w-52 text-xs",onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),v()),j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),l(!1))}}),s.jsxs(ue,{type:"button",size:"xs",onClick:v,disabled:f||!p||b,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&s.jsx(zt,{"aria-hidden":"true"}),"Create"]}),s.jsx(ue,{type:"button",size:"xs",variant:"ghost",onClick:()=>{l(!1),u("")},children:"Cancel"})]}),(h||b)&&s.jsx("p",{className:"text-[11px] text-red-700",children:h??`A group called "${c.trim()}" already exists.`})]}):s.jsxs("button",{type:"button",onClick:()=>l(!0),className:"flex items-center gap-1 rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground outline-none transition-colors hover:border-foreground/30 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx(cs,{className:"size-3","aria-hidden":"true"}),"New group"]})}function ef({groups:e,counts:t={},value:r,onChange:a,multiple:l=!1,required:c=!1,allowCreate:u=!0,onCreated:f}){const m=x.useId(),h=l?r:r?[r]:[],g=p=>{a(l?h.includes(p)?h.filter(b=>b!==p):[...h,p]:p)};return s.jsxs("div",{role:"group","aria-label":l?"Choose groups":"Choose a group",className:"flex flex-wrap items-center gap-1.5",children:[!l&&!c&&s.jsx(YT,{pressed:!r,onClick:()=>a(null),muted:!0,children:"No group"}),e.map(p=>c&&!l?s.jsxs("label",{className:"relative min-w-0 cursor-pointer",children:[s.jsx("input",{type:"radio",name:m,value:p.id,checked:r===p.id,onChange:()=>a(p.id),required:!0,className:"peer sr-only"}),s.jsxs("span",{className:"flex items-center gap-1.5 rounded-md border border-foreground/20 bg-background px-3 py-2 text-xs text-foreground transition-colors hover:border-foreground/40 hover:bg-accent/50 peer-checked:border-foreground/50 peer-checked:bg-accent peer-checked:font-medium peer-focus-visible:ring-2 peer-focus-visible:ring-ring",children:[r===p.id?s.jsx(Fn,{className:"size-3 shrink-0","aria-hidden":"true"}):s.jsx(Ta,{className:"size-3 shrink-0 text-muted-foreground","aria-hidden":"true"}),s.jsx("span",{className:"break-words",children:p.name}),t[p.id]!=null&&s.jsx("span",{"aria-label":`${t[p.id]} sandboxes`,className:"font-mono text-[10px] text-faint",children:t[p.id]})]})]},p.id):s.jsx(YT,{pressed:h.includes(p.id),onClick:()=>g(p.id),count:t[p.id],children:p.name},p.id)),u&&s.jsx(nq,{existing:e,onCreated:p=>{f==null||f(p),g(p.id)}})]})}const _s=e=>(e==null?void 0:e.label)??((e==null?void 0:e.target)==="cloud"?"Cloud":e!=null&&e.remote?`SSH · ${e.host??e.gateway}`:"Local"),Vn=e=>{var t,r;return JSON.stringify([[((t=e.location)==null?void 0:t.target)??"local",((r=e.location)==null?void 0:r.context)??""],e.id??e.name])};async function zM(e,t,r=1e3){let a=await e.connect({localGateway:t});for(;a.status==="working";)await new Promise(l=>setTimeout(l,r)),a=await e.connectionJob(a.id);if(a.status!=="ready")throw new Error(a.error||`Couldn’t connect to ${t}.`);return a}function So({location:e}){return e?s.jsxs("span",{className:`inline-flex shrink-0 items-center rounded border px-1.5 py-0.5 text-[10px] font-normal ${e.connected?"border-border text-muted-foreground":"border-amber-500/40 text-amber-600"}`,title:e.error||`${e.gateway} · ${e.workspace}`,children:[_s(e),!e.connected&&" · Disconnected"]}):null}function sq(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const rq=e=>{switch(e){case"success":return iq;case"info":return cq;case"warning":return lq;case"error":return uq;default:return null}},oq=Array(12).fill(0),aq=({visible:e,className:t})=>Je.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Je.createElement("div",{className:"sonner-spinner"},oq.map((r,a)=>Je.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),iq=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),lq=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),cq=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),uq=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},Je.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),dq=Je.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},Je.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Je.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),fq=()=>{const[e,t]=Je.useState(document.hidden);return Je.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)},[]),e};let mq=1;const hq=100,KT=e=>{var t;return typeof(e==null?void 0:e.id)=="number"||(e==null||(t=e.id)==null?void 0:t.length)>0?e.id:mq++};class pq{constructor(){this.subscribe=t=>(this.subscribers.push(t),this.getActiveToasts().forEach(r=>t(r)),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t],this.trimHistory()},this.trimHistory=()=>{let t=this.toasts.length-hq;t<=0||(this.toasts=this.toasts.filter(r=>t>0&&this.dismissedToasts.has(r.id)?(this.dismissedToasts.delete(r.id),t--,!1):!0))},this.create=t=>{const{message:r,...a}=t,l=KT(t),c=this.pendingDismissals.get(l);c!==void 0&&(cancelAnimationFrame(c),this.pendingDismissals.delete(l),this.dismissedToasts.delete(l));const u=this.dismissedToasts.has(l),f=t.dismissible===void 0?!0:t.dismissible;return u&&(this.dismissedToasts.delete(l),this.toasts=this.toasts.filter(h=>h.id!==l)),(u?void 0:this.toasts.find(h=>h.id===l))?this.toasts=this.toasts.map(h=>h.id===l?(this.publish({...h,...t,id:l,title:r}),{...h,...t,id:l,dismissible:f,title:r}):h):this.addToast({title:r,...a,dismissible:f,id:l}),l},this.dismiss=t=>{if(t==null)return this.getActiveToasts().forEach(a=>{this.dismissedToasts.add(a.id),this.subscribers.forEach(l=>l({id:a.id,dismiss:!0}))}),t;this.dismissedToasts.add(t);const r=this.pendingDismissals.get(t);return r!==void 0&&cancelAnimationFrame(r),this.pendingDismissals.set(t,requestAnimationFrame(()=>{this.pendingDismissals.delete(t),this.subscribers.forEach(a=>a({id:t,dismiss:!0}))})),t},this.message=(t,r)=>this.create({...r,message:t,type:void 0}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let a;r.loading!==void 0&&(a=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const l=Promise.resolve(t instanceof Function?t():t);let c=a!==void 0,u;const f=l.then(async h=>{if(u=["resolve",h],Je.isValidElement(h))c=!1,this.create({id:a,type:"default",message:h});else if(xq(h)&&!h.ok){c=!1;const p=typeof r.error=="function"?await r.error(`HTTP error! status: ${h.status}`):r.error,b=typeof r.description=="function"?await r.description(`HTTP error! status: ${h.status}`):r.description,j=typeof p=="object"&&!Je.isValidElement(p)?p:{message:p};this.create({id:a,type:"error",description:b,...j})}else if(h instanceof Error){c=!1;const p=typeof r.error=="function"?await r.error(h):r.error,b=typeof r.description=="function"?await r.description(h):r.description,j=typeof p=="object"&&!Je.isValidElement(p)?p:{message:p};this.create({id:a,type:"error",description:b,...j})}else if(r.success!==void 0){c=!1;const p=typeof r.success=="function"?await r.success(h):r.success,b=typeof r.description=="function"?await r.description(h):r.description,j=typeof p=="object"&&!Je.isValidElement(p)?p:{message:p};this.create({id:a,type:"success",description:b,...j})}}).catch(async h=>{if(u=["reject",h],r.error!==void 0){c=!1;const g=typeof r.error=="function"?await r.error(h):r.error,p=typeof r.description=="function"?await r.description(h):r.description,v=typeof g=="object"&&!Je.isValidElement(g)?g:{message:g};this.create({id:a,type:"error",description:p,...v})}}).finally(()=>{c&&(this.dismiss(a),a=void 0),r.finally==null||r.finally.call(r)}),m=()=>new Promise((h,g)=>f.then(()=>u[0]==="reject"?g(u[1]):h(u[1])).catch(g));return typeof a!="string"&&typeof a!="number"?{unwrap:m}:Object.assign(a,{unwrap:m})},this.custom=(t,r)=>{const a=KT(r);return this.create({...r,jsx:t(a),id:a,type:void 0}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}}const or=new pq,gq=(e,t)=>or.message(e,t),xq=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",bq=gq,yq=()=>or.toasts,vq=()=>or.getActiveToasts(),qe=Object.assign(bq,{success:or.success,info:or.info,warning:or.warning,error:or.error,custom:or.custom,message:or.message,promise:or.promise,dismiss:or.dismiss,loading:or.loading},{getHistory:yq,getToasts:vq});sq("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function kh(e){return e.label!==void 0}const wq=3,jq="24px",Sq="16px",XT=4e3,Nq=356,Cq=14,kq=45,Tq=200;function Lo(...e){return e.filter(Boolean).join(" ")}function Eq(e){const[t,r]=e.split("-"),a=[];return t&&a.push(t),r&&a.push(r),a}const Rq=e=>{var t,r,a,l,c,u,f,m,h;const{invert:g,toast:p,unstyled:b,interacting:v,setHeights:j,visibleToasts:S,heights:C,index:N,toasts:E,expanded:T,removeToast:A,defaultRichColors:k,closeButton:M,style:R,cancelButtonStyle:O,actionButtonStyle:D,className:_="",descriptionClassName:L="",duration:q,position:P,gap:$,expandByDefault:H,classNames:F,icons:V,closeButtonAriaLabel:G="Close toast"}=e,[X,B]=Je.useState(null),[Z,K]=Je.useState(null),[se,I]=Je.useState(!1),[U,Q]=Je.useState(!1),[te,le]=Je.useState(!1),[J,ne]=Je.useState(!1),[ce,oe]=Je.useState(!1),[W,de]=Je.useState(0),[Ee,Be]=Je.useState(0),Ne=Je.useRef(p.duration||q||XT),Ae=Je.useRef(null),ee=Je.useRef(null),re=N===0,xe=N+1<=S,he=p.type,$e=he??"default",we=p.dismissible!==!1,_e=p.className||"",Re=p.descriptionClassName||"",Te=Je.useMemo(()=>C.findIndex(Qe=>Qe.toastId===p.id)||0,[C,p.id]),be=Je.useMemo(()=>{var Qe;return(Qe=p.closeButton)!=null?Qe:M},[p.closeButton,M]),Ue=Je.useMemo(()=>p.duration||q||XT,[p.duration,q]),Ze=Je.useRef(0),ht=Je.useRef(0),at=Je.useRef(0),Pe=Je.useRef(null),[ct,We]=P.split("-"),me=Je.useMemo(()=>C.reduce((Qe,kt,At)=>At>=Te?Qe:Qe+kt.height,0),[C,Te]),De=fq(),Oe=Je.useMemo(()=>{var Qe;return(Qe=e.swipeDirections)!=null?Qe:Eq(P)},[e.swipeDirections,P]),nt=p.invert||g,Ge=he==="loading";ht.current=Je.useMemo(()=>Te*$+me,[Te,me]),Je.useEffect(()=>{Ne.current=Ue},[Ue]),Je.useEffect(()=>{I(!0)},[]),Je.useEffect(()=>{const Qe=ee.current;if(Qe){const kt=Qe.getBoundingClientRect().height;return Be(kt),j(At=>[{toastId:p.id,height:kt,position:p.position},...At]),()=>j(At=>At.filter(jt=>jt.toastId!==p.id))}},[j,p.id]),Je.useLayoutEffect(()=>{if(!se)return;const Qe=ee.current,kt=Qe.style.height;Qe.style.height="auto";const At=Qe.getBoundingClientRect().height;Qe.style.height=kt,Be(At),j(jt=>jt.find(St=>St.toastId===p.id)?jt.map(St=>St.toastId===p.id?{...St,height:At}:St):[{toastId:p.id,height:At,position:p.position},...jt])},[se,p.title,p.description,j,p.id,p.jsx,p.action,p.cancel]);const Ye=Je.useCallback(()=>{Q(!0),de(ht.current),j(Qe=>Qe.filter(kt=>kt.toastId!==p.id)),setTimeout(()=>{A(p)},Tq)},[p,A,j,ht]);Je.useEffect(()=>{if(p.promise&&he==="loading"||p.duration===1/0||p.type==="loading")return;let Qe;return T||v||De?(()=>{if(at.current<Ze.current){const jt=new Date().getTime()-Ze.current;Ne.current=Ne.current-jt}at.current=new Date().getTime()})():(()=>{Ne.current!==1/0&&(Ze.current=new Date().getTime(),Qe=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),Ye()},Ne.current))})(),()=>clearTimeout(Qe)},[T,v,p,he,De,Ye]),Je.useEffect(()=>{p.delete&&(Ye(),p.onDismiss==null||p.onDismiss.call(p,p))},[Ye,p.delete]);function pe(){var Qe;if(V!=null&&V.loading){var kt;return Je.createElement("div",{className:Lo(F==null?void 0:F.loader,p==null||(kt=p.classNames)==null?void 0:kt.loader,"sonner-loader"),"data-visible":he==="loading"},V.loading)}return Je.createElement(aq,{className:Lo(F==null?void 0:F.loader,p==null||(Qe=p.classNames)==null?void 0:Qe.loader),visible:he==="loading"})}const He=p.icon||(V==null?void 0:V[he])||rq(he);var Ie,ut;return Je.createElement("li",{tabIndex:0,ref:ee,className:Lo(_,_e,F==null?void 0:F.toast,p==null||(t=p.classNames)==null?void 0:t.toast,F==null?void 0:F[$e],p==null||(r=p.classNames)==null?void 0:r[$e]),"data-sonner-toast":"","data-rich-colors":(Ie=p.richColors)!=null?Ie:k,"data-styled":!(p.jsx||p.unstyled||b),"data-mounted":se,"data-promise":!!p.promise,"data-swiped":ce,"data-removed":U,"data-visible":xe,"data-y-position":ct,"data-x-position":We,"data-index":N,"data-front":re,"data-swiping":te,"data-dismissible":we,"data-type":he,"data-invert":nt,"data-swipe-out":J,"data-swipe-direction":Z,"data-expanded":!!(T||H&&se),"data-testid":p.testId,style:{"--index":N,"--toasts-before":N,"--z-index":E.length-N,"--offset":`${U?W:ht.current}px`,"--initial-height":H?"auto":`${Ee}px`,...R,...p.style},onDragEnd:()=>{le(!1),B(null),Pe.current=null},onPointerDown:Qe=>{Qe.button!==2&&(Ge||!we||(Ae.current=new Date,de(ht.current),Qe.target.setPointerCapture(Qe.pointerId),Qe.target.tagName!=="BUTTON"&&(le(!0),Pe.current={x:Qe.clientX,y:Qe.clientY})))},onPointerUp:()=>{var Qe,kt,At;if(J||!we)return;Pe.current=null;const jt=Number(((Qe=ee.current)==null?void 0:Qe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ht=Number(((kt=ee.current)==null?void 0:kt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),St=new Date().getTime()-((At=Ae.current)==null?void 0:At.getTime()),dt=X==="x"?jt:Ht,yt=Math.abs(dt)/St;if((X==="x"?Oe.includes(jt>0?"right":"left"):Oe.includes(Ht>0?"bottom":"top"))&&(Math.abs(dt)>=kq||yt>.11)){de(ht.current),p.onDismiss==null||p.onDismiss.call(p,p),K(X==="x"?jt>0?"right":"left":Ht>0?"down":"up"),Ye(),ne(!0);return}else{var Xe,rt;(Xe=ee.current)==null||Xe.style.setProperty("--swipe-amount-x","0px"),(rt=ee.current)==null||rt.style.setProperty("--swipe-amount-y","0px")}oe(!1),le(!1),B(null)},onPointerMove:Qe=>{var kt,At,jt;if(!Pe.current||!we||((kt=window.getSelection())==null?void 0:kt.toString().length)>0)return;const St=Qe.clientY-Pe.current.y,dt=Qe.clientX-Pe.current.x;!X&&(Math.abs(dt)>1||Math.abs(St)>1)&&B(Math.abs(dt)>Math.abs(St)?"x":"y");let yt={x:0,y:0};const ae=Xe=>1/(1.5+Math.abs(Xe)/20);if(X==="y"){if(Oe.includes("top")||Oe.includes("bottom"))if(Oe.includes("top")&&St<0||Oe.includes("bottom")&&St>0)yt.y=St;else{const Xe=St*ae(St);yt.y=Math.abs(Xe)<Math.abs(St)?Xe:St}}else if(X==="x"&&(Oe.includes("left")||Oe.includes("right")))if(Oe.includes("left")&&dt<0||Oe.includes("right")&&dt>0)yt.x=dt;else{const Xe=dt*ae(dt);yt.x=Math.abs(Xe)<Math.abs(dt)?Xe:dt}(Math.abs(yt.x)>0||Math.abs(yt.y)>0)&&oe(!0),(At=ee.current)==null||At.style.setProperty("--swipe-amount-x",`${yt.x}px`),(jt=ee.current)==null||jt.style.setProperty("--swipe-amount-y",`${yt.y}px`)}},be&&!p.jsx&&he!=="loading"?Je.createElement("button",{"aria-label":G,"data-disabled":Ge,"data-close-button":!0,onClick:Ge||!we?()=>{}:()=>{Ye(),p.onDismiss==null||p.onDismiss.call(p,p)},className:Lo(F==null?void 0:F.closeButton,p==null||(a=p.classNames)==null?void 0:a.closeButton)},(ut=V==null?void 0:V.close)!=null?ut:dq):null,(he||p.icon||p.promise)&&p.icon!==null&&((V==null?void 0:V[he])!==null||p.icon)?Je.createElement("div",{"data-icon":"",className:Lo(F==null?void 0:F.icon,p==null||(l=p.classNames)==null?void 0:l.icon)},he==="loading"?p.icon||pe():p.promise?pe():null,he!=="loading"?He:null):null,Je.createElement("div",{"data-content":"",className:Lo(F==null?void 0:F.content,p==null||(c=p.classNames)==null?void 0:c.content)},Je.createElement("div",{"data-title":"",className:Lo(F==null?void 0:F.title,p==null||(u=p.classNames)==null?void 0:u.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?Je.createElement("div",{"data-description":"",className:Lo(L,Re,F==null?void 0:F.description,p==null||(f=p.classNames)==null?void 0:f.description)},typeof p.description=="function"?p.description():p.description):null),Je.isValidElement(p.cancel)?p.cancel:p.cancel&&kh(p.cancel)?Je.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||O,onClick:Qe=>{kh(p.cancel)&&we&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Qe),Ye())},className:Lo(F==null?void 0:F.cancelButton,p==null||(m=p.classNames)==null?void 0:m.cancelButton)},p.cancel.label):null,Je.isValidElement(p.action)?p.action:p.action&&kh(p.action)?Je.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||D,onClick:Qe=>{kh(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Qe),!Qe.defaultPrevented&&Ye())},className:Lo(F==null?void 0:F.actionButton,p==null||(h=p.classNames)==null?void 0:h.actionButton)},p.action.label):null)};function WT(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Aq(e,t){const r={};return[e,t].forEach((a,l)=>{const c=l===1,u=c?"--mobile-offset":"--offset",f=c?Sq:jq;function m(h){["top","right","bottom","left"].forEach(g=>{r[`${u}-${g}`]=typeof h=="number"?`${h}px`:h})}typeof a=="number"||typeof a=="string"?m(a):typeof a=="object"?["top","right","bottom","left"].forEach(h=>{a[h]===void 0?r[`${u}-${h}`]=f:r[`${u}-${h}`]=typeof a[h]=="number"?`${a[h]}px`:a[h]}):m(f)}),r}const Oq=Je.forwardRef(function(t,r){const{id:a,invert:l,position:c="bottom-right",hotkey:u=["altKey","KeyT"],expand:f,closeButton:m,className:h,offset:g,mobileOffset:p,theme:b="light",richColors:v,duration:j,style:S,visibleToasts:C=wq,toastOptions:N,dir:E=WT(),gap:T=Cq,icons:A,customAriaLabel:k,containerAriaLabel:M="Notifications"}=t,[R,O]=Je.useState([]),D=Je.useMemo(()=>a?R.filter(I=>I.toasterId===a):R.filter(I=>!I.toasterId),[R,a]),_=Je.useMemo(()=>Array.from(new Set([c].concat(D.filter(I=>I.position).map(I=>I.position)))),[D,c]),[L,q]=Je.useState([]),[P,$]=Je.useState(!1),[H,F]=Je.useState(!1),[V,G]=Je.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),X=Je.useRef(null),B=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),Z=Je.useRef(null),K=Je.useRef(!1),se=Je.useCallback(I=>{O(U=>{var Q;return(Q=U.find(te=>te.id===I.id))!=null&&Q.delete||or.dismiss(I.id),U.filter(({id:te})=>te!==I.id)})},[]);return Je.useEffect(()=>or.subscribe(I=>{if(I.dismiss){requestAnimationFrame(()=>{O(U=>U.map(Q=>Q.id===I.id?{...Q,delete:!0}:Q))});return}setTimeout(()=>{QL.flushSync(()=>{O(U=>{const Q=U.findIndex(te=>te.id===I.id);return Q!==-1?[...U.slice(0,Q),{...U[Q],...I},...U.slice(Q+1)]:[I,...U]})})})}),[]),Je.useEffect(()=>{if(b!=="system"){G(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?G("dark"):G("light")),typeof window>"u")return;const I=window.matchMedia("(prefers-color-scheme: dark)");try{I.addEventListener("change",({matches:U})=>{G(U?"dark":"light")})}catch{I.addListener(({matches:Q})=>{try{G(Q?"dark":"light")}catch(te){console.error(te)}})}},[b]),Je.useEffect(()=>{R.length<=1&&$(!1)},[R]),Je.useEffect(()=>{const I=U=>{var Q;if(u.length>0&&u.every(J=>U[J]||U.code===J)){var le;$(!0),(le=X.current)==null||le.focus()}U.code==="Escape"&&(document.activeElement===X.current||(Q=X.current)!=null&&Q.contains(document.activeElement))&&$(!1)};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[u]),Je.useEffect(()=>{if(X.current)return()=>{Z.current&&(Z.current.focus({preventScroll:!0}),Z.current=null,K.current=!1)}},[X.current]),Je.createElement("section",{ref:r,"aria-label":k??`${M} ${B}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},_.map((I,U)=>{var Q;const[te,le]=I.split("-");return D.length?Je.createElement("ol",{key:I,dir:E==="auto"?WT():E,tabIndex:-1,ref:X,className:h,"data-sonner-toaster":!0,"data-sonner-theme":V,"data-y-position":te,"data-x-position":le,style:{"--front-toast-height":`${((Q=L[0])==null?void 0:Q.height)||0}px`,"--width":`${Nq}px`,"--gap":`${T}px`,...S,...Aq(g,p)},onBlur:J=>{K.current&&!J.currentTarget.contains(J.relatedTarget)&&(K.current=!1,Z.current&&(Z.current.focus({preventScroll:!0}),Z.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||K.current||(K.current=!0,Z.current=J.relatedTarget)},onMouseEnter:()=>$(!0),onMouseMove:()=>$(!0),onMouseLeave:()=>{H||$(!1)},onDragEnd:()=>$(!1),onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||F(!0)},onPointerUp:()=>F(!1)},D.filter(J=>!J.position&&U===0||J.position===I).map((J,ne)=>{var ce,oe;return Je.createElement(Rq,{key:J.id,icons:A,index:ne,toast:J,defaultRichColors:v,duration:(ce=N==null?void 0:N.duration)!=null?ce:j,className:N==null?void 0:N.className,descriptionClassName:N==null?void 0:N.descriptionClassName,invert:l,visibleToasts:C,closeButton:(oe=N==null?void 0:N.closeButton)!=null?oe:m,interacting:H,position:I,style:N==null?void 0:N.style,unstyled:N==null?void 0:N.unstyled,classNames:N==null?void 0:N.classNames,cancelButtonStyle:N==null?void 0:N.cancelButtonStyle,actionButtonStyle:N==null?void 0:N.actionButtonStyle,closeButtonAriaLabel:N==null?void 0:N.closeButtonAriaLabel,removeToast:se,toasts:D.filter(W=>W.position==J.position),heights:L.filter(W=>W.position==J.position),setHeights:q,expandByDefault:f,gap:T,expanded:P,swipeDirections:t.swipeDirections})})):null}))}),Mq={info:{icon:s.jsx(uf,{className:"size-4 text-muted-foreground"}),role:"status"},progress:{icon:s.jsx(zt,{className:"size-4 text-muted-foreground"}),role:"status"},success:{icon:s.jsx(Fn,{className:"size-4 text-emerald-600"}),role:"status"},warning:{icon:s.jsx(_a,{className:"size-4 text-amber-600"}),role:"alert"},error:{icon:s.jsx(PR,{className:"size-4 text-destructive"}),role:"alert"}};function Dq({tone:e="info",title:t,children:r,actions:a,onDismiss:l,dismissLabel:c}){const{icon:u,role:f}=Mq[e];return s.jsxs("div",{role:f,className:"flex w-[var(--width)] max-w-full gap-3 rounded-[var(--radius)] border border-border bg-popover p-4 text-xs text-popover-foreground shadow-lg",children:[s.jsx("span",{className:"mt-px shrink-0","aria-hidden":"true",children:u}),s.jsxs("div",{className:"min-w-0 flex-1",children:[t&&s.jsx("p",{className:"break-words font-medium",children:t}),r&&s.jsx("div",{className:"mt-0.5 break-words text-muted-foreground",children:r}),a&&s.jsx("div",{className:"mt-2.5 flex flex-wrap items-center gap-2",children:a})]}),l&&s.jsx("button",{type:"button","aria-label":c??"Dismiss notification",onClick:l,className:"-mt-1 -mr-1 size-6 shrink-0 rounded-md text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(On,{className:"mx-auto size-3.5"})})]})}function Pi({id:e,...t}){return x.useEffect(()=>{const r=setTimeout(()=>qe.custom(()=>s.jsx(Dq,{...t}),{id:e,duration:1/0,dismissible:!1,unstyled:!0}));return()=>clearTimeout(r)}),x.useEffect(()=>()=>{qe.dismiss(e)},[e]),null}const zq="Not downloaded yet. Import downloads this npm package and checks that it starts, in a temporary sandbox.",Aw=e=>e===zq||e.startsWith("Prepare package"),Ow=e=>e.kind==="mcp"&&!e.disabled&&!e.config&&!e.configuration&&!e.package;function Pq(e){const t=new Map([["shadcn","ui.shadcn.com"],["@magicuidesign/mcp","magicui.design"]]).get(e==null?void 0:e.name);return t?[{phase:"runtime",host:t,port:443,reason:"Default component registry this MCP reads from."}]:[]}function PM(e){var r;const t=new Set(e.preparationIssues||[]);return!!(!e.disabled&&e.package&&!e.artifact&&!((r=e.credentialFields)!=null&&r.length)&&e.issues.every(a=>Aw(a)||t.has(a)))}function Iq(e){return!e.disabled&&(!e.issues.length||PM(e))}function _q(e){const t=e.requirements||[];return[...t,...Pq(e.package).filter(r=>!t.some(a=>a.host===r.host&&a.phase===r.phase))]}const QT=e=>e.items.some(t=>!t.disabled&&t.issues.length>0),IM=e=>!!(e!=null&&e.useSourceSecrets||e!=null&&e.provider||Object.values((e==null?void 0:e.secrets)||{}).some(Boolean)),_M=(e,t)=>e.issues.filter(r=>{var a;return!Aw(r)&&!((a=e.preparationIssues)!=null&&a.includes(r))&&!(r.startsWith("Connect credentials")&&IM(t))}),Lq=(e,t={})=>new Map(e.items.map(r=>[r.id,new Set(_M(r,t[r.id]))])),Bq=(e,t={})=>e.items.filter(r=>!r.disabled&&_M(r,t[r.id]).length>0),$q=(e,t)=>t.items.some(r=>!r.disabled&&r.issues.some(a=>{var l;return!((l=e.get(r.id))!=null&&l.has(a))}));async function Vq(e,t,r,a,{onProgress:l=()=>{},onReview:c=()=>{},isCancelled:u=()=>!1,resumeJob:f,wait:m=h=>new Promise(g=>setTimeout(g,h))}={}){const h=Lq(t,a);let g=f||await e.prepareSetup(t.token,a);l(g);let p=0;for(;g.status==="running";){await m(1500*Math.min(p+1,4));try{g=await e.setupPreparation(g.id),p=0}catch(v){if(++p>=20)throw v;continue}l(g)}if(g.review&&c(g.review),g.status==="cancelled"||u())return{status:"cancelled",review:g.review};if(g.status!=="complete"||!g.review)throw new Error(g.message||"Import could not finish. Try again.");return $q(h,g.review)?{status:"needs-attention",review:g.review}:(l({...g,message:"Saving your setup…"}),{status:"saved",setup:await e.saveSetup(g.review.token,r,!0),inactive:g.review.items.filter(v=>!v.disabled&&v.issues.length).map(v=>v.name)})}function tf({value:e,startValue:t=0,direction:r="up",delay:a=0,className:l,decimalPlaces:c=0,...u}){const f=x.useRef(null),m=Bs(),h=Tw(r==="down"?e:t),g=PG(h,{damping:60,stiffness:100}),p=EM(f,{once:!0,margin:"0px"}),b=x.useCallback(v=>Intl.NumberFormat("en-US",{minimumFractionDigits:c,maximumFractionDigits:c}).format(Number(v.toFixed(c))),[c]);return x.useEffect(()=>{if(!p)return;const v=setTimeout(()=>h.set(r==="down"?t:e),a*1e3);return()=>clearTimeout(v)},[h,p,a,e,r,t]),x.useEffect(()=>g.on("change",v=>{f.current&&!m&&(f.current.textContent=b(v))}),[g,b,m]),x.useEffect(()=>{f.current&&m&&(f.current.textContent=b(e))},[m,e,b]),s.jsx("span",{ref:f,className:Le("inline-block tabular-nums",l),...u,children:m?b(e):t})}function LM(e){if(e.length<2)return e.length?`M${e[0][0]} ${e[0][1]}`:"";const t=e.length,r=[],a=[];for(let u=0;u<t-1;u++)r[u]=e[u+1][0]-e[u][0],a[u]=(e[u+1][1]-e[u][1])/(r[u]||1);const l=[a[0]];for(let u=1;u<t-1;u++)l[u]=a[u-1]*a[u]<=0?0:(a[u-1]+a[u])/2;l[t-1]=a[t-2];for(let u=0;u<t-1;u++){if(a[u]===0){l[u]=0,l[u+1]=0;continue}const f=l[u]/a[u],m=l[u+1]/a[u],h=Math.hypot(f,m);h>3&&(l[u]=3*f/h*a[u],l[u+1]=3*m/h*a[u])}let c=`M${e[0][0].toFixed(2)} ${e[0][1].toFixed(2)}`;for(let u=0;u<t-1;u++){const f=r[u]/3;c+=` C${(e[u][0]+f).toFixed(2)} ${(e[u][1]+l[u]*f).toFixed(2)} ${(e[u+1][0]-f).toFixed(2)} ${(e[u+1][1]-l[u+1]*f).toFixed(2)} ${e[u+1][0].toFixed(2)} ${e[u+1][1].toFixed(2)}`}return c}function BM(e,t,r){const a=r-t*6e4,l=Array.from({length:t},(c,u)=>({at:a+(u+1)*6e4,allowed:0,denied:0}));for(const c of e){if(c.kind!=="audit"||!c.verdict||!c.at)continue;const u=Date.parse(c.at);if(u<=a||u>r)continue;const f=Math.min(t-1,Math.floor((u-a)/6e4));l[f][c.verdict]+=1}return l}const Uq=e=>new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"});function $M({points:e,height:t=34,title:r,action:a}){const l=x.useRef(null),c=x.useId(),u=Bs(),[f,m]=x.useState(280),[h,g]=x.useState(null);x.useLayoutEffect(()=>{const k=l.current;if(!k)return;const M=()=>m(k.clientWidth);M();const R=new ResizeObserver(M);return R.observe(k),()=>R.disconnect()},[]);const p=Math.max(4,Math.round(t*.18)),b=e.map(k=>k.allowed+k.denied),v=Math.max(1,...b),j=k=>(e.length<2?f-12:k/(e.length-1)*(f-12))+6,S=k=>t-p-k/v*(t-p*2),C=b.map((k,M)=>[j(M),S(k)]),N=LM(C),E=`${N} L${j(e.length-1).toFixed(2)} ${t} L${j(0).toFixed(2)} ${t} Z`,T=h===null?null:e[h],A=k=>e.reduce((M,R)=>M+R[k],0);return s.jsxs("div",{className:"relative w-full",onMouseLeave:()=>g(null),onMouseMove:k=>{const M=k.currentTarget.getBoundingClientRect(),R=(k.clientX-M.left)/Math.max(1,M.width);g(Math.min(e.length-1,Math.max(0,Math.round(R*(e.length-1)))))},children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"min-w-0 truncate text-[10px] font-bold tracking-widest text-faint uppercase",children:T?s.jsxs("span",{className:"font-mono normal-case tracking-normal text-muted-foreground",children:[Uq(T.at)," · ",T.allowed," allowed",T.denied?s.jsxs("span",{className:"text-red-600",children:[" · ",T.denied," denied"]}):null]}):r}),s.jsx("span",{className:"ml-auto shrink-0",children:a})]}),s.jsx("div",{ref:l,className:"w-full",children:s.jsxs("svg",{width:f,height:t,role:"img","aria-label":`${A("allowed")} allowed and ${A("denied")} denied connections over ${e.length} minutes`,children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:c,x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"0%",stopColor:"var(--ink)",stopOpacity:"0.1"}),s.jsx("stop",{offset:"100%",stopColor:"var(--ink)",stopOpacity:"0"})]})}),s.jsx("path",{d:E,fill:`url(#${c})`}),s.jsx(Rn.path,{d:N,fill:"none",stroke:"var(--ink)",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.72",initial:u?!1:{pathLength:0},animate:{pathLength:1},transition:{duration:.9,ease:"easeOut"}}),e.map((k,M)=>k.denied?s.jsx("circle",{cx:j(M),cy:t-2,r:"1.75",fill:"var(--status-error)",opacity:h===M?1:.75},k.at):null),T&&s.jsxs("g",{children:[s.jsx("line",{x1:j(h),x2:j(h),y1:"0",y2:t,stroke:"var(--ink)",strokeWidth:"1",strokeDasharray:"2 3",opacity:"0.25"}),s.jsx("circle",{cx:j(h),cy:S(b[h]),r:"3",fill:"var(--surface)",stroke:"var(--ink)",strokeWidth:"1.5"})]})]})})]})}function ea({value:e,onValueChange:t,className:r,ref:a,...l}){return s.jsxs("div",{className:Le("relative",r),children:[s.jsx(s6,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground"}),s.jsx(Rt,{ref:a,value:e,onChange:c=>t(c.target.value),className:"h-7 rounded-[3px] pr-7 pl-8 text-xs focus-visible:ring-1",...l}),e&&s.jsx("button",{type:"button","aria-label":"Clear search",className:"absolute top-1/2 right-2 -translate-y-1/2",onClick:()=>t(""),children:s.jsx(On,{className:"size-3.5"})})]})}function Ul({...e}){return s.jsx(B5,{"data-slot":"sheet",...e})}function Hq({...e}){return s.jsx(H1,{"data-slot":"sheet-portal",...e})}function Fq({className:e,...t}){return s.jsx($1,{"data-slot":"sheet-overlay",className:Le("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs",e),...t})}function cu({className:e,children:t,side:r="right",showCloseButton:a=!0,...l}){return s.jsxs(Hq,{children:[s.jsx(Fq,{}),s.jsxs(U1,{"data-slot":"sheet-content","data-side":r,className:Le("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...l,children:[t,a&&s.jsxs($g,{"data-slot":"sheet-close",render:s.jsx(ue,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[s.jsx(On,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function uu({className:e,...t}){return s.jsx("div",{"data-slot":"sheet-header",className:Le("flex flex-col gap-0.5 p-4",e),...t})}function du({className:e,...t}){return s.jsx(F1,{"data-slot":"sheet-title",className:Le("font-heading text-base font-medium text-foreground",e),...t})}function fu({className:e,...t}){return s.jsx(V1,{"data-slot":"sheet-description",className:Le("text-sm text-muted-foreground",e),...t})}function Gq(e){return L5("alert-dialog",e)}function Wr({...e}){return s.jsx(Gq,{"data-slot":"alert-dialog",...e})}function qq({...e}){return s.jsx(H1,{"data-slot":"alert-dialog-portal",...e})}function Yq({className:e,...t}){return s.jsx($1,{"data-slot":"alert-dialog-overlay",className:fs("fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Qr({className:e,size:t="default",...r}){return s.jsxs(qq,{children:[s.jsx(Yq,{}),s.jsx(U1,{"data-slot":"alert-dialog-content","data-size":t,className:fs("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...r})]})}function Zr({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-header",className:fs("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Jr({className:e,...t}){return s.jsx("div",{"data-slot":"alert-dialog-footer",className:fs("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function eo({className:e,...t}){return s.jsx(F1,{"data-slot":"alert-dialog-title",className:fs("font-heading text-base font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function to({className:e,...t}){return s.jsx(V1,{"data-slot":"alert-dialog-description",className:fs("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function no({className:e,...t}){return s.jsx(ue,{"data-slot":"alert-dialog-action",className:fs(e),...t})}function so({className:e,variant:t="outline",size:r="default",...a}){return s.jsx($g,{"data-slot":"alert-dialog-cancel",className:fs(e),render:s.jsx(ue,{variant:t,size:r}),...a})}const VM=x.createContext(void 0);function Jg(e){const t=x.useContext(VM);if(t===void 0&&!e)throw new Error(Jt(33));return t}const UM=x.createContext(void 0);function $i(e){const t=x.useContext(UM);if(t===void 0&&!e)throw new Error(Jt(36));return t}const Kq=x.createContext(void 0);function Mw(e=!0){const t=x.useContext(Kq);if(t===void 0&&!e)throw new Error(Jt(25));return t}const HM=x.createContext(void 0);function Xq(){const e=x.useContext(HM);if(e===void 0)throw new Error(Jt(30));return e}function Wq(e){const{closeOnClick:t,highlighted:r,id:a,nodeId:l,store:c,typingRef:u,itemRef:f,itemMetadata:m}=e,{events:h}=c.useState("floatingTreeRoot"),g=c.useState("open"),p=Mw(!0),b=p!==void 0;return x.useMemo(()=>({id:a,role:"menuitem",tabIndex:g&&r?0:-1,onKeyDown(v){v.key===" "&&(u!=null&&u.current)&&v.preventDefault()},onMouseMove(v){l&&h.emit("itemhover",{nodeId:l,target:v.currentTarget})},onClick(v){t&&h.emit("close",{domEvent:v,reason:Al})},onMouseUp(v){if(p){const j=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,b&&j&&Math.abs(v.clientX-j.x)<=1&&Math.abs(v.clientY-j.y)<=1||b&&!r1&&v.button===2)return}f.current&&c.context.allowMouseUpTriggerRef.current&&(!b||v.button===2)&&m.type==="regular-item"&&Xc(f.current,v,{detail:1})}}),[t,r,a,h,l,g,c,u,f,p,b,m])}const Dw={type:"regular-item"};function zw(e){const{closeOnClick:t,disabled:r,highlighted:a,id:l,store:c,typingRef:u=c.context.typingRef,nativeButton:f,itemMetadata:m,nodeId:h}=e,g=x.useRef(null),{getButtonProps:p,buttonRef:b}=ro({disabled:r,focusableWhenDisabled:!0,native:f,composite:!0}),v=Wq({closeOnClick:t,highlighted:a,id:l,nodeId:h,store:c,typingRef:u,itemRef:g,itemMetadata:m}),j=x.useCallback(C=>Xs(v,{onMouseEnter(){m.type==="submenu-trigger"&&m.setActive()}},C,p),[v,p,m]),S=qr(g,b);return x.useMemo(()=>({getItemProps:j,itemRef:S}),[j,S])}const Qq="data-checked",Zq="data-unchecked",ex={checked(e){return e?{[Qq]:""}:{[Zq]:""}},...$a},Jq=x.forwardRef(function(t,r){const{render:a,className:l,id:c,label:u,nativeButton:f=!1,disabled:m=!1,closeOnClick:h=!1,checked:g,defaultChecked:p,onCheckedChange:b,style:v,...j}=t,S=Kl({guess:!0,label:u}),C=Jg(!0),N=ds(c),{store:E}=$i(),T=E.useState("disabled"),A=m||T,k=E.useState("isActive",S.index),M=E.useState("itemProps"),[R,O]=Xr({controlled:g,default:p??!1,name:"MenuCheckboxItem",state:"checked"}),{getItemProps:D,itemRef:_}=zw({closeOnClick:h,disabled:A,highlighted:k,id:N,store:E,nativeButton:f,nodeId:C==null?void 0:C.context.nodeId,itemMetadata:Dw}),L=x.useMemo(()=>({disabled:A,highlighted:k,checked:R}),[A,k,R]);function q($){const H=bt(Al,$.nativeEvent,void 0,{preventUnmountOnClose:Tn});b==null||b(!R,H),!H.isCanceled&&O(F=>!F)}const P=wt("div",t,{state:L,stateAttributesMapping:ex,props:[M,{role:"menuitemcheckbox","aria-checked":R,onClick:q},j,D],ref:[_,r,S.ref]});return s.jsx(HM.Provider,{value:L,children:P})}),eY=x.forwardRef(function(t,r){const{render:a,className:l,style:c,keepMounted:u=!1,...f}=t,m=Xq(),h=x.useRef(null),{transitionStatus:g,mounted:p,setMounted:b}=Va(m.checked);lr({batch:!0,enabled:!m.checked,open:m.checked,ref:h,onComplete(){m.checked||b(!1)}});const v={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:g};return wt("span",t,{state:v,ref:[r,h],stateAttributesMapping:ex,props:{"aria-hidden":!0,...f},enabled:u||p})}),Pw=x.createContext(void 0);function tY(){const e=x.useContext(Pw);if(e===void 0)throw new Error(Jt(31));return e}const nY=x.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,[f,m]=x.useState(void 0),h=wt("div",t,{ref:r,props:{role:"group","aria-labelledby":f,...u}});return s.jsx(Pw.Provider,{value:m,children:h})}),sY=x.forwardRef(function(t,r){const{render:a,className:l,style:c,id:u,...f}=t,m=ds(u),h=tY();return Ke(()=>(h(m),()=>{h(g=>g===m?void 0:g)}),[h,m]),wt("div",t,{ref:r,props:{id:m,"aria-hidden":!0,...f}})}),rY=x.forwardRef(function(t,r){const{render:a,className:l,id:c,label:u,nativeButton:f=!1,disabled:m=!1,closeOnClick:h=!0,style:g,...p}=t,b=Kl({guess:!0,label:u}),v=Jg(!0),j=ds(c),{store:S}=$i(),C=S.useState("disabled"),N=m||C,E=S.useState("isActive",b.index),T=S.useState("itemProps"),{getItemProps:A,itemRef:k}=zw({closeOnClick:h,disabled:N,highlighted:E,id:j,store:S,nativeButton:f,nodeId:v==null?void 0:v.context.nodeId,itemMetadata:Dw});return wt("div",t,{state:{disabled:N,highlighted:E},props:[T,p,A],ref:[k,r,b.ref]})}),oY=x.forwardRef(function(t,r){const{render:a,className:l,style:c,finalFocus:u,...f}=t,{store:m}=$i(),{side:h,align:g}=Jg(),p=Bg()!=null,b=m.useState("open"),v=m.useState("transitionStatus"),j=m.useState("popupProps"),S=m.useState("mounted"),C=m.useState("instantType"),N=m.useState("activeTriggerElement"),E=m.useState("parent"),T=m.useState("lastOpenChangeReason"),A=m.useState("rootId"),k=m.useState("floatingRootContext"),M=m.useState("floatingTreeRoot"),R=m.useState("closeDelay"),O=m.useState("hoverEnabled"),D=m.useState("disabled"),_=m.useState("openMethod"),L=E.type==="context-menu";lr({open:b,ref:m.context.popupRef,onComplete(){var F,V;b&&((V=(F=m.context).onOpenChangeComplete)==null||V.call(F,!0))}}),x.useEffect(()=>{function F(V){m.setOpen(!1,bt(V.reason,V.domEvent))}return M.events.on("close",F),()=>{M.events.off("close",F)}},[M.events,m]),D1(k,{enabled:O&&!D&&!L&&E.type!=="menubar",closeDelay:R});const q=m.useStateSetter("popupElement"),P={transitionStatus:v,side:h,align:g,open:b,nested:E.type==="menu",instant:C},$=wt("div",t,{state:P,ref:[r,m.context.popupRef,q],stateAttributesMapping:mg,props:[j,{onKeyDown(F){p&&Tf.has(F.key)&&F.stopPropagation()}},kf(v),f,{"data-rootownerid":A}]});let H=E.type===void 0||L;return(N||E.type==="menubar"&&T!==bg)&&(H=!0),s.jsx(Sg,{context:k,openInteractionType:_,modal:L,disabled:!S,returnFocus:u===void 0?H:u,initialFocus:E.type!=="menu",restoreFocus:!0,externalTree:E.type!=="menubar"?M:void 0,previousFocusableElement:N,nextFocusableElement:E.type===void 0?m.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:E.type===void 0?m.context.beforeContentFocusGuardRef:void 0,children:$})}),FM=x.createContext(void 0);function aY(){const e=x.useContext(FM);if(e===void 0)throw new Error(Jt(32));return e}const iY=x.forwardRef(function(t,r){const{keepMounted:a=!1,...l}=t,{store:c,parent:u}=$i();if(!(c.useState("mounted")||a))return null;const h=u.type==="menu"||u.type==="menubar"?"group":void 0;return s.jsx(FM.Provider,{value:a,children:s.jsx(jg,{ref:r,...l,portalOwnerRole:h})})}),lY=x.forwardRef(function(t,r){var re;const{anchor:a,positionMethod:l="absolute",className:c,render:u,side:f,align:m,sideOffset:h=0,alignOffset:g=0,collisionBoundary:p="clipping-ancestors",collisionPadding:b=5,arrowPadding:v=5,sticky:j=!1,disableAnchorTracking:S=!1,collisionAvoidance:C=GA,style:N,...E}=t,{store:T}=$i(),A=aY(),k=Mw(!0),M=T.useState("parent"),R=T.useState("floatingRootContext"),O=T.useState("floatingTreeRoot"),D=T.useState("mounted"),_=T.useState("open"),L=T.useState("modal"),q=T.useState("openMethod"),P=T.useState("activeTriggerElement"),$=T.useState("transitionStatus"),H=T.useState("positionerElement"),F=T.useState("instantType"),V=T.useState("adaptiveOrigin"),G=T.useState("lastOpenChangeReason"),X=T.useState("floatingNodeId"),B=T.useState("floatingParentNodeId"),Z=R.useState("domReferenceElement"),K=x.useRef(null),se=xf(H);let I=a,U=h,Q=g,te=m,le=C;M.type==="context-menu"&&(I=a??((re=M.context)==null?void 0:re.anchor),te=te??"start",!f&&te!=="center"&&(Q=t.alignOffset??2,U=t.sideOffset??-5));let J=f,ne=te;M.type==="menu"?(J=J??"inline-end",ne=ne??"start",le=t.collisionAvoidance??y1):M.type==="menubar"&&(J=J??(M.context.orientation==="vertical"?"inline-end":"bottom"),ne=ne??"start");const ce=M.type==="context-menu",oe=Pg({anchor:I,floatingRootContext:R,positionMethod:k?"fixed":l,mounted:D,side:J,sideOffset:U,align:ne,alignOffset:Q,arrowPadding:ce?0:v,collisionBoundary:p,collisionPadding:b,sticky:j,nodeId:X,keepMounted:A,disableAnchorTracking:S,collisionAvoidance:le,shift:ce?{crossAxis:!("side"in le&&le.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:O,adaptiveOrigin:V});x.useEffect(()=>{function xe(he){he.open&&(he.parentNodeId===X&&T.set("hoverEnabled",!1),he.nodeId!==X&&he.parentNodeId===T.select("floatingParentNodeId")&&T.setOpen(!1,bt(Td)))}return O.events.on("menuopenchange",xe),()=>{O.events.off("menuopenchange",xe)}},[T,O.events,X]),x.useEffect(()=>{if(T.select("floatingParentNodeId")==null)return;function xe(he){if(he.open||he.nodeId!==T.select("floatingParentNodeId"))return;const $e=he.reason??Td;T.setOpen(!1,bt($e))}return O.events.on("menuopenchange",xe),()=>{O.events.off("menuopenchange",xe)}},[O.events,T]);const W=es();x.useEffect(()=>{_||W.clear()},[_,W]),x.useEffect(()=>{function xe(he){if(!(!_||he.nodeId!==T.select("floatingParentNodeId")))if(he.target&&P&&P!==he.target){const $e=T.select("closeDelay");$e>0?W.isStarted()||W.start($e,()=>{T.setOpen(!1,bt(Td))}):T.setOpen(!1,bt(Td))}else W.clear()}return O.events.on("itemhover",xe),()=>{O.events.off("itemhover",xe)}},[O.events,_,P,T,W]),x.useEffect(()=>{const xe={open:_,nodeId:X,parentNodeId:B,reason:T.select("lastOpenChangeReason")};O.events.emit("menuopenchange",xe)},[O.events,_,T,X,B]),Ke(()=>{const xe=Z,he=K.current;if(xe&&(K.current=xe),he&&xe&&xe!==he){T.set("instantType",void 0);const $e=new AbortController;return se(()=>{T.set("instantType","trigger-change")},$e.signal),()=>{$e.abort()}}},[Z,se,T]);const de={open:_,side:oe.side,align:oe.align,anchorHidden:oe.anchorHidden,nested:M.type==="menu",instant:F},Ee=M.type==="menubar"&&M.context.modal;L1(_&&(Ee||L&&G!==Un),q==="touch",H,P);const Ne=_g(t,de,{styles:oe.positionerStyles,transitionStatus:$,props:E,refs:[r,T.useStateSetter("positionerElement")],hidden:!D,inert:!_}),Ae=D&&M.type!=="menu"&&(M.type!=="menubar"&&L&&G!==Un||M.type==="menubar"&&M.context.modal);let ee=null;return M.type==="menubar"?ee=M.context.contentElement:M.type===void 0&&(ee=P),s.jsxs(VM.Provider,{value:oe,children:[Ae&&s.jsx(Ig,{ref:M.type==="context-menu"||M.type==="nested-context-menu"?M.context.internalBackdropRef:null,inert:Nf(!_),cutout:ee}),s.jsx(ZA,{id:X,children:s.jsx(Cf,{elementsRef:T.context.itemDomElements,labelsRef:T.context.itemLabels,children:Ne})})]})}),GM=x.createContext(void 0);function cY(){const e=x.useContext(GM);if(e===void 0)throw new Error(Jt(34));return e}const uY=x.memo(x.forwardRef(function(t,r){const{render:a,className:l,value:c,defaultValue:u,onValueChange:f,disabled:m=!1,style:h,"aria-labelledby":g,...p}=t,[b,v]=x.useState(void 0),[j,S]=Xr({controlled:c,default:u,name:"MenuRadioGroup"}),C=et((A,k)=>{f==null||f(A,k),!k.isCanceled&&S(A)}),E=wt("div",t,{state:{disabled:m},ref:r,props:{role:"group","aria-labelledby":g??b,"aria-disabled":m||void 0,...p}}),T=x.useMemo(()=>({value:j,setValue:C,disabled:m}),[j,C,m]);return s.jsx(Pw.Provider,{value:v,children:s.jsx(GM.Provider,{value:T,children:E})})})),qM=x.createContext(void 0);function dY(){const e=x.useContext(qM);if(e===void 0)throw new Error(Jt(35));return e}const fY=x.forwardRef(function(t,r){const{render:a,className:l,id:c,label:u,nativeButton:f=!1,disabled:m=!1,closeOnClick:h=!1,value:g,style:p,...b}=t,v=Kl({guess:!0,label:u}),j=Jg(!0),S=ds(c),{store:C}=$i(),N=C.useState("isActive",v.index),E=C.useState("itemProps"),{value:T,setValue:A,disabled:k}=cY(),M=C.useState("disabled"),R=m||k||M,O=T===g,{getItemProps:D,itemRef:_}=zw({closeOnClick:h,disabled:R,highlighted:N,id:S,store:C,nativeButton:f,nodeId:j==null?void 0:j.context.nodeId,itemMetadata:Dw}),L=x.useMemo(()=>({disabled:R,highlighted:N,checked:O}),[R,N,O]);function q($){const H=bt(Al,$.nativeEvent,void 0,{preventUnmountOnClose:Tn});A(g,H)}const P=wt("div",t,{state:L,stateAttributesMapping:ex,props:[E,{role:"menuitemradio","aria-checked":O,onClick:q},b,D],ref:[_,r,v.ref]});return s.jsx(qM.Provider,{value:L,children:P})}),mY=x.forwardRef(function(t,r){const{render:a,className:l,style:c,keepMounted:u=!1,...f}=t,m=dY(),h=x.useRef(null),{transitionStatus:g,mounted:p,setMounted:b}=Va(m.checked);lr({batch:!0,enabled:!m.checked,open:m.checked,ref:h,onComplete(){m.checked||b(!1)}});const v={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:g};return wt("span",t,{state:v,stateAttributesMapping:ex,ref:[r,h],props:{"aria-hidden":!0,...f},enabled:u||p})}),hY=x.createContext(null);function YM(e){return x.useContext(hY)}const pY={...Og,disabled:e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")}};class gY extends bu{constructor(r,a,l=!1){const c=new Sf,u=bY(c,a,l,r);super(u,xY(c),pY);tn(this,"unsubscribeParentListener",null);this.unsubscribeParentListener=this.observe("parent",f=>{var m;if((m=this.unsubscribeParentListener)==null||m.call(this),f.type==="menu"){let h=f.store.select("rootId"),g=f.store.select("floatingTreeRoot"),p=f.store.select("keyboardEventRelay");this.unsubscribeParentListener=f.store.subscribe(()=>{const b=f.store.select("rootId"),v=f.store.select("floatingTreeRoot"),j=f.store.select("keyboardEventRelay");h===b&&g===v&&p===j||(h=b,g=v,p=j,this.notifyAll())}),this.context.allowMouseUpTriggerRef=f.store.context.allowMouseUpTriggerRef;return}f.type!==void 0&&(this.context.allowMouseUpTriggerRef=f.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(r,a){this.state.floatingRootContext.context.events.emit("setOpen",{open:r,eventDetails:a})}}function xY(e){return{positionerRef:x.createRef(),popupRef:x.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function bY(e,t,r=!1,a){return{...Ag(e,t,r),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new v1,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:gn,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...a}}const yY=x.createContext(void 0);function vY(){return x.useContext(yY)}const wY=vf(function(t){const{children:r,open:a,onOpenChange:l,onOpenChangeComplete:c,defaultOpen:u=!1,disabled:f=!1,modal:m,loopFocus:h=!0,orientation:g="vertical",actionsRef:p,closeParentOnEsc:b=!1,handle:v,triggerId:j,defaultTriggerId:S=null,highlightItemOnHover:C=!0}=t,N=Mw(!0),E=$i(!0),T=YM(!0),A=vY(),k=x.useMemo(()=>A&&E?{type:"menu",store:E.store}:T?{type:"menubar",context:T}:N&&!E?{type:"context-menu",context:N}:{type:void 0},[N,E,T,A]),M=Pl(),R=Pl(),O=_i(),D=k.type==="menu"?k.store:void 0,_=(a??u)&&(D==null?void 0:D.state.transitionStatus)==="starting",L=us(()=>_?D==null?void 0:D.state.instantType:void 0).current,q=jY({open:u,openProp:a,activeTriggerId:S,triggerIdProp:j,parent:k,disabled:f,highlightItemOnHover:C,modal:k.type===void 0?m:void 0,rootId:M,instantType:L},R,O!=null);q.useControlledProp("openProp",a),q.useControlledProp("triggerIdProp",j),q.useContextCallback("onOpenChangeComplete",c);const P=q.useState("floatingTreeRoot"),$=w1(P),H=q.useState("open"),F=q.useState("activeTriggerElement"),V=q.useState("positionerElement"),G=q.useState("hoverEnabled"),X=q.useState("disabled"),B=q.useState("lastOpenChangeReason"),Z=q.useState("parent"),K=q.useState("activeIndex"),se=q.useState("payload"),I=q.useState("floatingParentNodeId"),U=x.useRef(null),Q=x.useRef(Z.type!=="context-menu"),te=es(),le=x.useRef(!0),J=es(),ne=I!=null,{openMethod:ce,triggerProps:oe}=k5(H);q.useSyncedValues({disabled:f,highlightItemOnHover:C,modal:Z.type===void 0?m:void 0,openMethod:ce,rootId:M}),Tg(q);const{forceUnmount:W,transitionStatus:de}=Eg(H,q,()=>{q.set("allowMouseEnter",!1)},_),Ee=xf(q.context.popupRef);x.useEffect(()=>{if(L===void 0)return;const Pe=()=>{q.state.instantType===L&&q.set("instantType",void 0)};if(!H){Pe();return}if(de!==void 0)return;if(q.context.popupRef.current==null){Pe();return}const ct=new AbortController;return Ee(Pe,ct.signal),()=>{ct.abort()}},[L,H,de,Ee,q]),Ke(()=>{N&&!E?q.update({parent:{type:"context-menu",context:N},floatingNodeId:$,floatingParentNodeId:O}):E&&q.update({floatingNodeId:$,floatingParentNodeId:O})},[N,E,$,O,q]),x.useEffect(()=>{if(H||(U.current=null),Z.type==="context-menu"){if(!H){te.clear(),Q.current=!1;return}te.start(500,()=>{Q.current=!0})}},[te,H,Z.type]),Ke(()=>{!H&&!G&&q.set("hoverEnabled",!0)},[H,G,q]);const Be=et((Pe,ct)=>{const We=ct.reason;if(!Pe&&!q.select("open")||H===Pe&&ct.trigger===F&&B===We)return;const me=T1(ct);if(!Pe&&ct.trigger==null&&(ct.trigger=F??void 0),l==null||l(Pe,ct),ct.isCanceled)return;q.state.floatingRootContext.dispatchOpenChange(Pe,ct);const De=ct.event;if(Pe===!1&&(De==null?void 0:De.type)==="click"&&De.pointerType==="touch"&&!le.current)return;Pe&&We===Zc?(le.current=!1,J.start(300,()=>{le.current=!0})):(le.current=!0,J.clear());const Oe=(We===Wo||We===Al)&&De.detail===0,nt=!Pe&&(We===yf||We==null);U.current=ct.event;const Ge=kg(q.state,Pe,ct.trigger,me());Ge.openChangeReason=We,Z.type==="menubar"&&(We===Zc||We===Mi||We===Un||We===Hy||We===Td)?Ge.instantType="group":Oe||nt?Ge.instantType=Oe?"click":"dismiss":Ge.instantType=void 0,q.update(Ge)}),Ne=l5({popupStore:q,floatingRootContext:q.state.floatingRootContext,floatingId:R,nested:O!=null,onOpenChange:Be}),Ae=Ne.context.events;Ke(()=>{const Pe=({open:ct,eventDetails:We})=>Be(ct,We);return Ae.on("setOpen",Pe),()=>{Ae==null||Ae.off("setOpen",Pe)}},[Ae,Be]);const ee=x.useCallback(()=>{q.setOpen(!1,bt(yg))},[q]);x.useImperativeHandle(p,()=>({unmount:W,close:ee}),[W,ee]);let re;Z.type==="context-menu"&&(re=Z.context),x.useImperativeHandle(re==null?void 0:re.positionerRef,()=>V,[V]),x.useImperativeHandle(re==null?void 0:re.actionsRef,()=>({setOpen:Be}),[Be]);const xe=wf(Ne,{enabled:!X,bubbles:{escapeKey:b&&Z.type==="menu"},outsidePress(){var Pe;return Z.type!=="context-menu"||((Pe=U.current)==null?void 0:Pe.type)==="contextmenu"?!0:Q.current},externalTree:ne?P:void 0}),he=zg(),$e=x.useCallback(Pe=>{q.select("activeIndex")!==Pe&&q.set("activeIndex",Pe)},[q]),we=h5(Ne,{enabled:!X,listRef:q.context.itemDomElements,activeIndex:K,nested:Z.type!==void 0,loopFocus:h,orientation:g,parentOrientation:Z.type==="menubar"?Z.context.orientation:void 0,rtl:he==="rtl",disabledIndices:Cr,onNavigate:$e,openOnArrowKeyDown:Z.type!=="context-menu",externalTree:ne?P:void 0,focusItemOnHover:C}),_e=x.useCallback(Pe=>{q.context.typingRef.current=Pe},[q]),Re=p5(Ne,{enabled:!X,listRef:q.context.itemLabels,elementsRef:q.context.itemDomElements,activeIndex:K,resetMs:dB,onMatch:Pe=>{H&&Pe!==K&&q.set("activeIndex",Pe)},onTyping:_e}),Te=x.useMemo(()=>{const Pe=Xs(Re.reference,we.reference,xe.reference,{onMouseMove(){q.set("allowMouseEnter",!0)}},oe);return Pe["aria-haspopup"]="menu",Pe["aria-expanded"]=H,Pe},[q,Re.reference,we.reference,xe.reference,oe,H]),be=x.useMemo(()=>{const Pe=Xs(we.trigger,xe.trigger,oe);return Pe["aria-haspopup"]="menu",Pe["aria-expanded"]=!1,Pe},[we.trigger,xe.trigger,oe]);us(()=>(q.update({inactiveTriggerProps:be}),null));const Ue=x.useMemo(()=>Xs(jf,{id:R,role:"menu","aria-orientation":g==="horizontal"?"horizontal":void 0,"aria-labelledby":F==null?void 0:F.id,onMouseMove(){q.set("allowMouseEnter",!0),Z.type==="menu"&&q.set("hoverEnabled",!1)},onClick(){q.select("hoverEnabled")&&q.set("hoverEnabled",!1)},onKeyDown(Pe){const ct=q.select("keyboardEventRelay");ct&&!Pe.isPropagationStopped()&&ct(Pe)}},Re.floating,we.floating,xe.floating),[F,R,g,Z.type,q,Re.floating,we.floating,xe.floating]),Ze=we.item??gn;Rg(q,{floatingRootContext:Ne,activeTriggerProps:Te,inactiveTriggerProps:be,popupProps:Ue,itemProps:Ze});const ht=x.useMemo(()=>({store:q,parent:k}),[q,k]),at=s.jsxs(UM.Provider,{value:ht,children:[v&&s.jsx(Cg,{handle:v,store:q}),typeof r=="function"?r({payload:se}):r]});return Z.type===void 0||Z.type==="context-menu"?s.jsx(JA,{externalTree:P,children:at}):at});function jY(e,t,r){return us(()=>new gY(e,t,r)).current}function KM(e){const{render:t,className:r,style:a,state:l=gn,props:c=Cr,refs:u=Cr,metadata:f,stateAttributesMapping:m,tag:h="div",...g}=e,{compositeProps:p,compositeRef:b}=V5({metadata:f});return wt(h,e,{state:l,ref:[b,...u],props:[p,...c,g],stateAttributesMapping:m})}function XM(e){if(cn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!Sa(e))return XM(Ea(e))}function WM(e,t){const r=x.useRef(null);function a(c){Kr.flushSync(()=>{e.setOpen(!1,bt(Mi,c.nativeEvent,c.currentTarget))});const u=YL(r.current);u==null||u.focus()}function l(c){var f;const u=e.select("positionerElement");if(u&&Qc(c,u))(f=e.context.beforeContentFocusGuardRef.current)==null||f.focus();else{Kr.flushSync(()=>{e.setOpen(!1,bt(Mi,c.nativeEvent,c.currentTarget))});let m=qL(e.context.triggerFocusTargetRef.current||t.current);for(;m!==null&&pt(u,m);){const h=m;if(m=h1(m),m===h)break}m==null||m.focus()}}return{preFocusGuardRef:r,handlePreFocusGuardFocus:a,handleFocusTargetFocus:l}}function SY(e){const{enabled:t=!0,mouseDownAction:r,open:a}=e,l=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:c=>{(r==="open"&&!a||r==="close"&&a)&&(l.current=!0,Ft(c.currentTarget).addEventListener("click",()=>{l.current=!1},{once:!0}))},onClick:c=>{l.current&&(l.current=!1,c.preventBaseUIHandler())}}:gn,[t,r,a])}const NY=b1(function(t,r){const{render:a,className:l,style:c,disabled:u=!1,nativeButton:f=!0,id:m,openOnHover:h,delay:g=100,closeDelay:p=0,handle:b,payload:v,...j}=t,S=$i(!0),N=A1(b)??(S==null?void 0:S.store);if(!N)throw new Error(Jt(85));const E=ds(m),T=N.useState("isTriggerActive",E),A=N.useState("floatingRootContext"),k=N.useState("isOpenedByTrigger",E),M=N.useState("triggerPopupId",E),R=x.useRef(null),O=kY(),D=og(!0),_=Li(),L=x.useMemo(()=>_??new v1,[_]),q=w1(L),P=_i(),{registerTrigger:$,isMountedByThisTrigger:H}=E1(E,R,N,{payload:v,closeDelay:p,parent:O,floatingTreeRoot:L,floatingNodeId:q,floatingParentNodeId:P,keyboardEventRelay:D==null?void 0:D.relayKeyboardEvent}),F=O.type==="menubar",V=N.useState("disabled"),G=u||V||F&&O.context.disabled,{getButtonProps:X,buttonRef:B}=ro({disabled:G,native:f});x.useEffect(()=>{!k&&O.type===void 0&&(N.context.allowMouseUpTriggerRef.current=!1)},[N,k,O.type]);const Z=x.useRef(null),K=es(),se=et(re=>{if(!Z.current)return;K.clear(),N.context.allowMouseUpTriggerRef.current=!1;const xe=re.target;pt(Z.current,xe)||pt(N.select("positionerElement"),xe)||xe===Z.current||xe!=null&&XM(xe)===N.select("rootId")||T5(re,Z.current)||L.events.emit("close",{domEvent:re,reason:EA})});x.useEffect(()=>{k&&N.select("lastOpenChangeReason")===Un&&Ft(Z.current).addEventListener("mouseup",se,{once:!0})},[k,se,N]);const I=F&&O.context.hasSubmenuOpen,Q=z1(A,{enabled:(h??I)&&!G&&(!F||I&&!H),handleClose:P1({blockPointerEvents:!F}),mouseOnly:!0,move:!1,restMs:O.type===void 0?g:void 0,delay:{close:p},triggerElementRef:R,externalTree:L,isActiveTrigger:T,isClosing:()=>N.select("transitionStatus")==="ending"}),te=CY(k,N.select("lastOpenChangeReason")),le=S1(A,{enabled:!G,event:k&&F?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:O.type===void 0?te:!1}),J=f5(A,{enabled:!G&&I}),ne=SY({open:k,enabled:F,mouseDownAction:"open"}),ce=x.useMemo(()=>Xs(J.reference,le.reference),[J.reference,le.reference]),oe=N.useState("triggerProps",H),{preFocusGuardRef:W,handlePreFocusGuardFocus:de,handleFocusTargetFocus:Ee}=WM(N,R),Be={disabled:G,open:k},Ne=[Z,r,B,$,R],Ae=[ce,Q??gn,oe,{"aria-haspopup":"menu","aria-controls":M,id:E,onMouseDown:re=>{if(N.select("open"))return;K.start(200,()=>{N.context.allowMouseUpTriggerRef.current=!0}),Ft(re.currentTarget).addEventListener("mouseup",se,{once:!0})}},F?{role:"menuitem"}:{},ne,j,X],ee=wt("button",t,{enabled:!F,stateAttributesMapping:xp,state:Be,ref:Ne,props:Ae});return F?s.jsx(KM,{tag:"button",render:a,className:l,style:c,state:Be,refs:Ne,props:Ae,stateAttributesMapping:xp}):k?s.jsxs(x.Fragment,{children:[s.jsx(zi,{ref:W,onFocus:de},`${E}-pre-focus-guard`),s.jsx(x.Fragment,{children:ee},E),s.jsx(zi,{ref:N.context.triggerFocusTargetRef,onFocus:Ee},`${E}-post-focus-guard`)]}):s.jsx(x.Fragment,{children:ee},E)});function CY(e,t){const r=es(),[a,l]=x.useState(!1);return Ke(()=>{e&&t===Un?(l(!0),r.start(HA,()=>{l(!1)})):e||(r.clear(),l(!1))},[e,t,r]),a}function kY(){const e=YM();return x.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}const TY=x.forwardRef(function(t,r){const{className:a,render:l,orientation:c="horizontal",style:u,...f}=t;return wt("div",t,{state:{orientation:c},ref:r,props:[{role:"separator","aria-orientation":c},f]})});function ju({...e}){return s.jsx(wY,{"data-slot":"dropdown-menu",...e})}function Su({...e}){return s.jsx(NY,{"data-slot":"dropdown-menu-trigger",...e})}function Nu({align:e="start",alignOffset:t=0,side:r="bottom",sideOffset:a=4,className:l,positionerRender:c,...u}){return s.jsx(iY,{children:s.jsx(lY,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:r,sideOffset:a,render:c,children:s.jsx(oY,{"data-slot":"dropdown-menu-content",className:Le("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",l),...u})})})}function np({...e}){return s.jsx(nY,{"data-slot":"dropdown-menu-group",...e})}function zv({className:e,inset:t,...r}){return s.jsx(sY,{"data-slot":"dropdown-menu-label","data-inset":t,className:Le("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",e),...r})}function Ys({className:e,inset:t,variant:r="default",...a}){return s.jsx(rY,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:Le("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...a})}x.createContext(null);function Iw({className:e,children:t,checked:r,inset:a,...l}){return s.jsxs(Jq,{"data-slot":"dropdown-menu-checkbox-item","data-inset":a,className:Le("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:r,...l,children:[s.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-checkbox-item-indicator",children:s.jsx(eY,{children:s.jsx(Fn,{})})}),t]})}function EY({...e}){return s.jsx(uY,{"data-slot":"dropdown-menu-radio-group",...e})}function ZT({className:e,children:t,inset:r,...a}){return s.jsxs(fY,{"data-slot":"dropdown-menu-radio-item","data-inset":r,className:Le("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...a,children:[s.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:s.jsx(mY,{children:s.jsx(Fn,{})})}),t]})}function $d({className:e,...t}){return s.jsx(TY,{"data-slot":"dropdown-menu-separator",className:Le("-mx-1 my-1 h-px bg-border",e),...t})}function En({className:e,...t}){return s.jsx("label",{"data-slot":"label",className:fs("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}const RY=[{id:"rest",label:"HTTP",hint:"Inspect each request: method and path"},{id:"tcp",label:"TCP",hint:"Connection only; nothing inside is inspected"},{id:"websocket",label:"WebSocket"},{id:"graphql",label:"GraphQL"}],QM=[{id:"read-only",label:"Read only",hint:"GET, HEAD and OPTIONS"},{id:"read-write",label:"Read & write",hint:"Adds POST, PUT, PATCH and DELETE"},{id:"full",label:"Full",hint:"Any request"},{id:"custom",label:"Specific requests",hint:"Only the method and path pairs listed"}],AY=["GET","POST","PUT","PATCH","DELETE","HEAD","*"],go=(e={})=>({host:"",ports:"443",protocol:"rest",access:"read-only",allow:[],deny:[],enforcement:"enforce",allowedIps:"",...e}),OY=[{id:"github-api-read",label:"GitHub API · read",rule:{name:"github-api-read",binaries:[],endpoints:[go({host:"api.github.com",access:"custom",allow:[{method:"GET",path:"/repos/**"}]})]}},{id:"github-git",label:"git clone from GitHub",rule:{name:"github-git",binaries:["/usr/lib/git-core/git-remote-http","/usr/lib/git-core/git-remote-https"],endpoints:[go({host:"github.com"}),go({host:"codeload.github.com"})]}},{id:"npm",label:"npm registry",rule:{name:"npm-registry",binaries:["/usr/bin/node","/usr/local/bin/node"],endpoints:[go({host:"registry.npmjs.org"})]}},{id:"pypi",label:"PyPI",rule:{name:"pypi",binaries:["/usr/bin/python3*","/usr/local/bin/pip*"],endpoints:[go({host:"pypi.org"}),go({host:"files.pythonhosted.org"})]}},{id:"huggingface",label:"Hugging Face · downloads",rule:{name:"huggingface",binaries:["/usr/bin/python3*"],endpoints:[go({host:"huggingface.co"}),go({host:"**.hf.co"})]}}];function fy(e){var t;return{name:(e==null?void 0:e.name)??"",binaries:[...(e==null?void 0:e.binaries)??[]],endpoints:((t=e==null?void 0:e.endpoints)!=null&&t.length?e.endpoints:[go()]).map(r=>{var a;return go({...r,ports:Array.isArray(r.ports)?r.ports.join(", "):String(r.ports??r.port??"443"),access:(a=r.allow)!=null&&a.length?"custom":r.access&&r.access!=="custom"?r.access:"read-only",protocol:r.protocol??"rest",allowedIps:Array.isArray(r.allowedIps)?r.allowedIps.join(", "):r.allowedIps??"",allow:[...r.allow??[]],deny:[...r.deny??[]]})})}}function MY(e){return{name:e.name.trim(),binaries:e.binaries,endpoints:e.endpoints.map(t=>({host:t.host.trim(),ports:t.ports.split(/[\s,]+/).filter(Boolean).map(Number),protocol:t.protocol,...t.protocol==="tcp"&&t.tlsSkip?{tlsSkip:!0}:{},access:t.protocol==="tcp"||t.access==="custom"?null:t.access,allow:t.protocol==="tcp"||t.access!=="custom"?[]:t.allow.filter(r=>r.path),deny:t.protocol==="tcp"?[]:t.deny.filter(r=>r.path),enforcement:t.enforcement,allowedIps:t.allowedIps.split(/[\s,]+/).filter(Boolean)}))}}function DY(e){const t={binaries:e.binaries??[],endpoints:(e.endpoints??[]).map(u=>({...u,ports:u.ports??(u.port?[u.port]:[]),allow:u.allow??[],deny:u.deny??[]}))},r=t.binaries.length?[...new Set(t.binaries.map(u=>u.split("/").pop()))].join(", "):"no program",a=t.endpoints.map(u=>{var m;const f=`${u.host||"…"}:${u.ports.join(",")||"…"}`;return u.protocol==="tcp"?`open connections to ${f}`:u.allow.length?`send ${u.allow.map(h=>`${h.method} ${h.path}`).join(", ")} to ${f}`:`make ${((m=QM.find(h=>h.id===u.access))==null?void 0:m.label.toLowerCase())??""} requests to ${f}`}),l=t.endpoints.flatMap(u=>u.deny.map(f=>`${f.method} ${f.path}`)),c=t.endpoints.some(u=>u.enforcement==="audit");return`${r} may ${a.join("; and ")}${l.length?`, except ${l.join(", ")}`:""}.${c?" Audit only: violations are logged but allowed.":""}`}function nu({options:e,value:t,onChange:r,label:a}){return s.jsx("div",{role:"radiogroup","aria-label":a,className:"flex items-center gap-1 rounded-md border border-border p-0.5",children:e.map(l=>s.jsx("button",{type:"button",role:"radio","aria-checked":t===l.id,onClick:()=>r(l.id),title:l.hint,className:`flex-1 rounded px-2 py-1 text-[11px] whitespace-nowrap outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${t===l.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,children:l.label},l.id))})}function Hp({items:e,onChange:t,kind:r}){return s.jsxs("div",{className:"space-y-1.5",children:[e.map((a,l)=>s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(hn,{value:a.method,onChange:c=>t(e.map((u,f)=>f===l?{...u,method:c.target.value}:u)),"aria-label":"Method",className:"h-8 rounded-md border border-input bg-transparent px-1.5 font-mono text-[11px] outline-none focus-visible:ring-2 focus-visible:ring-ring",children:AY.map(c=>s.jsx("option",{children:c},c))}),s.jsx(Rt,{value:a.path,onChange:c=>t(e.map((u,f)=>f===l?{...u,path:c.target.value}:u)),className:"h-8 font-mono text-[11px]",placeholder:"/repos/**","aria-label":"Path pattern"}),s.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${r} rule`,onClick:()=>t(e.filter((c,u)=>u!==l)),children:s.jsx(On,{className:"size-3.5"})})]},l)),s.jsxs("button",{type:"button",onClick:()=>t([...e,{method:"GET",path:""}]),className:`flex items-center gap-1 text-[11px] outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring ${r==="deny"?"text-red-700":"text-muted-foreground"}`,children:[s.jsx(cs,{className:"size-3"}),r==="deny"?"Block request":"Allow request"]})]})}function zY({open:e,onOpenChange:t,initial:r,onSubmit:a,knownPrograms:l=[],title:c="New rule",submitLabel:u="Add rule",lockName:f=!1}){const[m,h]=x.useState(()=>fy(r)),[g,p]=x.useState(""),[b,v]=x.useState(!1),[j,S]=x.useState(null);x.useEffect(()=>{e&&(h(fy(r)),S(null),p(""))},[e,r]);const C=(k,M)=>h(R=>({...R,endpoints:R.endpoints.map((O,D)=>D===k?{...O,...M}:O)})),N=k=>{const M=k.trim();M&&!m.binaries.includes(M)&&h(R=>({...R,binaries:[...R.binaries,M]})),p("")},E=MY(m),T=l.filter(k=>!m.binaries.includes(k));async function A(k){k.preventDefault(),v(!0),S(null);try{await a(E),t(!1)}catch(M){S(M.message)}finally{v(!1)}}return s.jsx(yn,{open:e,onOpenChange:t,children:s.jsx(vn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-xl",children:s.jsxs("form",{onSubmit:A,className:"grid gap-5",children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:c}),s.jsx(Hn,{className:"sr-only",children:"Everything not allowed by a rule stays denied."})]}),!f&&s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[s.jsx("span",{className:"self-center text-[11px] text-muted-foreground",children:"Presets"}),OY.map(k=>s.jsx("button",{type:"button",onClick:()=>h(fy(k.rule)),className:"rounded border border-border px-2 py-0.5 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:k.label},k.id))]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"rule-name",className:"text-xs",children:"Rule name"}),s.jsx(Rt,{id:"rule-name",value:m.name,disabled:f,onChange:k=>h(M=>({...M,name:k.target.value.toLowerCase()})),className:"font-mono text-xs",placeholder:"github-api-read",required:!0})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium",children:"Programs"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[m.binaries.map(k=>s.jsxs("span",{className:"flex items-center gap-1 rounded-md border border-foreground/20 bg-accent py-0.5 pr-0.5 pl-2 font-mono text-[11px]",children:[k,s.jsx("button",{type:"button","aria-label":`Remove ${k}`,onClick:()=>h(M=>({...M,binaries:M.binaries.filter(R=>R!==k)})),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(On,{className:"size-3"})})]},k)),!m.binaries.length&&s.jsx("span",{className:"text-[11px] text-amber-700",children:"Add at least one program"})]}),s.jsxs("div",{className:"flex gap-1.5",children:[s.jsx(Rt,{value:g,onChange:k=>p(k.target.value),onKeyDown:k=>{k.key==="Enter"&&(k.preventDefault(),N(g))},className:"h-8 font-mono text-[11px]",placeholder:"/usr/bin/curl",title:"Globs like /usr/bin/python3* work","aria-label":"Program path"}),s.jsx(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>N(g),disabled:!g.trim(),children:"Add"})]}),T.length>0&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Seen"}),T.slice(0,6).map(k=>s.jsxs("button",{type:"button",onClick:()=>N(k),className:"rounded border border-dashed border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:["+ ",k]},k))]})]}),s.jsxs("div",{className:"grid gap-3",children:[s.jsx("span",{className:"text-xs font-medium",children:"Destinations"}),m.endpoints.map((k,M)=>s.jsxs("div",{className:"grid gap-3 rounded-lg border border-border p-3",children:[s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsxs("div",{className:"grid flex-1 gap-1",children:[s.jsx(En,{className:"text-[11px] text-muted-foreground",htmlFor:`host-${M}`,children:"Host"}),s.jsx(Rt,{id:`host-${M}`,value:k.host,onChange:R=>C(M,{host:R.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"api.github.com",title:"Wildcards like *.example.com work",required:!0})]}),s.jsxs("div",{className:"grid w-24 gap-1",children:[s.jsx(En,{className:"text-[11px] text-muted-foreground",htmlFor:`ports-${M}`,children:"Ports"}),s.jsx(Rt,{id:`ports-${M}`,value:k.ports,onChange:R=>C(M,{ports:R.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"443",required:!0})]}),m.endpoints.length>1&&s.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Remove destination",onClick:()=>h(R=>({...R,endpoints:R.endpoints.filter((O,D)=>D!==M)})),children:s.jsx(Yn,{className:"size-3.5"})})]}),s.jsx(nu,{label:"Inspection",options:RY,value:k.protocol,onChange:R=>C(M,{protocol:R})}),k.protocol!=="tcp"&&s.jsxs(s.Fragment,{children:[s.jsx(nu,{label:"Access",options:QM,value:k.access,onChange:R=>C(M,{access:R,allow:R==="custom"&&!k.allow.length?[{method:"GET",path:""}]:k.allow})}),k.access==="custom"&&s.jsx(Hp,{kind:"allow",items:k.allow,onChange:R=>C(M,{allow:R})}),s.jsx(Hp,{kind:"deny",items:k.deny,onChange:R=>C(M,{deny:R})})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("div",{className:"w-52",children:s.jsx(nu,{label:"Enforcement",options:[{id:"enforce",label:"Enforce"},{id:"audit",label:"Audit only"}],value:k.enforcement,onChange:R=>C(M,{enforcement:R})})}),k.enforcement==="audit"&&s.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-700",children:[s.jsx(_a,{className:"size-3"}),"Logged, not blocked"]})]}),s.jsxs("details",{className:"group",children:[s.jsx("summary",{title:"Only for hosts resolving to private addresses. Loopback and metadata are always blocked.",className:"cursor-pointer text-[11px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:"Private network access"}),s.jsx("div",{className:"mt-2 grid gap-1",children:s.jsx(Rt,{value:k.allowedIps,onChange:R=>C(M,{allowedIps:R.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"10.0.5.20/32","aria-label":"Allowed IPs"})})]})]},M)),s.jsxs(ue,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>h(k=>({...k,endpoints:[...k.endpoints,go()]})),children:[s.jsx(cs,{}),"Add destination"]})]}),s.jsx("p",{className:"rounded-md border border-border bg-muted/40 px-3 py-2 text-[11px] leading-relaxed",children:DY(E)}),j&&s.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:j}),s.jsxs(No,{children:[s.jsx(ue,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),s.jsxs(ue,{type:"submit",disabled:b||!m.binaries.length,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[b&&s.jsx(zt,{"aria-hidden":"true"}),u]})]})]})})})}function Pf({className:e,...t}){return s.jsx("textarea",{"data-slot":"textarea",className:fs("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...t})}const ki={ports:[443,80],programs:[],requests:"any",allow:[],deny:[],enforcement:"enforce",privateIps:[]},ZM=[{id:"any",label:"Any",hint:"Every method and path"},{id:"read-only",label:"Read only",hint:"GET, HEAD and OPTIONS"},{id:"read-write",label:"Read & write",hint:"Adds POST, PUT and PATCH"},{id:"custom",label:"Specific",hint:"Only the method and path pairs listed"}],PY=[{label:"GitHub · read and clone",policy:{name:"GitHub read",destinations:["github.com","api.github.com","codeload.github.com"],advanced:{...ki,ports:[443],requests:"custom",allow:[{method:"GET",path:"/**"},{method:"HEAD",path:"/**"},{method:"POST",path:"/*/*/git-upload-pack"}],deny:[{method:"*",path:"/*/*/git-receive-pack"}]}}},{label:"npm",policy:{name:"npm registry",destinations:["registry.npmjs.org"],advanced:{...ki,ports:[443]}}},{label:"PyPI",policy:{name:"PyPI",destinations:["pypi.org","files.pythonhosted.org"],advanced:{...ki,ports:[443],requests:"read-only"}}}],Vd=(e={})=>({name:"",action:"allow",destinations:[],appliesTo:{everyone:!1,groups:[],sandboxes:[]},advanced:ki,...e}),IY=e=>e.split(`
514
- `).map(t=>t.trim()).filter(Boolean),Fp=e=>e.split(/[\s,]+/).filter(Boolean),_Y=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40).replace(/-$/,""),sp=e=>e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`,LY=e=>JSON.stringify({...ki,...e})===JSON.stringify(ki);function my(e){const t={...ki,...(e==null?void 0:e.advanced)??{}};return{id:(e==null?void 0:e.id)??"",name:(e==null?void 0:e.name)??"",action:(e==null?void 0:e.action)??"allow",setup:(e==null?void 0:e.setup)??null,destinations:[...(e==null?void 0:e.destinations)??[]],appliesTo:{everyone:!1,groups:[],sandboxes:[],...(e==null?void 0:e.appliesTo)??{}},ports:t.ports.join(", "),programs:[...t.programs],requests:t.requests,allow:[...t.allow],deny:[...t.deny],enforcement:t.enforcement,privateIps:t.privateIps.join(", ")}}function BY(e,t){return{id:t?_Y(e.name):e.id,name:e.name.trim(),action:e.action,destinations:e.destinations,appliesTo:e.appliesTo,...e.setup?{setup:e.setup}:{},...e.action==="allow"?{advanced:{ports:Fp(e.ports).map(Number),programs:e.programs,requests:e.requests,allow:e.requests==="custom"?e.allow.filter(r=>r.path):[],deny:e.deny.filter(r=>r.path),enforcement:e.enforcement,privateIps:Fp(e.privateIps)}}:{}}}const $Y=e=>{var t;return((t=e.setup)==null?void 0:t.name)??"an MCPs & Skills setup"};function Gp(e,t){var l;const r=e.appliesTo;if(r.everyone)return"every sandbox";const a=[...r.groups.map(c=>{var u;return((u=t.find(f=>f.id===c))==null?void 0:u.name)??c}),...r.sandboxes,...(l=r.setups)!=null&&l.length?[`sandboxes using “${$Y(e)}”`]:[]];return a.length?sp(a):null}function VY(e,t=[]){var g;const r=e.destinations.length>3?`${e.destinations.slice(0,3).join(", ")} and ${e.destinations.length-3} more`:sp(e.destinations),a=Gp(e,t),l=a?`Applies to ${a}.`:"Not applied to any sandbox yet.";if(e.action==="block")return`Blocks ${r||"…"} and their subdomains, for every program. Beats every allow. ${l}`;const c={...ki,...e.advanced},u=c.requests==="custom"?`only ${c.allow.map(p=>`${p.method} ${p.path}`).join(", ")||"the listed requests"}`:((g=ZM.find(p=>p.id===c.requests))==null?void 0:g.label.toLowerCase())+" requests",f=c.programs.length?`from ${sp([...new Set(c.programs.map(p=>p.split("/").pop()))])}`:"from any program",m=c.deny.length?`, except ${c.deny.map(p=>`${p.method} ${p.path}`).join(", ")}`:"",h=c.enforcement==="audit"?" Audit only: violations are logged, not blocked.":"";return`Allows ${u}${m} to ${r||"…"} on port${c.ports.length===1?"":"s"} ${sp(c.ports.map(String))}, ${f}.${h} ${l}`}function JM({open:e,onOpenChange:t,initial:r,groups:a=[],sandboxes:l=[],assignments:c={},setupMembers:u={},knownPrograms:f=[],onSaved:m,onGroupCreated:h}){var K,se;const g=$t(),p=!(r!=null&&r.id),[b,v]=x.useState(()=>my(r)),[j,S]=x.useState([]),C=[...a,...j.filter(I=>!a.some(U=>U.id===I.id))].sort((I,U)=>I.name.localeCompare(U.name)),[N,E]=x.useState(""),[T,A]=x.useState(""),[k,M]=x.useState(!1),[R,O]=x.useState(null),[D,_]=x.useState(!1);x.useEffect(()=>{e&&(v(my(r)),O(null),E(""),A(""),_(!1))},[e,r]);const L=I=>v(U=>({...U,...I})),q=I=>v(U=>({...U,appliesTo:{...U.appliesTo,...I}})),P=((K=b.appliesTo.setups)==null?void 0:K.length)>0,$=!b.appliesTo.everyone&&!b.appliesTo.sandboxes.length&&(P||b.appliesTo.groups.length>0)&&b.appliesTo.groups.every(I=>C.some(U=>U.id===I)),H=BY(b,p),F=I=>{const U=Fp(I).filter((Q,te,le)=>!b.destinations.includes(Q)&&le.indexOf(Q)===te);U.length&&L({destinations:[...b.destinations,...U]}),A("")},V=I=>{const U=I.trim();U&&!b.programs.includes(U)&&L({programs:[...b.programs,U]}),E("")},G=Object.fromEntries(C.map(I=>[I.id,l.filter(U=>jo({assignments:c},U).includes(I.id)).length])),X=l.filter(I=>Zg(H,{name:I,groups:jo({assignments:c},I),setups:u[I]??[]}));async function B(I){if(I.preventDefault(),!$){O("Choose at least one group for this network rule.");return}M(!0),O(null);const U=Fp(T).filter(te=>!H.destinations.includes(te)),Q={...H,destinations:[...H.destinations,...U]};try{m(await g.savePolicy({...Q,isNew:p}),Q),t(!1)}catch(te){O(te.message)}finally{M(!1)}}async function Z(){M(!0),O(null);try{m({...await g.deletePolicy(r.id),deleted:!0},r),t(!1)}catch(I){O(I.message)}finally{M(!1)}}return s.jsx(yn,{open:e,onOpenChange:t,children:s.jsx(vn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-xl",children:s.jsxs("form",{onSubmit:B,className:"grid gap-5",children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:p?"Add network rule":`Edit ${r.name}`}),s.jsx(Hn,{className:"text-xs",children:"Sandboxes start locked down: nothing leaves them unless a rule allows it. A block beats every allow."})]}),p&&s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[s.jsx("span",{className:"self-center text-[11px] text-muted-foreground",children:"Start from"}),PY.map(I=>s.jsx("button",{type:"button",onClick:()=>v(U=>({...my(Vd(I.policy)),appliesTo:U.appliesTo})),className:"rounded border border-border px-2 py-0.5 text-[11px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:I.label},I.label))]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"policy-name",className:"text-xs",children:"Name"}),s.jsx(Rt,{id:"policy-name",value:b.name,onChange:I=>L({name:I.target.value}),className:"text-xs",placeholder:"GitHub read",required:!0,autoFocus:p})]}),s.jsxs("fieldset",{className:"grid gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[s.jsxs("legend",{className:"px-1 text-xs font-medium",children:["Groups ",s.jsxs("span",{className:"text-muted-foreground",children:["· ",P?"Optional":"Required"]})]}),P&&s.jsxs("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:["Applies to sandboxes that use the MCPs & Skills setup",(se=b.setup)!=null&&se.name?s.jsxs(s.Fragment,{children:[" “",s.jsx("span",{className:"text-foreground",children:b.setup.name}),"”"]}):"",". Groups you pick here also get it."]}),s.jsx(ef,{multiple:!0,required:!P,groups:C,counts:G,value:b.appliesTo.groups,onChange:I=>q({everyone:!1,groups:I,sandboxes:[]}),onCreated:I=>{S(U=>[...U,I]),h==null||h(I)}}),X.length>0&&s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[X.length," ",X.length===1?"sandbox":"sandboxes"," currently in scope."]}),!p&&!P&&(r.appliesTo.everyone||r.appliesTo.sandboxes.length||!r.appliesTo.groups.length)&&s.jsx("p",{className:"text-[11px] text-amber-700",children:"This rule uses a legacy scope. Choose its groups before saving; saving replaces the previous scope."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium",children:"Action"}),s.jsx("div",{className:"w-48",children:s.jsx(nu,{label:"Action",options:[{id:"allow",label:"Allow"},{id:"block",label:"Block"}],value:b.action,onChange:I=>L({action:I})})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"policy-destinations",className:"text-xs",children:"Destinations"}),s.jsxs("div",{className:"flex min-h-9 flex-wrap items-center gap-1.5 rounded-md border border-input bg-transparent px-2 py-1.5 focus-within:ring-2 focus-within:ring-ring",children:[b.destinations.map(I=>s.jsxs("span",{className:"flex items-center gap-1 rounded-md border border-foreground/20 bg-accent py-0.5 pr-0.5 pl-2 font-mono text-[11px]",children:[I,s.jsx("button",{type:"button","aria-label":`Remove ${I}`,onClick:()=>L({destinations:b.destinations.filter(U=>U!==I)}),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(On,{className:"size-3"})})]},I)),s.jsx("input",{id:"policy-destinations",value:T,onChange:I=>/[\s,]$/.test(I.target.value)?F(I.target.value):A(I.target.value),onKeyDown:I=>{I.key==="Enter"?(I.preventDefault(),F(T)):I.key==="Backspace"&&!T&&b.destinations.length&&L({destinations:b.destinations.slice(0,-1)})},onBlur:()=>F(T),className:"min-w-32 flex-1 bg-transparent font-mono text-[11px] outline-none placeholder:text-muted-foreground",placeholder:b.destinations.length?"":b.action==="block"?"pastebin.com":"github.com","aria-label":"Destinations"})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:b.action==="block"?"Press Enter after each host. Blocking a host also blocks its subdomains.":"Press Enter after each host. *.example.com matches one level, **.example.com any depth."})]}),b.action==="allow"&&s.jsxs("details",{className:"group rounded-lg border border-border",open:!LY(r==null?void 0:r.advanced)||void 0,children:[s.jsx("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Advanced"}),s.jsxs("div",{className:"grid gap-4 border-t border-border p-3",children:[s.jsxs("div",{className:"grid gap-1",children:[s.jsx(En,{htmlFor:"policy-ports",className:"text-[11px] text-muted-foreground",children:"Ports"}),s.jsx(Rt,{id:"policy-ports",value:b.ports,onChange:I=>L({ports:I.target.value}),className:"h-8 w-40 font-mono text-[11px]",placeholder:"443, 80"})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Requests"}),s.jsx(nu,{label:"Requests",options:ZM,value:b.requests,onChange:I=>L({requests:I,allow:I==="custom"&&!b.allow.length?[{method:"GET",path:""}]:b.allow})}),b.requests==="custom"&&s.jsx(Hp,{kind:"allow",items:b.allow,onChange:I=>L({allow:I})}),s.jsx(Hp,{kind:"deny",items:b.deny,onChange:I=>L({deny:I})})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Programs"}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[b.programs.map(I=>s.jsxs("span",{className:"flex items-center gap-1 rounded-md border border-foreground/20 bg-accent py-0.5 pr-0.5 pl-2 font-mono text-[11px]",children:[I,s.jsx("button",{type:"button","aria-label":`Remove ${I}`,onClick:()=>L({programs:b.programs.filter(U=>U!==I)}),className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(On,{className:"size-3"})})]},I)),!b.programs.length&&s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Any program"})]}),s.jsxs("div",{className:"flex gap-1.5",children:[s.jsx(Rt,{value:N,onChange:I=>E(I.target.value),onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),V(N))},className:"h-8 font-mono text-[11px]",placeholder:"/usr/bin/git",title:"Globs like /usr/bin/python3* work","aria-label":"Program path"}),s.jsx(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>V(N),disabled:!N.trim(),children:"Add"})]}),f.filter(I=>!b.programs.includes(I)).length>0&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Seen"}),f.filter(I=>!b.programs.includes(I)).slice(0,6).map(I=>s.jsxs("button",{type:"button",onClick:()=>V(I),className:"rounded border border-dashed border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:["+ ",I]},I))]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("div",{className:"w-52",children:s.jsx(nu,{label:"Enforcement",options:[{id:"enforce",label:"Enforce"},{id:"audit",label:"Audit only"}],value:b.enforcement,onChange:I=>L({enforcement:I})})}),b.enforcement==="audit"&&s.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-amber-700",children:[s.jsx(_a,{className:"size-3"}),"Request rules are logged, not enforced"]})]}),s.jsxs("div",{className:"grid gap-1",children:[s.jsx(En,{htmlFor:"policy-ips",className:"text-[11px] text-muted-foreground",title:"Loopback and cloud metadata stay blocked",children:"Private addresses"}),s.jsx(Rt,{id:"policy-ips",value:b.privateIps,onChange:I=>L({privateIps:I.target.value}),className:"h-8 font-mono text-[11px]",placeholder:"10.0.5.0/24"})]})]})]}),s.jsx("p",{className:"rounded-md border border-border bg-muted/40 px-3 py-2 text-[11px] leading-relaxed",children:VY(H,C)}),R&&s.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:R}),s.jsxs(No,{className:"sm:justify-between",children:[p?s.jsx("span",{}):D?s.jsxs("span",{className:"grid gap-1.5",children:[b.setup&&s.jsxs("span",{className:"max-w-64 text-[11px] text-muted-foreground",children:["Sandboxes that use “",b.setup.name,"” lose access to these websites. Enabling the setup again asks you to approve them for each sandbox."]}),s.jsx(ue,{type:"button",variant:"destructive",disabled:k,onClick:Z,children:"Delete rule"})]}):s.jsx(ue,{type:"button",variant:"ghost",className:"text-muted-foreground hover:text-destructive",onClick:()=>_(!0),children:"Delete"}),s.jsxs("span",{className:"flex gap-2",children:[s.jsx(ue,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),s.jsxs(ue,{type:"submit",disabled:k||!$||!b.name.trim()||!b.destinations.length&&!T.trim(),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[k&&s.jsx(zt,{"aria-hidden":"true"}),p?"Add rule":"Save rule"]})]})]})]})})})}function UY({open:e,onOpenChange:t,org:r,onSaved:a}){const l=$t(),[c,u]=x.useState(""),[f,m]=x.useState(!1),[h,g]=x.useState(null);x.useEffect(()=>{e&&(u(((r==null?void 0:r.blocked)??[]).join(`
515
- `)),g(null))},[e,r]);async function p(b){b.preventDefault(),m(!0),g(null);try{a(await l.saveOrg({...r,blocked:IY(c)})),t(!1)}catch(v){g(v.message)}finally{m(!1)}}return s.jsx(yn,{open:e,onOpenChange:t,children:s.jsx(vn,{className:"sm:max-w-md",children:s.jsxs("form",{onSubmit:p,className:"grid gap-4",children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:"Blocked everywhere"}),s.jsx(Hn,{className:"text-xs",children:"Blocked in every sandbox, with their subdomains. No rule can open them."})]}),s.jsx(Pf,{rows:6,value:c,onChange:b=>u(b.target.value),className:"font-mono text-[11px]",placeholder:`pastebin.com
516
- **.ngrok.io`,"aria-label":"Blocked hosts"}),h&&s.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:h}),s.jsxs(No,{children:[s.jsx(ue,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),s.jsxs(ue,{type:"submit",disabled:f,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&s.jsx(zt,{"aria-hidden":"true"}),"Save"]})]})]})})})}function JT({className:e,size:t="default",...r}){return s.jsx("div",{"data-slot":"card","data-size":t,className:Le("group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-lg border border-border bg-card py-(--card-spacing) text-sm text-card-foreground [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg",e),...r})}function e3({borderWidth:e=1,duration:t=14,shineColor:r="#000000",className:a,style:l,...c}){return s.jsx("div",{style:{"--border-width":`${e}px`,"--duration":`${t}s`,backgroundImage:`radial-gradient(transparent,transparent, ${Array.isArray(r)?r.join(","):r},transparent,transparent)`,backgroundSize:"300% 300%",mask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",WebkitMask:"linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",WebkitMaskComposite:"xor",maskComposite:"exclude",padding:"var(--border-width)",...l},className:Le("motion-safe:animate-shine pointer-events-none absolute inset-0 size-full rounded-[inherit] will-change-[background-position]",a),...c})}const t3=x.createContext(void 0);function If(e){const t=x.useContext(t3);if(t===void 0&&!e)throw new Error(Jt(72));return t}const HY={...Og,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class FY extends bu{constructor(r,a,l){const c=new Sf;super(GY(r,c,a,l),qY(c),HY);tn(this,"setOpen",(r,a)=>{i$(this,r,a,{extraState:{openChangeReason:a.reason}})})}cancelPendingOpen(r){this.state.floatingRootContext.dispatchOpenChange(!1,bt(Wo,r))}}function GY(e,t,r,a=!1){return{...Ag(t,r,a),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e}}function qY(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const YY=vf(function(t){const{disabled:r=!1,defaultOpen:a=!1,open:l,disableHoverablePopup:c=!1,trackCursorAxis:u="none",actionsRef:f,onOpenChange:m,onOpenChangeComplete:h,handle:g,triggerId:p,defaultTriggerId:b=null,children:v}=t,j=k1((L,q)=>new FY({open:a,openProp:l,activeTriggerId:b,triggerIdProp:p},L,q));j.useControlledProp("openProp",l),j.useControlledProp("triggerIdProp",p),j.useContextCallback("onOpenChange",m),j.useContextCallback("onOpenChangeComplete",h);const S=j.useState("open"),C=!r&&S,N=j.useState("activeTriggerId"),E=j.useState("mounted"),T=j.useState("payload");j.useSyncedValues({trackCursorAxis:u,disableHoverablePopup:c,disabled:r}),Tg(j,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:A,transitionStatus:k}=Eg(C,j),M=j.useState("isInstantPhase"),R=j.useState("instantType"),O=j.useState("lastOpenChangeReason"),D=x.useRef(null);Ke(()=>{S&&r&&j.setOpen(!1,bt(RA))},[S,r,j]),Ke(()=>{k==="ending"&&O===kr||k!=="ending"&&M?(R!=="delay"&&(D.current=R),j.set("instantType","delay")):D.current!==null&&(j.set("instantType",D.current),D.current=null)},[k,M,O,R,j]),Ke(()=>{C&&N==null&&j.set("payload",void 0)},[j,N,C]),x.useImperativeHandle(f,()=>({unmount:A,close:()=>j.setOpen(!1,bt(yg))}),[A,j]);const _=C||E||!r&&u!=="none";return s.jsxs(t3.Provider,{value:j,children:[g&&s.jsx(Cg,{handle:g,store:j}),_&&s.jsx(KY,{store:j,disabled:r,trackCursorAxis:u}),typeof v=="function"?v({payload:T}):v]})});function KY({store:e,disabled:t,trackCursorAxis:r}){const a=e.useState("floatingRootContext"),l=wf(a,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),c=bB(a,{enabled:!t&&r!=="none",axis:r==="none"?void 0:r}),u=x.useMemo(()=>Xs(c.reference,l.reference),[c.reference,l.reference]);return Rg(e,{activeTriggerProps:u,inactiveTriggerProps:u,popupProps:l.floating??gn}),null}const n3=x.createContext(void 0);function XY(){return x.useContext(n3)}const WY=600,s3="data-base-ui-tooltip-trigger";function eE(e){if("composedPath"in e){const r=e.composedPath();for(let a=0;a<r.length;a+=1){const l=r[a];if(Gt(l))return l}}const t=e.target;return Gt(t)?t:null}function QY(e){let t=e;for(;t;){const r=t.closest(`[${s3}]`);if(r)return r;const a=t.getRootNode();t="host"in a&&Gt(a.host)?a.host:null}return null}const ZY=b1(function(t,r){const{render:a,className:l,style:c,handle:u,payload:f,disabled:m,delay:h,closeOnClick:g=!0,closeDelay:p,id:b,...v}=t,j=If(!0),C=A1(u)??j;if(!C)throw new Error(Jt(82));const N=ds(b),E=C.useState("isTriggerActive",N),T=C.useState("isOpenedByTrigger",N),A=C.useState("floatingRootContext"),k=x.useRef(null),M=p??0,{registerTrigger:R,isMountedByThisTrigger:O}=E1(N,k,C,{payload:f,closeOnClick:g,closeDelay:M}),D=XY(),{activeIdRef:_,delayRef:L,isInstantPhase:q,hasProvider:P}=lB(A,{open:T}),$=M1(A);C.useSyncedValue("isInstantPhase",q);const H=C.useState("disabled"),F=m??H,V=Ln(F),G=C.useState("trackCursorAxis"),X=C.useState("disableHoverablePopup"),B=x.useRef(!1),Z=es(),K=x.useRef(void 0);function se(){return P&&_.current!=null?0:h??D??WY}function I(W){const de=k.current;if(!de||!W)return!1;const Ee=QY(W);return Ee!==null&&Ee!==de&&pt(de,Ee)}function U(W){const de=I(W);return B.current=de,de&&($.openChangeTimeout.clear(),$.restTimeout.clear(),$.restTimeoutPending=!1,Z.clear()),de}const Q=z1(A,{enabled:!F,mouseOnly:!0,move:!1,handleClose:!X&&G!=="both"?P1():null,restMs:se,delay(){return p==null&&P?{close:_l(L.current,"close")}:{close:M}},triggerElementRef:k,isActiveTrigger:E,isClosing:()=>C.select("transitionStatus")==="ending",shouldOpen(){return!B.current}}),te=f5(A,{enabled:!F}).reference,le=W=>{const de=B.current,Ee=eE(W),Be=U(Ee),Ne=k.current,Ae=Ne&&Ee&&pt(Ne,Ee);if(Be&&C.select("open")&&C.select("lastOpenChangeReason")===Un){C.setOpen(!1,bt(Un,W));return}if(de&&!Be&&Ae&&!V.current&&!C.select("open")&&Ne&&Ci(K.current)){const ee=()=>{!B.current&&!V.current&&!C.select("open")&&C.setOpen(!0,bt(Un,W,Ne))},re=se();re===0?(Z.clear(),ee()):Z.start(re,ee)}},J=C.useState("triggerProps",O);return wt("button",t,{state:{open:T},ref:[r,R,k],props:[Q,te,O||G!=="none"?J:void 0,{onMouseOver(W){le(W.nativeEvent)},onFocus(W){I(eE(W.nativeEvent))&&W.preventBaseUIHandler()},onMouseLeave(){B.current=!1,Z.clear(),K.current=void 0},onPointerEnter(W){K.current=W.pointerType},onPointerDown(W){K.current=W.pointerType,C.set("closeOnClick",g),g&&!C.select("open")&&C.cancelPendingOpen(W.nativeEvent)},onClick(W){g&&!C.select("open")&&C.cancelPendingOpen(W.nativeEvent)},id:N,[Ly]:F?"":void 0,[s3]:F?void 0:""},v],stateAttributesMapping:l1})}),r3=x.createContext(void 0);function JY(){const e=x.useContext(r3);if(e===void 0)throw new Error(Jt(70));return e}const eK=x.forwardRef(function(t,r){const{children:a,container:l,className:c,render:u,style:f,...m}=t,{node:h,subtree:g}=KA({container:l,ref:r,componentProps:t,elementProps:m});return!g&&!h?null:s.jsxs(x.Fragment,{children:[g,h&&Kr.createPortal(a,h)]})}),tK=x.forwardRef(function(t,r){const{keepMounted:a=!1,...l}=t;return If().useState("mounted")||a?s.jsx(r3.Provider,{value:a,children:s.jsx(eK,{ref:r,...l})}):null}),o3=x.createContext(void 0);function a3(){const e=x.useContext(o3);if(e===void 0)throw new Error(Jt(71));return e}const nK=x.forwardRef(function(t,r){const{render:a,className:l,anchor:c,positionMethod:u="absolute",side:f="top",align:m="center",sideOffset:h=0,alignOffset:g=0,collisionBoundary:p="clipping-ancestors",collisionPadding:b=5,arrowPadding:v=5,sticky:j=!1,disableAnchorTracking:S=!1,collisionAvoidance:C=y1,style:N,...E}=t,T=If(),A=JY(),k=T.useState("open"),M=T.useState("mounted"),R=T.useState("trackCursorAxis"),O=T.useState("disableHoverablePopup"),D=T.useState("floatingRootContext"),_=T.useState("instantType"),L=T.useState("transitionStatus"),q=T.useState("adaptiveOrigin"),P=Pg({anchor:c,positionMethod:u,floatingRootContext:D,mounted:M,side:f,sideOffset:h,align:m,alignOffset:g,collisionBoundary:p,collisionPadding:b,sticky:j,arrowPadding:v,disableAnchorTracking:S,keepMounted:A,collisionAvoidance:C,adaptiveOrigin:q}),$=x.useMemo(()=>({open:k,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:R!=="none"?"tracking-cursor":_}),[k,P.side,P.align,P.anchorHidden,R,_]),H=_g(t,$,{styles:P.positionerStyles,transitionStatus:L,props:E,refs:[r,T.useStateSetter("positionerElement")],hidden:!M,inert:!k||R==="both"||O});return s.jsx(o3.Provider,{value:P,children:H})}),sK=x.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,f=If(),{side:m,align:h}=a3(),g=f.useState("open"),p=f.useState("instantType"),b=f.useState("transitionStatus"),v=f.useState("popupProps"),j=f.useState("floatingRootContext"),S=f.useState("disabled"),C=f.useState("closeDelay");lr({open:g,ref:f.context.popupRef,onComplete(){var A,k;g&&((k=(A=f.context).onOpenChangeComplete)==null||k.call(A,!0))}}),D1(j,{enabled:!S,closeDelay:C});const N=f.useStateSetter("popupElement");return wt("div",t,{state:{open:g,side:m,align:h,instant:p,transitionStatus:b},ref:[r,f.context.popupRef,N],props:[jf,v,kf(b),u],stateAttributesMapping:mg})}),rK=x.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,f=If(),{arrowRef:m,side:h,align:g,arrowUncentered:p,arrowStyles:b}=a3(),v=f.useState("open"),j=f.useState("instantType");return wt("div",t,{state:{open:v,side:h,align:g,uncentered:p,instant:j},ref:[r,m],props:[{style:b,"aria-hidden":!0},u],stateAttributesMapping:pf})}),oK=function(t){const{delay:r,closeDelay:a,timeout:l=400}=t,c=x.useMemo(()=>({open:r,close:a}),[r,a]);return s.jsx(n3.Provider,{value:r,children:s.jsx(iB,{delay:c,timeoutMs:l,children:t.children})})};function _f({delay:e=0,...t}){return s.jsx(oK,{"data-slot":"tooltip-provider",delay:e,...t})}function Ma({...e}){return s.jsx(YY,{"data-slot":"tooltip",...e})}function Da({...e}){return s.jsx(ZY,{"data-slot":"tooltip-trigger",...e})}function za({className:e,side:t="top",sideOffset:r=4,align:a="center",alignOffset:l=0,children:c,...u}){return s.jsx(tK,{children:s.jsx(nK,{align:a,alignOffset:l,side:t,sideOffset:r,className:"isolate z-50",children:s.jsxs(sK,{"data-slot":"tooltip-content",className:Le("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...u,children:[c,s.jsx(rK,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const Yo={own:{label:"Sandbox",swatch:"bg-stone-700",beam:["#a8a29e","#44403c"]},agent:{label:"Agent defaults",swatch:"bg-indigo-500",beam:["#a5b4fc","#6366f1"]},org:{label:"Shared",swatch:"bg-[#4a5568]",beam:["#94a3b8","#4a5568"]},group:{label:"Inherited",swatch:"bg-teal-600",beam:["#5eead4","#0f766e"]},policy:{label:"Network rule",swatch:"bg-indigo-600",beam:["#a5b4fc","#4338ca"]},secret:{label:"Secret",swatch:"bg-amber-600",beam:["#fcd34d","#b45309"]}},qp=["org","policy","group","agent","own","secret"],ka=e=>e.startsWith("_provider_")?"secret":e.startsWith("egress_")?"policy":e.startsWith("org_")?"org":e.startsWith("group_")?"group":e.startsWith("agent-")?"agent":"own",Ud=e=>e.replace(/^_provider_/,"").replace(/^(org|group|egress)_/,"").replace(/_/g,"-");function _w(e){if(!e)return null;try{return new URL(e.includes("://")?e:`https://${e}`).hostname}catch{return e.split("/")[0].replace(/:\d+$/,"")}}function i3(e){try{const t=new URL(e.includes("://")?e:`https://${e}`);return Number(t.port)||(t.protocol==="http:"?80:443)}catch{return 443}}const Yp=e=>e.split("/").pop(),l3=e=>/^\d+\.\d+\.\d+\.\d+$/.test(e);function aK(e){const t=String(e).replace(/^\*\*?\./,"").split(".");return(t.length>=3&&["co","com","org","net","ac","gov"].includes(t.at(-2))?t.at(-3):t.at(-2)??t[0])??e}function Lw({host:e,tone:t="default",className:r}){return s.jsx("span",{"aria-hidden":"true",className:Le("flex size-6 shrink-0 items-center justify-center rounded-md border font-sans text-xs font-medium",t==="denied"?"border-red-200/60 bg-red-50 text-red-700":"border-border bg-muted/50 text-muted-foreground",r),children:aK(e).charAt(0).toUpperCase()})}const tE=x.forwardRef(function({item:t,denied:r,active:a,onFocus:l,onBlur:c,onAllow:u},f){const m=Yo[t.source]??Yo.own;return s.jsxs("div",{ref:f,className:Le("relative z-10 flex h-[23px] w-full min-w-0 items-center rounded-md border bg-card transition-colors",a?"border-stone-400":"border-border/80"),children:[s.jsxs(Ma,{children:[s.jsxs(Da,{render:s.jsx("button",{type:"button"}),onMouseEnter:l,onMouseLeave:c,onFocus:l,onBlur:c,"aria-label":`${t.host}, ${r?`${t.count} blocked attempts`:`allowed · ${m.label}`}`,className:"flex h-full min-w-0 flex-1 items-center gap-2 rounded-md px-2.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-foreground",children:t.host}),r?s.jsxs("span",{className:"shrink-0 text-[10px] tabular-nums text-muted-foreground",children:[t.count,"×"]}):s.jsx("span",{className:Le("size-1 shrink-0 rounded-full",m.swatch)})]}),s.jsxs(za,{className:"max-w-sm break-all font-sans",children:[t.host," · ",r?"Blocked in recent activity":`Allowed · ${m.label}`]})]}),r&&u&&s.jsx(ue,{size:"sm",variant:"ghost",className:"mr-1 px-2 text-[11px]",onClick:u,children:"Review"})]})}),Th=x.forwardRef(function({title:t,count:r,icon:a,summary:l,open:c,onToggle:u,tone:f="neutral",children:m,className:h,...g},p){const b=x.useId();return s.jsxs("section",{ref:p,...g,className:Le("relative z-10 min-w-0 overflow-hidden rounded-none border shadow-[0_2px_6px_#1c191703]",f==="blocked"?"border-red-200/60 bg-[var(--graph-blocked)]":f==="allowed"?"border-emerald-200/60 bg-[var(--graph-allowed)]":"border-stone-200 bg-[var(--graph-neutral)]",h),children:[s.jsxs("button",{type:"button","aria-expanded":c,"aria-controls":b,"aria-label":`${c?"Collapse":"Expand"} ${t}`,onClick:u,className:"group flex w-full items-center gap-2.5 rounded-none px-4 py-2.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[s.jsx("span",{className:Le("flex size-7 shrink-0 items-center justify-center rounded-full border bg-card",f==="blocked"?"border-red-200/60 text-red-500":f==="allowed"?"border-emerald-200/60 text-emerald-600":"border-border text-stone-500"),children:s.jsx(a,{className:"size-3.5",strokeWidth:1.5})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"flex items-center gap-2 text-[11px] font-medium",children:[t,s.jsx("span",{className:"text-[10px] font-normal tabular-nums text-muted-foreground",children:r})]}),s.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-muted-foreground",title:l,children:l})]}),s.jsx(Xo,{className:Le("size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none",c&&"rotate-180")})]}),s.jsx(Rn.div,{id:b,initial:!1,animate:{height:c?"auto":0,opacity:c?1:0},transition:{duration:Bs()?0:.22,ease:[.22,1,.36,1]},inert:!c,"aria-hidden":!c,className:"overflow-hidden",children:s.jsx("div",{className:"space-y-0.5 border-t border-black/5 p-2",children:m})})]})});function Uc({children:e,canvas:t,label:r}){var m;const[a,l]=x.useState({x:0,y:0}),c=x.useRef(null),u=x.useRef(!1),f=(h,g,p)=>{const b=t.current.getBoundingClientRect(),v=h.getBoundingClientRect(),j=b.width/t.current.offsetWidth||1,S=(v.left-b.left)/j-a.x,C=(v.top-b.top)/j-a.y;return{x:Math.max(-S,Math.min(g,b.width/j-S-v.width/j)),y:Math.max(-C,Math.min(p,b.height/j-C-v.height/j))}};return x.useLayoutEffect(()=>{var h;(h=t.current)==null||h.dispatchEvent(new Event("graph-move"))},[a,t]),x.cloneElement(e,{tabIndex:0,"aria-label":`${r}. Drag to move or use arrow keys`,className:Le(e.props.className,"cursor-grab touch-none select-none outline-none focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing"),style:{...e.props.style,transform:`translate(${a.x}px, ${a.y}px)`,zIndex:(m=c.current)!=null&&m.moved?30:10},onDragStart:h=>h.preventDefault(),onPointerDown:h=>{h.button!==0||!h.isPrimary||h.target.closest("[data-resource-list]")||h.target.closest("button")&&!h.target.closest("button[aria-expanded], [data-graph-drag-handle]")||(u.current=!1,c.current={id:h.pointerId,x:h.clientX,y:h.clientY,offset:a,moved:!1})},onPointerLeave:()=>{var h;(h=c.current)!=null&&h.moved||(c.current=null)},onPointerMove:h=>{const g=c.current;if(!g||g.id!==h.pointerId)return;const p=h.clientX-g.x,b=h.clientY-g.y;if(!g.moved&&Math.hypot(p,b)<5)return;g.moved=!0,u.current=!0,h.currentTarget.setPointerCapture(h.pointerId);const v=t.current.getBoundingClientRect().width/t.current.offsetWidth||1;l(f(h.currentTarget,g.offset.x+p/v,g.offset.y+b/v))},onPointerUp:h=>{h.currentTarget.hasPointerCapture(h.pointerId)&&h.currentTarget.releasePointerCapture(h.pointerId),c.current=null,l(g=>({...g}))},onPointerCancel:()=>{c.current=null,u.current=!1},onLostPointerCapture:()=>{c.current=null},onClickCapture:h=>{u.current&&(h.preventDefault(),h.stopPropagation(),u.current=!1)},onKeyDown:h=>{if(h.target!==h.currentTarget)return;const g={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[h.key];if(!g)return;h.preventDefault();const p=h.shiftKey?20:5;l(f(h.currentTarget,a.x+g[0]*p,a.y+g[1]*p))}})}function iK({name:e,phase:t,agents:r=[],agentStatus:a="Agent inventory not checked",allowed:l,denied:c,onAllow:u,compact:f=!1,fill:m=!1,owner:h="Not reported",secrets:g=[],gateway:p}){const b=x.useRef(null),v=x.useRef(null),j=x.useRef(null),S=x.useMemo(()=>({agents:x.createRef(),owner:x.createRef(),secrets:x.createRef(),blocked:x.createRef(),allowed:x.createRef()}),[]),[C,N]=x.useReducer(D=>D+1,0);x.useEffect(()=>{var L;let D=(L=b.current)==null?void 0:L.clientWidth;const _=new ResizeObserver(()=>{var P;const q=(P=b.current)==null?void 0:P.clientWidth;q!==D&&(D=q,N())});return _.observe(b.current),()=>_.disconnect()},[]);const[E,T]=x.useState({}),[A,k]=x.useState(null),M=D=>T(_=>({..._,[D]:!_[D]})),R=["secrets","blocked","allowed",...r.flatMap(D=>[`${D.name}:mcps`,`${D.name}:skills`])],O=R.every(D=>E[D]);return s.jsx(_f,{delay:150,children:s.jsxs("div",{className:Le("@container flex flex-col overflow-hidden rounded-xl border border-border/70 bg-card font-sans",m&&"flex-1"),"aria-label":`Access graph for ${e}`,children:[s.jsx("div",{className:"flex items-center justify-end gap-3 border-b border-border/50 px-4 py-1.5",children:s.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[s.jsx("button",{type:"button",onClick:N,className:"rounded px-1 text-[10px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:"Reset layout"}),s.jsx("button",{type:"button",onClick:()=>T(Object.fromEntries(R.map(D=>[D,!O]))),className:"rounded px-1 text-[10px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:O?"Collapse all":"Expand all"})]})}),s.jsxs("div",{ref:b,className:Le("relative mx-auto grid w-full flex-1 max-w-[1020px] grid-cols-1 items-center gap-5 px-4 @2xl:grid-cols-[minmax(0,1fr)_160px_minmax(0,1.3fr)] @2xl:gap-x-8 @2xl:gap-y-7 @2xl:px-6",f?"py-3":"py-7"),children:[s.jsx("div",{ref:S.agents,"aria-label":"Agent types",className:"relative z-10 order-3 flex flex-col items-center gap-7 @2xl:order-none @2xl:col-start-1 @2xl:row-start-1 @2xl:row-span-4",children:(r.length?r:[{name:a,logo:null}]).map(D=>s.jsx(Uc,{canvas:b,label:D.name,children:s.jsxs("div",{className:"flex w-full max-w-[280px] flex-col items-center gap-2",children:[s.jsxs(JT,{"data-agent-node":!0,className:"relative isolate size-[52px] shrink-0 items-center justify-center gap-0 overflow-visible rounded-[14px] border-stone-300/80 bg-gradient-to-b from-stone-50 to-stone-100 p-1.5 shadow-[0_3px_0_-1px_var(--color-stone-200),0_3px_0_0_var(--edge-neutral),0_6px_10px_-5px_#1c191725,inset_0_1px_0_var(--frame-highlight)]",children:[s.jsx(e3,{shineColor:["var(--edge-neutral)","var(--frame-highlight)","var(--ink-faint)"],duration:18,"aria-hidden":"true"}),s.jsx("div",{className:"flex size-full items-center justify-center rounded-[9px] border border-stone-200/80 bg-card shadow-[inset_0_2px_4px_#1c191708,0_1px_0_var(--frame-highlight)]",children:D.logo?s.jsx("img",{src:D.logo,alt:"",className:"size-6 object-contain"}):s.jsx(ER,{className:"size-5 text-muted-foreground",strokeWidth:1.3,"aria-hidden":"true"})})]}),s.jsx("span",{className:"max-w-full break-words bg-card px-2 text-center text-xs font-medium",children:D.name}),r.length>0&&s.jsx("div",{className:"relative w-full pt-4 before:absolute before:left-1/2 before:top-0 before:h-4 before:border-l before:border-[var(--edge-neutral)]",children:s.jsx("div",{role:"group","aria-label":`${D.name} resources`,className:"overflow-hidden rounded-xl border border-border/80 bg-card shadow-[0_2px_8px_#1c191705]",children:[{kind:"mcps",title:"MCPs",icon:qv},{kind:"skills",title:"Skills",icon:BP}].map(({kind:_,title:L,icon:q})=>{var G;const P=(G=D.resources)==null?void 0:G[_],$=(P==null?void 0:P.status)==="checked",H=(P==null?void 0:P.status)==="unsupported",F=$?P.items:[],V=`${D.name}:${_}`;return s.jsx(Th,{title:L,"aria-label":`${D.name} ${L}`,count:$?F.length:"-",icon:q,summary:H?"Setup integration unavailable":$?"In agent user configuration":"Inventory unavailable",open:!!E[V],onToggle:()=>M(V),className:Le("border-0 shadow-none",_==="skills"&&"border-t border-border/60"),children:s.jsxs("div",{"data-resource-list":!0,className:"max-h-48 touch-pan-y select-text space-y-0.5 overflow-y-auto overscroll-contain",children:[F.map(X=>s.jsxs("div",{className:"flex min-h-[23px] items-center gap-2 rounded-md border border-border/80 bg-card px-2.5 py-1 text-[11px]",children:[s.jsx("span",{className:"min-w-0 flex-1 break-words",children:_==="skills"?X.name.replace(/^os-[a-f0-9]{8}-(?=.)/i,""):X.name}),X.disabled&&s.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:"Disabled"})]},X.name)),!F.length&&s.jsx("p",{className:"px-2 py-2 text-center text-[11px] text-muted-foreground",children:H?`${L} integration unavailable`:$?`No ${L} found in user configuration`:`${L} inventory unavailable`})]})},_)})})})]})},`${e}-${C}-${D.name}`))}),s.jsx(Uc,{canvas:b,label:"Owner",children:s.jsxs(JT,{ref:S.owner,role:"group","aria-label":"Owner",className:"relative z-10 w-max min-w-0 max-w-full justify-self-center gap-1.5 border-stone-200 bg-[var(--graph-neutral)] px-3 py-2.5 shadow-[0_2px_6px_#1c191703] @2xl:col-start-2 @2xl:row-start-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] text-muted-foreground",children:[s.jsx(C6,{className:"size-3 shrink-0",strokeWidth:1.5,"aria-hidden":"true"}),s.jsx("span",{children:"Owner"})]}),s.jsx("p",{className:"min-w-0 whitespace-normal text-[11px] font-medium leading-relaxed [overflow-wrap:anywhere]",children:h})]})},`${e}-${C}-owner`),s.jsx(Uc,{canvas:b,label:e,children:s.jsxs("div",{ref:j,className:"relative z-10 flex min-w-0 flex-col items-center justify-self-center rounded-xl px-3 @2xl:col-start-2 @2xl:row-start-2",children:[s.jsx("div",{ref:v,className:"flex size-14 items-center justify-center rounded-2xl border border-stone-300 bg-card shadow-[0_3px_8px_#1c191708]",children:s.jsx(ql,{className:"size-6 text-stone-600",strokeWidth:1.3})}),s.jsx("p",{className:"mt-2 max-w-[156px] truncate text-xs font-medium",title:e,children:e})]})},`${e}-${C}-sandbox`),s.jsx(Uc,{canvas:b,label:"Gateway",children:s.jsx("div",{className:"relative z-10 flex justify-center @2xl:col-start-2 @2xl:row-start-3",children:s.jsxs(Ma,{children:[s.jsxs(Da,{"data-graph-drag-handle":!0,render:s.jsx("button",{type:"button"}),className:"relative z-10 flex min-h-10 max-w-full items-center gap-1.5 bg-card px-2 text-[10px] text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx(df,{className:"size-3 shrink-0",strokeWidth:1.5}),s.jsx("span",{children:p?p.remote?"Remote endpoint":"Local/tunnel endpoint":"Gateway not reported"})]}),s.jsxs(za,{className:"max-w-64 font-sans",children:[p?`Connected through ${p.name}. `:"","The sandbox’s host machine is not reported."]})]})})},`${e}-${C}-gateway`),s.jsx(Uc,{canvas:b,label:"Network access",children:s.jsxs("section",{"aria-label":"Network access",className:"relative z-10 order-4 overflow-hidden rounded-xl border border-border/80 bg-card shadow-[0_2px_8px_#1c191705] @2xl:order-none @2xl:col-start-3 @2xl:row-start-1 @2xl:row-span-4",children:[s.jsxs("div",{className:"flex items-center gap-2 border-b border-border/60 px-4 py-3",children:[s.jsx(tg,{className:"size-3.5 text-muted-foreground",strokeWidth:1.5,"aria-hidden":"true"}),s.jsx("h4",{className:"text-[11px] font-medium",children:"Network"}),s.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:"Outbound access"})]}),s.jsxs(Th,{ref:S.allowed,title:"Approved network",count:l.length,icon:Fn,summary:"Destinations in policy",tone:"allowed",open:!!E.allowed,onToggle:()=>M("allowed"),className:"border-0 shadow-none",children:[l.map(D=>s.jsx(tE,{item:D,active:A===D.host,onFocus:()=>k(D.host),onBlur:()=>k(null)},D.host)),!l.length&&s.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No approved destinations"})]}),s.jsxs(Th,{ref:S.blocked,title:"Blocked network",count:c.length,icon:_P,summary:"Recent connection attempts",tone:"blocked",open:!!E.blocked,onToggle:()=>M("blocked"),className:"border-0 border-t border-border/60 shadow-none",children:[c.map(D=>s.jsx(tE,{item:D,denied:!0,active:A===D.host,onFocus:()=>k(D.host),onBlur:()=>k(null),onAllow:u?()=>u(D):void 0},D.host)),!c.length&&s.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No blocked attempts"})]})]})},`${e}-${C}-network`),s.jsx(Uc,{canvas:b,label:"Secrets",children:s.jsxs(Th,{ref:S.secrets,title:"Secrets",count:g.length,icon:hu,summary:g.length?g.map(D=>D.name).join(", "):"None attached",open:!!E.secrets,onToggle:()=>M("secrets"),className:"@2xl:col-start-2 @2xl:row-start-4",children:[g.map(D=>{var _;return s.jsxs(Ma,{children:[s.jsx(Da,{render:s.jsx("button",{type:"button"}),className:"block w-full truncate rounded-lg border border-border/70 bg-card px-2.5 py-1.5 text-left text-[11px] outline-none focus-visible:ring-2 focus-visible:ring-ring",children:D.name}),s.jsxs(za,{className:"max-w-72 break-words font-sans",children:[D.name,D.type?` · ${D.type}`:"",(_=D.credentialKeys)!=null&&_.length?` · ${D.credentialKeys.join(", ")}`:""]})]},D.name)}),!g.length&&s.jsx("p",{className:"py-2 text-center text-[11px] text-muted-foreground",children:"No secrets attached"})]})},`${e}-${C}-secrets`),s.jsx(lK,{container:b,core:v,hub:j,groups:S},`${e}-${C}-${r.map(D=>D.name).join(",")}`)]})]})})}function lK({container:e,core:t,hub:r,groups:a}){const l=x.useRef(null),[c,u]=x.useState([]);return x.useEffect(()=>{function f(){var N;if(!e.current||!t.current||!r.current)return;const g=(N=l.current)==null?void 0:N.getScreenCTM();if(!g)return;const p=g.inverse(),b=E=>{const T=E.getBoundingClientRect(),A=new DOMPoint(T.left,T.top).matrixTransform(p),k=new DOMPoint(T.right,T.bottom).matrixTransform(p);return{left:A.x,top:A.y,right:k.x,bottom:k.y,width:k.x-A.x,height:k.y-A.y}},v=b(t.current),j=b(r.current),S=v.left+v.width/2,C=v.top+v.height/2;u(Object.entries(a).flatMap(([E,T])=>{const A=T.current?b(T.current):null;if(!A)return[];if(E==="owner"||E==="secrets"){const L=E==="owner"?v.top:j.bottom,q=E==="owner"?A.bottom:A.top,P=A.left+A.width/2,$=(L+q)/2;return[{key:E,d:`M ${S} ${L} C ${S} ${$}, ${P} ${$}, ${P} ${q}`,x:P,y:q}]}if(E==="agents")return[...T.current.querySelectorAll("[data-agent-node]")].map((L,q)=>{const P=b(L),$=v.left,H=P.right,F=P.top+P.height/2,V=($+H)/2;return{key:`agent-${q}`,d:`M ${$} ${C} C ${V} ${C}, ${V} ${F}, ${H} ${F}`,x:H,y:F}});const k=v.right,M=A.left,R=b(T.current.querySelector("button")),O=R.top+R.height/2,D=k+(M-k)*.4,_=D+(M-D)*.5;return[{key:E,d:`M ${k} ${C} H ${D} C ${_} ${C}, ${_} ${O}, ${M} ${O}`,x:M,y:O}]}))}f();const m=new ResizeObserver(f);[e.current,t.current,r.current,...Object.values(a).map(g=>g.current)].filter(Boolean).forEach(g=>m.observe(g));const h=e.current;return h.addEventListener("graph-move",f),()=>{m.disconnect(),h.removeEventListener("graph-move",f)}},[e,t,r,a]),s.jsx("svg",{ref:l,className:"pointer-events-none absolute inset-0 hidden size-full overflow-visible @2xl:block","aria-hidden":"true",fill:"none",children:c.map(f=>s.jsxs("g",{children:[s.jsx("path",{d:f.d,stroke:f.key==="blocked"?"var(--edge-blocked)":f.key==="allowed"?"var(--edge-allowed)":"var(--edge-neutral)",strokeWidth:"1.5",strokeLinecap:"round"}),s.jsx("circle",{cx:f.x,cy:f.y,r:"2.5",fill:"var(--card)",stroke:"var(--edge-neutral)"})]},f.key))})}async function cK(e,t){const r=[],a=[],l=[];for(const c of e)try{const u=await t(c.id);r.push(c.id);for(const f of u.failed??[])l.push({...f,rule:c.name})}catch(u){a.push({id:c.id,name:c.name,message:u.message})}return{deleted:r,failed:a,syncFailures:l}}const nf=e=>e.id||`${e.sandbox}|${e.at}|${e.source}|${e.target}|${e.message}`,nE={CRITICAL:6,FATAL:6,HIGH:5,MED:4,MEDIUM:4,LOW:3,INFO:2,INFORMATIONAL:2},uK={policy_dns_ineligible:"no rule allows this host",transparent_tcp_policy_denied:"no rule allows this connection"},dK={NET:"Network",HTTP:"HTTP",SSH:"Session",CONFIG:"Configuration",PROC:"Process",FILE:"File",AUTH:"Authentication",FINDING:"Finding",EVENT:"Event"};function c3(e){var u,f,m,h;const t=((u=e.binary)==null?void 0:u.split("/").pop())||"",r=Wg.find(g=>g.commands.includes(t.toLowerCase())&&t.toLowerCase()!=="agent"),a=r?{name:r.name,logo:`/logos/agents/${r.logo}.svg`}:null,l=e.direction||(e.kind==="inbound"&&["NET","HTTP","SSH"].includes(e.category)?"in":e.kind==="audit"&&["NET","HTTP"].includes(e.category)?"out":"unknown"),c={time:e.at??"",sandbox:e.sandbox??"",scope:e.scope??"",sandboxId:e.sandboxId??((f=e.original)==null?void 0:f.sandboxId)??"",agent:(a==null?void 0:a.name)??"Unknown",category:dK[e.category]??(e.kind==="log"?"Log":"Unclassified"),severity:e.severity||"Not reported",logLevel:e.level&&e.level!=="OCSF"?e.level:"Not reported",direction:l,verdict:e.verdict||(["NET","HTTP","SSH","AUTH"].includes(e.category)?"not reported":"not applicable"),outcome:e.outcome??"unknown",process:e.binary??"",action:[r?"":t,e.method||e.action].filter(Boolean).join(" · ")||"Not reported",destination:e.destination??"",policy:e.policy??"",session:e.sessionId??"",correlation:e.correlationId??"",why:uK[e.reason]??e.reason??""};return{event:e,agent:a,key:nf(e),values:c,timestamp:Date.parse(e.at),search:[...Object.values(c),e.message,e.detail,e.source,e.target,JSON.stringify(((m=e.original)==null?void 0:m.fields)??((h=e.original)==null?void 0:h.metadata)??{})].join(" ").toLowerCase()}}function sE(e,{query:t="",direction:r="all",sandboxes:a=[],verdicts:l=[],agents:c=[],filters:u={},range:f="all",from:m="",to:h="",now:g=Date.now(),sort:p={key:"time",direction:"desc"}}={}){const b=new Set(a),v=t.trim().toLowerCase(),j=f==="custom"?m?Date.parse(m):-1/0:f==="all"?-1/0:g-Number(f)*6e4,S=f==="custom"&&h?Date.parse(h):1/0;return e.filter(C=>r!=="all"&&C.values.direction!==r||b.size&&!b.has(C.values.sandbox)||c.length&&!c.includes(C.values.agent)||l.length&&!l.includes(C.values.verdict)||v&&!C.search.includes(v)||f!=="all"&&(!Number.isFinite(C.timestamp)||C.timestamp<j||C.timestamp>S)?!1:Object.entries(u).every(([N,E])=>{var T;return!((T=E==null?void 0:E.value)!=null&&T.trim())||(E.mode==="equals"?(C.values[N]??"").toLowerCase()===E.value.trim().toLowerCase():(C.values[N]??"").toLowerCase().includes(E.value.trim().toLowerCase()))!==(E.mode==="excludes")})).sort((C,N)=>{const E=p.key==="severity"?nE[C.values.severity.toUpperCase()]??-1:p.key==="time"?Number.isFinite(C.timestamp)?C.timestamp:0:C.values[p.key]??"",T=p.key==="severity"?nE[N.values.severity.toUpperCase()]??-1:p.key==="time"?Number.isFinite(N.timestamp)?N.timestamp:0:N.values[p.key]??"",A=typeof E=="number"?E-T:E.localeCompare(T,void 0,{numeric:!0});return(p.direction==="asc"?A:-A)||C.key.localeCompare(N.key)})}const u3=x.createContext(null),hy=2e3;function Bw({children:e}){const t=$t(),r=Cn(),[a,l]=x.useState(null),[c,u]=x.useState(null),[f,m]=x.useState([]),[h,g]=x.useState("connecting"),[p,b]=x.useState(null),[v,j]=x.useState(null),S=x.useRef(new Set),C=x.useRef(0),[N,E]=x.useState(0),T=x.useCallback(R=>{const O=R.filter(D=>{const _=nf(D);return S.current.has(_)?!1:(S.current.add(_),!0)});O.length&&m(D=>{const _=[...O,...D].sort((L,q)=>(q.at??"").localeCompare(L.at??""));if(_.length<=hy)return _;for(const L of _.slice(hy))S.current.delete(nf(L));return _.slice(0,hy)})},[]),A=x.useCallback(async()=>{try{u(await t.overview())}catch(R){u(O=>O??{error:R.message})}},[t]),k=x.useCallback(async()=>{const R=C.current;try{const O=await t.activity({limit:500});if(R!==C.current)return;T(O.events),b(O.coverage),j(null)}catch(O){j(O.message)}},[T,t]);x.useEffect(()=>{let R,O,D=!1;const _=()=>{C.current++,S.current.clear(),m([]),E(L=>L+1),k()};return l(null),u(null),m([]),S.current.clear(),C.current++,t.context().then(async L=>{if(D)return;if(!r&&!L.configured){g("setup-required"),l([]);return}A(),k(),O=setInterval(A,15e3);const q=await t.contextKey();D||(R=new EventSource(t.url("/stream",{context:q,...r?{location:"1"}:{}})),R.onopen=()=>{g("live"),_()},R.addEventListener("context-changed",()=>window.location.reload()),R.addEventListener("activity-deleted",P=>{b(JSON.parse(P.data).coverage),_()}),R.onerror=()=>g("reconnecting"),R.addEventListener("sandboxes",P=>{g("live"),l(JSON.parse(P.data))}),R.addEventListener("log",P=>T([JSON.parse(P.data)])),R.addEventListener("collection",P=>b(JSON.parse(P.data))),R.addEventListener("gateway-health",()=>g("live")),R.addEventListener("gateway-error",()=>g("gateway-down")))}).catch(()=>{D||g("gateway-down")}),()=>{D=!0,R==null||R.close(),clearInterval(O)}},[T,k,A,t,r==null?void 0:r.context]);const M=x.useMemo(()=>({sandboxes:a??(c==null?void 0:c.sandboxes)??null,overview:c,events:f,connection:h,collection:p,historyError:v,activityRevision:N,refresh:()=>{A(),k()}}),[a,c,f,h,p,v,N,A,k]);return s.jsx(u3.Provider,{value:M,children:e})}function Ua(){const e=x.useContext(u3);if(!e)throw new Error("useLive outside LiveProvider");return e}const Sl={running:{label:"Ready",bar:"bg-emerald-500",strip:"bg-emerald-500",cell:"bg-emerald-500/85",ring:"ring-emerald-600/30"},sleeping:{label:"Stopped",bar:"bg-stone-300",strip:"bg-stone-400",cell:"bg-stone-300",ring:"ring-stone-400/40"},provisioning:{label:"Preparing",bar:"bg-amber-400",strip:"bg-amber-400",cell:"bg-amber-400",ring:"ring-amber-600/30"},error:{label:"Needs attention",bar:"bg-red-500",strip:"bg-red-500",cell:"bg-red-500",ring:"ring-red-600/40"},unknown:{label:"Unverified",bar:"bg-stone-200",strip:"bg-stone-300",cell:"bg-stone-200",ring:"ring-stone-400/30"}},Pv=["running","sleeping","provisioning","error","unknown"],fK={ready:"running",provisioning:"provisioning",starting:"provisioning",stopping:"provisioning",stopped:"sleeping",completed:"sleeping",error:"error",deleting:"unknown",unknown:"unknown",unspecified:"unknown"},Kp={ready:"Ready",provisioning:"Provisioning",starting:"Starting",stopping:"Stopping",stopped:"Stopped",completed:"Completed",error:"Error",deleting:"Deleting",unknown:"Unknown",unspecified:"Unknown"},tx=e=>fK[e]??"unknown",Pa=e=>Sl[tx(e)],mK=e=>["ready","provisioning","starting"].includes(e),hK=e=>e==="stopped",pK=e=>e!=null&&e.length?e.join(" "):"Scratch shell",rp=(e,t)=>t||(/^sha256:[a-f0-9]{64}$/i.test(e??"")?"Unknown template":e)||"Gateway default";function gK(e){const t=Object.fromEntries(Pv.map(r=>[r,0]));for(const r of e)t[tx(r.phase)]+=1;return{total:e.length,status:t}}const Hd=e=>{var t,r;return e.owner||((t=e.labels)==null?void 0:t["openshell.console/owner"])||((r=e.labels)==null?void 0:r.owner)||"Not reported"};function d3(e,t=Date.now()){const r=Date.parse(e);if(!Number.isFinite(r))return"Not reported";const a=Math.max(0,Math.floor((t-r)/6e4));return a<1?"<1m":a<60?`${a}m`:a<1440?`${Math.floor(a/60)}h ${a%60}m`:`${Math.floor(a/1440)}d ${Math.floor(a%1440/60)}h`}function xK(e,t=Date.now()){return["stopped","completed"].includes(e.phase)?"Not running":e.phase==="ready"?d3(e.startedAt,t):"-"}const Ko={loaded:{label:"Enforced",dot:"bg-emerald-500",cls:"bg-emerald-50 text-emerald-800 border-emerald-600/20"},pending:{label:"Loading",dot:"bg-amber-400",cls:"bg-amber-50 text-amber-800 border-amber-500/30"},failed:{label:"Failed",dot:"bg-red-500",cls:"bg-red-50 text-red-700 border-red-200"},superseded:{label:"Superseded",dot:"bg-stone-300",cls:"bg-muted text-muted-foreground border-border"},unspecified:{label:"Unknown",dot:"bg-stone-200",cls:"bg-muted text-muted-foreground border-border"}},$w={"read-only":"Read only","read-write":"Read & write",full:"Any request",custom:"Specific requests",connect:"Connection",none:"No access",blocked:"Blocked"},bK=["GET","POST","PUT","PATCH","DELETE","HEAD","*"],yK={own:OR,agent:ql,org:HP,group:Ta,policy:pu,secret:hu},vo=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,f3=e=>e.replace(/^\*\*?\./,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,56);function Cd({children:e,tone:t="",title:r}){return s.jsx("span",{title:r,className:Le("rounded-md border px-1.5 py-px font-mono text-[10.5px]",t||"border-border text-muted-foreground"),children:e})}function m3({source:e}){return s.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-card px-2 py-0.5 text-[11.5px] text-foreground/80",children:[s.jsx("span",{className:Le("size-1.5 rounded-full",Yo[e].swatch),"aria-hidden":"true"}),Yo[e].label]})}function su({className:e,children:t}){return s.jsx("div",{className:Le("rounded-lg border border-border bg-card",e),children:t})}function vK({options:e,value:t,onChange:r,label:a}){return s.jsx("div",{role:"tablist","aria-label":a,className:"flex items-center gap-0.5 rounded-lg bg-muted p-0.5",children:e.map(l=>s.jsxs("button",{role:"tab","aria-selected":t===l.id,onClick:()=>r(l.id),className:Le("rounded-md px-2.5 py-1 text-[12px] outline-none transition-all focus-visible:ring-2 focus-visible:ring-ring",t===l.id?"bg-card text-foreground shadow-[0_1px_2px_#0000001a]":"text-muted-foreground hover:text-foreground"),children:[l.label,l.count!=null&&s.jsx("span",{className:"ml-1 text-faint tabular-nums",children:l.count})]},l.id))})}function h3({n:e,total:t}){return s.jsxs("span",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"h-1 w-14 overflow-hidden rounded-full bg-muted",children:s.jsx("span",{className:"block h-full rounded-full bg-stone-700",style:{width:`${t?e/t*100:0}%`}})}),s.jsxs("span",{className:"text-[12px] tabular-nums",children:[s.jsx("span",{className:"text-foreground",children:e}),s.jsxs("span",{className:"text-faint",children:["/",t]})]})]})}const p3="grid-cols-[minmax(0,2fr)_minmax(0,1fr)_8rem_7rem_5rem_1rem]",g3="grid-cols-[minmax(0,1.6fr)_7.5rem_5rem_minmax(0,1fr)_13.5rem]",rE="grid-cols-[minmax(0,1.2fr)_minmax(0,1.3fr)_8rem_5rem_1rem]",py="grid-cols-[1rem_minmax(0,1.1fr)_4.5rem_minmax(0,1.5fr)_minmax(0,1fr)_7.5rem_5rem]";function wK({d:e,total:t,onOpen:r}){const[a,l]=x.useState(!1),c=Bs(),u=x.useId(),f=qp.filter(h=>e.sources.has(h)),m=[...e.grants].sort((h,g)=>h.sandbox.localeCompare(g.sandbox)||h.key.localeCompare(g.key));return s.jsxs("li",{children:[s.jsxs("button",{onClick:()=>l(!a),"aria-expanded":a,"aria-controls":u,className:Le("grid min-h-10 w-full items-center gap-4 px-6 py-2 text-left outline-none transition-colors hover:bg-muted/60 focus-visible:bg-muted/60",a&&"bg-muted/60",p3),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx(Lw,{host:e.host,className:"size-6 text-[13px]"}),s.jsx("span",{className:"min-w-0",children:s.jsxs("span",{className:"block truncate font-mono text-[11px]",title:e.host,children:[e.host,s.jsx("span",{className:"ml-2 text-faint",children:[...e.ports].map(h=>`:${h}`).join(" ")})]})})]}),s.jsx("span",{className:"flex flex-wrap gap-1",children:f.map(h=>s.jsx(m3,{source:h},h))}),s.jsx("span",{className:"text-[12px] text-muted-foreground",children:e.access.size===1?$w[[...e.access][0]]??[...e.access][0]:"Mixed"}),s.jsx("span",{className:"block",children:s.jsx(h3,{n:e.sandboxes.size,total:t})}),s.jsx("span",{className:"text-right text-[12px] tabular-nums text-muted-foreground",children:e.hits?e.hits.toLocaleString():"-"}),s.jsx(Ur,{className:Le("size-3.5 text-faint transition-transform",a&&"rotate-90"),"aria-hidden":"true"})]}),s.jsx(Vl,{initial:!1,children:a&&s.jsx(Rn.div,{id:u,role:"region","aria-label":`Access to ${e.host}`,initial:c?!1:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:c?0:.18,ease:[.2,0,0,1]},className:"overflow-hidden bg-muted/30",children:s.jsxs(Rn.div,{initial:c?!1:{opacity:0,y:-3},animate:{opacity:1,y:0},transition:{duration:c?0:.2},className:"px-6 pt-3 pb-4 pl-[3.75rem]",children:[s.jsxs("div",{className:"mb-2 flex items-baseline gap-2",children:[s.jsx("h3",{className:"text-xs font-medium",children:"Sandbox access"}),s.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[vo(e.sandboxes.size,"sandbox","sandboxes")," · ",vo(m.length,"rule assignment")]})]}),s.jsx("div",{className:"overflow-hidden rounded-md border border-border bg-card",children:s.jsxs("table",{className:"w-full table-fixed text-left text-xs","aria-label":`Sandbox access to ${e.host}`,children:[s.jsxs("colgroup",{children:[s.jsx("col",{className:"w-[35%]"}),s.jsx("col",{className:"w-[35%]"}),s.jsx("col",{className:"w-[15%]"}),s.jsx("col",{className:"w-[15%]"})]}),s.jsx("thead",{className:"border-b border-border bg-muted/40 text-[11px] text-muted-foreground",children:s.jsxs("tr",{children:[["Sandbox","Rule","Source"].map(h=>s.jsx("th",{scope:"col",className:"h-8 px-3 font-medium",children:h},h)),s.jsx("th",{scope:"col",className:"px-3",children:s.jsx("span",{className:"sr-only",children:"Actions"})})]})}),s.jsx("tbody",{className:"divide-y divide-border/60",children:m.map(h=>{const g=Yo[ka(h.key)];return s.jsxs("tr",{className:"transition-colors hover:bg-muted/30 focus-within:bg-muted/30",children:[s.jsx("td",{className:"h-10 px-3",children:s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(ql,{"aria-hidden":"true",strokeWidth:1.4,className:"size-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate font-medium",title:h.sandbox,children:h.sandbox})]})}),s.jsx("td",{className:"px-3",children:s.jsx("span",{className:"block truncate font-mono text-[11px] text-muted-foreground",title:Ud(h.key),children:Ud(h.key)})}),s.jsx("td",{className:"px-3 text-muted-foreground",children:s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{"aria-hidden":"true",className:Le("size-1.5 shrink-0 rounded-full",g.swatch)}),g.label]})}),s.jsx("td",{className:"px-2 text-right",children:s.jsxs(ue,{variant:"ghost",size:"sm",className:"h-7 text-[11px] text-muted-foreground","aria-label":`View ${h.sandbox} policy for ${Ud(h.key)}`,onClick:()=>r(h.sandbox),children:["View rules",s.jsx(Ri,{className:"size-3"})]})})]},`${h.sandbox}:${h.key}`)})})]})})]})})})]})}function jK({b:e,onDecide:t}){return s.jsxs("li",{className:Le("grid items-center gap-4 px-6 py-2",g3),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx(Lw,{host:e.host,tone:"denied",className:"size-6 text-[13px]"}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate font-mono text-xs",children:e.host}),s.jsxs("span",{className:"block text-[11.5px] text-muted-foreground",children:[":",e.port,e.lastAt?` · ${xu(e.lastAt)}`:""]})]})]}),s.jsx("span",{className:"text-[12px] tabular-nums",children:vo(e.sandboxes.size,"sandbox","sandboxes")}),s.jsxs("span",{className:"text-[12px] tabular-nums text-red-600/90",children:[e.attempts,"×"]}),s.jsx("span",{className:"truncate font-mono text-[11.5px] text-muted-foreground",children:[...e.programs].map(Yp).join(", ")||"-"}),s.jsxs("span",{className:"flex items-center justify-end gap-1.5",children:[s.jsxs(ju,{children:[s.jsxs(Su,{className:"inline-flex h-7 items-center gap-1 rounded-md bg-[var(--action)] px-2.5 text-[12px] font-medium text-[var(--action-foreground)] outline-none transition-opacity hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring",children:["Allow",s.jsx(Xo,{className:"size-3 opacity-70"})]}),s.jsx(Nu,{align:"end",className:"w-60",children:s.jsxs(np,{children:[s.jsxs(zv,{children:["Allow ",e.host]}),s.jsxs(Ys,{onClick:()=>t("allow-org",e),children:[s.jsx(Ta,{}),"Choose groups",s.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"new rule"})]}),e.sandboxes.size===1&&s.jsxs(Ys,{onClick:()=>t("allow-one",e),children:[s.jsx(Ta,{}),"Groups of ",[...e.sandboxes][0]]})]})})]}),s.jsx(ue,{variant:"ghost",size:"sm",className:"h-7 rounded-lg px-2.5 text-[12px] text-muted-foreground hover:text-red-700",onClick:()=>t("block-org",e),title:"Add to the shared blocked hosts",children:"Block everywhere"})]})]})}function Iv({title:e,count:t,actions:r,children:a}){return s.jsxs("section",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx("h3",{className:"text-[16px] font-semibold tracking-[-0.01em]",children:e}),t!=null&&s.jsx("span",{className:"rounded-full bg-muted px-2 py-px text-[12px] tabular-nums text-muted-foreground",children:t}),r&&s.jsx("div",{className:"ml-auto flex flex-wrap items-center gap-2",children:r})]}),a]})}function op({className:e,children:t}){return s.jsx("div",{className:Le("sticky top-0 z-10 grid h-9 items-center gap-4 border-b border-border bg-muted px-6 text-xs font-medium text-muted-foreground",e),children:t})}function oE({action:e}){return e==="block"?s.jsx("span",{className:"w-fit rounded-full border border-red-200 bg-red-50 px-2 py-px text-[11.5px] text-red-700",children:"Block"}):s.jsx("span",{className:"w-fit rounded-full border border-emerald-600/20 bg-emerald-50 px-2 py-px text-[11.5px] text-emerald-800",children:"Allow"})}function aE({hosts:e}){return s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",title:e.join(`
517
- `),children:e.slice(0,3).join(", ")}),e.length>3&&s.jsxs("span",{className:"shrink-0 text-[11px] text-faint",children:["+",e.length-3]})]})}function iE({label:e,checked:t,mixed:r=!1,disabled:a,onChange:l}){const c=x.useRef(null);return x.useEffect(()=>{c.current&&(c.current.indeterminate=r)},[r]),s.jsx("input",{ref:c,type:"checkbox","aria-label":e,checked:t,disabled:a,onChange:l,className:"block size-4 cursor-pointer rounded border-border accent-[var(--action)] focus-visible:outline-2 focus-visible:outline-ring disabled:cursor-not-allowed"})}function SK({policies:e,org:t,sandboxes:r,groups:a,assignments:l,setupMembers:c,onEdit:u,onEditBlocked:f,onClearBlocked:m,selected:h,onSelect:g,onSelectAll:p,onDelete:b,deleting:v}){var N;const j=((N=t==null?void 0:t.org)==null?void 0:N.blocked)??[],S=e.filter(E=>h.has(E.id)).length,C=e.length>0&&S===e.length;return s.jsxs(s.Fragment,{children:[s.jsxs(op,{className:py,children:[s.jsx(iE,{label:"Select all matching network rules",checked:C,mixed:S>0&&!C,disabled:v||!e.length,onChange:p}),s.jsx("span",{children:"Rule"}),s.jsx("span",{children:"Action"}),s.jsx("span",{children:"Destinations"}),s.jsx("span",{children:"Groups"}),s.jsx("span",{children:"Enforced"}),s.jsx("span",{className:"text-right",children:"Actions"})]}),s.jsxs("ul",{className:"divide-y divide-border/60",children:[j.length>0&&s.jsxs("li",{className:Le("grid min-h-10 items-center gap-4 px-6 py-2 transition-colors hover:bg-muted/60",py),children:[s.jsx("span",{}),s.jsxs("button",{onClick:f,"aria-label":"Edit blocked everywhere",className:"col-span-5 grid grid-cols-subgrid items-center gap-4 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx(Yv,{"aria-hidden":"true",strokeWidth:1.5,className:"size-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate text-xs font-medium",children:"Blocked everywhere"})]}),s.jsx(oE,{action:"block"}),s.jsx(aE,{hosts:j}),s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:"Every sandbox · beats every rule"}),s.jsx("span",{className:"text-[12px] text-faint",children:"Always"})]}),s.jsxs(ue,{variant:"ghost",size:"sm",className:"h-7 justify-self-end px-2 text-xs text-muted-foreground hover:text-destructive","aria-label":"Clear blocked everywhere",disabled:v,onClick:m,children:[s.jsx(Yn,{className:"size-3.5"}),"Delete"]})]}),e.map(E=>{const T=r.filter(k=>Zg(E,{name:k.name,groups:jo({assignments:l},k.name),setups:(c==null?void 0:c[k.name])??[]})),A=T.filter(k=>k.status==="loaded"&&k.rules.some(M=>M.key===`egress_${E.id}`)).length;return s.jsxs("li",{className:Le("grid min-h-10 items-center gap-4 px-6 py-2 transition-colors hover:bg-muted/60",py,h.has(E.id)&&"bg-accent/40"),children:[s.jsx(iE,{label:`Select ${E.name}`,checked:h.has(E.id),disabled:v,onChange:()=>g(E.id)}),s.jsxs("button",{onClick:()=>u(E),disabled:v,"aria-label":`Edit ${E.name}`,className:"col-span-5 grid grid-cols-subgrid items-center gap-4 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx(pu,{"aria-hidden":"true",strokeWidth:1.5,className:"size-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate text-xs font-medium",children:E.name})]}),s.jsx(oE,{action:E.action}),s.jsx(aE,{hosts:E.destinations}),s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:E.appliesTo.everyone||E.appliesTo.sandboxes.length||!E.appliesTo.groups.length?s.jsx("span",{className:"text-amber-700",title:`Current scope: ${Gp(E,a)||"none"}`,children:"Assign a group"}):Gp(E,a)}),T.length?s.jsx(h3,{n:A,total:T.length}):s.jsx("span",{className:"text-[12px] text-faint",children:"No sandboxes"})]}),s.jsxs(ue,{variant:"ghost",size:"sm",className:"h-7 justify-self-end px-2 text-xs text-muted-foreground hover:text-destructive","aria-label":`Delete ${E.name}`,disabled:v,onClick:()=>b([E]),children:[s.jsx(Yn,{className:"size-3.5"}),"Delete"]})]},E.id)})]})]})}function NK({fleet:e,org:t,events:r,onOpen:a,onOpenGlobal:l,onDecide:c,onNavigate:u,onRefresh:f,onEditPolicy:m,onAddPolicy:h,onEditBlocked:g,onClearBlocked:p,forSandbox:b,onClearSandbox:v}){var Re,Te;const j=$t(),[S,C]=x.useState(()=>new Set),[N,E]=x.useState(null),[T,A]=x.useState(!1),[k,M]=x.useState([]),R=x.useRef(!1),[O,D]=x.useState("all"),[_,L]=x.useState(""),[q,P]=x.useState(100),[$,H]=x.useState("rules"),[F,V]=x.useState(Date.now),G=x.useRef(null),X=x.useRef(null);x.useEffect(()=>{const be=setInterval(()=>V(Date.now()),3e4),Ue=Ze=>{var ht;(Ze.metaKey||Ze.ctrlKey)&&Ze.key.toLowerCase()==="k"&&(Ze.preventDefault(),(ht=G.current)==null||ht.focus())};return window.addEventListener("keydown",Ue),()=>{clearInterval(be),window.removeEventListener("keydown",Ue)}},[]),x.useEffect(()=>{var be;P(100),(be=X.current)==null||be.scrollTo({top:0})},[_,O,$]);const B=x.useMemo(()=>BM(r,15,F),[r,F]),Z=e.sandboxes,K=Z.length,se=(t==null?void 0:t.policies)??[],I=(t==null?void 0:t.groups)??[],{destinations:U,blocked:Q,perSandbox:te}=x.useMemo(()=>{var Pe,ct;const be=new Map,Ue=new Map,Ze=new Map;for(const We of Z){const me=new Set,De={};for(const Oe of We.rules){const nt=ka(Oe.key);De[nt]=(De[nt]??0)+1;for(const Ge of Oe.endpoints){if(Ge.blocked)continue;me.add(Ge.host);const Ye=be.get(Ge.host)??{host:Ge.host,sources:new Set,access:new Set,ports:new Set,sandboxes:new Set,grants:[],hits:0,hitsBySandbox:new Map};Ye.sources.add(nt),Ye.access.add(Ge.access),Ge.ports.forEach(He=>Ye.ports.add(He)),Ye.sandboxes.add(We.name);let pe=Ye.grants.find(He=>He.sandbox===We.name&&He.key===Oe.key);pe||(pe={sandbox:We.name,key:Oe.key,source:nt,access:[],ports:[]},Ye.grants.push(pe)),pe.access.push(Ge.access),pe.ports.push(...Ge.ports),be.set(Ge.host,Ye)}}Ue.set(We.name,me),Ze.set(We.name,{counts:De,blocked:0})}const ht=new Map;for(const We of r){if(We.kind!=="audit"||!We.verdict)continue;const me=_w(We.destination);if(!me||l3(me))continue;if(We.verdict==="allowed"){const nt=be.get(me);nt&&(nt.hits+=1,nt.hitsBySandbox.set(We.sandbox,(nt.hitsBySandbox.get(We.sandbox)??0)+1));continue}if(We.verdict!=="denied"||(Pe=Ue.get(We.sandbox))!=null&&Pe.has(me))continue;const De=ht.get(me)??{host:me,port:i3(We.destination),sandboxes:new Set,attempts:0,programs:new Set,lastAt:null};De.attempts+=1,De.sandboxes.add(We.sandbox),We.binary&&De.programs.add(We.binary),We.at&&(!De.lastAt||We.at>De.lastAt)&&(De.lastAt=We.at),ht.set(me,De);const Oe=Ze.get(We.sandbox);Oe&&(Oe.blocked+=1)}const at=eq([...((ct=t==null?void 0:t.org)==null?void 0:ct.blocked)??[],...((t==null?void 0:t.policies)??[]).filter(We=>We.action==="block").flatMap(We=>We.destinations)]);return{destinations:[...be.values()].sort((We,me)=>me.sandboxes.size-We.sandboxes.size||me.hits-We.hits||We.host.localeCompare(me.host)),blocked:[...ht.values()].filter(We=>!at.some(me=>OM(me,We.host))).sort((We,me)=>me.sandboxes.size-We.sandboxes.size||me.attempts-We.attempts),perSandbox:Ze}},[Z,r,t]),le=Z.filter(be=>be.status==="loaded").length,J=_.trim().toLowerCase(),ne=U.filter(be=>(O==="all"||be.sources.has(O))&&(!J||[be.host,...be.grants.flatMap(Ue=>[Ue.sandbox,Ue.key])].join(" ").toLowerCase().includes(J))),ce=ne.length,oe=[{id:"all",label:"All"},...qp.filter(be=>U.some(Ue=>Ue.sources.has(be))).map(be=>({id:be,label:Yo[be].label}))],W=Q.filter(be=>!J||[be.host,...be.programs,...be.sandboxes].join(" ").toLowerCase().includes(J)),de=Z.filter(be=>!J||be.name.toLowerCase().includes(J)),Ee=be=>{var Ue;return!b||Zg(be,{name:b,groups:jo(t,b),setups:((Ue=t==null?void 0:t.setupMembers)==null?void 0:Ue[b])??[]})},Be=se.filter(be=>Ee(be)).filter(be=>!J||[be.name,be.action,...be.destinations,Gp(be,I)].join(" ").toLowerCase().includes(J)),Ne=se.filter(be=>S.has(be.id)),Ae=Be.filter(be=>S.has(be.id)).length;function ee(be){C(Ue=>{const Ze=new Set(Ue);return Ze.has(be)?Ze.delete(be):Ze.add(be),Ze})}function re(){C(be=>{const Ue=new Set(be),Ze=Be.every(ht=>be.has(ht.id));for(const ht of Be)Ze?Ue.delete(ht.id):Ue.add(ht.id);return Ue})}async function xe(){if(!(R.current||!(N!=null&&N.length))){R.current=!0,A(!0),M([]);try{const be=await cK(N,Ue=>j.deletePolicy(Ue));C(Ue=>{const Ze=new Set(Ue);return be.deleted.forEach(ht=>Ze.delete(ht)),be.failed.forEach(({id:ht})=>Ze.add(ht)),Ze}),M(be.failed),be.deleted.length&&qe.success(`Deleted ${vo(be.deleted.length,"network rule")}`),be.failed.length&&qe.error(`${vo(be.failed.length,"network rule")} could not be deleted. Review the errors and retry.`),be.syncFailures.length&&qe.warning("Rules deleted, but some sandboxes could not be updated",{description:be.syncFailures.map(Ue=>`${Ue.rule} · ${Ue.sandbox}: ${Ue.error}`).join(`
518
- `)}),E(null),await f()}finally{A(!1),R.current=!1}}}const he=$==="rules"?Be.length:$==="destinations"?ce:$==="blocked"?W.length:de.length,$e=$==="rules"?se.length:$==="destinations"?U.length:$==="blocked"?Q.length:K,we=!!(_||$==="destinations"&&O!=="all"),_e=()=>{L(""),D("all")};return s.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 pt-4 pb-3 sm:px-6",children:[s.jsx("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Egress inventory",children:[{id:"rules",label:"Rules",count:se.length},{id:"destinations",label:"Destinations",count:U.length},{id:"blocked",label:"Blocked hosts",count:Q.length,dot:"bg-red-500"},{id:"sandboxes",label:"Sandboxes",count:K}].map(be=>s.jsxs("button",{"aria-pressed":$===be.id,onClick:()=>{H(be.id),_e()},className:Le("rounded-md px-3 py-1.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",$===be.id?"bg-accent/70":"hover:bg-muted/60"),children:[s.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[be.dot&&s.jsx("span",{className:Le("size-1.5 rounded-full",be.dot)}),be.label]}),s.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:s.jsx(tf,{value:be.count})})]},be.id))}),s.jsx("div",{className:"ml-auto hidden w-64 px-3 lg:block",children:s.jsx($M,{points:B,height:34,title:"Connections · 15m"})})]}),s.jsxs("div",{className:"flex h-[3px] shrink-0 overflow-hidden bg-border",role:"img","aria-label":`${le} of ${K} sandbox policies enforced`,children:[le>0&&s.jsx("span",{className:"bg-emerald-400/70",style:{width:`${le/K*100}%`}}),K>le&&s.jsx("span",{className:"flex-1 bg-amber-400/70"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-2 sm:px-6",children:[s.jsx(ea,{ref:G,value:_,onValueChange:L,placeholder:$==="sandboxes"?"Search sandbox…":$==="rules"?"Search rule, destination…":"Search destination, sandbox, rule…","aria-label":"Search egress",className:"mr-auto w-full sm:w-64"}),$==="destinations"&&s.jsx(hn,{"aria-label":"Filter by source",value:O,onChange:be=>D(be.target.value),className:"h-8 max-w-44 rounded-md border border-border bg-card px-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",children:oe.map(be=>s.jsx("option",{value:be.id,children:be.id==="all"?"All sources":be.label},be.id))}),we&&s.jsxs(ue,{variant:"ghost",size:"sm",onClick:_e,children:[s.jsx(On,{className:"size-3"}),"Clear"]}),b&&$==="rules"&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"flex items-center gap-1 rounded-md border border-foreground/20 bg-accent py-0.5 pr-0.5 pl-2 text-[12px]",children:["For ",s.jsx("span",{className:"font-mono",children:b}),s.jsx("button",{"aria-label":"Show every rule",onClick:v,className:"rounded p-0.5 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(On,{className:"size-3"})})]}),s.jsxs(ue,{variant:"ghost",size:"sm",onClick:()=>a(b),children:["Rules & history",s.jsx(Ri,{className:"size-3"})]})]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Refresh egress",onClick:f,children:s.jsx(Ia,{className:"size-3.5"})}),s.jsxs(ue,{size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:h,children:[s.jsx(cs,{className:"size-3.5"}),"Add rule"]})]}),$==="rules"&&Ne.length>0&&s.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border bg-accent/30 px-6 py-2",children:[s.jsxs("span",{role:"status",className:"mr-auto text-xs",children:[s.jsx("strong",{children:Ne.length})," selected",Ne.length>Ae&&s.jsxs("span",{className:"text-muted-foreground",children:[" · ",Ne.length-Ae," outside current filters"]})]}),s.jsx(ue,{variant:"ghost",size:"sm",disabled:T,onClick:()=>C(new Set),children:"Clear selection"}),s.jsxs(ue,{variant:"destructive",size:"sm",disabled:T,onClick:()=>E([...Ne]),children:[s.jsx(Yn,{className:"size-3.5"}),T?"Deleting…":"Delete selected"]})]}),Z.some(be=>be.source==="global")&&s.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-2 border-b border-amber-500/30 bg-amber-50/60 px-6 py-2 text-xs text-amber-800",children:[s.jsx(_a,{className:"size-3.5"}),s.jsx("span",{className:"mr-auto",children:"A global policy overrides every sandbox's network rules."}),s.jsx(ue,{variant:"outline",size:"sm",onClick:l,children:"Review"})]}),k.length>0&&s.jsxs(Pi,{id:"egress:delete-errors",tone:"error",title:"Some rules could not be deleted",onDismiss:()=>M([]),dismissLabel:"Dismiss deletion errors",children:[s.jsx("p",{children:"Failed rules remain selected for retry."}),s.jsx("ul",{className:"mt-1 max-h-28 overflow-auto",children:k.map(be=>s.jsxs("li",{children:[s.jsx("strong",{className:"text-foreground",children:be.name}),": ",be.message]},be.id))})]}),s.jsx("div",{ref:X,tabIndex:0,role:"region","aria-label":"Egress inventory results",className:"min-h-0 flex-1 overflow-auto overscroll-contain outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:he===0&&!($==="rules"&&!we&&((Te=(Re=t==null?void 0:t.org)==null?void 0:Re.blocked)!=null&&Te.length))?s.jsxs("div",{className:"py-20 text-center",children:[s.jsx(OR,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),s.jsx("p",{className:"text-sm",children:we?"No matching results":$==="rules"?b?`No rule applies to ${b} yet`:"No network rules yet":$==="blocked"?"No blocked hosts to review":$==="sandboxes"?"No sandboxes yet":"No open destinations"}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:!we&&$==="rules"?"Sandboxes are locked down: nothing leaves them until a rule allows it.":!we&&$==="destinations"?"Destinations appear when a sandbox policy allows access.":!we&&$==="blocked"?"Blocked connection attempts will appear here.":""}),we?s.jsx(ue,{variant:"outline",className:"mt-4",onClick:_e,children:"Clear filters"}):$==="rules"&&s.jsxs(ue,{className:"mt-4 bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:h,children:[s.jsx(cs,{}),"Add rule"]})]}):s.jsxs("div",{className:"min-w-[960px] bg-card",children:[$==="rules"&&s.jsx(SK,{policies:Be,org:we?null:t,sandboxes:Z,groups:I,assignments:t==null?void 0:t.assignments,setupMembers:t==null?void 0:t.setupMembers,onEdit:m,onEditBlocked:g,onClearBlocked:p,selected:S,onSelect:ee,onSelectAll:re,onDelete:E,deleting:T}),$==="destinations"&&s.jsxs(s.Fragment,{children:[s.jsxs(op,{className:p3,children:[s.jsx("span",{children:"Destination"}),s.jsx("span",{children:"Source"}),s.jsx("span",{children:"Access"}),s.jsx("span",{children:"Sandboxes"}),s.jsx("span",{className:"text-right",children:"Requests"}),s.jsx("span",{})]}),s.jsx("ul",{className:"divide-y divide-border/60",children:ne.slice(0,q).map(be=>s.jsx(wK,{d:be,total:K,onOpen:a},be.host))})]}),$==="blocked"&&s.jsxs(s.Fragment,{children:[s.jsxs(op,{className:g3,children:[s.jsx("span",{children:"Destination"}),s.jsx("span",{children:"Sandboxes"}),s.jsx("span",{children:"Attempts"}),s.jsx("span",{children:"Program"}),s.jsx("span",{className:"text-right",children:"Actions"})]}),s.jsx("ul",{className:"divide-y divide-border/60",children:W.slice(0,q).map(be=>s.jsx(jK,{b:be,onDecide:c},be.host))})]}),$==="sandboxes"&&s.jsxs(s.Fragment,{children:[s.jsxs(op,{className:rE,children:[s.jsx("span",{children:"Sandbox"}),s.jsx("span",{children:"Rules by source"}),s.jsx("span",{children:"Policy"}),s.jsx("span",{className:"text-right",children:"Blocked"}),s.jsx("span",{})]}),s.jsx("ul",{className:"divide-y divide-border/70",children:de.slice(0,q).map(be=>{var Ze,ht;const Ue=te.get(be.name)??{counts:{},blocked:0};return s.jsx("li",{children:s.jsxs("button",{onClick:()=>a(be.name),className:Le("grid min-h-10 w-full items-center gap-4 px-6 py-2 text-left outline-none transition-colors hover:bg-muted/60 focus-visible:bg-muted/60",rE),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("span",{className:Le("size-2 shrink-0 rounded-[3px]",Pa(be.phase).cell),"aria-hidden":"true"}),s.jsx("span",{className:"truncate font-mono text-xs",children:be.name})]}),s.jsx("span",{className:"items-center gap-3 flex",children:qp.filter(at=>Ue.counts[at]).map(at=>s.jsxs("span",{className:"flex items-center gap-1.5 text-[12px] tabular-nums",title:Yo[at].label,children:[s.jsx("span",{className:Le("size-1.5 rounded-full",Yo[at].swatch)}),Ue.counts[at]]},at))}),s.jsxs("span",{className:"items-center gap-1.5 text-[12px] flex",children:[s.jsx("span",{className:Le("size-1.5 rounded-full",((Ze=Ko[be.status])==null?void 0:Ze.dot)??"bg-stone-200")}),be.error?"Unavailable":be.version?`v${be.version} ${(ht=Ko[be.status])==null?void 0:ht.label.toLowerCase()}`:"-"]}),s.jsx("span",{className:Le("text-right text-[12px] tabular-nums",Ue.blocked?"text-red-600/90":"text-faint"),children:Ue.blocked||"-"}),s.jsx(Ur,{className:"size-3.5 text-faint","aria-hidden":"true"})]})},be.name)})})]}),$!=="rules"&&he>q&&s.jsxs("button",{onClick:()=>P(be=>be+100),className:"w-full border-t border-border py-3 text-xs text-muted-foreground outline-none hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring",children:["Show ",Math.min(100,he-q)," more"]})]})}),s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border bg-card px-6 py-2 text-[11px] text-muted-foreground",children:[s.jsxs("span",{children:[s.jsx("strong",{className:"font-medium text-foreground",children:he.toLocaleString()}),we?` of ${$e.toLocaleString()}`:""," ",$==="blocked"?"blocked hosts":$]}),s.jsxs("span",{className:"hidden sm:inline",children:[le,"/",K," policies enforced · ⌘K to search"]})]}),s.jsx(Wr,{open:N!==null,onOpenChange:be=>{!be&&!R.current&&E(null)},children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsxs(eo,{children:["Delete ",vo((N==null?void 0:N.length)??0,"network rule"),"?"]}),s.jsx(to,{children:"Removes these rules and updates the affected sandboxes. Deleting an allow rule can remove access; deleting a block rule can permit access allowed by other rules. Each sandbox must keep at least one network rule across its groups."})]}),s.jsx("ul",{"aria-label":"Network rules to delete",className:"max-h-48 overflow-auto rounded-md border border-border p-3 text-xs",children:N==null?void 0:N.map(be=>s.jsx("li",{className:"break-all py-1",children:be.name},be.id))}),s.jsxs(Jr,{children:[s.jsx(so,{disabled:T,children:"Cancel"}),s.jsx(no,{variant:"destructive",disabled:T||!(N!=null&&N.length),onClick:xe,children:T?"Deleting…":"Delete rules"})]})]})})]})}function lE({kind:e,onAdd:t}){const[r,a]=x.useState(!1),[l,c]=x.useState("GET"),[u,f]=x.useState("");return r?s.jsxs("form",{className:"flex items-center gap-1.5",onSubmit:async m=>{m.preventDefault(),await t({method:l,path:u})&&(a(!1),f(""))},children:[s.jsx(hn,{value:l,onChange:m=>c(m.target.value),"aria-label":"Method",className:"h-7 rounded-md border border-input bg-card px-1 font-mono text-[11px]",children:bK.map(m=>s.jsx("option",{children:m},m))}),s.jsx(Rt,{value:u,onChange:m=>f(m.target.value),className:"h-7 w-48 bg-card font-mono text-[11px]",placeholder:"/path/**","aria-label":"Path pattern",autoFocus:!0}),s.jsx(ue,{type:"submit",size:"xs",variant:e==="deny"?"destructive":"outline",disabled:!u.startsWith("/"),children:e==="deny"?"Block":"Allow"}),s.jsx(ue,{type:"button",size:"icon-xs",variant:"ghost",onClick:()=>a(!1),"aria-label":"Cancel",children:s.jsx(On,{})})]}):s.jsxs("button",{onClick:()=>a(!0),className:Le("flex items-center gap-1 text-[12px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",e==="deny"?"text-red-600/80 hover:text-red-700":"text-muted-foreground hover:text-foreground"),children:[s.jsx(cs,{className:"size-3"}),e==="deny"?"Block request":"Allow request"]})}function CK(e){const t=[...new Set(e.endpoints.map(r=>$w[r.access]??r.access))];return t.length===1?t[0]:"Mixed"}function Vw({rule:e,onOp:t,onDelete:r,busy:a,locked:l,managedBy:c,onManage:u}){const[f,m]=x.useState(!1),h=ka(e.key),g=yK[h],p=e.endpoints.map(v=>v.host),b=e.endpoints.some(v=>v.protocol!=="tcp"&&v.enforcement==="audit"||v.credentialRisk);return s.jsxs("div",{children:[s.jsxs("button",{onClick:()=>m(!f),"aria-expanded":f,className:"flex w-full items-center gap-4 px-5 py-3.5 text-left outline-none transition-colors hover:bg-stone-50/70 focus-visible:bg-stone-50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",children:[s.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg border border-border bg-linear-to-b from-card to-stone-100",title:Yo[h].label,children:s.jsx(g,{strokeWidth:1.5,className:"size-3.5 text-stone-600"})}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate text-[13.5px] font-medium",children:Ud(e.key)}),b&&s.jsx(_a,{className:"size-3 shrink-0 text-amber-600","aria-label":"Audit only or uninspected"})]}),s.jsxs("span",{className:"mt-0.5 flex min-w-0 items-center gap-1.5",children:[s.jsx("span",{className:"truncate font-mono text-[11.5px] text-muted-foreground",children:p[0]}),p.length>1&&s.jsxs("span",{className:"shrink-0 text-[11.5px] text-faint",children:["+",p.length-1]})]})]}),s.jsx("span",{className:"hidden shrink-0 sm:block",children:s.jsx(m3,{source:h})}),s.jsx("span",{className:"hidden w-24 shrink-0 text-[12px] text-muted-foreground sm:block",children:CK(e)}),s.jsx("span",{className:"hidden w-28 shrink-0 truncate text-right font-mono text-[11px] text-faint lg:block",children:[...new Set(e.binaries.map(Yp))].join(", ")}),s.jsx(Ur,{className:Le("size-3.5 shrink-0 text-faint transition-transform duration-200",f&&"rotate-90 text-muted-foreground"),"aria-hidden":"true"})]}),s.jsx(Vl,{initial:!1,children:f&&s.jsx(Rn.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.22,ease:[.2,0,0,1]},className:"overflow-hidden",children:s.jsxs("div",{className:"space-y-4 px-5 pt-1 pb-5 pl-[4.25rem]",children:[h==="agent"&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"Included for this agent at launch. Only the destinations and programs listed here are allowed by this rule."}),e.endpoints.map(v=>s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsxs("span",{className:"font-mono text-[12.5px] font-medium",children:[v.host,s.jsx("span",{className:"text-muted-foreground",children:v.ports.length?`:${v.ports.join(",")}`:""}),v.path?` ${v.path}`:""]}),s.jsx(Cd,{children:v.protocol}),s.jsx(Cd,{children:($w[v.access]??v.access).toLowerCase()}),v.protocol!=="tcp"&&v.enforcement==="audit"&&s.jsx(Cd,{tone:"border-amber-500/40 bg-amber-50 text-amber-800",title:v.enforcementUnset?"Unset, treated as audit":void 0,children:"audit only"}),v.allowedIps.length>0&&s.jsxs(Cd,{title:"Private addresses allowed",children:["ips ",v.allowedIps.join(", ")]}),v.credentialRisk&&s.jsx(Cd,{tone:"border-amber-500/40 bg-amber-50 text-amber-800",title:v.tlsSkip?"Encrypted traffic passes through without request inspection":"Credentials are uninspected",children:v.tlsSkip?"TLS passthrough":"uninspected"}),!l&&e.endpoints.length>1&&s.jsx("button",{onClick:()=>t({kind:"removeEndpoint",ruleName:e.key,host:v.host,port:v.port}),disabled:a,className:"ml-auto text-[12px] text-faint outline-none hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring",children:"Remove"})]}),(v.allow.length>0||v.deny.length>0)&&s.jsxs("ul",{className:"space-y-1 border-l border-border pl-3 font-mono text-[11.5px]",children:[v.allow.map((j,S)=>s.jsxs("li",{children:[s.jsx("span",{className:"text-emerald-700",children:"allow"})," ",s.jsxs("span",{className:"text-foreground/75",children:[j.method," ",j.path]})]},`a${S}`)),v.deny.map((j,S)=>s.jsxs("li",{children:[s.jsx("span",{className:"text-red-600",children:"block"})," ",s.jsxs("span",{className:"text-foreground/75",children:[j.method," ",j.path]})]},`d${S}`))]}),!l&&v.protocol!=="tcp"&&s.jsxs("div",{className:"flex flex-wrap gap-x-5 gap-y-1.5",children:[s.jsx(lE,{kind:"allow",onAdd:j=>t({kind:"addAllow",ruleName:e.key,host:v.host,ports:v.ports,binaries:e.binaries,match:j})}),s.jsx(lE,{kind:"deny",onAdd:j=>t({kind:"addDeny",ruleName:e.key,host:v.host,ports:v.ports,binaries:e.binaries,match:j})})]})]},`${v.host}:${v.ports.join(",")}:${v.path??""}`)),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.binaries.map(v=>s.jsxs("span",{title:v,className:"flex items-center gap-0.5 rounded-md bg-muted py-0.5 pr-1 pl-2 font-mono text-[10.5px] text-foreground/75",children:[Yp(v),!l&&e.binaries.length>1?s.jsx("button",{onClick:()=>t({kind:"removeBinary",ruleName:e.key,binary:v}),disabled:a,"aria-label":`Remove ${v}`,className:"rounded p-0.5 text-muted-foreground outline-none hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(On,{className:"size-2.5"})}):s.jsx("span",{className:"w-1"})]},v)),s.jsxs("span",{className:"ml-auto flex items-center gap-2",children:[c&&(u?s.jsxs("button",{onClick:u,className:"text-[12px] text-muted-foreground underline-offset-2 outline-none hover:text-foreground hover:underline focus-visible:ring-2 focus-visible:ring-ring",children:["Managed in ",c]}):s.jsxs("span",{className:"text-[12px] text-muted-foreground",children:["Managed in ",c]})),!l&&r&&s.jsxs(ue,{variant:"ghost",size:"xs",className:"text-muted-foreground hover:text-destructive",disabled:a,onClick:r,children:[s.jsx(Yn,{}),"Delete"]})]})]})]})})})]})}function kK({revisions:e,onOpen:t}){const r=e.slice(0,10).reverse();return s.jsx("div",{className:"flex items-center gap-1","aria-label":"Revisions",children:r.map((a,l)=>{var c,u;return s.jsx("button",{onClick:()=>t(a.version),title:`v${a.version} · ${(c=Ko[a.status])==null?void 0:c.label} · ${xu(a.createdAt)}`,className:Le("rounded-full outline-none transition-transform hover:scale-125 focus-visible:ring-2 focus-visible:ring-ring",l===r.length-1?"size-2.5":"size-1.5",((u=Ko[a.status])==null?void 0:u.dot)??"bg-stone-200"),"aria-label":`Revision ${a.version}`},a.version)})})}function TK({sandbox:e,version:t,latest:r,onClose:a,onRestore:l}){var m,h,g,p;const c=$t(),[u,f]=x.useState(null);return x.useEffect(()=>{f(null),t!=null&&c.revision(e,t).then(f).catch(b=>f({error:b.message}))},[e,t,c]),s.jsx(Ul,{open:t!=null,onOpenChange:b=>{b||a()},children:s.jsxs(cu,{className:"w-full! overflow-y-auto sm:max-w-[460px]!",children:[s.jsxs(uu,{className:"border-b p-6",children:[s.jsxs(du,{className:"font-mono text-base",children:[e," · v",t]}),s.jsx(fu,{children:u!=null&&u.revision?`${(m=Ko[u.revision.status])==null?void 0:m.label} · ${Yd(u.revision.createdAt)}`:"Loading…"})]}),s.jsxs("div",{className:"space-y-4 px-6 pb-6",children:[(u==null?void 0:u.error)&&s.jsx("p",{className:"text-sm text-muted-foreground",children:u.error}),((h=u==null?void 0:u.revision)==null?void 0:h.loadError)&&s.jsx("p",{className:"rounded-md border border-red-200 bg-red-50/60 p-2 font-mono text-[11px] text-red-700",children:u.revision.loadError}),((p=(g=u==null?void 0:u.revision)==null?void 0:g.provenance)==null?void 0:p["console.openshell/change"])&&s.jsx("p",{className:"font-mono text-[11px] text-muted-foreground",children:u.revision.provenance["console.openshell/change"]}),(u==null?void 0:u.policy)&&(u.policy.rules.length?s.jsx(su,{className:"divide-y divide-border/70 overflow-hidden",children:u.policy.rules.map(b=>s.jsx(Vw,{rule:b,locked:!0,onOp:()=>{}},b.key))}):s.jsx("p",{className:"text-[12px] text-muted-foreground",children:"No rules."})),(u==null?void 0:u.policy)&&t!==r&&s.jsxs(ue,{variant:"outline",size:"sm",onClick:()=>l(t),children:[s.jsx(JI,{}),"Restore"]})]})]})})}function x3({onClick:e}){return s.jsxs("button",{onClick:e,className:"group flex items-center gap-1.5 text-[12.5px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx(Vv,{className:"size-3.5 transition-transform group-hover:-translate-x-0.5"}),"All sandboxes"]})}function EK({onBack:e}){var f,m,h;const t=$t(),[r,a]=x.useState(null),[l,c]=x.useState(!1),u=x.useCallback(()=>t.globalPolicy().then(a).catch(g=>a({error:g.message})),[t]);return x.useEffect(()=>{u()},[u]),s.jsxs("div",{className:"space-y-6 px-4 py-5 sm:px-6",children:[s.jsx(x3,{onClick:e}),r?r.error?s.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:r.error}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-xl font-semibold tracking-tight",children:r.active?`Global policy · v${(f=r.current)==null?void 0:f.revision.version}`:"No global policy"}),s.jsx("p",{className:"mt-3 text-[13px] text-muted-foreground",children:r.active?"Overrides every sandbox's own rules.":"Each sandbox follows its own rules."}),r.active&&s.jsxs(ue,{variant:"outline",className:"mt-5 rounded-lg border-destructive/30 text-destructive hover:bg-destructive/5",onClick:()=>c(!0),children:[s.jsx(Yv,{}),"Remove"]})]}),((h=(m=r.current)==null?void 0:m.policy)==null?void 0:h.rules.length)>0&&s.jsx(su,{className:"divide-y divide-border/70 overflow-hidden",children:r.current.policy.rules.map(g=>s.jsx(Vw,{rule:g,locked:!0,onOp:()=>{}},g.key))}),r.revisions.length>0&&s.jsx(Iv,{title:"History",children:s.jsx(su,{className:"divide-y divide-border/60",children:r.revisions.map(g=>{var p,b;return s.jsxs("div",{className:"flex h-11 items-center gap-3 px-5 text-[12.5px]",children:[s.jsx("span",{className:Le("size-1.5 rounded-full",(p=Ko[g.status])==null?void 0:p.dot),"aria-hidden":"true"}),s.jsxs("span",{className:"font-mono",children:["v",g.version]}),s.jsx("span",{className:"text-muted-foreground",children:(b=Ko[g.status])==null?void 0:b.label}),s.jsx("span",{className:"ml-auto text-muted-foreground",children:xu(g.createdAt)})]},g.version)})})})]}):s.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"}),s.jsx(Wr,{open:l,onOpenChange:c,children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsx(eo,{children:"Remove the global policy?"}),s.jsx(to,{children:"Every sandbox reverts to its own rules."})]}),s.jsxs(Jr,{children:[s.jsx(so,{children:"Cancel"}),s.jsx(no,{variant:"destructive",onClick:async()=>{try{await t.removeGlobal(),qe.success("Global policy removed"),u()}catch(g){qe.error(g.message)}finally{c(!1)}},children:"Remove"})]})]})})]})}const cE=[{id:"all",label:"All"},...qp.map(e=>({id:e,label:Yo[e].label}))];function RK({name:e,sandbox:t,events:r,onBack:a,onNavigate:l,onDraft:c,onEditPolicy:u,onEditBlocked:f,onOpenGlobal:m,reloadSignal:h}){var F,V,G,X,B,Z;const g=$t(),p=Cn(),[b,v]=x.useState(null),[j,S]=x.useState(!1),[C,N]=x.useState(null),[E,T]=x.useState(null),[A,k]=x.useState("all"),M=x.useCallback(async()=>{try{const K=await g.policy(e);return v(K),K}catch(K){v({error:K.message})}},[e,g]);x.useEffect(()=>{v(null),M()},[M]),x.useEffect(()=>{h&&M()},[h]);async function R(K){var se;for(let I=0;I<20;I++){const U=await M(),Q=(se=U==null?void 0:U.revisions)==null?void 0:se.find(te=>te.version===K);if((Q==null?void 0:Q.status)==="loaded"){qe.success(`Policy v${K} is enforced in ${e}`);return}if((Q==null?void 0:Q.status)==="failed"){qe.error(`v${K} failed to load: ${Q.loadError??"unknown error"}`);return}await new Promise(te=>setTimeout(te,1500))}qe.warning(`v${K} saved; not yet loaded by ${e}`)}async function O(K){S(!0);try{const se=await g.applyOps(e,K);return qe(`Saved as v${se.version}`),R(se.version),!0}catch(se){return qe.error(se.message),!1}finally{S(!1)}}async function D(K){S(!0);try{const se=await g.restore(e,K);qe(`Restored v${K} as v${se.version}`),T(null),R(se.version)}catch(se){qe.error(se.message)}finally{S(!1)}}const _=((F=b==null?void 0:b.effective)==null?void 0:F.rules)??[],L=new Set(_.flatMap(K=>K.endpoints.filter(se=>!se.blocked).map(se=>se.host))),q=x.useMemo(()=>{const K=new Map;for(const se of r){if(se.sandbox!==e||se.verdict!=="denied")continue;const I=_w(se.destination);if(!I||l3(I)||L.has(I))continue;const U=K.get(I)??{host:I,port:i3(se.destination),count:0,binary:null,lastAt:null};U.count+=1,!U.binary&&se.binary&&(U.binary=se.binary),se.at&&(!U.lastAt||se.at>U.lastAt)&&(U.lastAt=se.at),K.set(I,U)}return[...K.values()].sort((se,I)=>I.count-se.count)},[r,e,b]),P=(b==null?void 0:b.source)==="global",$=Object.fromEntries(cE.map(K=>[K.id,_.filter(se=>K.id==="all"||ka(se.key)===K.id).length])),H=_.filter(K=>A==="all"||ka(K.key)===A);return s.jsxs("div",{className:"space-y-6 px-4 py-5 sm:px-6",children:[s.jsxs("div",{className:"space-y-5",children:[s.jsx(x3,{onClick:a}),b?b.error?s.jsx("p",{role:"alert",className:"py-16 text-center text-sm text-muted-foreground",children:b.error}):s.jsxs("header",{className:"flex flex-wrap items-end gap-x-6 gap-y-4",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:[s.jsx("span",{className:Le("size-2 rounded-[3px]",Pa(t==null?void 0:t.phase).cell)}),"Sandbox"]}),s.jsx("h2",{className:"mt-2 truncate text-xl font-semibold tracking-tight",children:e}),s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-4",children:[b.latest&&s.jsxs("span",{className:Le("flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[12px]",(V=Ko[b.latest.status])==null?void 0:V.cls),children:[s.jsxs("span",{className:"relative flex size-1.5",children:[b.latest.status==="loaded"&&s.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full bg-emerald-400 opacity-60"}),s.jsx("span",{className:Le("relative inline-flex size-1.5 rounded-full",(G=Ko[b.latest.status])==null?void 0:G.dot)})]}),"v",b.latest.version," ",(X=Ko[b.latest.status])==null?void 0:X.label.toLowerCase()]}),s.jsx(kK,{revisions:b.revisions,onOpen:T}),s.jsxs("span",{className:"text-[12.5px] text-muted-foreground tabular-nums",children:[vo(L.size,"destination")," open"]})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(ue,{variant:"outline",className:"rounded-lg",onClick:()=>{try{sessionStorage.setItem("gateway-box",p?JSON.stringify({name:e,location:p}):e)}catch{}l("sandboxes")},children:[s.jsx(tg,{}),"View sandbox"]}),s.jsxs(ue,{className:"rounded-lg bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",disabled:j||P,onClick:()=>c(null,R),children:[s.jsx(cs,{}),"Add rule"]})]})]}):s.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"})]}),b&&!b.error&&s.jsxs(s.Fragment,{children:[P&&s.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border border-amber-500/30 bg-amber-50/60 px-4 py-2 text-[12.5px] text-amber-800",children:[s.jsx(_a,{className:"size-3.5"}),s.jsx("span",{className:"mr-auto",children:"Global policy in force · editing disabled"}),s.jsx(ue,{variant:"outline",size:"sm",onClick:m,children:"Review"})]}),b.configurationError&&s.jsx("p",{className:"rounded-xl border border-red-200 bg-red-50/60 px-4 py-3 font-mono text-[11.5px] text-red-700",children:b.configurationError}),q.length>0&&!P&&s.jsx(Iv,{title:"Blocked recently",count:q.length,children:s.jsx(su,{className:"divide-y divide-border/70 overflow-hidden",children:q.slice(0,6).map(K=>s.jsxs("div",{className:"flex items-center gap-3 px-5 py-3",children:[s.jsx(Lw,{host:K.host,tone:"denied",className:"size-7 text-[15px]"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"block truncate font-mono text-[12.5px]",children:[K.host,s.jsxs("span",{className:"text-muted-foreground",children:[":",K.port]})]}),s.jsxs("span",{className:"block text-[11.5px] text-muted-foreground",children:[K.binary?Yp(K.binary):"Unknown program",K.lastAt?` · ${xu(K.lastAt)}`:""]})]}),s.jsxs("span",{className:"text-[12px] tabular-nums text-red-600/90",children:[K.count,"×"]}),s.jsx(ue,{variant:"outline",size:"sm",className:"h-7 rounded-lg text-[12px]",onClick:()=>c({name:f3(K.host),binaries:K.binary?[K.binary]:[],endpoints:[{host:K.host,ports:[K.port],protocol:K.port===443||K.port===80?"rest":"tcp",access:"read-only",enforcement:"enforce"}]},R),children:"Allow"})]},K.host))})}),s.jsx(Iv,{title:"Rules",count:_.length,actions:s.jsx(vK,{label:"Filter rules",options:cE.filter(K=>K.id==="all"||$[K.id]>0).map(K=>({...K,count:$[K.id]})),value:A,onChange:k}),children:H.length===0?s.jsx(su,{className:"flex flex-col items-center border-dashed py-12 shadow-none",children:s.jsx("p",{className:"text-[13px] text-muted-foreground",children:"No rules yet"})}):s.jsx(su,{className:"divide-y divide-border/70 overflow-hidden",children:H.map(K=>{const se=ka(K.key);return s.jsx(Vw,{rule:K,busy:j,locked:!["own","agent"].includes(se)||P,onOp:I=>O([I]),onDelete:["own","agent"].includes(se)?()=>N(K.key):null,managedBy:se==="secret"?"Secrets":se==="policy"?"Network rules":se==="org"?"Blocked everywhere":se==="group"?"Groups":null,onManage:se==="secret"?()=>l("secrets"):se==="policy"?()=>u(K.key.replace(/^egress_/,"")):se==="org"?f:se==="group"?()=>l("groups"):void 0},K.key)})})})]}),s.jsx(Wr,{open:!!C,onOpenChange:K=>{K||N(null)},children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsxs(eo,{children:["Delete rule ",C,"?"]}),s.jsxs(to,{children:[e," loses access immediately. Restorable from revisions."]})]}),s.jsxs(Jr,{children:[s.jsx(so,{children:"Cancel"}),s.jsx(no,{variant:"destructive",onClick:async()=>{await O([{kind:"removeRule",ruleName:C}]),N(null)},children:"Delete rule"})]})]})}),s.jsx(TK,{sandbox:e,version:E,latest:(Z=(B=b==null?void 0:b.revisions)==null?void 0:B[0])==null?void 0:Z.version,onClose:()=>T(null),onRestore:D})]})}function AK(e){const t=e.port===443||e.port===80;return{name:f3(e.host),binaries:[...e.programs],endpoints:[{host:e.host,ports:[e.port],protocol:t?"rest":"tcp",...t?{access:"read-only"}:{},enforcement:"enforce"}]}}const uE="egress-allow",dE="egress-sandbox",Hl="egress-policy",fE=()=>{try{const e=JSON.parse(sessionStorage.getItem(Hl)??"null");return sessionStorage.removeItem(Hl),e}catch{return null}};function OK(e){const t=Cn();return s.jsx(MK,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function MK({onNavigate:e}){var le,J,ne,ce,oe;const t=$t(),r=Cn(),a=W=>e(W,r),l=Ua(),[c,u]=x.useState(null),[f,m]=x.useState(!1),[h,g]=x.useState(()=>{try{const W=sessionStorage.getItem(dE);return sessionStorage.removeItem(dE),W}catch{return null}}),[p,b]=x.useState(null),[v,j]=x.useState(null),[S,C]=x.useState(null),[N,E]=x.useState(null),[T,A]=x.useState(!1),[k,M]=x.useState(!1),[R,O]=x.useState(!1),[D,_]=x.useState(null),[L,q]=x.useState(0),P=x.useRef(null),$=x.useCallback(async()=>{try{b(await t.fleetPolicy())}catch(W){b({error:W.message,sandboxes:[]})}try{j(await t.org())}catch{j(null)}},[t]);x.useEffect(()=>{$()},[$]);const[H,F]=x.useState(fE);x.useEffect(()=>{const W=()=>{const de=fE();de&&(F(de),$())};return window.addEventListener(Hl,W),()=>window.removeEventListener(Hl,W)},[$]),x.useEffect(()=>{H!=null&&H.new&&E({initial:Vd({appliesTo:{everyone:!1,groups:[],sandboxes:[],...H.new.appliesTo}})})},[H]);const V=x.useRef(null);x.useEffect(()=>{if(!(H!=null&&H.edit)||!v||V.current===H)return;const W=v.policies.find(de=>de.id===H.edit);W&&(V.current=H,E({initial:W}))},[H,v]),x.useEffect(()=>{let W=null;try{W=JSON.parse(sessionStorage.getItem(uE)??"null"),sessionStorage.removeItem(uE)}catch{}!(W!=null&&W.sandbox)||!(W!=null&&W.host)||(u(W.sandbox),C({sandbox:W.sandbox,initial:AK({host:W.host,port:Number(W.port)||443,programs:new Set(W.binary?[W.binary]:[])}),after:()=>q(de=>de+1)}))},[]);const G=x.useMemo(()=>{const W=new Set;for(const de of l.events)de.binary&&W.add(de.binary);return[...W].sort()},[l.events]),X=W=>{var de;u(W),(de=P.current)==null||de.scrollTo({top:0})},B=()=>{var W;m(!0),(W=P.current)==null||W.scrollTo({top:0})},Z=()=>{var W;u(null),m(!1),$(),(W=P.current)==null||W.scrollTo({top:0})};function K(W,de){const Be={everyone:!1,groups:W==="allow-one"?jo(v,[...de.sandboxes][0]):[],sandboxes:[]};if(W.startsWith("allow")){E({initial:Vd({name:de.host,destinations:[de.host],appliesTo:Be})});return}_({kind:W,b:de})}function se(W){const de=((v==null?void 0:v.policies)??[]).find(Ee=>Ee.id===W);de&&E({initial:de})}function I(W,de){var Be,Ne;const Ee=((Be=W.applied)==null?void 0:Be.length)??0;(Ne=W.failed)!=null&&Ne.length?qe.warning(`${de}. ${vo(W.failed.length,"sandbox","sandboxes")} could not be updated`,{description:W.failed.map(Ae=>`${Ae.sandbox}: ${Ae.error}`).join(`
519
- `)}):qe.success(de,{description:Ee?`Updated ${vo(Ee,"sandbox","sandboxes")}.`:void 0}),$(),q(Ae=>Ae+1)}async function U(){O(!0);try{const W=v??await t.org();I(await t.saveOrg({...W.org,blocked:[]}),"Cleared blocked hosts"),M(!1)}catch(W){qe.error(W.message)}finally{O(!1)}}async function Q(){const{b:W}=D;try{const de=v??await t.org();I(await t.saveOrg({...de.org,blocked:[...de.org.blocked,W.host]}),`${W.host} blocked everywhere`),_(null)}catch(de){qe.error(de.message)}}const te=((le=p==null?void 0:p.sandboxes)==null?void 0:le.length)??0;return s.jsxs("div",{ref:P,className:"h-full overflow-y-auto",children:[f?s.jsx(EK,{onBack:Z}):c?s.jsx(RK,{name:c,sandbox:((J=p==null?void 0:p.sandboxes)==null?void 0:J.find(W=>W.name===c))??((ne=l.sandboxes)==null?void 0:ne.find(W=>W.name===c)),events:l.events,onBack:Z,onNavigate:a,onOpenGlobal:B,reloadSignal:L,onDraft:(W,de)=>C({sandbox:c,initial:W,after:de}),onEditPolicy:se,onEditBlocked:()=>A(!0)},c):p?p.error?s.jsx("p",{role:"alert",className:"py-24 text-center text-sm text-muted-foreground",children:p.error}):s.jsx(NK,{fleet:p,org:v,events:l.events,onOpen:X,onOpenGlobal:B,onDecide:K,onNavigate:a,onRefresh:$,onEditPolicy:W=>E({initial:W}),onEditBlocked:()=>A(!0),onClearBlocked:()=>M(!0),onAddPolicy:()=>E({initial:Vd(h?{appliesTo:{everyone:!1,groups:jo(v,h),sandboxes:[]}}:{})}),forSandbox:h,onClearSandbox:()=>g(null)}):s.jsx("p",{role:"status",className:"py-24 text-center text-sm text-muted-foreground",children:"Loading…"}),s.jsx(JM,{open:!!N,onOpenChange:W=>{W||E(null)},initial:N==null?void 0:N.initial,groups:(v==null?void 0:v.groups)??[],sandboxes:((p==null?void 0:p.sandboxes)??l.sandboxes??[]).map(W=>W.name),assignments:(v==null?void 0:v.assignments)??{},setupMembers:(v==null?void 0:v.setupMembers)??{},knownPrograms:G,onGroupCreated:()=>t.org().then(j).catch(()=>{}),onSaved:(W,de)=>I(W,`${W.deleted?"Deleted":"Saved"} ${de.name}`)}),s.jsx(Wr,{open:k,onOpenChange:W=>{!W&&!R&&M(!1)},children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsxs(eo,{children:["Unblock ",vo(((oe=(ce=v==null?void 0:v.org)==null?void 0:ce.blocked)==null?void 0:oe.length)??0,"host")," everywhere?"]}),s.jsx(to,{children:"Removes the shared blocked list and updates every sandbox. These hosts can then be reached if another rule allows them."})]}),s.jsxs(Jr,{children:[s.jsx(so,{disabled:R,children:"Cancel"}),s.jsx(no,{variant:"destructive",disabled:R,onClick:U,children:R?"Removing…":"Unblock all"})]})]})}),s.jsx(UY,{open:T,onOpenChange:A,org:v==null?void 0:v.org,onSaved:W=>I(W,"Saved blocked hosts")}),s.jsx(zY,{open:!!S,onOpenChange:W=>{W||C(null)},initial:S==null?void 0:S.initial,knownPrograms:G,onSubmit:async W=>{var Ee;const de=await t.applyOps(S.sandbox,[{kind:"addRule",rule:W}]);qe(`Saved as v${de.version}`),q(Be=>Be+1),(Ee=S.after)==null||Ee.call(S,de.version)}}),s.jsx(Wr,{open:!!D,onOpenChange:W=>{W||_(null)},children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsxs(eo,{children:["Block ",D==null?void 0:D.b.host," everywhere?"]}),s.jsxs(to,{children:["Adds it, with its subdomains, to the hosts blocked in every sandbox. No rule can open it. Applies to ",vo(te,"sandbox","sandboxes"),"."]})]}),s.jsxs(Jr,{children:[s.jsx(so,{children:"Cancel"}),s.jsx(no,{variant:"destructive",onClick:Q,children:"Block everywhere"})]})]})})]})}const DK=e=>e!=null&&e.egressPolicy?` ${e.egressPolicy.created?"Created":"Updated"} the egress policy “${e.egressPolicy.name}”.`:e!=null&&e.egressPolicyError?" Its egress policy wasn’t saved.":"";function zK(e,t=Vq){let r=[];const a=new Set,l=new Map,c=(u,f)=>{r=r.map(m=>m.id===u?{...m,...f}:m),a.forEach(m=>m())};return{subscribe:u=>(a.add(u),()=>a.delete(u)),getSnapshot:()=>r,updateReview(u,f,m){if(l.has(u))throw new Error("Wait for the import to finish before removing items.");c(u,{review:f,prepared:m,preparation:null,status:"needs-attention",message:f.items.length?"Import selection updated. Review it to finish importing.":"No items remain in this import."})},dismiss(u){r=r.filter(f=>f.id!==u),a.forEach(f=>f())},async cancel(u){var h;const f=l.get(u);if(!f)return;f.cancelled=!0;const m=r.find(g=>g.id===u);((h=m==null?void 0:m.preparation)==null?void 0:h.status)==="running"&&await f.api.cancelSetupPreparation(m.preparation.id)},start({id:u=crypto.randomUUID(),review:f,name:m,choices:h={},resumeJob:g,saveOnly:p=!1,api:b=e,location:v=null},j={}){if(l.has(u))return{id:u,promise:l.get(u).promise};const S={cancelled:!1,api:b};return l.set(u,S),r=[...r.filter(C=>C.id!==u),{id:u,name:m,review:f,location:v,prepared:p,status:"importing",message:p?"Saving your setup…":"Preparing your tools…"}],a.forEach(C=>C()),S.promise=(async()=>{var C;try{const N=p?{status:"saved",setup:await b.saveSetup(f.token,m,!0),inactive:f.items.filter(E=>{var T;return!E.disabled&&((T=E.issues)==null?void 0:T.length)}).map(E=>E.name)}:await t(b,f,m,h,{resumeJob:g,isCancelled:()=>S.cancelled,onProgress:E=>{var T;c(u,{preparation:E,message:E.message}),(T=j.onProgress)==null||T.call(j,E)},onReview:E=>{var T;c(u,{review:E,prepared:!0}),(T=j.onReview)==null||T.call(j,E)}});return c(u,{status:N.status,setup:N.setup,...N.status==="cancelled"?{prepared:!1}:{},message:N.status==="saved"?`Available in templates and sandboxes.${(C=N.inactive)!=null&&C.length?` Inactive: ${N.inactive.join(", ")}.`:""}${DK(N.setup)}`:N.status==="needs-attention"?"Some items need attention. Open the import to remove or fix them.":"Import cancelled. You can resume from the completed preparation."}),N}catch(N){throw c(u,{status:"failed",message:N.message}),N}finally{l.delete(u)}})(),{id:u,promise:S.promise}}}}const Ti=zK(is),PK=(e,t)=>(e??[]).filter(r=>{var a;return r.action==="allow"&&(((a=r.appliesTo)==null?void 0:a.setups)??[]).some(l=>{var c;return l===t.id||l===((c=t.preparedFrom)==null?void 0:c.id)})}),IK=(e={})=>{var t,r,a;return!((t=e.programs)!=null&&t.length)&&(e.requests??"any")==="any"&&!((r=e.deny)!=null&&r.length)&&!((a=e.privateIps)!=null&&a.length)},_K=(e,t,r)=>PK(e,t).some(a=>{var l;return IK(a.advanced)&&(((l=a.advanced)==null?void 0:l.ports)??[443,80]).map(Number).includes(Number(r.port??443))&&a.destinations.some(c=>OM(c,r.host))}),b3=e=>{var t;return!!(e.credentialRef||(t=e.credentialFields)!=null&&t.length)},LK=(e,t)=>String(e??"").toLowerCase()===String(t??"").toLowerCase(),mE=(e,t)=>!b3(e)&&(t.phase==="runtime"||t.phase==="auth"&&(e.requirements??[]).some(r=>r.phase==="runtime"&&LK(r.host,t.host))),_v=e=>`${e.host}${Number(e.port??443)===443?"":`:${e.port}`}`,BK=e=>`${_v(e)}${e.path||""}`;function $K(e,t,r,a=l=>l.requirements??[]){const l=new Set,c=new Map;for(const f of e)for(const m of r(f))for(const h of a(m).filter(g=>["runtime","auth"].includes(g.phase)))t&&!(h.phase==="runtime"&&b3(m))&&_K(t,f,h)?l.add(_v(h)):c.set(BK(h),_v(h));const u=new Set(c.values());return{covered:[...l].filter(f=>!u.has(f)),uncovered:[...c.keys()]}}function VK(e){const t=(e==null?void 0:e.hosts)??[],r=a=>[...new Set(t.filter(l=>l.host===a).flatMap(l=>l.items??[]))];return[...new Set((e==null?void 0:e.destinations)??t.map(a=>a.host))].filter(a=>{var l;return!((l=e==null?void 0:e.blocked)!=null&&l.includes(a))}).map(a=>({host:a,items:r(a)}))}const Uw=[{id:"codex",name:"Codex",logo:"codex"},{id:"claude",name:"Claude Code",logo:"claudecode"},{id:"cursor",name:"Cursor",logo:"cursor"}],Xp=(e,t)=>e.items.filter(r=>r.kind===t).length,ja=e=>e.issues.filter(t=>!Aw(t)),UK=e=>e.items.filter(t=>!t.disabled&&!ja(t).length).length,Wp=e=>e.items.filter(t=>ja(t).length).length,hE=e=>e.sources.map(t=>{var r;return((r=Uw.find(a=>a.id===t))==null?void 0:r.name)||t}).join(", "),HK=e=>`${e.host}${e.port&&Number(e.port)!==443?`:${e.port}`:""}${e.path||""}`,FK={build:"Downloads from",runtime:"Connects to",auth:"Sign-in"},pE={connected:"Connected","needs-sign-in":"Needs sign-in","needs-credentials":"Needs credentials",unverified:"Couldn’t check"},GK={prepared:"Ready","sign-in-in-sandbox":"Sign in after install","needs-attention":"Needs attention",disabled:"Inactive"},gE=e=>{var t,r,a;return e.disabled?"Inactive":Ow(e)?"Can’t run in a sandbox":ja(e).length?"Needs attention":e.issues.length?"Installs on import":e.kind==="skill"?`${((t=e.files)==null?void 0:t.length)??0} files`:((r=e.auth)==null?void 0:r.mode)==="agent-session"?"Sign in after install":((a=e.verification)==null?void 0:a.status)==="connected"?"Connected":e.artifact?"Package ready":"Not checked yet"},qK=e=>/^(?=.{1,253}$)[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?\.[a-z]{2,63}$/i.test(e)&&!e.includes("..")&&!e.includes("*")&&!e.endsWith(".local"),y3=(e=[])=>e.some(t=>!qK(t))?"Enter domain names like api.github.com (no wildcards, IP addresses or local names).":e.length>20?"Add up to 20 websites.":"",v3=e=>{var t;return((t=e.credentialFields)==null?void 0:t.length)>0&&!e.requirements.some(r=>r.phase==="runtime")},w3=(e,t)=>{var r;return v3(e)&&IM(t)&&!((r=t==null?void 0:t.hosts)!=null&&r.length)},ap=e=>(e==null?void 0:e.egressPolicy)??(e!=null&&e.egressPolicyError?{error:e.egressPolicyError}:null),YK=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`;function sf({children:e}){return e?s.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/20 bg-destructive/5 p-3 text-xs text-destructive",children:e}):null}function j3({children:e}){return s.jsxs("div",{className:"flex gap-2 rounded-lg border bg-muted/30 p-3 text-xs leading-relaxed text-muted-foreground",children:[s.jsx(pu,{className:"mt-0.5 size-3.5 shrink-0"}),s.jsx("span",{children:e})]})}const xE=[{kind:"mcp",label:"MCPs",icon:qv},{kind:"skill",label:"Skills",icon:Hv}];function S3({items:e,children:t}){return s.jsxs(Ef,{defaultValue:e.some(r=>r.kind==="mcp")?"mcp":"skill",className:"min-w-0 gap-3",children:[s.jsx(Rf,{"aria-label":"Setup item categories",className:"w-full",children:xE.map(({kind:r,label:a,icon:l})=>s.jsxs(wr,{value:r,className:"gap-2 text-xs",children:[s.jsx(l,{className:"size-3.5"}),a,s.jsx("span",{className:"rounded bg-foreground/5 px-1.5 text-[10px] tabular-nums text-muted-foreground",children:e.filter(c=>c.kind===r).length})]},r))}),xE.map(({kind:r,label:a,icon:l})=>s.jsx(bo,{value:r,keepMounted:!0,className:"min-w-0",children:s.jsx(qo,{duration:.16,offset:2,blur:"0px",children:e.some(c=>c.kind===r)?t(e.filter(c=>c.kind===r)):s.jsxs("div",{className:"rounded-lg border border-dashed px-4 py-8 text-center",children:[s.jsx(l,{className:"mx-auto mb-2 size-5 text-muted-foreground",strokeWidth:1.5}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["No ",a," in this setup."]})]})})},r))]})}function N3(e){const t=Cn();return s.jsx(KK,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function KK({sandbox:e=null,setupIds:t=[]}){const r=$t(),a=Cn(),[l,c]=x.useState(null),[u,f]=x.useState(""),[m,h]=x.useState(!1),[g,p]=x.useState(null),[b,v]=x.useState(null),[j,S]=x.useState(!1),[C,N]=x.useState(""),[E,T]=x.useState(""),[A,k]=x.useState("all"),[M,R]=x.useState(!1),[O,D]=x.useState(!1),[_,L]=x.useState(null),q=x.useCallback(async()=>{D(!0);try{c(await r.setups()),f("")}catch(V){f(V.message)}finally{D(!1)}},[r]),$=x.useSyncExternalStore(Ti.subscribe,Ti.getSnapshot).filter(V=>{var G;return V.status==="saved"&&((G=V.location)==null?void 0:G.context)===(a==null?void 0:a.context)}).map(V=>V.id).join(",");x.useEffect(()=>{q()},[q,$]);const H=x.useMemo(()=>(l||[]).filter(V=>{const G=[V.name,...V.items.flatMap(X=>[X.name,...X.sources||[]])].join(" ").toLowerCase().includes(E.trim().toLowerCase());return(!e||t.includes(V.id))&&G&&(A==="all"||(A==="review"?Wp(V)>0:Wp(V)===0))}).sort((V,G)=>V.name.localeCompare(G.name,void 0,{numeric:!0})*(M?-1:1)),[l,E,A,M,e,t]),F=!!(E||A!=="all");return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-4 py-3 sm:px-6",children:[s.jsx(ea,{"aria-label":"Search setups",placeholder:"Search…",value:E,onValueChange:T,className:"mr-auto min-w-32 flex-1 sm:max-w-60"}),s.jsxs(hn,{"aria-label":"Filter setups by status",value:A,onChange:V=>k(V.target.value),className:"h-8 w-36 bg-card text-xs",children:[s.jsx("option",{value:"all",children:"All statuses"}),s.jsx("option",{value:"imported",children:"Imported"}),s.jsx("option",{value:"review",children:"Needs review"})]}),F&&s.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>{T(""),k("all")},children:"Clear"}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Refresh setups",disabled:O,onClick:q,children:O?s.jsx(zt,{className:"size-3.5"}):s.jsx(Ia,{className:"size-3.5"})}),s.jsxs(ue,{size:"sm",className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>h(!0),children:[s.jsx(cs,{}),"Bring my setup"]})]}),u&&s.jsxs("div",{className:"space-y-2 border-b px-4 py-3 sm:px-6",children:[s.jsx(sf,{children:u}),s.jsx(ue,{variant:"outline",size:"sm",disabled:O,onClick:q,children:"Try again"})]}),s.jsx("div",{className:"flex-1",children:!l&&!u?s.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 py-12 text-xs text-muted-foreground",children:[s.jsx(zt,{}),"Loading setups…"]}):l&&!H.length?s.jsxs("div",{className:"px-4 py-16 text-center",children:[s.jsx(wI,{className:"mx-auto mb-3 size-6 text-muted-foreground",strokeWidth:1.5}),s.jsx("p",{className:"text-sm font-medium",children:e&&!F?"No setups in this sandbox":l.length?"No matching setups":"No setups yet"}),s.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:e&&!F?"Choose a setup from MCPs & Skills to enable it here.":l.length?"Try another name, tool, source agent, or status.":"Import MCPs and Skills from Codex, Claude Code, or Cursor."}),(!e||F)&&s.jsx(ue,{variant:"outline",size:"sm",className:"mt-4",onClick:()=>l.length?(T(""),k("all")):h(!0),children:l.length?"Clear filters":"Bring my setup"})]}):l&&s.jsx(qo,{duration:.15,offset:0,blur:"0px",children:s.jsxs(A8,{"aria-label":"MCPs & Skills",className:"min-w-[740px] text-xs",children:[s.jsx(O8,{children:s.jsxs(MC,{className:"hover:bg-transparent",children:[s.jsx(P0,{scope:"col","aria-sort":M?"descending":"ascending",className:"h-9 px-4 text-[11px] font-normal text-muted-foreground sm:pl-6",children:s.jsxs("button",{className:"flex items-center gap-1.5 rounded outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>R(V=>!V),children:["Name",M?s.jsx(af,{className:"size-3"}):s.jsx(lf,{className:"size-3"})]})}),["Source agents","MCPs","Skills","Created"].map(V=>s.jsx(P0,{scope:"col",className:"h-9 px-4 text-[11px] font-normal text-muted-foreground",children:V},V)),s.jsx(P0,{className:"w-12",children:s.jsx("span",{className:"sr-only",children:"Actions"})})]})}),s.jsx(M8,{children:H.map(V=>{const G=Uw.filter(X=>V.items.some(B=>{var Z;return(Z=B.sources)==null?void 0:Z.includes(X.id)}));return s.jsxs(MC,{className:"cursor-pointer hover:bg-muted/40",onClick:()=>p(V),children:[s.jsx($c,{className:"max-w-72 px-4 py-2 sm:pl-6",children:s.jsxs("button",{"aria-label":`Open setup ${V.name}`,onClick:X=>{X.stopPropagation(),p(V)},className:"group flex max-w-full items-center gap-2 rounded text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-lg border bg-muted/40 text-muted-foreground",children:s.jsx(Gv,{className:"size-3.5",strokeWidth:1.5})}),s.jsx("span",{className:"truncate font-mono text-xs font-medium group-hover:underline",children:V.name})]})}),s.jsx($c,{className:"px-4 py-2",children:s.jsxs("div",{className:"flex items-center gap-2",children:[G.map(X=>s.jsx("img",{src:`/logos/agents/${X.logo}.svg`,alt:X.name,title:X.name,className:"size-4 object-contain"},X.id)),!G.length&&s.jsx("span",{className:"text-muted-foreground",children:"Not reported"})]})}),s.jsx($c,{className:"px-4 py-2 tabular-nums",children:s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(qv,{"aria-hidden":"true",className:"size-3.5 text-muted-foreground",strokeWidth:1.5}),Xp(V,"mcp")]})}),s.jsx($c,{className:"px-4 py-2 tabular-nums",children:s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(Hv,{"aria-hidden":"true",className:"size-3.5 text-muted-foreground",strokeWidth:1.5}),Xp(V,"skill")]})}),s.jsx($c,{className:"px-4 py-2 text-[11px] text-muted-foreground",children:V.createdAt?Yd(V.createdAt):"Not reported"}),s.jsx($c,{className:"px-4 py-2 text-right sm:pr-6",children:s.jsx(ue,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive","aria-label":`Delete setup ${V.name}`,onClick:X=>{X.stopPropagation(),N(""),v(V)},children:s.jsx(Yn,{className:"size-3.5"})})})]},V.id)})})]})})}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t bg-card px-4 py-2 text-[11px] text-muted-foreground sm:px-6",children:[s.jsxs("span",{children:[s.jsx("strong",{className:"font-medium text-foreground",children:H.length}),F?` of ${(l==null?void 0:l.length)||0}`:""," ",(l==null?void 0:l.length)===1?"setup":"setups"]}),s.jsx("span",{children:"Saved locally · Available in templates and sandboxes"})]}),b&&s.jsx(yn,{open:!0,onOpenChange:V=>{!V&&!j&&v(null)},children:s.jsxs(vn,{className:"sm:max-w-md",children:[s.jsxs(Nn,{children:[s.jsxs(wn,{children:["Delete “",b.name,"”?"]}),s.jsx(Hn,{children:"This deletes the setup and its egress policy. MCPs already installed in sandboxes stay, but lose access to the websites that policy allowed. Templates that use this setup need another setup before reuse."})]}),s.jsx(sf,{children:C}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ue,{variant:"ghost",disabled:j,onClick:()=>v(null),children:"Cancel"}),s.jsxs(ue,{variant:"destructive",disabled:j,onClick:async()=>{S(!0),N("");try{await r.deleteSetup(b.id,b.revision),c(V=>V.filter(G=>G.id!==b.id)),p(V=>(V==null?void 0:V.id)===b.id?null:V),v(null)}catch(V){N(V.message)}finally{S(!1)}},children:[j&&s.jsx(zt,{}),"Delete setup"]})]})]})}),m&&s.jsx(k3,{initialReview:m.review,initialName:m.name,onClose:()=>h(!1),onSaved:V=>{h(!1),q(),L(ap(V))}}),_&&s.jsx(C3,{policy:_,onClose:()=>L(null)}),g&&s.jsx(JK,{setup:g,sandbox:e,onPrepare:async()=>{try{const V=await r.prepareSavedSetup(g.id);h({review:V,name:g.name+" (updated)"}),p(null)}catch(V){f(V.message)}},onUpdated:V=>{p(V),c(G=>G.map(X=>X.id===V.id?V:X))},onClose:()=>p(null)})]})}function XK(){const e=x.useSyncExternalStore(Ti.subscribe,Ti.getSnapshot),[t,r]=x.useState(null),[a,l]=x.useState(null);return s.jsxs(s.Fragment,{children:[e.map(c=>s.jsx(Pi,{id:`setup-import:${c.id}`,tone:c.status==="importing"?"progress":c.status==="saved"?"success":c.status==="failed"?"error":"warning",title:s.jsxs(s.Fragment,{children:[c.name," · ",c.status==="importing"?"Importing":c.status==="saved"?"Imported":c.status==="cancelled"?"Import cancelled":c.status==="failed"?"Import failed":"Import needs attention"]}),actions:s.jsxs(s.Fragment,{children:[s.jsx(So,{location:c.location}),!["importing","saved"].includes(c.status)&&s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>r(c),children:"Review import"}),c.status==="saved"&&ap(c.setup)&&s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>l({policy:ap(c.setup),location:c.location}),children:"View egress policy"})]}),onDismiss:c.status==="importing"?void 0:()=>Ti.dismiss(c.id),dismissLabel:`Dismiss import notification for ${c.name}`,children:c.message},c.id)),t&&s.jsx(Oa,{location:t.location,children:s.jsx(k3,{initialJob:t,initialReview:t.review,initialName:t.name,onClose:()=>r(null),onSaved:c=>{l({policy:ap(c),location:t.location}),r(null)}},t.id)}),(a==null?void 0:a.policy)&&s.jsx(Oa,{location:a.location,children:s.jsx(C3,{policy:a.policy,onClose:()=>l(null)})})]})}function C3({policy:e,onClose:t}){var A,k,M,R,O;const r=$t(),a=Cn(),[l,c]=x.useState([]),[u,f]=x.useState(null),[m,h]=x.useState([]),[g,p]=x.useState(!1),[b,v]=x.useState(""),[j,S]=x.useState(!1);x.useEffect(()=>{if(e.error)return;let D=!0;return r.org().then(_=>{var q;if(!D)return;const L=(_.policies??[]).find(P=>P.id===e.id);h(_.groups??[]),f(L??null),c(((q=L==null?void 0:L.appliesTo)==null?void 0:q.groups)??[])}).catch(_=>{D&&v(`Could not load groups: ${_.message}`)}),()=>{D=!1}},[r,e.id,e.error]);const C=async()=>{p(!0),v("");try{await r.savePolicy({...u,appliesTo:{...u.appliesTo,everyone:!1,groups:l},isNew:!1}),f({...u,appliesTo:{...u.appliesTo,groups:l}}),S(!0)}catch(D){v(D.message)}finally{p(!1)}},N=u&&(l.length!==u.appliesTo.groups.length||l.some(D=>!u.appliesTo.groups.includes(D))),E=VK(e),T=()=>{try{sessionStorage.setItem(Hl,JSON.stringify({edit:e.id}))}catch{}t(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"egress",location:a}})),window.dispatchEvent(new Event(Hl))};return e.error?s.jsx(yn,{open:!0,onOpenChange:D=>{D||t()},children:s.jsxs(vn,{className:"sm:max-w-md",children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:"Egress policy not saved"}),s.jsx(Hn,{children:"The setup was saved, but its egress policy wasn’t. When you enable the setup on a sandbox, you approve its websites there instead."})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:e.error}),s.jsx("div",{className:"flex justify-end",children:s.jsx(ue,{onClick:t,children:"Done"})})]})}):s.jsx(yn,{open:!0,onOpenChange:D=>{D||t()},children:s.jsxs(vn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-md",children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:e.created?"Egress policy created":"Egress policy updated"}),s.jsxs(Hn,{children:["We ",e.created?"created":"updated"," the egress policy “",e.name,"”. Sandboxes that use this setup can now reach the websites below. This policy doesn’t open anything else."]})]}),E.length>0&&s.jsx("ul",{"aria-label":"Allowed websites",className:"max-h-64 divide-y overflow-y-auto rounded-lg border text-xs",children:E.map(D=>s.jsxs("li",{className:"flex items-baseline justify-between gap-3 px-3 py-2",children:[s.jsx("span",{className:"min-w-0 break-all font-mono",children:D.host}),D.items.length>0&&s.jsx("span",{className:"max-w-[50%] text-right text-muted-foreground",children:D.items.join(", ")})]},D.host))}),((A=e.blocked)==null?void 0:A.length)>0&&s.jsxs("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:["Not allowed because your organization blocks them: ",e.blocked.join(", "),"."]}),((k=e.approval)==null?void 0:k.length)>0&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Not in this policy, because an MCP sends credentials there or names it as its sign-in service: ",e.approval.map(D=>`${D.host} (${D.items.join(", ")})`).join(", "),". You approve these for each sandbox when you enable the setup there."]}),(((M=e.sync)==null?void 0:M.error)||((O=(R=e.sync)==null?void 0:R.failed)==null?void 0:O.length)>0)&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"The policy is saved, but some sandboxes that use this setup weren’t updated yet. The console keeps retrying in the background."}),u&&s.jsxs("fieldset",{className:"grid gap-1.5 text-xs",children:[s.jsx("legend",{className:"font-medium",children:"Assign to groups"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Sandboxes in these groups get this policy, whether or not they use the setup."}),s.jsx(ef,{multiple:!0,groups:m,value:l,onChange:D=>{S(!1),c(D)},onCreated:D=>h(_=>[..._,D])}),b&&s.jsx("p",{role:"alert",className:"text-[11px] text-red-700",children:b}),j&&!N&&s.jsx("p",{role:"status",className:"text-[11px] text-muted-foreground",children:"Groups saved."})]}),!u&&b&&s.jsx("p",{role:"alert",className:"text-[11px] text-red-700",children:b}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"To let an MCP reach another website, add it to this policy in Network › Egress."}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ue,{variant:"outline",onClick:T,children:"Edit policy"}),N&&s.jsxs(ue,{disabled:g,onClick:C,children:[g&&s.jsx(zt,{}),"Save groups"]}),s.jsx(ue,{variant:N?"ghost":"default",disabled:g,onClick:t,children:N?"Skip":"Done"})]})]})})}function WK({item:e}){var l;const t=c=>[...new Set(e.requirements.filter(u=>["runtime","auth"].includes(u.phase)&&c(u)).map(u=>u.host.toLowerCase()))],r=t(c=>mE(e,c)),a=t(c=>!mE(e,c));return s.jsxs(s.Fragment,{children:[r.length>0&&s.jsxs("p",{className:"text-muted-foreground",children:["Import adds ",r.join(", ")," to this setup’s egress policy."]}),a.length>0&&s.jsxs("p",{className:"text-muted-foreground",children:["You approve ",a.join(", ")," for each sandbox when you enable the setup there",e.credentialRef||(l=e.credentialFields)!=null&&l.length?", because this MCP sends credentials":"","."]})]})}function QK({preparation:e,onCancel:t}){var p,b;const r=e.status==="running",[a,l]=x.useState(Date.now);x.useEffect(()=>{if(!r)return;l(Date.now());const v=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(v)},[r]);const c=Date.parse(e.createdAt),u=r?e.current:null,f=((p=e.items)==null?void 0:p.filter(v=>v.kind==="mcp"))??[],m=((b=e.items)==null?void 0:b.filter(v=>v.kind==="skill"))??[],h=m.every(v=>v.state),g=s.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/40"});return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(zt,{}),s.jsx("span",{className:"min-w-0 flex-1",children:u&&f.length?"Preparing your tools…":e.message}),r&&!Number.isNaN(c)&&s.jsx("span",{"aria-hidden":"true",className:"tabular-nums text-muted-foreground",children:YK(Math.max(0,Math.floor((a-c)/1e3)))}),r&&s.jsx(ue,{size:"sm",variant:"outline",onClick:t,children:"Cancel import"})]}),(f.length>0||m.length>0)&&s.jsxs("ul",{"aria-label":"Import progress",className:"space-y-1.5 border-t pt-2",children:[f.map(v=>{const j=(u==null?void 0:u.id)===v.id,S=!j&&Ow(v);return s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center",children:j?s.jsx(zt,{className:"size-3.5"}):S||!v.state||v.state==="disabled"?g:v.state==="needs-attention"?s.jsx(pu,{className:"size-3.5 text-amber-600"}):s.jsx(Fn,{className:"size-3.5 text-emerald-600"})}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:v.name}),s.jsx("span",{className:"min-w-0 max-w-[60%] truncate text-right text-muted-foreground",children:j?u.message:S?"Skipped":GK[v.state]||"Waiting"})]},v.id)}),m.length>0&&s.jsxs("li",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"flex size-3.5 shrink-0 items-center justify-center",children:h?s.jsx(Fn,{className:"size-3.5 text-emerald-600"}):g}),s.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[m.length," ",m.length===1?"skill":"skills"]}),s.jsx("span",{className:"text-muted-foreground",children:h?"Done":"Waiting"})]})]})]})}function ZK({item:e,choice:t,disabled:r,onChange:a}){const l=y3(t==null?void 0:t.hosts)||(w3(e,t)?"Enter at least one website, for example api.github.com.":"");return v3(e)?s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx("p",{className:"font-medium",children:"Where should this MCP send its credentials?"}),s.jsxs("p",{className:"text-muted-foreground",children:[e.name," needs at least one website it may send ",e.credentialFields.join(", ")," to, for example api.github.com."]}),s.jsx(Rt,{"aria-label":`Websites for ${e.name}`,"aria-invalid":l?!0:void 0,disabled:r,placeholder:"e.g. api.github.com",value:(t==null?void 0:t.hostsText)??"",onChange:c=>a(c.target.value)}),s.jsx("span",{className:"text-muted-foreground",children:"Domain names only, separated by commas or spaces. HTTPS only."}),l&&s.jsx("p",{className:"text-amber-700 dark:text-amber-400",children:l})]}):null}function k3({onClose:e,onSaved:t,initialReview:r=null,initialName:a="My setup",initialJob:l=null}){const c=$t(),u=Cn(),[f,m]=x.useState([]),[h,g]=x.useState(null),[p,b]=x.useState([]),[v,j]=x.useState(r),[S,C]=x.useState(a),[N,E]=x.useState(""),[T,A]=x.useState(null),[k,M]=x.useState(!1),[R,O]=x.useState("");async function D(oe){M(!0),O("");try{await oe()}catch(W){O(W.message)}finally{M(!1)}}const[_,L]=x.useState({}),[q,P]=x.useState((l==null?void 0:l.preparation)??null),[$,H]=x.useState((l==null?void 0:l.prepared)??!1),[F,V]=x.useState(!1),[G,X]=x.useState(!!l),B=x.useRef(l==null?void 0:l.id),Z=x.useRef(!0);x.useEffect(()=>(Z.current=!0,()=>{Z.current=!1}),[]);const K=(q==null?void 0:q.status)==="running"||k&&!!q,se=(oe,W)=>{H(!1),L(de=>({...de,[oe]:{...de[oe],...W}}))};async function I(oe){const W=await c.removeSetupReviewItem(v.token,oe);j(W),b(de=>de.filter(Ee=>Ee!==oe)),L(de=>Object.fromEntries(Object.entries(de).filter(([Ee])=>Ee!==oe))),P(null),B.current&&Ti.updateReview(B.current,W,$)}async function U(oe=!1){X(!0),V(!0);const W=Ti.start({id:B.current,review:v,name:S,choices:_,saveOnly:oe,api:c,location:u,resumeJob:(q==null?void 0:q.status)==="running"?q:void 0},{onProgress:de=>{Z.current&&P(de)},onReview:de=>{Z.current&&(j(de),H(!0),L({}))}});B.current=W.id;try{const de=await W.promise;if(!Z.current)return;de.status==="saved"?t(de.setup):de.status==="needs-attention"?O("Some items couldn’t be prepared. Remove them or fix them, then retry the import."):(H(!1),O("Import cancelled. Completed preparation is kept here for retry."))}finally{Z.current&&V(!1)}}const Q=(h==null?void 0:h.items.filter(oe=>`${oe.name} ${oe.kind} ${oe.sources.join(" ")}`.toLowerCase().includes(N.toLowerCase())))??[],te=new Set(p),le=(oe,W)=>b(de=>{const Ee=new Set(de);for(const Be of oe)W?Ee.add(Be.id):Ee.delete(Be.id);return[...Ee]}),J=Q.length>0&&Q.every(oe=>te.has(oe.id)),ne=v?Bq(v,_):[],ce=Object.values(_).some(oe=>y3(oe.hosts))||!!(v!=null&&v.items.some(oe=>!oe.disabled&&w3(oe,_[oe.id])));return s.jsxs(yn,{open:!0,onOpenChange:oe=>{!oe&&(B.current||F||!k&&!K)&&e()},children:[s.jsxs(vn,{className:"flex max-h-[90svh] flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl",children:[s.jsxs(Nn,{className:"shrink-0 px-6 pb-4 pt-6 pr-12",children:[s.jsx(wn,{children:v?"Import setup":h?"Choose what to bring":"Bring my setup"}),s.jsx(Hn,{children:v?"Import downloads and checks your MCPs, then saves the setup.":h?"Select the MCPs and skills to import. Items found in more than one agent are listed once.":"Choose the agents to import MCPs and skills from."})]}),s.jsxs("div",{className:"min-h-0 space-y-5 overflow-y-auto px-6 pb-5",children:[!h&&!v&&s.jsx(s.Fragment,{children:s.jsx("div",{className:"grid gap-2 sm:grid-cols-3",children:Uw.map(oe=>s.jsxs("button",{type:"button","aria-pressed":f.includes(oe.id),onClick:()=>m(W=>W.includes(oe.id)?W.filter(de=>de!==oe.id):[...W,oe.id]),className:`flex items-center gap-2 rounded-xl border px-3 py-4 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring ${f.includes(oe.id)?"border-ring bg-muted":"bg-card"}`,children:[s.jsx("span",{className:"flex size-7 items-center justify-center rounded-lg border bg-muted/30",children:s.jsx("img",{src:`/logos/agents/${oe.logo}.svg`,alt:"",className:"size-4"})}),oe.name,f.includes(oe.id)&&s.jsx(Fn,{className:"ml-auto size-3.5"})]},oe.id))})}),h&&!v&&s.jsxs(s.Fragment,{children:[s.jsx(ea,{"aria-label":"Search discovered tools",placeholder:"Search MCPs and Skills…",value:N,onValueChange:E}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("p",{role:"status",className:"text-xs text-muted-foreground",children:[p.length," of ",h.items.length," selected",N.trim()?` · ${Q.length} matching`:""]}),s.jsx(ue,{size:"sm",variant:"outline",disabled:k||!Q.length,onClick:()=>le(Q,!J),children:J?N.trim()?"Clear results":"Clear all":N.trim()?"Select all results":"Select all"})]}),s.jsx("div",{className:"grid items-start gap-3 sm:grid-cols-2",children:[{kind:"mcp",label:"MCPs"},{kind:"skill",label:"Skills"}].map(({kind:oe,label:W})=>{const de=Q.filter(Ne=>Ne.kind===oe),Ee=de.filter(Ne=>te.has(Ne.id)).length,Be=de.length>0&&Ee===de.length;return s.jsxs("section",{"aria-label":W,className:"min-w-0 overflow-hidden rounded-xl border",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3 border-b bg-muted px-3 py-2",children:[s.jsxs("h3",{className:"text-xs font-medium",children:[W,s.jsxs("span",{className:"ml-2 font-normal text-muted-foreground",children:[Ee,"/",de.length]})]}),s.jsx(ue,{size:"sm",variant:"ghost",className:"h-7 text-xs",disabled:k||!de.length,"aria-label":`${Be?"Clear":"Select all"} ${W}${N.trim()?" in search results":""}`,onClick:()=>le(de,!Be),children:Be?"Clear":"Select all"})]}),s.jsxs("div",{className:"max-h-64 divide-y overflow-y-auto",children:[de.map(Ne=>s.jsxs("label",{className:"flex cursor-pointer items-start gap-3 p-3",children:[s.jsx(Il,{disabled:k,"aria-label":`Import ${Ne.name} from ${hE(Ne)}`,checked:te.has(Ne.id),onCheckedChange:Ae=>le([Ne],Ae)}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-xs font-medium",children:Ne.name}),s.jsxs("span",{className:"mt-1 block text-[11px] text-muted-foreground",children:[hE(Ne),Ow(Ne)?" · Can’t run in a sandbox":ja(Ne).length?" · Needs attention":""]})]})]},Ne.id)),!de.length&&s.jsx("p",{className:"p-4 text-xs text-muted-foreground",children:N.trim()?`No matching ${W}`:`No ${W} found`})]})]},oe)})}),N.trim()&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Select all only affects the search results. Other selections are kept."}),h.warnings.map(oe=>s.jsx("p",{className:"text-[11px] text-muted-foreground",children:oe},oe))]}),v&&s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"grid gap-1.5 text-xs",children:["Setup name",s.jsx(Rt,{disabled:k,value:S,onChange:oe=>C(oe.target.value),maxLength:80})]}),s.jsx("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs text-muted-foreground",children:s.jsxs("span",{children:[UK(v)," ready · ",Wp(v)," need attention"]})}),s.jsx(S3,{items:v.items,children:oe=>s.jsx(N7,{className:"overflow-hidden rounded-lg border",children:oe.map(W=>{var de,Ee,Be,Ne,Ae,ee,re,xe;return s.jsxs(C7,{value:W.id,children:[s.jsxs("div",{className:"flex items-center [&>h3]:min-w-0 [&>h3]:flex-1",children:[s.jsxs(k7,{className:"items-center gap-3 rounded-none px-3 py-3 text-xs hover:bg-muted/30 hover:no-underline",children:[s.jsx("span",{className:"min-w-0 flex-1 break-words",children:W.name}),s.jsx("span",{className:`shrink-0 text-[11px] font-normal ${["Needs attention","Can’t run in a sandbox"].includes(gE(W))?"text-amber-700 dark:text-amber-400":"text-muted-foreground"}`,children:gE(W)})]}),s.jsx(ue,{variant:"ghost",size:"icon",className:"mr-2 size-7 shrink-0 text-muted-foreground hover:text-destructive",disabled:k||K,"aria-label":`Remove ${W.name} from import`,title:"Remove from this import",onClick:()=>D(()=>I(W.id)),children:s.jsx(Yn,{className:"size-3.5"})})]}),s.jsxs(T7,{className:"space-y-3 border-t bg-muted/10 px-4 py-4 text-xs leading-relaxed [&_p:not(:last-child)]:mb-0",children:[ja(W).length>0&&s.jsx("div",{className:"space-y-1 text-amber-700 dark:text-amber-400",children:ja(W).map(he=>s.jsx("p",{children:he},he))}),W.requirements.length>0&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-[11px] font-medium text-muted-foreground",children:"Network access"}),W.requirements.map((he,$e)=>s.jsxs("p",{children:[s.jsxs("span",{className:"font-medium",children:[FK[he.phase]||he.phase,":"]})," ",HK(he),s.jsxs("span",{className:"text-muted-foreground",children:[" · ",he.reason]})]},$e)),W.kind==="mcp"&&!W.disabled&&!ja(W).some(he=>!he.startsWith("Connect credentials"))&&s.jsx(WK,{item:W})]}),W.package&&s.jsxs("p",{children:["npm package ",W.package.name,"@",((de=W.artifact)==null?void 0:de.version)||W.package.requested,W.artifact?" · downloaded and version-locked":" · downloads when you press Import"]}),W.verification&&s.jsxs("p",{children:["Connection: ",pE[W.verification.status]||W.verification.status,W.verification.reason?` · ${W.verification.reason}`:""]}),((Ee=W.artifact)==null?void 0:Ee.verification)&&s.jsxs("p",{children:["Startup check: ",pE[W.artifact.verification.status]||W.artifact.verification.status,W.artifact.verification.toolCount!==void 0?` · ${W.artifact.verification.toolCount} tools found`:""]}),W.credentialRef&&s.jsxs("p",{children:["Credentials connected · ",W.credentialRef.provider,". Values are held by the gateway."]}),((Be=W.configuration)==null?void 0:Be.endpoint)&&!W.credentialRef&&s.jsx(j3,{children:"If this MCP needs an account, sign in from the agent inside the sandbox. Your desktop sign-in isn’t copied."}),W.kind==="mcp"&&!W.disabled&&(W.configuration||W.package)&&!((Ne=W.configuration)!=null&&Ne.endpoint)&&s.jsx(ZK,{item:W,choice:_[W.id],disabled:k||K,onChange:he=>se(W.id,{hostsText:he,hosts:he.split(/[\s,]+/).map($e=>$e.replace(/^https?:\/\//i,"").split("/")[0].toLowerCase()).filter(Boolean)})}),((Ae=W.credentialFields)==null?void 0:Ae.length)>0&&s.jsxs("div",{className:"space-y-2 rounded border p-3",children:[s.jsx("p",{className:"font-medium",children:"Connect credentials"}),((ee=W.sourceCredentialFields)==null?void 0:ee.length)>0&&s.jsxs("label",{className:"flex items-start gap-2",children:[s.jsx(Il,{disabled:k||K,checked:((re=_[W.id])==null?void 0:re.useSourceSecrets)||!1,onCheckedChange:he=>se(W.id,{useSourceSecrets:!!he})}),"Use the credentials from your config file (",W.sourceCredentialFields.join(", "),")."]}),W.credentialFields.filter(he=>{var $e,we;return!(($e=_[W.id])!=null&&$e.useSourceSecrets)||!((we=W.sourceCredentialFields)!=null&&we.includes(he))}).map(he=>{var $e,we;return s.jsxs("label",{className:"grid gap-1",children:[he,s.jsx(Rt,{type:"password",autoComplete:"new-password","aria-label":`${W.name} ${he}`,disabled:k||K,value:((we=($e=_[W.id])==null?void 0:$e.secrets)==null?void 0:we[he])||"",onChange:_e=>{var Re;return se(W.id,{secrets:{...(Re=_[W.id])==null?void 0:Re.secrets,[he]:_e.target.value}})}})]},he)}),s.jsx("p",{className:"text-muted-foreground",children:"Stored in the gateway and sent only to this MCP’s server. Never saved in the setup or in images."})]}),W.configuration&&s.jsxs("details",{className:"group/config",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-sm text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",children:[s.jsx(Ur,{className:"size-3 transition-transform group-open/config:rotate-90"}),"Configuration"]}),s.jsx("pre",{className:"mt-2 overflow-x-auto rounded border bg-muted/30 p-3 text-[11px]",children:JSON.stringify(W.configuration,null,2)})]}),(xe=W.files)==null?void 0:xe.map(he=>s.jsxs("button",{disabled:k,onClick:()=>D(async()=>A({path:he.path,...await c.setupFile(v.token,W.id,he.path)})),className:"flex w-full items-center gap-1.5 rounded px-1 py-1 text-left hover:bg-muted",children:[s.jsx(Hv,{className:"size-3"}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:he.path}),s.jsxs("span",{className:"text-muted-foreground",children:[he.bytes," B"]})]},he.path))]})]},W.id)})})}),q&&s.jsx("div",{role:"status","aria-live":"polite",className:"space-y-2 rounded-lg border bg-muted/30 p-3 text-xs",children:K?s.jsx(QK,{preparation:q,onCancel:()=>{Ti.cancel(B.current).catch(oe=>O(oe.message))}}):s.jsx("p",{children:$?QT(v)?"Checks finished. Some items need attention.":"Checks finished. Ready to save.":"Not finished. Press Import to continue."})}),r&&s.jsx(ue,{variant:"ghost",disabled:K||k,onClick:()=>{j(null),m([...new Set(r.items.flatMap(oe=>oe.sources))]),P(null),H(!1),L({})},children:"Re-scan sources"})]}),s.jsx(sf,{children:R})]}),s.jsxs("div",{className:"shrink-0 space-y-4 border-t bg-muted/20 px-6 py-4",children:[v&&!K&&!$&&ne.length>0&&s.jsxs("p",{className:"text-xs text-muted-foreground",children:[ne.map(oe=>oe.name).join(", ")," will be saved as inactive. You can fix ",ne.length===1?"it":"them"," later."]}),s.jsxs("div",{className:"flex items-center justify-end gap-2",children:[h&&s.jsx(ue,{variant:"ghost",disabled:k||K,onClick:()=>{v?(j(null),H(!1),P(null),L({})):(g(null),b([])),O("")},children:"Back"}),s.jsx(ue,{variant:"ghost",disabled:!B.current&&!F&&(k||K),onClick:e,children:F?"Continue in background":B.current?"Close":"Cancel"}),v?s.jsxs(ue,{disabled:k||!S.trim()||!v.items.length||ce,onClick:()=>D(()=>U($&&!QT(v))),children:[k&&s.jsx(zt,{}),k?"Importing…":K?"Resume import":G?"Retry import":"Import"]}):h?s.jsxs(ue,{disabled:k||!p.length,onClick:()=>D(async()=>{j(await c.reviewSetup(h.token,p)),X(!1)}),children:[k&&s.jsx(zt,{}),"Review selection"]}):s.jsxs(ue,{disabled:k||!f.length,onClick:()=>D(async()=>g(await c.discoverSetups(f))),children:[k&&s.jsx(zt,{}),"Discover tools"]})]})]})]}),T&&s.jsx(yn,{open:!0,onOpenChange:()=>A(null),children:s.jsxs(vn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-3xl",children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:T.path}),s.jsx(Hn,{children:"Read-only file preview. Content is not executed."})]}),s.jsx("pre",{className:"whitespace-pre-wrap break-words rounded-lg border bg-muted/30 p-4 font-mono text-xs",children:T.content})]})})]})}function JK({setup:e,sandbox:t,onUpdated:r,onClose:a,onPrepare:l}){var L,q;const c=$t(),u=Cn(),[f,m]=x.useState([]),[h,g]=x.useState(null),[p,b]=x.useState(t||""),[v,j]=x.useState([]),[S,C]=x.useState(null),[N,E]=x.useState(null),[T,A]=x.useState([]),[k,M]=x.useState(!1),[R,O]=x.useState("");x.useEffect(()=>{let P=!0;return c.overview().then($=>{P&&(m($.sandboxes),g({...$.gateway,target:u==null?void 0:u.target}))}).catch($=>{P&&O($.message)}),()=>{P=!1}},[c]),x.useEffect(()=>{let P=!1,$;const H=async()=>{try{const F=await c.setupJobs(e.id);if(P)return;A(F),F.some(V=>V.status==="waiting")&&($=setTimeout(H,2e3))}catch{}};return H(),()=>{P=!0,clearTimeout($)}},[e.id,N,c]);async function D(P){M(!0),O("");try{await P()}catch($){O($.message),C(null)}finally{M(!1)}}const _=e.items.filter(P=>{var $;return!P.disabled&&!P.issues.length&&!P.credentialRef&&(($=P.auth)==null?void 0:$.mode)==="agent-session"});return s.jsx(yn,{open:!0,onOpenChange:P=>{!P&&!k&&a()},children:s.jsxs(vn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-lg",children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:e.name}),s.jsx(Hn,{className:"sr-only",children:"Manage the MCPs and Skills in this saved setup."})]}),s.jsx(S3,{items:e.items,children:P=>s.jsx("div",{className:"max-h-72 divide-y overflow-y-auto rounded-lg border",children:P.map($=>{var H,F;return s.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5",children:[s.jsx("div",{className:"min-w-0 flex-1 self-center",children:$.issues.length||((H=$.auth)==null?void 0:H.mode)==="agent-session"?s.jsxs("details",{className:"group/item",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-sm text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",children:[s.jsx(Ur,{className:"size-3 shrink-0 text-muted-foreground transition-transform group-open/item:rotate-90"}),s.jsx("span",{className:"min-w-0 flex-1 break-words font-medium",children:$.name}),s.jsx("span",{className:`shrink-0 text-[10px] ${ja($).length?"text-amber-700 dark:text-amber-400":"text-muted-foreground"}`,children:ja($).length?"Needs review":$.issues.length?"Installs automatically":"Sign-in needed"})]}),s.jsxs("div",{className:"space-y-1.5 pb-1 pl-5 pt-2 text-[11px] leading-relaxed text-muted-foreground",children:[$.issues.map(V=>s.jsx("p",{children:V},V)),((F=$.auth)==null?void 0:F.mode)==="agent-session"&&s.jsx("p",{children:"Sign in inside the sandbox after installation."})]})]}):s.jsx("p",{className:"break-words pl-5 text-xs font-medium",children:$.name})}),s.jsx(ue,{variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground hover:text-destructive",disabled:k,"aria-label":`Delete ${$.name} from setup`,title:$.kind==="mcp"?"Remove from this setup. Copies already installed in sandboxes stay, but lose the website access only this MCP needed.":"Remove from this setup. Copies already installed in sandboxes stay.",onClick:()=>D(async()=>{const{egressPolicyError:V,...G}=await c.deleteSetupItem(e.id,$.id,e.revision);C(null),E(null),r(G),V&&O(`Removed. The setup’s egress policy wasn’t updated: ${V}`)}),children:s.jsx(Yn,{className:"size-3.5"})})]},$.id)})})}),s.jsx("div",{className:"flex items-center justify-between gap-3",children:s.jsxs(ue,{variant:"outline",size:"sm",onClick:l,disabled:k,children:[Wp(e)?"Resolve issues":"Prepare setup",s.jsx(Ur,{className:"size-3.5"})]})}),s.jsxs("details",{className:"group/install border-t pt-3",open:t?!0:void 0,children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between rounded-sm text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",children:["Install in a sandbox",s.jsx(Ur,{className:"size-3.5 text-muted-foreground transition-transform group-open/install:rotate-90"})]}),s.jsxs("div",{className:"space-y-3 pt-4",children:[s.jsxs("fieldset",{disabled:k,className:"grid gap-3",children:[s.jsxs("label",{className:"grid gap-1.5 text-xs",children:["Sandbox",s.jsxs(hn,{"aria-label":"Setup destination",value:p,onChange:P=>{b(P.target.value),C(null),E(null)},className:"w-full text-xs",children:[s.jsx("option",{value:"",children:"Choose a sandbox"}),f.map(P=>s.jsxs("option",{value:P.name,children:[P.name," · ",P.phase]},P.name))]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"mb-2 text-xs",children:"Enable for agents"}),s.jsx("div",{className:"flex flex-wrap gap-4",children:R6.map(P=>s.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[s.jsx(Il,{disabled:!P.config,title:P.reason,checked:v.includes(P.id),onCheckedChange:$=>{j(H=>$?[...H,P.id]:H.filter(F=>F!==P.id)),C(null),E(null)}}),P.name,!P.config&&s.jsx("span",{className:"text-muted-foreground",children:" · Unavailable"})]},P.id))})]}),s.jsxs(ue,{variant:"outline",disabled:!p||!v.length||k,onClick:()=>D(async()=>{E(null),C(await c.previewSetup(e.id,p,v))}),children:[k&&s.jsx(zt,{}),"Check requirements"]})]}),S&&s.jsxs("div",{className:"space-y-3",children:[S.problems.map(P=>s.jsx("p",{className:"text-xs text-amber-700",children:P},P)),S.network.map((P,$)=>{var H;return s.jsxs("div",{className:"rounded-lg border p-3 text-xs",children:[s.jsxs("p",{className:"flex justify-between gap-2 font-medium",children:[s.jsxs("span",{children:[P.item," · ",P.host,":",P.port,P.path||""]}),s.jsx("span",{children:P.status==="allowed"?"Existing access":P.status==="policy"?"Allowed by setup policy":P.status==="blocked"?"Blocked":P.status==="proposed"?"Requested access":"Needs review"})]}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:P.reason}),((H=P.binaries)==null?void 0:H.length)>0&&s.jsx("p",{className:"mt-1 break-all font-mono text-muted-foreground",children:P.binaries.join(", ")}),P.credentialProvider&&s.jsxs("p",{children:["Credential binding: ",P.credentialProvider]})]},$)}),(L=S.inactive)==null?void 0:L.map(P=>s.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.name,": inactive · ",P.issues.join(" ")]},P.name)),S.notes.length>0&&s.jsx(j3,{children:S.notes.join(" ")}),!S.canEnable&&s.jsx("button",{type:"button",onClick:()=>{a(),window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"egress",location:u}}))},className:"inline-block text-xs underline underline-offset-4",children:"Review access in Network › Egress"}),s.jsxs("div",{className:"flex justify-end gap-2",children:[S.installed&&s.jsx(ue,{variant:"outline",disabled:k,onClick:()=>D(async()=>{E(await c.removeSetup(e.id,p,S.token)),C(null)}),children:"Remove from sandbox"}),s.jsxs(ue,{disabled:k||!S.canEnable,onClick:()=>D(async()=>{E(await c.enableSetup(e.id,p,S.token,S.requiresApproval)),C(null)}),children:[k&&s.jsx(zt,{}),S.requiresApproval?"Approve access & enable":S.installed?"Check & reapply":"Enable & check"]})]})]}),N&&s.jsx("p",{role:"status",className:"rounded-lg border bg-muted/30 p-3 text-xs",children:N.status==="removed"?"Removed from this sandbox. Restart the agent to unload it. The sandbox no longer gets this setup’s egress policy; access you approved for it separately stays.":"Prepared configuration installed. Restart the agent to load it. Connection checks below apply to this sandbox; they do not execute tools."}),(q=N==null?void 0:N.checks)==null?void 0:q.map((P,$)=>s.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.item,": ",P.status,P.toolCount!==void 0?` · ${P.toolCount} tools discovered`:"",P.reason?` · ${P.reason}`:""]},$)),((N==null?void 0:N.status)==="installed"||(S==null?void 0:S.installed)||T.some(P=>P.sandbox===p&&P.status==="installed"))&&p&&(h==null?void 0:h.name)&&(h==null?void 0:h.workspace)&&_.length>0&&s.jsxs("div",{className:"space-y-2 text-xs",children:[s.jsxs("p",{className:"font-medium",children:["Sign in to ",_.map(P=>P.name).join(", ")]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:v.map(P=>{var $,H;return s.jsxs("a",{className:"rounded-md border px-3 py-2 hover:bg-muted",href:Up(p,(($=Oy(P))==null?void 0:$.command)||P,h),target:"_blank",rel:"noreferrer",children:["Open ",(H=Oy(P))==null?void 0:H.name]},P)})}),v.includes("codex")&&_.filter(P=>{var $;return($=P.configuration)==null?void 0:$.endpoint}).map(P=>s.jsxs("a",{className:"block underline underline-offset-4",href:`${Up(p,"codex",h)}&setupLogin=${e.id}&mcp=${encodeURIComponent(P.id)}`,target:"_blank",rel:"noreferrer",children:["Sign in to ",P.name," with Codex"]},P.id)),s.jsxs("details",{className:"text-[11px] text-muted-foreground",children:[s.jsx("summary",{className:"cursor-pointer",children:"About sign-in"}),s.jsx("p",{className:"mt-2",children:"Use the agent’s MCP menu to authenticate and confirm tool availability. Sessions stay in this sandbox and are not baked into images. Console connection checks do not use these sessions."})]})]}),T.filter(P=>!p||P.sandbox===p).map((P,$)=>s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[P.sandbox,": ",P.status,P.error?` · ${P.error}`:""]},$))]})]}),s.jsx(sf,{children:R})]})})}function T3(e){const t=Cn();return s.jsx(eX,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}const bE=[];function eX({value:e=[],onChange:t,inherited:r=bE,accessReview:a,onAccessReview:l,automaticAccess:c=!1,autoPrepare:u=!1,preparationContext:f="sandbox",localCatalog:m,retained:h=bE}){const g=$t(),[p,b]=x.useState([]),[v,j]=x.useState(""),[S,C]=x.useState(null),N=!!l;x.useEffect(()=>{let D=!0;return g.setups().then(_=>{D&&b(_.filter(L=>!(m!=null&&m.available)||!L.localSource||m.setups.includes(L.id)||r.includes(L.id)||h.includes(L.id)))}).catch(_=>{D&&j(_.message)}),()=>{D=!1}},[g,m,r,h]),x.useEffect(()=>{if(!N)return;let D=!0;return g.org().then(_=>{D&&C(_.policies??null)}).catch(()=>{D&&C(null)}),()=>{D=!1}},[N,g]);const E=p.filter(D=>e.includes(D.id)||r.includes(D.id)),T=D=>u?Iq(D):!D.disabled&&!D.issues.length,A=D=>u?D.items.filter(PM):[],k=D=>D.items.filter(_=>!T(_)),M=$K(E,S,D=>D.items.filter(T),D=>u?_q(D):D.requirements),R=E.some(D=>D.items.some(_=>{var L;return T(_)&&!_.credentialRef&&((L=_.auth)==null?void 0:L.mode)==="agent-session"})),O=JSON.stringify(E.map(D=>[D.id,D.revision]));return x.useEffect(()=>{l==null||l(c?Object.fromEntries(JSON.parse(O)):null)},[O,c,l]),s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs font-medium",children:"MCPs & Skills"}),p.map(D=>s.jsxs("div",{className:"rounded-lg border p-2.5 text-xs",children:[s.jsxs("label",{className:"flex items-start gap-2",children:[s.jsx(Il,{"aria-label":`Use ${D.name}`,disabled:r.includes(D.id)||!D.items.some(T),checked:e.includes(D.id)||r.includes(D.id),onCheckedChange:_=>t(_?[...e,D.id]:e.filter(L=>L!==D.id))}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"block truncate",children:[D.name,r.includes(D.id)?" · From image template":""]}),s.jsxs("span",{className:"mt-1 block text-[11px] text-muted-foreground",children:[Xp(D,"mcp")," MCPs · ",Xp(D,"skill")," Skills",A(D).length?` · ${A(D).length} install automatically`:"",k(D).length?` · ${k(D).length} inactive`:""]})]})]}),k(D).length>0&&s.jsxs("details",{className:"mt-2 pl-6 text-[11px] text-muted-foreground",children:[s.jsx("summary",{className:"cursor-pointer",children:"Items that will stay inactive"}),s.jsxs("div",{className:"mt-2 space-y-2",children:[k(D).map(_=>s.jsxs("p",{children:[s.jsxs("span",{className:"font-medium text-foreground",children:[_.name,":"]})," ",_.issues.join(" ")]},_.id)),s.jsx("p",{children:"Resolve these items in MCPs & Skills."})]})]})]},D.id)),l&&M.uncovered.length>0&&s.jsxs("div",{className:"space-y-2 pt-1 text-xs",children:[s.jsx("p",{className:"font-medium",children:c?"Required access":"Network access"}),s.jsx("ul",{className:"divide-y text-[11px] text-muted-foreground",children:M.uncovered.map(D=>s.jsx("li",{className:"break-all py-1",children:D},D))}),!c&&s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"flex items-start gap-2",children:[s.jsx(Il,{checked:!!a,onCheckedChange:D=>l(D?Object.fromEntries(E.map(_=>[_.id,_.revision])):null)}),"Allow these destinations for tools and connection checks."]}),!a&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Otherwise, review access in MCPs & Skills before installation."})]})]}),l&&M.covered.length>0&&s.jsxs("div",{className:"space-y-2 pt-1 text-xs",children:[s.jsx("p",{className:"font-medium",children:E.length>1?"Allowed by the setups’ egress policies":"Allowed by the setup’s egress policy"}),s.jsx("ul",{className:"divide-y text-[11px] text-muted-foreground",children:M.covered.map(D=>s.jsx("li",{className:"break-all py-1",children:D},D))})]}),s.jsx(sf,{children:v}),R&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:f==="template"?"Sign in after launching the sandbox.":"Sign in inside the sandbox after installation."})]})}function tX(e){var r;const t={locations:[],sandboxes:[],templates:[]};for(const{target:a,inventory:l,cloud:c=a==="cloud"}of e){const u=new Map((l.locations??[]).map(f=>{const m={...f,target:a,cloud:c,id:JSON.stringify([a,f.context]),...c?{label:"Cloud"}:{}};return t.locations.push(m),[f.context,m]}));for(const f of["sandboxes","templates"])for(const m of l[f]??[]){const h=u.get((r=m.location)==null?void 0:r.context);h&&t[f].push({...m,location:h})}}return t}function Cu(){var h;const e=Tr(),t=!!(e!=null&&e.localViewer),r=t&&e.connected,a=`${t}:${r?(h=e.user)==null?void 0:h.uid:""}`,[l,c]=x.useState(null),[u,f]=x.useReducer(g=>g+1,0);x.useEffect(()=>{let g=!0,p;const b=new AbortController,v=Gr("local",b.signal);let j=null;const S=async()=>{var A,k;const C=await Promise.allSettled([v.inventory(),...r?[ru("inventory",void 0,{signal:b.signal})]:[]]);if(!g)return;const N=[],E=[];for(let M=0;M<C.length;M++){const R=M===0?"local":"cloud",O=M!==0||!t,D=C[M];if(D.status==="fulfilled")N.push({target:R,cloud:O,inventory:D.value}),(A=D.value.machine)!=null&&A.error&&E.push(D.value.machine.error);else{E.push(`${O?"Cloud":"Local"} inventory unavailable: ${D.reason.message}`);const _=(k=j==null?void 0:j.filter(L=>L.target===R)[0])==null?void 0:k.inventory;if(_){const L=_.locations.map(q=>({...q,connected:!1,error:D.reason.message}));N.push({target:R,cloud:O,inventory:{..._,locations:L}})}}}j=N;const T=tX(N);c({scope:a,inventory:T,error:E.join("; ")||null}),p=setTimeout(S,T.templates.some(M=>M.status==="building")?1200:5e3)};return S(),()=>{g=!1,b.abort(),clearTimeout(p)}},[a,u,t,r]);const m=(l==null?void 0:l.scope)===a?l:null;return{...(m==null?void 0:m.inventory)??{sandboxes:[],templates:[],locations:[]},error:(m==null?void 0:m.error)??null,loading:!m,refresh:f}}function nX(){let e=[];const t=new Set,r=new Map,a=()=>t.forEach(u=>u()),l=(u,f)=>{e=e.map(m=>m.id===u?{...m,...typeof f=="function"?f(m):f}:m),a()};function c(u){const f=e.find(p=>p.id===u),{task:m}=r.get(u),h=new AbortController;r.set(u,{task:m,controller:h}),l(u,{status:"preparing",message:"Preparing environment…",error:null,build:null});const g={signal:h.signal,progress:p=>l(u,{message:p}),build:p=>l(u,b=>{var v;return{build:{...p,logs:p.logs??((v=b.build)==null?void 0:v.logs)}}}),creating:()=>l(u,{status:"creating",message:"Creating sandbox…"})};m(g).then(p=>{if(h.signal.aborted)return l(u,{status:"cancelled",message:"Creation cancelled."});l(u,{status:"created",sandbox:{...p,location:p.location??f.location},message:""})}).catch(p=>{h.signal.aborted||p.name==="AbortError"?l(u,{status:"cancelled",message:"Creation cancelled."}):l(u,{status:"failed",error:p.message,message:""})})}return{subscribe:u=>(t.add(u),()=>t.delete(u)),getSnapshot:()=>e,start({name:u,location:f,task:m}){const h=crypto.randomUUID();return e=[...e,{id:h,name:u,location:f,status:"preparing"}],r.set(h,{task:m}),c(h),h},retry(u){r.has(u)&&c(u)},cancel(u){var m,h;const f=e.find(g=>g.id===u);(f==null?void 0:f.status)==="preparing"&&((h=(m=r.get(u))==null?void 0:m.controller)==null||h.abort(),l(u,{message:"Cancelling…"}))},update:l,dismiss(u){r.delete(u),e=e.filter(f=>f.id!==u),a()}}}const yo=nX(),Nl="gateway-box",E3=["error","stopped","completed","deleting"],yE=(e,t)=>JSON.stringify([e==null?void 0:e.context,t]),vE=e=>e.status==="created"&&e.phase!=="ready"&&!E3.includes(e.phase);function sX({jobs:e}){const{sandboxes:t,loading:r}=Cu();return x.useEffect(()=>{if(r)return;const a=new Map(t.map(l=>[yE(l.location,l.name),l]));for(const l of e){const c=a.get(yE(l.location,l.name));c?(c.phase!==l.phase||!l.reported)&&yo.update(l.id,{phase:c.phase,reported:!0,sandbox:c}):l.reported&&yo.dismiss(l.id)}},[t,r,e]),null}function wE(e){try{sessionStorage.setItem(Nl,JSON.stringify({name:e.name,location:e.location}))}catch{}window.dispatchEvent(new CustomEvent("openrod-navigate",{detail:{view:"sandboxes"}})),window.dispatchEvent(new Event(Nl))}function rX({job:e,onClose:t}){const r=x.useRef(null),a=x.useRef(!0),l=e.build;return x.useEffect(()=>{a.current&&r.current&&(r.current.scrollTop=r.current.scrollHeight)},[l==null?void 0:l.logs,e.message]),s.jsx(yn,{open:!0,onOpenChange:c=>{c||t()},children:s.jsxs(vn,{className:"flex h-[min(36rem,90svh)] flex-col gap-3 sm:max-w-2xl",children:[s.jsxs(Nn,{children:[s.jsxs(wn,{children:["Build logs · ",e.name]}),s.jsx(Hn,{children:(l==null?void 0:l.status)==="failed"?"Build failed":e.status==="failed"?"Creation failed":e.status==="cancelled"?"Creation cancelled":(l==null?void 0:l.status)==="ready"?"Build complete":e.message||"Preparing environment…"})]}),(l==null?void 0:l.name)&&s.jsx("p",{className:"truncate font-mono text-[11px] text-muted-foreground",children:l.name}),s.jsx("pre",{ref:r,tabIndex:0,"aria-label":"Build output",onScroll:c=>{const u=c.currentTarget;a.current=u.scrollHeight-u.scrollTop-u.clientHeight<40},className:"min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-all rounded-md border bg-muted/30 p-3 font-mono text-[10px] leading-relaxed",children:(l==null?void 0:l.logs)||((l==null?void 0:l.status)==="ready"?"Using a ready image template. No build was needed.":"Waiting for build output…")}),((l==null?void 0:l.error)||e.error)&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:(l==null?void 0:l.error)||e.error})]})})}function oX(){const e=x.useSyncExternalStore(yo.subscribe,yo.getSnapshot),[t,r]=x.useState(null),a=e.filter(c=>c.status==="created"),l=e.find(c=>c.id===t);return s.jsxs(s.Fragment,{children:[a.some(vE)&&s.jsx(sX,{jobs:a}),e.map(c=>{var p;const u=c.status==="created"&&c.phase==="ready",f=c.status==="created"&&E3.includes(c.phase),m=c.status==="preparing"||c.status==="creating"||vE(c),h=c.build&&s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>r(c.id),children:"Show build"}),g=c.status==="preparing"?{tone:"progress",title:`Preparing ${c.name}…`,body:c.message,actions:s.jsxs(s.Fragment,{children:[h,s.jsx(ue,{size:"xs",variant:"ghost",onClick:()=>yo.cancel(c.id),children:"Cancel"})]})}:c.status==="creating"?{tone:"progress",title:`Creating ${c.name}…`,body:c.message}:c.status==="failed"?{tone:"error",title:`Couldn’t create ${c.name}`,body:c.error,actions:s.jsxs(s.Fragment,{children:[h,s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>yo.retry(c.id),children:"Try again"})]})}:c.status==="cancelled"?{tone:"info",title:`${c.name} not created`,body:"Creation was cancelled."}:u?{tone:"success",title:`${c.name} is ready`,body:"Your sandbox is ready to use.",actions:s.jsxs(ue,{size:"xs",variant:"outline",disabled:((p=c.location)==null?void 0:p.connected)===!1,onClick:()=>wE(c),children:["Open sandbox",s.jsx(Ri,{className:"size-3"})]})}:f?{tone:"error",title:`${c.name} needs attention`,body:`Status: ${Kp[c.phase]}. Open the sandbox to inspect it.`,actions:s.jsxs(ue,{size:"xs",variant:"outline",onClick:()=>wE(c),children:["Open sandbox",s.jsx(Ri,{className:"size-3"})]})}:{tone:"progress",title:`Starting ${c.name}…`,body:"Your new sandbox is starting. You can keep browsing while it gets ready."};return s.jsx(Pi,{id:`sandbox-creation:${c.id}`,tone:g.tone,title:g.title,actions:s.jsxs(s.Fragment,{children:[s.jsx(So,{location:c.location}),g.actions]}),onDismiss:m?void 0:()=>yo.dismiss(c.id),dismissLabel:`Dismiss status for ${c.name}`,children:g.body},c.id)}),l&&s.jsx(rX,{job:l,onClose:()=>r(null)})]})}const R3=x.createContext(void 0);function aX(){return x.useContext(R3)}const iX=x.forwardRef(function(t,r){const{className:a,defaultPressed:l=!1,disabled:c=!1,form:u,onPressedChange:f,pressed:m,render:h,type:g,value:p,nativeButton:b=!0,style:v,...j}=t,S=ds(p||void 0),C=aX(),N=(C==null?void 0:C.value)??[],E=(c||(C==null?void 0:C.disabled))??!1,[T,A]=Xr({controlled:C?S!==void 0&&N.indexOf(S)>-1:m,default:l,name:"Toggle",state:"pressed"}),{getButtonProps:k,buttonRef:M}=ro({disabled:E,native:b}),R={disabled:E,pressed:T},O=[M,r],D=[{"aria-pressed":T,onClick(q){var H;const P=!T,$=bt(kr,q.nativeEvent);f==null||f(P,$),!$.isCanceled&&(S&&((H=C==null?void 0:C.setGroupValue)==null||H.call(C,S,P,$)),!$.isCanceled&&A(P))}},j,k],_=wt("button",t,{enabled:!C,state:R,ref:O,props:D}),L=x.useMemo(()=>({disabled:E,focusableWhenDisabled:!1}),[E]);return C?s.jsx(KM,{tag:"button",render:h,className:a,style:v,metadata:L,state:R,refs:O,props:D}):_}),lX=x.createContext(void 0);function cX(){return x.useContext(lX)}const uX=x.forwardRef(function(t,r){const{defaultValue:a,disabled:l=!1,loopFocus:c=!0,onValueChange:u,orientation:f="horizontal",multiple:m=!1,value:h,className:g,render:p,style:b,...v}=t,j=Bg(),S=cX(),C=a??Cr,N=h!==void 0||a!==void 0,E=((j==null?void 0:j.disabled)??!1)||((S==null?void 0:S.disabled)??!1)||l,[T,A]=Xr({controlled:h,default:C,name:"ToggleGroup",state:"value"}),k=et((_,L,q)=>{let P;m?(P=T.slice(),L?P.push(_):P.splice(T.indexOf(_),1)):P=L?[_]:[],u==null||u(P,q),!q.isCanceled&&A(P)}),M={disabled:E,multiple:m,orientation:f},R=x.useMemo(()=>({disabled:E,setGroupValue:k,value:T,isValueInitialized:N}),[E,k,T,N]),O={role:"group"},D=wt("div",t,{enabled:!!j,state:M,ref:r,props:[O,v]});return s.jsx(R3.Provider,{value:R,children:j?D:s.jsx(H5,{render:p,className:g,style:b,state:M,refs:[r],props:[O,v],loopFocus:c,enableHomeAndEndKeys:!0,orientation:f})})}),dX=ag("group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-muted"},size:{default:"h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2"}},defaultVariants:{variant:"default",size:"default"}}),A3=x.createContext({size:"default",variant:"default",spacing:2,orientation:"horizontal"});function fX({className:e,variant:t,size:r,spacing:a=2,orientation:l="horizontal",children:c,...u}){return s.jsx(uX,{"data-slot":"toggle-group","data-variant":t,"data-size":r,"data-spacing":a,"data-orientation":l,style:{"--gap":a},className:Le("group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",e),...u,children:s.jsx(A3.Provider,{value:{variant:t,size:r,spacing:a,orientation:l},children:c})})}function mX({className:e,children:t,variant:r="default",size:a="default",...l}){const c=x.useContext(A3);return s.jsx(iX,{"data-slot":"toggle-group-item","data-variant":c.variant||r,"data-size":c.size||a,"data-spacing":c.spacing,className:Le("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",dX({variant:c.variant||r,size:c.size||a}),e),...l,children:t})}const jE=[{value:"light",label:"Light mode",icon:x6},{value:"dark",label:"Dark mode",icon:BI},{value:"system",label:"Auto · Follow computer",icon:_I}];function hX(){const{theme:e="system",setTheme:t}=xR(),r=Bs(),a=Math.max(0,jE.findIndex(l=>l.value===e));return s.jsx(_f,{delay:200,children:s.jsxs(fX,{"aria-label":"Appearance",value:[e],onValueChange:l=>{l.length&&t(l[0])},spacing:1,className:"relative isolate mb-3 gap-1 rounded-xl border border-sidebar-border bg-background/70 p-1 shadow-[inset_0_1px_3px_#00000008]",children:[s.jsx(Rn.span,{"aria-hidden":"true",initial:!1,animate:{x:a*36},transition:r?{duration:0}:{type:"spring",stiffness:450,damping:32},className:"pointer-events-none absolute left-1 top-1 size-8 rounded-lg border border-border bg-card shadow-[0_2px_4px_#00000014,inset_0_1px_0_var(--button-highlight)]",children:s.jsx(e3,{duration:12,shineColor:["var(--border)","var(--frame-highlight)","var(--ink-faint)"]})}),jE.map(({value:l,label:c,icon:u})=>s.jsxs(Ma,{children:[s.jsx(Da,{render:s.jsx(mX,{value:l,"aria-label":c}),className:Le("relative z-10 size-8 min-w-8 rounded-lg p-0 text-muted-foreground hover:bg-transparent aria-pressed:bg-transparent data-[state=on]:bg-transparent motion-reduce:transition-none",e===l&&"text-foreground"),children:s.jsx(Rn.span,{"aria-hidden":"true",initial:!1,animate:{rotate:e===l&&l==="light"?45:e===l&&l==="dark"?-12:0,scale:e===l?1:.9},transition:{duration:r?0:.22},className:"flex items-center justify-center",children:s.jsx(u,{className:"size-3.5",strokeWidth:1.7})})}),s.jsx(za,{side:"top",children:c})]},l))]})})}const O3=x.createContext(void 0);function Lf(e){const t=x.useContext(O3);if(t===void 0&&!e)throw new Error(Jt(47));return t}const pX={...Og,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class gX extends bu{constructor(r,a,l){const c=new Sf;super(xX(r,c,a,l),bX(c),pX);tn(this,"setOpen",(r,a)=>{var p,b;const l=a.reason===Un,c=a.reason===Wo&&a.event.detail===0,u=!r&&(a.reason===yf||a.reason==null),f=T1(a),m=this.select("activeTriggerId");if(!r&&a.reason===TA&&a.trigger==null&&m!=null&&(a.trigger=this.context.triggerElements.getById(m)??this.select("activeTriggerElement")??void 0),(b=(p=this.context).onOpenChange)==null||b.call(p,r,a),a.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(r,a);const h=()=>{const v=kg(this.state,r,a.trigger,f());v.openChangeReason=a.reason,this.update(v)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(HA,()=>{this.set("stickIfOpen",!1)}),Kr.flushSync(h)):h();let g;c?g="click":u?g="dismiss":a.reason===Mi&&(g="focus"),this.set("instantType",g)})}}function xX(e,t,r,a=!1){const l={...Ag(t,r,a),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return l.open&&(e==null?void 0:e.mounted)===void 0&&(l.mounted=!0),l}function bX(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new Yr,triggerElements:e}}const SE=vf(function({props:t}){const{children:r,open:a,defaultOpen:l=!1,onOpenChange:c,onOpenChangeComplete:u,modal:f=!1,handle:m,triggerId:h,defaultTriggerId:g=null}=t,p=vX(m,{modal:f,open:l,openProp:a,activeTriggerId:g,triggerIdProp:h});p.useControlledProp("openProp",a),p.useControlledProp("triggerIdProp",h);const b=p.useState("open"),v=p.useState("mounted"),j=p.useState("payload");p.useContextCallback("onOpenChange",c),p.useContextCallback("onOpenChangeComplete",u),u5(p,b),Tg(p);const{forceUnmount:S}=Eg(b,p,()=>{p.update({stickIfOpen:!0,openChangeReason:null})});p.useSyncedValues({modal:f}),x.useEffect(()=>{b||p.context.stickIfOpenTimeout.clear()},[p,b]),x.useImperativeHandle(t.actionsRef,()=>({unmount:S,close:()=>p.setOpen(!1,bt(yg))}),[S,p]);const C=b||v;return s.jsxs(O3.Provider,{value:p,children:[m&&s.jsx(Cg,{handle:m,store:p}),C&&s.jsx(wX,{store:p,modal:f}),typeof r=="function"?r({payload:j}):r]})});function yX(e){return Lf(!0)?s.jsx(SE,{props:e}):s.jsx(JA,{children:s.jsx(SE,{props:e})})}function vX(e,t){const r=k1((a,l)=>new gX(t,a,l));return x.useEffect(()=>r.context.stickIfOpenTimeout.disposeEffect(),[r]),r}function wX({store:e,modal:t}){const r=e.useState("floatingRootContext"),a=wf(r,{outsidePressEvent:{mouse:t==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),l=a.reference,c=a.floating;return Rg(e,{activeTriggerProps:l,inactiveTriggerProps:l,popupProps:c}),null}const jX=300,SX=b1(function(t,r){const{render:a,className:l,style:c,disabled:u=!1,nativeButton:f=!0,handle:m,payload:h,openOnHover:g=!1,delay:p=jX,closeDelay:b=0,id:v,...j}=t,S=Lf(!0),N=A1(m)??S;if(!N)throw new Error(Jt(74));const E=ds(v),T=N.useState("isTriggerActive",E),A=N.useState("floatingRootContext"),k=N.useState("isOpenedByTrigger",E),M=N.useState("triggerPopupId",E),R=x.useRef(null),{registerTrigger:O,isMountedByThisTrigger:D}=E1(E,R,N,{payload:h,disabled:u,openOnHover:g,closeDelay:b}),_=N.useState("openChangeReason"),L=N.useState("stickIfOpen"),q=N.useState("openMethod"),P=N.useState("focusManagerModal"),$=z1(A,{enabled:!u&&g&&(q!=="touch"||_!==Wo),mouseOnly:!0,move:!1,handleClose:P1(),restMs:p,delay:{close:b},triggerElementRef:R,isActiveTrigger:T,isClosing:()=>N.select("transitionStatus")==="ending"}),H=S1(A,{stickIfOpen:L}),F=C5(()=>N.select("open"),te=>{N.set("openMethod",te)}),V=N.useState("triggerProps",D),{getButtonProps:G,buttonRef:X}=ro({disabled:u,native:f}),B={open(te){return te&&_===Wo?xp.open(te):l1.open(te)}},{preFocusGuardRef:Z,handlePreFocusGuardFocus:K,handleFocusTargetFocus:se}=WM(N,R),U=wt("button",t,{state:{disabled:u,open:k},ref:[X,r,O,R],props:[H.reference,$,V,F,{[FA]:"",id:E,"aria-haspopup":"dialog","aria-expanded":k,"aria-controls":M},j,G],stateAttributesMapping:B}),Q=s.jsx(x.Fragment,{children:U},E);return D&&!P?s.jsxs(x.Fragment,{children:[s.jsx(zi,{ref:Z,onFocus:K}),Q,s.jsx(zi,{ref:N.context.triggerFocusTargetRef,onFocus:se})]}):Q}),M3=x.createContext(void 0);function NX(){const e=x.useContext(M3);if(e===void 0)throw new Error(Jt(45));return e}const CX=x.forwardRef(function(t,r){const{keepMounted:a=!1,...l}=t;return Lf().useState("mounted")||a?s.jsx(M3.Provider,{value:a,children:s.jsx(jg,{ref:r,...l})}):null}),D3=x.createContext(void 0);function kX(){const e=x.useContext(D3);if(!e)throw new Error(Jt(46));return e}const TX=x.forwardRef(function(t,r){const{render:a,className:l,style:c,anchor:u,positionMethod:f,side:m,align:h,sideOffset:g,alignOffset:p,collisionBoundary:b="clipping-ancestors",collisionPadding:v,arrowPadding:j,sticky:S,disableAnchorTracking:C=!1,collisionAvoidance:N=y1,...E}=t,T=Lf(),A=NX(),k=w1(),M=T.useState("floatingRootContext"),R=T.useState("mounted"),O=T.useState("open"),D=T.useState("openChangeReason"),_=T.useState("activeTriggerElement"),L=T.useState("modal"),q=T.useState("openMethod"),P=T.useState("positionerElement"),$=T.useState("instantType"),H=T.useState("transitionStatus"),F=T.useState("adaptiveOrigin"),V=x.useRef(null),G=xf(P),X=Pg({anchor:u,floatingRootContext:M,positionMethod:f,mounted:R,side:m,sideOffset:g,align:h,alignOffset:p,arrowPadding:j,collisionBoundary:b,collisionPadding:v,sticky:S,disableAnchorTracking:C,keepMounted:A,nodeId:k,collisionAvoidance:N,adaptiveOrigin:F}),B=M.useState("domReferenceElement");Ke(()=>{const U=B,Q=V.current;if(U&&(V.current=U),Q&&U&&U!==Q){T.set("instantType",void 0);const te=new AbortController;return G(()=>{T.set("instantType","trigger-change")},te.signal),()=>{te.abort()}}},[B,G,T]);const Z=L===!0&&D!==Un;L1(O&&Z,q==="touch",P,_);const K=T.useStateSetter("positionerElement"),se={open:O,side:X.side,align:X.align,anchorHidden:X.anchorHidden,instant:$},I=_g(t,se,{styles:X.positionerStyles,transitionStatus:H,props:E,refs:[r,K],hidden:!R,inert:!O});return s.jsxs(D3.Provider,{value:X,children:[R&&Z&&s.jsx(Ig,{inert:Nf(!O),cutout:_}),s.jsx(ZA,{id:k,children:I})]})}),EX=x.createContext(void 0);function RX(){const[e,t]=x.useState(0),r=et(()=>(t(l=>l+1),()=>{t(l=>Math.max(0,l-1))}));return{context:x.useMemo(()=>({register:r}),[r]),hasClosePart:e>0}}const AX=x.forwardRef(function(t,r){const{render:a,className:l,style:c,initialFocus:u,finalFocus:f,...m}=t,h=Lf(),g=kX(),p=Bg()!=null,{context:b,hasClosePart:v}=RX(),j=h.useState("open"),S=h.useState("openMethod"),C=h.useState("instantType"),N=h.useState("transitionStatus"),E=h.useState("popupProps"),T=h.useState("titleElementId"),A=h.useState("descriptionElementId"),k=h.useState("modal"),M=h.useState("mounted"),R=h.useState("openChangeReason"),O=h.useState("activeTriggerElement"),D=h.useState("floatingRootContext"),_=D.useState("floatingId"),L=h.useState("disabled"),q=h.useState("openOnHover"),P=h.useState("closeDelay");lr({open:j,ref:h.context.popupRef,onComplete(){var X,B;j&&((B=(X=h.context).onOpenChangeComplete)==null||B.call(X,!0))}}),D1(D,{enabled:q&&!L,closeDelay:P});const $=u===void 0?c5(h.context.popupRef):u,H=k!==!1&&v;h.useSyncedValue("focusManagerModal",H);const F=h.useStateSetter("popupElement"),V={open:j,side:g.side,align:g.align,instant:C,transitionStatus:N},G=wt("div",t,{state:V,ref:[r,h.context.popupRef,F],props:[E,{id:_,role:"dialog",...jf,"aria-labelledby":T,"aria-describedby":A,onKeyDown(X){p&&Tf.has(X.key)&&X.stopPropagation()}},kf(N),m],stateAttributesMapping:mg});return s.jsx(Sg,{context:D,openInteractionType:S,modal:H,disabled:!M||R===Un,initialFocus:$,returnFocus:f,restoreFocus:"popup",previousFocusableElement:cn(O)?O:void 0,nextFocusableElement:h.context.triggerFocusTargetRef,beforeContentFocusGuardRef:h.context.beforeContentFocusGuardRef,children:s.jsx(EX.Provider,{value:b,children:G})})});function ip({...e}){return s.jsx(yX,{"data-slot":"popover",...e})}function lp({...e}){return s.jsx(SX,{"data-slot":"popover-trigger",...e})}function cp({className:e,align:t="center",alignOffset:r=0,side:a="bottom",sideOffset:l=4,...c}){return s.jsx(CX,{children:s.jsx(TX,{align:t,alignOffset:r,side:a,sideOffset:l,className:"isolate z-50",children:s.jsx(AX,{"data-slot":"popover-content",className:fs("z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...c})})})}function z3(e){return wt(e.defaultTagName??"div",e,e)}const gy=768;function OX(){const[e,t]=x.useState(void 0);return x.useEffect(()=>{const r=window.matchMedia(`(max-width: ${gy-1}px)`),a=()=>{t(window.innerWidth<gy)};return r.addEventListener("change",a),t(window.innerWidth<gy),()=>r.removeEventListener("change",a)},[]),!!e}const MX="sidebar_state",DX=3600*24*7,zX="16rem",PX="18rem",IX="3rem",_X="b",P3=x.createContext(null);function Hw(){const e=x.useContext(P3);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function LX({defaultOpen:e=!0,open:t,onOpenChange:r,className:a,style:l,children:c,...u}){const f=OX(),[m,h]=x.useState(!1),[g,p]=x.useState(e),b=t??g,v=x.useCallback(N=>{const E=typeof N=="function"?N(b):N;r?r(E):p(E),document.cookie=`${MX}=${E}; path=/; max-age=${DX}`},[r,b]),j=x.useCallback(()=>f?h(N=>!N):v(N=>!N),[f,v,h]);x.useEffect(()=>{const N=E=>{E.key===_X&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),j())};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[j]);const S=b?"expanded":"collapsed",C=x.useMemo(()=>({state:S,open:b,setOpen:v,isMobile:f,openMobile:m,setOpenMobile:h,toggleSidebar:j}),[S,b,v,f,m,h,j]);return s.jsx(P3.Provider,{value:C,children:s.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":zX,"--sidebar-width-icon":IX,...l},className:Le("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",a),...u,children:c})})}function BX({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:a,children:l,dir:c,...u}){const{isMobile:f,state:m,openMobile:h,setOpenMobile:g}=Hw();return r==="none"?s.jsx("div",{"data-slot":"sidebar",className:Le("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",a),...u,children:l}):f?s.jsx(Ul,{open:h,onOpenChange:g,...u,children:s.jsxs(cu,{dir:c,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":PX},side:e,children:[s.jsxs(uu,{className:"sr-only",children:[s.jsx(du,{children:"Sidebar"}),s.jsx(fu,{children:"Displays the mobile sidebar."})]}),s.jsx("div",{className:"flex h-full w-full flex-col",children:l})]})}):s.jsxs("div",{className:"group peer hidden text-sidebar-foreground md:block","data-state":m,"data-collapsible":m==="collapsed"?r:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[s.jsx("div",{"data-slot":"sidebar-gap",className:Le("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),s.jsx("div",{"data-slot":"sidebar-container","data-side":e,className:Le("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...u,children:s.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border",children:l})})]})}function $X({className:e,onClick:t,...r}){const{toggleSidebar:a}=Hw();return s.jsxs(ue,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:Le(e),onClick:l=>{t==null||t(l),a()},...r,children:[s.jsx(FI,{}),s.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function VX({className:e,...t}){return s.jsx("main",{"data-slot":"sidebar-inset",className:Le("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function UX({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:Le("flex flex-col gap-2 p-2",e),...t})}function HX({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:Le("flex flex-col gap-2 p-2",e),...t})}function FX({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:Le("no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function NE({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:Le("relative flex w-full min-w-0 flex-col p-2",e),...t})}function CE({className:e,render:t,...r}){return z3({defaultTagName:"div",props:Xs({className:Le("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",e)},r),render:t,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function kE({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:Le("w-full text-sm",e),...t})}function TE({className:e,...t}){return s.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:Le("flex w-full min-w-0 flex-col gap-0",e),...t})}function EE({className:e,...t}){return s.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:Le("group/menu-item relative",e),...t})}const GX=ag("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function RE({render:e,isActive:t=!1,variant:r="default",size:a="default",tooltip:l,className:c,...u}){const{isMobile:f,state:m}=Hw(),h=z3({defaultTagName:"button",props:Xs({className:Le(GX({variant:r,size:a}),c)},u),render:l?s.jsx(Da,{render:e}):e,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:t}});return l?(typeof l=="string"&&(l={children:l}),s.jsxs(Ma,{children:[h,s.jsx(za,{side:"right",align:"center",hidden:m!=="collapsed"||f,...l})]})):h}const qX=[{label:"Sandboxes",icon:ql,view:"sandboxes"},{label:"Templates",icon:AI,view:"templates"},{label:"MCPs & Skills",icon:Gv,view:"setups"},{label:"Activity",icon:AP,view:"activity"},{label:"Connections",icon:GP,view:"connections"}],YX=[{label:"Groups",icon:Ta,view:"groups"},{label:"Network",icon:tg,view:"egress",also:["ingress"]},{label:"Secrets",icon:hu,view:"secrets"}],AE={live:{label:"Live",dot:"bg-emerald-500"},connecting:{label:"Connecting",dot:"bg-amber-400"},reconnecting:{label:"Reconnecting",dot:"bg-amber-400"},"gateway-down":{label:"Unreachable",dot:"bg-red-500"},"setup-required":{label:"Not connected",dot:"bg-muted-foreground"}};function KX({view:e,onNavigate:t}){const{connection:r,overview:a}=Ua(),l=AE[r]??AE.connecting,c=a==null?void 0:a.gateway;return s.jsxs(BX,{collapsible:"offcanvas",className:"border-r border-sidebar-border",children:[s.jsx(UX,{className:"h-14 shrink-0 justify-center px-6 py-0",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"sidebar-icon-hover inline-flex shrink-0",children:s.jsx("img",{src:"/openrod.png",alt:"","aria-hidden":"true",className:"sidebar-icon size-9 object-contain"})}),s.jsxs("span",{className:"flex flex-col leading-none",children:[s.jsx("span",{className:"sidebar-wordmark text-lg font-normal tracking-tight whitespace-nowrap",children:"OpenRod"}),s.jsx("span",{className:"mt-0.5 text-[10px] whitespace-nowrap text-muted-foreground",children:"for OpenShell"})]})]})}),s.jsxs(FX,{className:"px-3 pt-4",children:[s.jsxs(NE,{className:"p-0",children:[s.jsx(CE,{className:"px-3 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Environment"}),s.jsx(kE,{children:s.jsx(TE,{children:qX.map(({label:u,icon:f,view:m})=>s.jsx(EE,{children:s.jsxs(RE,{isActive:e===m,onClick:()=>t(m),children:[s.jsx(f,{}),u]})},m))})})]}),s.jsxs(NE,{className:"p-0 pt-4",children:[s.jsx(CE,{className:"px-3 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Security"}),s.jsx(kE,{children:s.jsx(TE,{children:YX.map(({label:u,icon:f,view:m,also:h=[]})=>s.jsx(EE,{children:s.jsxs(RE,{isActive:e===m||h.includes(e),onClick:()=>t(h.includes(e)?e:m),children:[s.jsx(f,{}),u]})},m))})})]})]}),s.jsxs(HX,{className:"border-t border-sidebar-border p-4",children:[s.jsx(hX,{}),s.jsxs(ip,{children:[s.jsxs(lp,{className:"flex w-full items-center gap-2 rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring","aria-label":"Gateway details",children:[s.jsxs("span",{className:"relative flex size-1.5 shrink-0","aria-hidden":"true",children:[r==="live"&&s.jsx("span",{className:"absolute inline-flex size-full rounded-full bg-emerald-400/55 motion-safe:animate-ping"}),s.jsx("span",{className:`relative inline-flex size-1.5 rounded-full ${l.dot}`})]}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-xs font-medium",children:(c==null?void 0:c.name)??"Gateway"}),s.jsxs("span",{className:"block truncate font-mono text-[10px] text-muted-foreground",children:[l.label,c!=null&&c.version?` · v${c.version}`:""]})]})]}),s.jsxs(cp,{side:"top",align:"start",sideOffset:10,className:"w-64 gap-3 p-4",children:[s.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-medium",children:[s.jsx("span",{className:`size-1.5 rounded-full ${(c==null?void 0:c.status)==="healthy"?"bg-emerald-500":"bg-red-500"}`,"aria-hidden":"true"}),c?c.status==="healthy"?"Healthy":c.status:r==="setup-required"?"No connection selected":a!=null&&a.error?"Unreachable":"Reading…"]}),c?s.jsx("dl",{className:"grid gap-2.5",children:[["Endpoint",c.endpoint,!0],["Authentication",c.authMode==="mtls"?"mTLS":c.authMode],["Runtime",c.drivers.map(u=>`${u.driver}${u.version?` ${u.version}`:""}`).join(", ")||"-",!0],["Registration",c.remote?"Remote":"Local / tunnel endpoint"]].map(([u,f,m])=>s.jsxs("div",{children:[s.jsx("dt",{className:"text-[10px] text-muted-foreground",children:u}),s.jsx("dd",{className:`break-all ${m?"font-mono text-[11px]":"text-xs"}`,children:f})]},u))}):a!=null&&a.error?s.jsx("p",{className:"font-mono text-[10px] text-muted-foreground",children:a.error}):null,s.jsx(XX,{})]})]})]})]})}function XX(){const[e,t]=x.useState(null),[r,a]=x.useState(!1),[l,c]=x.useState(null);if(x.useEffect(()=>{let f=!0;return is.connections().then(m=>{f&&t(m.active)}).catch(()=>{}),()=>{f=!1}},[]),!e||e.status!=="connected")return null;async function u(){a(!0),c(null);try{await is.disconnectRemote(),t(null)}catch(f){c(f.message)}finally{a(!1)}}return s.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(df,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-xs font-medium",children:e.host}),s.jsx("span",{className:"block text-[10px] text-muted-foreground",children:"SSH machine · connected"})]}),s.jsx(ue,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:r,onClick:u,children:r?"Disconnecting…":"Disconnect"})]}),l&&s.jsx("p",{role:"alert",className:"text-[10px] text-destructive",children:l})]})}const Fl={local:{id:"local",label:"Local",hint:"Runs on this computer"},remote:{id:"remote",label:"Remote",hint:"Runs on an SSH host"},cloud:{id:"cloud",label:"Cloud",hint:"Runs on a cloud machine"}},up=e=>{var t;return((t=Fl[e==null?void 0:e.placement])==null?void 0:t.id)??(e!=null&&e.remote?"remote":"local")},xy=({x:e,y:t})=>s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:e-1.6,cy:t,r:".7",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:e+1.6,cy:t,r:".7",fill:"currentColor",stroke:"none"}),s.jsx("path",{d:`M${e-1.1} ${t+1.5}q1.1 1 2.2 0`})]}),WX={local:()=>s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"2.5",y:"2.5",width:"11",height:"8",rx:"1.8"}),s.jsx("path",{d:"M1 13.5h14"}),s.jsx(xy,{x:8,y:6})]}),remote:()=>s.jsxs(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"5",width:"10",height:"9",rx:"2"}),s.jsx("path",{d:"M5.8 3a3.2 3.2 0 0 1 4.4 0"}),s.jsx("circle",{cx:"8",cy:"1.6",r:".55",fill:"currentColor",stroke:"none",className:"motion-safe:animate-pulse"}),s.jsx(xy,{x:8,y:8.8})]}),cloud:()=>s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4.5 13.5a3 3 0 0 1-.4-6 4 4 0 0 1 7.7-.7 3.4 3.4 0 0 1-.1 6.7z"}),s.jsx("path",{d:"M13.6 1.2v2M12.6 2.2h2",className:"motion-safe:animate-pulse"}),s.jsx(xy,{x:7.6,y:9.6})]})},QX={local:"bg-indigo-50 text-indigo-700 ring-indigo-200 dark:bg-indigo-500/15 dark:text-indigo-300 dark:ring-indigo-400/30",remote:"bg-fuchsia-50 text-fuchsia-700 ring-fuchsia-200 dark:bg-fuchsia-500/15 dark:text-fuchsia-300 dark:ring-fuchsia-400/30",cloud:"bg-sky-50 text-sky-700 ring-sky-200 dark:bg-sky-500/15 dark:text-sky-300 dark:ring-sky-400/30"};function ZX({type:e,className:t="size-3.5"}){const r=WX[e];return s.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:`shrink-0 overflow-visible transition-transform duration-200 motion-safe:group-hover:-translate-y-px motion-safe:group-hover:-rotate-6 ${t}`,children:s.jsx(r,{})})}function I3({type:e,title:t}){return s.jsxs("span",{title:t,className:`inline-flex shrink-0 items-center gap-1 rounded-full py-0.5 pr-2 pl-1.5 text-[11px] font-medium ring-1 ring-inset ${QX[e]}`,children:[s.jsx(ZX,{type:e}),Fl[e].label]})}function _3({location:e}){const t=up(e);return s.jsx(I3,{type:t,title:`${Fl[t].hint} · ${_s(e)}`})}const JX=864e5;function eW(e,t,r){const a=e.map(f=>Date.parse(f.createdAt)).filter(Number.isFinite).sort((f,m)=>f-m),l=e.length-a.length,c=[];let u=0;for(let f=t-1;f>=0;f--){const m=r-f*JX;for(;u<a.length&&a[u]<=m;)u++;c.push({at:m,count:u+l})}return c}const tW=e=>new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"});function nW({points:e,height:t=34,title:r}){const a=x.useRef(null),l=x.useId(),c=Bs(),[u,f]=x.useState(280),[m,h]=x.useState(null);x.useLayoutEffect(()=>{const A=a.current;if(!A)return;const k=()=>f(A.clientWidth);k();const M=new ResizeObserver(k);return M.observe(A),()=>M.disconnect()},[]);const g=Math.max(4,Math.round(t*.18)),p=e.map(A=>A.count),b=Math.max(1,...p),v=A=>(e.length<2?u-12:A/(e.length-1)*(u-12))+6,j=A=>t-g-A/b*(t-g*2),S=LM(p.map((A,k)=>[v(k),j(A)])),C=`${S} L${v(e.length-1).toFixed(2)} ${t} L${v(0).toFixed(2)} ${t} Z`,N=m===null?null:e[m],E=p[0]??0,T=p[p.length-1]??0;return s.jsxs("div",{className:"relative w-full",onMouseLeave:()=>h(null),onMouseMove:A=>{const k=A.currentTarget.getBoundingClientRect(),M=(A.clientX-k.left)/Math.max(1,k.width);h(Math.min(e.length-1,Math.max(0,Math.round(M*(e.length-1)))))},children:[s.jsx("h2",{className:"min-w-0 truncate text-[10px] font-bold tracking-widest text-faint uppercase",children:N?s.jsxs("span",{className:"font-mono normal-case tracking-normal text-muted-foreground",children:[tW(N.at)," · ",N.count.toLocaleString("en-US")," ",N.count===1?"box":"boxes"]}):r}),s.jsx("div",{ref:a,className:"w-full",children:s.jsxs("svg",{width:u,height:t,role:"img","aria-label":`${E} boxes ${e.length} days ago, ${T} now`,children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:l,x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"0%",stopColor:"var(--ink)",stopOpacity:"0.1"}),s.jsx("stop",{offset:"100%",stopColor:"var(--ink)",stopOpacity:"0"})]})}),s.jsx("path",{d:C,fill:`url(#${l})`}),s.jsx(Rn.path,{d:S,fill:"none",stroke:"var(--ink)",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.72",initial:c?!1:{pathLength:0},animate:{pathLength:1},transition:{duration:.9,ease:"easeOut"}}),N&&s.jsxs("g",{children:[s.jsx("line",{x1:v(m),x2:v(m),y1:"0",y2:t,stroke:"var(--ink)",strokeWidth:"1",strokeDasharray:"2 3",opacity:"0.25"}),s.jsx("circle",{cx:v(m),cy:j(p[m]),r:"3",fill:"var(--surface)",stroke:"var(--ink)",strokeWidth:"1.5"})]})]})})]})}const sW=e=>e?new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"",rW={policy_dns_ineligible:"no rule allows this host",transparent_tcp_policy_denied:"no rule allows this connection"},oW=e=>e?rW[e]??e:null;function aW({event:e,dense:t=!1,showSandbox:r=!1}){var l;const a=e.verdict==="denied";return s.jsxs("div",{className:`flex items-center gap-3 border-b border-border/50 px-3 font-mono text-[11px] last:border-b-0 ${t?"h-[26px]":"h-[30px] px-4"} ${a?"bg-red-50/40":""}`,title:e.message,children:[s.jsx("span",{className:"w-[4.5rem] shrink-0 tabular-nums text-muted-foreground",children:sW(e.at)}),s.jsx("span",{className:`w-12 shrink-0 text-[10px] font-medium tracking-wide uppercase ${a?"text-red-600":"text-emerald-700"}`,children:a?"Denied":"Allowed"}),r&&s.jsx("span",{className:"hidden w-24 shrink-0 truncate text-muted-foreground md:block",children:e.sandbox}),!t&&s.jsx("span",{className:"hidden w-20 shrink-0 truncate text-muted-foreground lg:block",children:e.binary?e.binary.split("/").pop():e.category==="HTTP"?e.method:"-"}),s.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[e.method&&t?`${e.method} `:"",e.destination??e.detail]}),!t&&s.jsx("span",{className:"hidden w-56 shrink-0 truncate text-right text-[10px] text-muted-foreground xl:block",children:a?oW(e.reason):(l=e.policy)==null?void 0:l.replace(/^_provider_/,"provider · ")})]})}function rf({command:e,label:t}){const[r,a]=x.useState(!1);return s.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md border border-border bg-muted/40 py-1.5 pr-1.5 pl-3",children:[s.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[11px]",title:t?void 0:e,children:t??e}),s.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Copy command",onClick:async()=>{await navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),1500)},children:r?s.jsx(Fn,{className:"size-3.5 text-emerald-600"}):s.jsx(cf,{className:"size-3.5"})})]})}function L3(e=[],t){const r=Rw(t);return e.filter(a=>!a.appliesTo.everyone&&a.appliesTo.groups.some(l=>r.includes(l)))}function Fw(){const[e,t]=x.useState(null),[r,a]=x.useState(""),l=x.useRef(null),c=x.useRef(!0),u=x.useCallback((g,p,b=!0)=>{const v=l.current;v&&(l.current=null,v.cleanup(),b&&t(null),p?v.reject(p):v.resolve(g))},[]),f=x.useCallback(()=>u(void 0,new DOMException("Workspace transfer cancelled.","AbortError")),[u]);x.useEffect(()=>(c.current=!0,()=>{c.current=!1,u(void 0,new DOMException("Workspace transfer cancelled.","AbortError"),!1)}),[u]);const m=x.useCallback(async(g,p,b)=>{b==null||b.throwIfAborted();const v=await g.org();if(!c.current)throw new DOMException("Workspace transfer cancelled.","AbortError");b==null||b.throwIfAborted();const j=(v.groups??[]).filter(S=>L3(v.policies??[],[S.id]).length>0);if(!j.length)throw new Error(`Add a group with a network rule in ${p} before copying this workspace.`);if(j.length!==1){if(l.current)throw new Error("Finish the current workspace transfer first.");return a(""),t({groups:j,label:p}),new Promise((S,C)=>{const N=()=>u(void 0,new DOMException("Workspace transfer cancelled.","AbortError"));l.current={resolve:S,reject:C,cleanup:()=>b==null?void 0:b.removeEventListener("abort",N)},b==null||b.addEventListener("abort",N,{once:!0}),b!=null&&b.aborted&&N()})}},[u]),h=s.jsx(yn,{open:!!e,onOpenChange:g=>{g||f()},children:s.jsxs(vn,{className:"sm:max-w-md",children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:"Choose a destination group"}),s.jsxs(Hn,{children:["The copied sandbox inherits this group’s network rules in ",e==null?void 0:e.label,"."]})]}),s.jsxs(hn,{"aria-label":"Destination sandbox group",value:r,onChange:g=>a(g.target.value),className:"h-9 rounded-md border bg-background px-2 text-sm",children:[s.jsx("option",{value:"",children:"Choose a group"}),e==null?void 0:e.groups.map(g=>s.jsx("option",{value:g.id,children:g.name},g.id))]}),s.jsxs(No,{children:[s.jsx(ue,{variant:"ghost",onClick:f,children:"Cancel"}),s.jsx(ue,{disabled:!(e!=null&&e.groups.some(g=>g.id===r)),onClick:()=>u([r]),children:"Copy workspace"})]})]})});return{chooseGroups:m,dialog:h,cancel:f}}const Qp="http://127.0.0.1:4600",iW=e=>`${Qp}/?handoff=cloud&target=local#cloud-return=${encodeURIComponent(e)}`;function OE(e,t,r,a){var l;return!!(t&&e.source===t&&e.origin===Qp&&((l=e.data)==null?void 0:l.type)===a&&e.data.nonce===r)}function lW({children:e,className:t,variant:r="outline",size:a="sm"}){return s.jsx(_f,{delay:200,children:s.jsxs(Ma,{children:[s.jsxs(Da,{render:s.jsx(ue,{type:"button",variant:r,size:a,disabled:!0,focusableWhenDisabled:!0,className:Le("cursor-not-allowed opacity-50",t)}),children:[e,s.jsxs("span",{className:"sr-only",children:[" ",Rl]})]}),s.jsx(za,{side:"bottom",className:"max-w-60",children:Rl})]})})}function cW({name:e,sandbox:t}){const r=$t(),a=Tr(),l=Cn(),{locations:c,refresh:u}=Cu(),{chooseGroups:f,dialog:m}=Fw(),h=x.useRef(null);x.useEffect(()=>()=>{var j;return(j=h.current)==null?void 0:j.abort()},[]);const[g,p]=x.useState(null),b=x.useRef(null);if(x.useEffect(()=>{let j=!0;const S=async N=>{const E=b.current;if(E){if(OE(N,E.popup,E.nonce,"openrod-local-result")&&E.accepted){if(j){if(typeof N.data.error=="string")qe.error("Couldn’t continue locally",{description:N.data.error});else if(typeof N.data.name=="string")qe.success("Workspace ready locally",{description:N.data.warning||E.warning||"Reconnect your agent credentials locally to continue."});else return;p(null)}b.current=null;return}if(!(E.accepted||!OE(N,E.popup,E.nonce,"openrod-local-ready"))){E.accepted=!0,p("transfer");try{const T=await r.cloudExport(E.name);E.warning=T.warning,E.popup.postMessage({type:"openrod-local-bundle",nonce:E.nonce,bundle:T.bundle,warning:T.warning},Qp)}catch(T){E.popup.postMessage({type:"openrod-local-bundle",nonce:E.nonce,error:T.message},Qp),b.current===E&&(b.current=null),j&&(p(null),qe.error("Couldn’t continue locally",{description:T.message}))}}}};window.addEventListener("message",S);const C=setInterval(()=>{const N=b.current;N&&(N.popup.closed||Date.now()>N.expires)&&(b.current=null,p(null),N.popup.closed||qe.error("Local transfer timed out. Try again."))},1e3);return()=>{j=!1,window.removeEventListener("message",S),clearInterval(C),b.current=null}},[e,r]),(t==null?void 0:t.phase)!=="ready")return null;async function v(){if(g||(l==null?void 0:l.connected)===!1)return;const j=c.find(N=>N.target!=="cloud"&&!N.remote&&N.connected);if(!j){qe.error("Connect a local gateway before importing this workspace.");return}const S=new AbortController;h.current=S;const C=r.signal?AbortSignal.any([r.signal,S.signal]):S.signal;p("transfer");try{const N=Gr("local",C,j.context);p("groups");const E=await f(N,"local OpenRod",C);p("transfer");const T=await xP(Gr(r.target,C,l==null?void 0:l.context),N,e,E);C.throwIfAborted(),qe.success("Workspace running locally",{description:T.warning||"Your cloud source is unchanged. Reconnect agent credentials locally."});try{sessionStorage.setItem("gateway-box",JSON.stringify({name:T.name,context:j.context,target:"local"}))}catch{}u(),a.selectTarget("local"),window.dispatchEvent(new CustomEvent("openrod-sandbox-handoff",{detail:{name:T.name,context:j.context,target:"local"}}))}catch(N){N.name!=="AbortError"&&qe.error("Couldn’t import locally",{description:N.message})}finally{S.signal.aborted||p(null),h.current===S&&(h.current=null)}}return a!=null&&a.localViewer&&!Ho?s.jsxs(lW,{className:"w-full justify-start text-xs",children:[s.jsx(mp,{className:"size-3.5","aria-hidden":"true"}),"Import and run locally"]}):s.jsxs("div",{className:"flex items-center gap-1",children:[m,s.jsxs(ue,{variant:"outline",size:"sm",className:"flex-1 justify-start text-xs",disabled:!!g||(l==null?void 0:l.connected)===!1,onClick:()=>{if(a!=null&&a.localViewer){v();return}const j=crypto.randomUUID(),S=window.open(iW(j),"_blank");if(!S){qe.error("Allow popups to continue locally.");return}b.current={popup:S,nonce:j,name:e,accepted:!1,expires:Date.now()+40*6e4},p("connect")},children:[g?s.jsx(zt,{className:"size-3.5"}):s.jsx(mp,{className:"size-3.5","aria-hidden":"true"}),g==="connect"?"Connecting to local OpenRod…":g==="groups"?"Choose destination group…":g==="transfer"?"Copying and rebuilding…":"Import and run locally"]}),s.jsx(_f,{delay:200,children:s.jsxs(Ma,{children:[s.jsx(Da,{render:s.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"What this does",className:"text-muted-foreground"}),children:s.jsx(uf,{className:"size-3.5","aria-hidden":"true"})}),s.jsxs(za,{side:"bottom",className:"max-w-60",children:[a!=null&&a.localViewer?"Creates a separate local sandbox, copies files and rebuilds the image for this computer. Your cloud source stays available.":"Open OpenRod on this computer first. Creates a local sandbox, copies files and rebuilds saved templates."," Reconnect agents locally."]})]})})]})}const ya="/sandbox",ME=1024**3;function rr(e){if(e==null||!Number.isFinite(e))return"-";if(e<1024)return`${e} B`;const t=["KB","MB","GB","TB"];let r=e/1024,a=0;for(;r>=1024&&a<t.length-1;)r/=1024,a++;return`${r>=10?Math.round(r):r.toFixed(1)} ${t[a]}`}function mu(e){return/^[\w@%+=:,./~-]+$/.test(e)?e:`'${e.replaceAll("'","'\\''")}'`}const B3=e=>e.startsWith("~/")?`~/${mu(e.slice(2))}`:mu(e),Lv=(e,t,r=ya)=>`openshell sandbox upload ${mu(e)} ${B3(t)} ${mu(r)}`,uW=(e,t,r=".")=>`openshell sandbox download ${mu(e)} ${mu(t)} ${B3(r)}`,dp=new Set(["waiting","uploading","cloning"]),dW=(e,t)=>e==="/"?`/${t}`:`${e}/${t}`,Eh=e=>e.type==="dir"||e.targetType==="dir";function fW(e){const t=[...e.items??[]].map(r=>{var a;return(a=r.webkitGetAsEntry)==null?void 0:a.call(r)}).filter(Boolean);return t.length?t:[...e.files]}async function mW(e){const t=[];async function r(a,l){if(a instanceof window.File){t.push({path:a.name,file:a});return}if(a.isFile)t.push({path:l+a.name,file:await new Promise((c,u)=>a.file(c,u))});else if(a.isDirectory){const c=a.createReader();for(;;){const u=await new Promise((f,m)=>c.readEntries(f,m));if(!u.length)break;for(const f of u)await r(f,`${l}${a.name}/`)}}}for(const a of e)await r(a,"");return t}function hW({seed:e,onRetry:t}){if(!e)return null;const r=e.kind==="folder"?"Uploading":"Cloning";return dp.has(e.state)?s.jsxs("p",{className:"flex items-center gap-2 border-b border-border bg-muted/30 px-5 py-2 text-xs",children:[s.jsx(zt,{"aria-hidden":"true"}),e.state==="waiting"?"Waiting for the sandbox to start, then "+r.toLowerCase():r,s.jsx("span",{className:"min-w-0 truncate font-mono text-[11px]",children:e.source}),"→",s.jsx("span",{className:"font-mono text-[11px]",children:e.dest})]}):e.state==="failed"?s.jsxs("div",{role:"alert",className:"flex items-start gap-3 border-b border-red-200 bg-red-50/60 px-5 py-2.5 text-xs text-red-700",children:[s.jsx(_a,{className:"mt-0.5 size-3.5 shrink-0","aria-hidden":"true"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"font-medium",children:[e.kind==="folder"?"Upload":"Clone"," of ",s.jsx("span",{className:"font-mono text-[11px]",children:e.source})," failed"]}),s.jsx("p",{className:"mt-0.5 text-[11px]",children:e.error})]}),s.jsx(ue,{variant:"outline",size:"sm",onClick:t,className:"shrink-0",children:"Retry"})]}):s.jsxs("p",{className:"flex items-center gap-2 border-b border-border px-5 py-2 text-[11px] text-muted-foreground",children:[s.jsx(yI,{className:"size-3.5 shrink-0","aria-hidden":"true"}),"Started from ",s.jsx("span",{className:"min-w-0 truncate font-mono",children:e.source}),e.files!=null&&s.jsxs("span",{children:["· ",e.files.toLocaleString()," files, ",rr(e.bytes)]}),s.jsxs("span",{children:["→ ",s.jsx("span",{className:"font-mono",children:e.dest})]})]})}function pW(e){const t=Cn();return s.jsx(gW,{...e},`${(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default"}:${e.sandbox.name}`)}function gW({sandbox:e,demo:t}){const r=$t(),a=Cn(),l=e.name,c=e.phase==="ready",u=XG(e),[f,m]=x.useState(u?`${ya}/${u}`:ya),[h,g]=x.useState(null),[p,b]=x.useState(null),[v,j]=x.useState(!1),[S,C]=x.useState(null),[N,E]=x.useState(!1),[T,A]=x.useState(null),[k,M]=x.useState(null),[R,O]=x.useState(null),D=x.useRef(null),_=x.useCallback(async B=>{j(!0);try{const Z=await r.files(l,B);g(Z),b(null),Z.path!==B&&m(Z.path)}catch(Z){if(B!==ya&&/does not exist/.test(Z.message)){m(ya);return}b(Z.message)}finally{j(!1)}},[l,r]);x.useEffect(()=>{c&&!t&&_(f)},[f,c,t,_]);const L=S==null?void 0:S.state;x.useEffect(()=>{if(t)return;let B=!1,Z;const K=async()=>{try{const se=await r.seed(l);if(B)return;C(se),se&&dp.has(se.state)&&(Z=setTimeout(K,2e3))}catch{}};return(!S||dp.has(L))&&K(),()=>{B=!0,clearTimeout(Z)}},[l,t,L,r]);const q=x.useRef(null);x.useEffect(()=>{if(dp.has(q.current)&&L==="done"&&c){const B=u?`${ya}/${u}`:f;B!==f?m(B):_(f)}q.current=L},[L]);async function P(){try{C(await r.retrySeed(l))}catch(B){qe.error(B.message)}}async function $(B,Z){O(B);const K=qe.loading(`Preparing ${Z}…`);try{const{token:se,filename:I,bytes:U}=await r.prepareDownload(l,B),Q=document.createElement("a");Q.href=r.url(`/downloads/${se}`,{context:await r.contextKey(),...a?{location:"1"}:{}}),Q.download=I,document.body.append(Q),Q.click(),Q.remove(),qe.success(`Downloading ${I}`,{id:K,description:rr(U)})}catch(se){qe.error(se.message,{id:K})}finally{O(null)}}function H(B){if(!B.length){qe.error("Nothing to upload. Empty folders are skipped.");return}const Z=B.reduce((U,Q)=>U+Q.file.size,0);if(Z>ME){qe.error(`That is ${rr(Z)}; the console uploads up to ${rr(ME)}.`,{description:`From a terminal: ${Lv(l,"./my-files",f)}`});return}if(h&&Z>h.free){qe.error(`The sandbox has ${rr(h.free)} free; this is ${rr(Z)}.`);return}const se=[...new Set(B.map(U=>U.path.split("/")[0]))].filter(U=>h==null?void 0:h.entries.some(Q=>Q.name===U)),I={files:B,bytes:Z,dir:f,taken:se};se.length?M(I):F(I)}async function F({files:B,bytes:Z,dir:K}){M(null);const se=new AbortController;let I;A({done:0,total:B.length,sent:0,bytes:Z,committing:!1,controller:se});try{({id:I}=await r.startUpload(l));let U=0;await Promise.all(Array.from({length:Math.min(4,B.length)},async()=>{for(;U<B.length&&!se.signal.aborted;){const te=B[U++];try{await r.uploadFile(l,I,te.path,te.file,se.signal)}catch(le){throw se.abort(),le}A(le=>le&&{...le,done:le.done+1,sent:le.sent+te.file.size})}})),A(te=>te&&{...te,committing:!0});const Q=await r.commitUpload(l,I,K);qe.success(`Uploaded ${Q.files.toLocaleString()} ${Q.files===1?"file":"files"} to ${Q.dest}`,{description:rr(Q.bytes)}),K===f&&_(f)}catch(U){I&&r.cancelUpload(l,I).catch(()=>{}),qe.error(se.signal.aborted&&U.name==="AbortError"?"Upload cancelled.":U.message)}finally{A(null)}}async function V(B){if(B.preventDefault(),E(!1),!c||T)return;const Z=fW(B.dataTransfer);try{H(await mW(Z))}catch(K){qe.error(`Could not read the dropped files: ${K.message}`)}}if(t)return s.jsx("p",{className:"p-5 text-sm text-muted-foreground",children:"Files are unavailable for synthetic sandboxes."});const G=f.split("/").filter(Boolean).map((B,Z,K)=>({label:B,path:`/${K.slice(0,Z+1).join("/")}`})),X=(h==null?void 0:h.path)===f?h.entries:[];return s.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",onDragOver:B=>{c&&!T&&Array.from(B.dataTransfer.types).includes("Files")&&(B.preventDefault(),E(!0))},onDragLeave:B=>{B.currentTarget.contains(B.relatedTarget)||E(!1)},onDrop:V,children:[s.jsx(hW,{seed:S,onRetry:P}),s.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border px-5 py-2",children:[s.jsx("nav",{"aria-label":"Folder",className:"flex min-w-0 flex-1 items-center gap-0.5 font-mono text-[11px]",children:G.map((B,Z)=>s.jsxs(x.Fragment,{children:[Z>0&&s.jsx(Ur,{className:"size-3 shrink-0 text-muted-foreground","aria-hidden":"true"}),Z===G.length-1?s.jsx("span",{className:"truncate px-1 text-foreground","aria-current":"page",children:B.label}):s.jsx("button",{type:"button",onClick:()=>m(B.path),className:"truncate rounded px-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:B.label})]},B.path))}),h&&s.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[rr(h.free)," free"]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Refresh",disabled:!c||v,onClick:()=>_(f),children:s.jsx(Ia,{className:v?"animate-spin":void 0,"aria-hidden":"true"})}),s.jsxs(ue,{variant:"outline",size:"sm",disabled:!c||!!R,onClick:()=>$(f,`${f.split("/").pop()}.tar.gz`),children:[R===f?s.jsx(zt,{"aria-hidden":"true"}):s.jsx(Kc,{"aria-hidden":"true"}),"Download folder"]}),s.jsxs(ue,{variant:"outline",size:"sm",disabled:!c||!!T,onClick:()=>{var B;return(B=D.current)==null?void 0:B.click()},children:[s.jsx(S6,{"aria-hidden":"true"}),"Upload"]}),s.jsx("input",{ref:D,type:"file",multiple:!0,hidden:!0,onChange:B=>{const Z=[...B.target.files].map(K=>({path:K.name,file:K}));B.target.value="",H(Z)}})]}),T&&s.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border bg-muted/30 px-5 py-2 text-xs",role:"status",children:[s.jsx(zt,{"aria-hidden":"true"}),s.jsx("span",{className:"flex-1",children:T.committing?`Sending ${T.total.toLocaleString()} ${T.total===1?"file":"files"} to ${f}…`:`Reading ${T.done.toLocaleString()} of ${T.total.toLocaleString()} files · ${rr(T.sent)} of ${rr(T.bytes)}`}),!T.committing&&s.jsxs(ue,{variant:"ghost",size:"sm",onClick:()=>T.controller.abort(),children:[s.jsx(On,{"aria-hidden":"true"}),"Cancel"]})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:c?p?s.jsx("p",{role:"alert",className:"p-5 text-sm text-destructive",children:p}):h?s.jsxs("ul",{"aria-label":`Files in ${f}`,className:"divide-y divide-border/60",children:[f!==ya&&s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>m(f.slice(0,f.lastIndexOf("/"))||"/"),className:"flex w-full items-center gap-2 px-5 py-1.5 text-left font-mono text-xs text-muted-foreground hover:bg-muted/50",children:[s.jsx(oC,{className:"size-3.5","aria-hidden":"true"}),".."]})}),X.map(B=>{const Z=dW(f,B.name),K=B.type==="link"?zR:Eh(B)?oC:xI,se=s.jsxs(s.Fragment,{children:[s.jsx(K,{className:`size-3.5 shrink-0 ${Eh(B)?"text-sky-600":"text-muted-foreground"}`,"aria-hidden":"true"}),s.jsx("span",{className:"truncate",children:B.name}),B.target&&s.jsxs("span",{className:"truncate text-muted-foreground",children:["→ ",B.target]})]});return s.jsxs("li",{className:"group flex items-center gap-3 px-5 py-1 hover:bg-muted/50",children:[Eh(B)?s.jsx("button",{type:"button",onClick:()=>m(Z),className:"flex min-w-0 flex-1 items-center gap-2 py-0.5 text-left font-mono text-xs",children:se}):s.jsx("span",{className:"flex min-w-0 flex-1 items-center gap-2 py-0.5 font-mono text-xs",children:se}),s.jsx("span",{className:"w-16 shrink-0 text-right text-[11px] text-muted-foreground",children:B.size!=null?rr(B.size):""}),s.jsx("span",{className:"hidden w-16 shrink-0 text-right text-[11px] text-muted-foreground sm:block",title:B.modifiedAt,children:xu(B.modifiedAt)}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":`Download ${B.name}`,className:"opacity-60 group-hover:opacity-100",disabled:!!R||B.targetType==="missing",onClick:()=>$(Z,Eh(B)?`${B.name}.tar.gz`:B.name),children:R===Z?s.jsx(zt,{"aria-hidden":"true"}):s.jsx(Kc,{"aria-hidden":"true"})})]},B.name)}),!X.length&&s.jsx("li",{className:"px-5 py-3 text-xs text-muted-foreground",children:"This folder is empty. Drop files here to upload them."}),h.truncated&&s.jsxs("li",{className:"px-5 py-2 text-[11px] text-muted-foreground",children:["Showing the first ",X.length.toLocaleString()," entries."]})]}):s.jsx("p",{className:"p-5 text-sm text-muted-foreground",children:"Loading files…"}):s.jsx("p",{className:"p-5 text-sm text-muted-foreground",children:"Start the sandbox to browse its files."})}),s.jsxs("div",{className:"shrink-0 space-y-1.5 border-t border-border bg-muted/20 px-5 py-3",children:[s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Drop files or folders anywhere here to upload into this folder. Only /sandbox is reachable; symlinks stay links. From a terminal:"}),s.jsxs("div",{className:"grid gap-1.5 lg:grid-cols-2",children:[s.jsx(rf,{command:Lv(l,"./my-files",f)}),s.jsx(rf,{command:uW(l,f,".")})]})]}),N&&s.jsxs("div",{className:"pointer-events-none absolute inset-2 flex items-center justify-center rounded-lg border-2 border-dashed border-sky-500 bg-background/85 text-sm",children:["Drop to upload into ",s.jsx("span",{className:"ml-1 font-mono",children:f})]}),s.jsx(Wr,{open:!!k,onOpenChange:B=>{B||M(null)},children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsxs(eo,{children:["Replace ",(k==null?void 0:k.taken.length)===1?`“${k.taken[0]}”`:`${k==null?void 0:k.taken.length} items`,"?"]}),s.jsxs(to,{children:[(k==null?void 0:k.taken.length)>1&&s.jsxs("span",{className:"mb-2 block font-mono text-[11px]",children:[k.taken.slice(0,6).join(", "),k.taken.length>6?", …":""]}),"Files with the same name in ",k==null?void 0:k.dir," are replaced. Folders are merged: matching files inside are replaced, and nothing is deleted."]})]}),s.jsxs(Jr,{children:[s.jsx(so,{children:"Cancel"}),s.jsx(no,{onClick:()=>F(k),children:"Replace"})]})]})})]})}function fp({agent:e={name:"Not reported"}}){return s.jsxs("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1.5 align-middle",title:`AI agent: ${e.name}`,children:[e.logo?s.jsx("img",{src:e.logo,alt:"",className:"size-3.5 shrink-0 object-contain"}):s.jsx(ER,{"aria-hidden":"true",className:"size-3.5 shrink-0 text-muted-foreground",strokeWidth:1.5}),s.jsx("span",{className:"truncate",children:e.name})]})}function DE({agents:e=[],status:t="Agent inventory not checked"}){return e.length?s.jsx("span",{title:t,className:"flex min-w-0 flex-col items-start gap-1.5",children:e.map(r=>s.jsx(fp,{agent:r},r.name))}):s.jsx("span",{className:"text-muted-foreground",children:t})}function Cl({title:e,icon:t,children:r,aside:a,className:l}){return s.jsxs("section",{className:l,children:[s.jsxs("h3",{className:"mb-2 flex items-center gap-1.5 text-sm font-medium text-foreground",children:[t&&s.jsx(t,{className:"size-3","aria-hidden":"true"}),e,a&&s.jsx("span",{className:"ml-auto font-normal normal-case tracking-normal",children:a})]}),r]})}function xW(){const e=$t(),t=Tr(),r=!!(t!=null&&t.nativeActions),[a,l]=x.useState([]);return x.useEffect(()=>{if(!r)return;let c=!1,u,f;const m=()=>{f??(f=e.editors().then(h=>h.filter(g=>g.installed))),f.then(h=>{c||l(h)}).catch(()=>{f=void 0,c||(u=setTimeout(m,3e3))})};return m(),()=>{c=!0,clearTimeout(u)}},[r,e]),a}function bW({name:e,editors:t,cloud:r,context:a,cursorAgent:l=!1}){var D;const c=$t(),[u,f]=x.useState(null),[m,h]=x.useState(null),[g,p]=x.useState("ssh"),[b,v]=x.useState(!1),[j,S]=x.useState(!1),[C,N]=x.useState(null);x.useEffect(()=>{if(r)return;let _=!1;return f(null),h(null),p("ssh"),N(null),c.sshConnection(e).then(L=>{_||(f(L),p(L.defaultMode))}).catch(L=>{_||h(L.message)}),()=>{_=!0}},[e,r,c]);const E=(u==null?void 0:u.modes[g])??(u==null?void 0:u.modes.ssh),T=g==="ssh"?"Open SSH in terminal":g==="attach"?"Attach canonical TTY":`New ${((D=AM(E==null?void 0:E.session))==null?void 0:D.toLowerCase())??"session"}`,A=m||(u?u.cliInstalled?u.sshInstalled?u.terminalSupported?null:"Opening a system terminal is supported on macOS and Linux.":"Install OpenSSH to connect.":"Install the openshell CLI to connect.":"Checking connection…");async function k(_){v(!0);try{await c.openEditor(e,_.id),qe.success(`Opening ${e} in ${_.label}`)}catch(L){qe.error(`Couldn’t open ${_.label}`,{description:L.message})}finally{v(!1)}}async function M(){v(!0);try{await c.openSshTerminal(e,g),qe.success(g==="ssh"?`Opening SSH to ${e}`:g==="attach"?`Attaching to ${e}`:`Starting a new session in ${e}`)}catch(_){qe.error("Couldn’t open SSH terminal",{description:_.message})}finally{v(!1)}}async function R(){S(!0);try{N(await c.sshConfig(e))}catch(_){qe.error("Couldn’t generate SSH config",{description:_.message})}finally{S(!1)}}const O=s.jsxs(ue,{variant:"outline",size:"sm",className:"justify-start text-xs",nativeButton:!1,disabled:!r&&(!(a!=null&&a.name)||!(a!=null&&a.workspace)),render:s.jsx("a",{href:r||a!=null&&a.name&&(a!=null&&a.workspace)?Up(e,void 0,a):void 0,target:"_blank",rel:"noreferrer"}),children:[s.jsx(Fv,{className:"size-3.5"}),"Browser"]});return r?s.jsx(Cl,{title:"Open in",children:s.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:O})}):s.jsxs(s.Fragment,{children:[s.jsxs(Cl,{title:"Open in",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[s.jsxs(ue,{variant:"outline",size:"sm",className:"justify-start text-xs",disabled:!(u!=null&&u.canOpenTerminal)||b,title:A??T,onClick:M,children:[b?s.jsx(zt,{className:"size-3.5"}):s.jsx(_R,{className:"size-3.5"}),"Terminal"]}),[...l?[{id:"cursor",label:"Cursor"}]:[],{id:"vscode",label:"VS Code"}].map(_=>{const L=t.some(q=>q.id===_.id);return s.jsxs(ue,{variant:"outline",size:"sm",className:"justify-start text-xs",disabled:!L||b,title:L?"Connects over SSH through OpenShell. The first time, OpenShell adds one Include line to ~/.ssh/config.":`${_.label} is not installed.`,onClick:()=>k(_),children:[s.jsx("img",{src:`/logos/${_.id}.svg`,alt:"",className:"size-3.5 dark:invert"}),_.label]},_.id)}),O]}),A&&s.jsx("p",{role:m?"alert":"status",className:"mt-2 text-[11px] text-muted-foreground",children:A}),u&&s.jsxs("details",{className:"group mt-2 text-[11px] text-muted-foreground",children:[s.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-1 py-1 hover:text-foreground [&::-webkit-details-marker]:hidden",children:[s.jsx(Ur,{className:"size-3 transition-transform group-open:rotate-90","aria-hidden":"true"}),"Connection options"]}),s.jsxs("div",{className:"mt-1.5 space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap gap-1 rounded-md bg-muted p-1",children:[s.jsx(ue,{type:"button",variant:g==="ssh"?"secondary":"ghost",size:"xs",onClick:()=>p("ssh"),children:"SSH shell"}),s.jsx(ue,{type:"button",variant:g==="exec"?"secondary":"ghost",size:"xs",onClick:()=>p("exec"),children:"New session"}),u.modes.attach&&s.jsx(ue,{type:"button",variant:g==="attach"?"secondary":"ghost",size:"xs",onClick:()=>p("attach"),children:"Attach"})]}),s.jsx("p",{className:"text-[10px] leading-relaxed",children:g==="ssh"?"Login shell over SSH.":g==="attach"?"Reconnects to the sandbox’s running terminal.":"Starts a separate shell or agent in the sandbox."}),E&&s.jsx(rf,{command:E.command,label:g==="ssh"?`ssh ${E.alias}`:`openshell sandbox ${g==="attach"?"connect":"exec --name"} ${e}`}),u.gateway.remote&&s.jsxs("p",{className:"break-all text-[10px]",children:["Via gateway ",s.jsxs("span",{className:"font-mono",children:[u.gateway.name,"/",u.gateway.workspace]})," at ",s.jsx("span",{className:"font-mono",children:u.gateway.endpoint})]}),s.jsxs(ue,{variant:"outline",size:"sm",className:"w-full justify-start text-xs font-normal text-muted-foreground",disabled:!u.cliInstalled||j,onClick:R,children:[j?s.jsx(zt,{className:"size-3.5"}):s.jsx(u6,{className:"size-3.5"}),"SSH configuration"]})]})]})]}),s.jsx(yn,{open:!!C,onOpenChange:_=>{_||N(null)},children:s.jsxs(vn,{className:"sm:max-w-2xl",children:[s.jsxs(Nn,{children:[s.jsxs(wn,{children:["SSH configuration for ",e]}),s.jsx(Hn,{children:"The console does not change ~/.ssh/config. Review and add this Host block yourself, then connect with the command below."})]}),C&&s.jsxs(s.Fragment,{children:[s.jsx("pre",{className:"max-h-[50svh] overflow-auto whitespace-pre rounded-md border bg-muted/30 p-3 font-mono text-[11px]",children:C.config}),s.jsx(rf,{command:C.command}),s.jsx(ue,{variant:"outline",onClick:async()=>{try{await navigator.clipboard.writeText(C.config),qe.success("SSH config copied")}catch{qe.error("Couldn’t copy SSH config")}},children:"Copy Host block"})]})]})})]})}const yW={"read-only":"read-only","read-write":"read-write",full:"full",custom:"custom rules",blocked:"blocked"},vW={secret:"from provider",policy:"network rule",org:"blocked everywhere",group:"inherited",agent:"agent defaults",own:"rule"};function wW(e){var r;const t=Cn();return t&&!((r=e.liveData)!=null&&r.demo)?s.jsx(Bw,{children:s.jsx(zE,{...e,scoped:!0},e.name)},t.id??t.context):s.jsx(zE,{...e},e.name)}function zE({name:e,sandbox:t,onClose:r,onNavigate:a,onChanged:l,liveData:c,scoped:u}){var I,U,Q,te,le;const f=$t(),m=Cn(),h=Ua(),g=u?h:c??h,p=J=>a(J,m),[b,v]=x.useState(15),[j,S]=x.useState(Date.now);x.useEffect(()=>{const J=setInterval(()=>S(Date.now()),3e4);return()=>clearInterval(J)},[]);const[C,N]=x.useState(null),[E,T]=x.useState(null),[A,k]=x.useState(null),[M,R]=x.useState(!1),O=Tr(),D=!!(O!=null&&O.nativeActions),_=!!(m!=null&&m.cloud||((m==null?void 0:m.target)??(O==null?void 0:O.target))==="cloud"),L=xW(),q=((I=g.sandboxes)==null?void 0:I.find(J=>J.name===e))??t,P=q?`${q.phase}|${q.policyVersion}`:null;x.useEffect(()=>{if(!e||(m==null?void 0:m.connected)===!1){N(null),T((m==null?void 0:m.error)??null);return}if(N(null),T(null),g.demo)return;let J=!1,ne,ce=3e4;const oe=async()=>{var W;try{const de=await f.sandbox(e);J||(N(de),T(null),ce=(W=de.setupJobs)!=null&&W.some(Ee=>Ee.status==="waiting")?2e3:3e4)}catch(de){J||T(de.message)}J||(ne=setTimeout(oe,ce))};return oe(),()=>{J=!0,clearTimeout(ne)}},[e,P,g.demo,f,m==null?void 0:m.connected,m==null?void 0:m.error]);const $=(C==null?void 0:C.name)===e?C:q,H=x.useMemo(()=>g.events.filter(J=>J.sandbox===e&&J.kind==="audit"&&J.verdict).slice(0,14),[g.events,e]);async function F(J){var ne;if((m==null?void 0:m.connected)!==!1){k(J);try{await f.lifecycle(e,J),qe.success(J==="delete"?`Deleting ${e}`:J==="stop"?`Stopping ${e}`:`Starting ${e}`),l==null||l(),(ne=g.refresh)==null||ne.call(g),J==="delete"&&r()}catch(ce){qe.error(ce.message)}finally{k(null),R(!1)}}}const V=x.useMemo(()=>g.events.filter(J=>J.sandbox===e),[g.events,e]),G=x.useMemo(()=>BM(V,b,j),[V,b,j]),X=x.useMemo(()=>{var ne;const J=new Map;for(const ce of((ne=C==null?void 0:C.policy)==null?void 0:ne.rules)??[])for(const oe of ce.endpoints)!oe.blocked&&!J.has(oe.host)&&J.set(oe.host,{host:oe.host,source:ka(ce.key)});return[...J.values()]},[C]),B=x.useMemo(()=>{const J=new Map;for(const ne of V){if(ne.kind!=="audit"||ne.verdict!=="denied")continue;const ce=_w(ne.destination);if(!ce)continue;const oe=J.get(ce)??{host:ce,count:0};oe.count+=1,J.set(ce,oe)}return[...J.values()].sort((ne,ce)=>ce.count-ne.count)},[V]),Z=RM($),K=$==null?void 0:$.phase,se=((U=C==null?void 0:C.policy)==null?void 0:U.rules)??[];return s.jsxs(s.Fragment,{children:[s.jsx(yn,{open:!!e,onOpenChange:J=>{J||r()},children:s.jsxs(vn,{className:"flex! h-[min(900px,94svh)] w-[calc(100%-1.5rem)]! max-w-[1280px]! flex-col gap-0! overflow-hidden p-0!",children:[s.jsxs(Nn,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-6 gap-y-3",children:[s.jsxs(wn,{className:"flex min-w-0 items-center gap-2 text-base",children:[s.jsx(ql,{"aria-hidden":"true",strokeWidth:1.5,className:"size-4 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate",children:e}),s.jsx(So,{location:m}),K&&s.jsxs("span",{className:"ml-2 flex shrink-0 items-center gap-1.5 text-xs font-normal text-muted-foreground",children:[s.jsx("span",{className:`size-1.5 rounded-full ${Pa(K).cell}`}),Kp[K]]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 text-xs text-muted-foreground",children:[s.jsxs("span",{children:[s.jsx("strong",{className:"mr-1 font-sans font-medium text-foreground",children:C!=null&&C.policy?X.length:"-"}),"allowed hosts"]}),s.jsxs("span",{children:[s.jsx("strong",{className:"mr-1 font-sans font-medium text-foreground",children:B.length}),"blocked hosts"]})]})]}),s.jsx(Hn,{className:"sr-only",children:"Sandbox access graph, details, rules, files, and connection activity."})]}),E&&s.jsx("p",{role:"alert",className:"shrink-0 border-b px-5 py-2 text-xs text-destructive",children:E}),$?s.jsxs(Ef,{defaultValue:"overview",className:"min-h-0 flex-1 gap-0!",children:[s.jsx("div",{className:"shrink-0 border-b border-border px-5 py-2",children:s.jsxs(Rf,{variant:"line","aria-label":"Sandbox information",className:"max-w-full",children:[s.jsx(wr,{value:"overview",className:"px-3 text-xs",children:"Overview"}),s.jsxs(wr,{value:"rules",className:"px-3 text-xs",children:["Rules",(C==null?void 0:C.policy)&&s.jsx("span",{className:"text-muted-foreground",children:se.length})]}),s.jsx(wr,{value:"setups",className:"px-3 text-xs",children:"MCPs & Skills"}),s.jsx(wr,{value:"files",className:"px-3 text-xs",children:"Files"}),s.jsx(wr,{value:"activity",className:"px-3 text-xs",children:"Activity"}),s.jsx(wr,{value:"details",className:"px-3 text-xs",children:"Details"})]})}),s.jsx(bo,{value:"overview",className:"min-h-0 overflow-y-auto",children:s.jsxs("div",{className:"grid min-h-full grid-cols-1 lg:h-full lg:grid-cols-[minmax(0,1fr)_250px]",children:[s.jsx("div",{className:"flex min-w-0 flex-col p-4 sm:p-5",children:s.jsx(Cl,{title:"Access graph",className:"flex flex-1 flex-col",children:C!=null&&C.policy?s.jsx(iK,{compact:!0,fill:!0,agentStatus:cy($),agents:Z,name:e,phase:K,allowed:X,denied:B,owner:Hd($),gateway:g.demo||(Q=g.overview)==null?void 0:Q.gateway,secrets:($.providers??[]).map(J=>{var ne,ce;return((ce=(ne=g.overview)==null?void 0:ne.providers)==null?void 0:ce.find(oe=>oe.name===J))??{name:J}})}):s.jsx("p",{className:"rounded-lg border border-border p-5 text-sm text-muted-foreground",children:g.demo?"Policy data is unavailable for synthetic sandboxes.":E?"The access graph is unavailable because the policy could not be loaded.":C?"No policy was reported by the gateway.":"Loading access graph…"})})}),s.jsxs("aside",{"aria-label":"Sandbox summary",className:"space-y-5 border-t border-border bg-muted/20 p-5 lg:border-t-0 lg:border-l",children:[K==="ready"&&!g.demo&&(m==null?void 0:m.connected)!==!1&&s.jsx(bW,{name:e,editors:L,cursorAgent:Z.some(J=>J.name==="Cursor"),cloud:!D,context:m?{name:m.gateway,workspace:m.workspace,target:m.target}:{...(te=g.overview)==null?void 0:te.gateway,target:O==null?void 0:O.target}},e),!g.demo&&K==="ready"&&(m==null?void 0:m.connected)!==!1&&_&&s.jsx(cW,{name:e,sandbox:$},e),s.jsxs(Cl,{title:"At a glance",children:[(le=$.setupJobs)==null?void 0:le.filter(J=>["waiting","failed","blocked"].includes(J.status)).map(J=>s.jsx("p",{role:"status",className:"mb-3 text-xs text-muted-foreground",children:J.status==="waiting"?"Installing included MCPs and skills…":`Included tools could not be activated: ${J.error} Open MCPs & Skills to retry.`},J.setup)),s.jsx("dl",{className:"grid grid-cols-2 gap-4 lg:grid-cols-1",children:[["Status",s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("span",{className:`size-1.5 rounded-full ${Pa(K).cell}`,"aria-hidden":"true"}),Kp[K]??"Unknown"]})],["Owner",Hd($)],[Z.length===1?"AI agent":"AI agents",s.jsx(DE,{agents:Z,status:cy($)})],["Image",rp($.image,$.imageTemplateName)],["Providers",$.providers.join(", ")||"None"],["Created",Yd($.createdAt)],["Policy",C?`v${C.policyVersionNumber??$.policyVersion} · ${C.policySource??"sandbox"}`:"Not reported"]].map(([J,ne])=>s.jsxs("div",{className:"min-w-0",children:[s.jsx("dt",{className:"text-[11px] text-muted-foreground",children:J}),s.jsx("dd",{className:"mt-1 break-words text-xs",children:ne})]},J))})]}),$.problem&&tx(K)==="error"&&s.jsxs("div",{className:"rounded-md border border-red-200 bg-red-50/60 p-3",children:[s.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-medium text-red-700",children:[s.jsx(_a,{className:"size-3.5","aria-hidden":"true"}),"Failed to start"]}),/failed to resolve .*image/i.test($.problem)&&/index\.docker\.io/.test($.problem)&&s.jsx("p",{className:"mt-1 text-[11px] text-red-700",children:"Start Docker, then recreate this sandbox."}),s.jsx("p",{className:"mt-1 max-h-28 overflow-y-auto font-mono text-[10px] leading-relaxed break-words text-red-700/80",children:$.problem})]})]})]})}),s.jsx(bo,{value:"rules",className:"min-h-0 space-y-6 overflow-y-auto p-5",children:s.jsx(Cl,{title:"Network rules",icon:Fv,aside:s.jsx("button",{disabled:(m==null?void 0:m.connected)===!1,onClick:()=>{try{sessionStorage.setItem("egress-sandbox",e)}catch{}r(),p("egress")},className:"text-[11px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:"Edit"}),children:C!=null&&C.policy?se.length===0?s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No rules. All outbound denied."}):s.jsx("ul",{className:"divide-y divide-border/70 rounded-md border border-border",children:se.map(J=>s.jsxs("li",{className:"px-3 py-2",children:[s.jsxs("p",{className:"flex items-center gap-2 text-[11px]",children:[s.jsx("span",{className:"truncate font-mono font-medium",children:ka(J.key)==="own"?J.name:Ud(J.key)}),s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:vW[ka(J.key)]})]}),s.jsx("ul",{className:"mt-1.5 space-y-0.5",children:J.endpoints.map(ne=>s.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[s.jsx("span",{className:`size-1.5 shrink-0 rounded-full ${ne.blocked?"bg-red-500":"bg-emerald-500"}`,"aria-hidden":"true"}),s.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[ne.host,ne.port?`:${ne.port}`:""]}),s.jsxs("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:[yW[ne.access]??ne.access,ne.tlsSkip?" · TLS passthrough":"",ne.protocol!=="tcp"&&ne.enforcement==="audit"?" · audit only":""]})]},`${ne.host}:${ne.port}`))}),J.binaries.length>0&&s.jsx("p",{className:"mt-1.5 truncate font-mono text-[10px] text-muted-foreground",title:J.binaries.join(", "),children:J.binaries.map(ne=>ne.split("/").pop()).filter((ne,ce,oe)=>oe.indexOf(ne)===ce).join(", ")})]},J.key))}):s.jsx("p",{className:"text-sm text-muted-foreground",children:g.demo?"Policy data is unavailable in this preview.":E?"Rules could not be loaded. Close and reopen to retry.":C?"No policy reported.":"Loading rules…"})})}),s.jsx(bo,{value:"setups",className:"min-h-0 overflow-y-auto",children:(m==null?void 0:m.connected)===!1?s.jsx("p",{role:"status",className:"p-5 text-sm text-muted-foreground",children:"Reconnect this location to manage MCPs & Skills."}):s.jsx(N3,{sandbox:e,setupIds:(C==null?void 0:C.setupIds)??[]})}),s.jsx(bo,{value:"files",className:"flex min-h-0 flex-col",children:(m==null?void 0:m.connected)===!1?s.jsx("p",{role:"status",className:"p-5 text-sm text-muted-foreground",children:"Reconnect this location to access files."}):s.jsx(pW,{sandbox:$,demo:g.demo})}),s.jsxs(bo,{value:"activity",className:"min-h-0 space-y-6 overflow-y-auto p-5",children:[s.jsxs(Cl,{title:"Connection activity",aside:s.jsx("div",{className:"flex gap-1",children:[15,60].map(J=>s.jsx("button",{onClick:()=>v(J),"aria-pressed":b===J,className:`rounded px-2 py-1 text-xs ${b===J?"bg-accent text-foreground":"text-muted-foreground hover:bg-muted"}`,children:J===15?"15m":"1h"},J))}),children:[s.jsx("div",{className:"rounded-lg border border-border p-4",children:s.jsx($M,{points:G,height:100,title:"Outbound decisions per minute"})}),s.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Based on the recent event buffer",g.demo?" · synthetic preview":"","."]})]}),s.jsx(Cl,{title:"Egress",aside:H.length?s.jsx("button",{onClick:()=>{r(),p("activity")},className:"text-[11px] text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:"All"}):null,children:H.length?s.jsx("div",{className:"rounded-md border border-border",children:H.map(J=>s.jsx(aW,{event:J,dense:!0},`${J.at}|${J.message}`))}):s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No connections yet"})})]}),s.jsx(bo,{value:"details",className:"min-h-0 space-y-5 overflow-y-auto p-5",children:s.jsx("dl",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2",children:[["Owner",Hd($)],["Image",rp($.image,$.imageTemplateName),!0],...$.image&&rp($.image,$.imageTemplateName)!==$.image?[["Image reference",$.image,!0]]:[],["Command",pK($.command),!0],[Z.length===1?"AI agent":"AI agents",s.jsx(DE,{agents:Z,status:cy($)})],["Providers",$.providers.join(", ")||"None"],["Created",Yd($.createdAt)],["Workspace",$.workspace],["Policy",C?`v${C.policyVersionNumber??$.policyVersion} · ${C.policySource??"sandbox"}`:`v${$.policyVersion??"-"}`],["Sandbox ID",$.id,!0,!0]].map(([J,ne,ce,oe])=>s.jsxs("div",{className:oe?"sm:col-span-2":void 0,children:[s.jsx("dt",{className:"mb-1 text-[11px] text-muted-foreground",children:J}),s.jsx("dd",{className:`break-all ${ce?"font-mono text-xs":"text-sm"}`,children:ne??"Not reported"})]},J))})})]}):s.jsx("p",{role:"status",className:"flex-1 p-5 text-sm text-muted-foreground",children:E?"Sandbox details unavailable.":"Loading sandbox…"}),$&&!g.demo&&s.jsxs("div",{className:"flex shrink-0 flex-wrap gap-2 border-t border-border bg-muted/20 px-5 py-3",children:[mK(K)&&s.jsxs(ue,{variant:"outline",size:"sm",disabled:!!A||(m==null?void 0:m.connected)===!1,onClick:()=>F("stop"),children:[A==="stop"?s.jsx(zt,{"aria-hidden":"true"}):s.jsx(p6,{"aria-hidden":"true"}),"Stop"]}),hK(K)&&s.jsxs(ue,{variant:"outline",size:"sm",disabled:!!A||(m==null?void 0:m.connected)===!1,onClick:()=>F("start"),children:[A==="start"?s.jsx(zt,{"aria-hidden":"true"}):s.jsx(IR,{"aria-hidden":"true"}),"Start"]}),s.jsxs(ue,{variant:"outline",size:"sm",disabled:!!A||(m==null?void 0:m.connected)===!1||K==="deleting",className:"border-destructive/30 text-destructive hover:bg-destructive/5 hover:text-destructive",onClick:()=>R(!0),children:[s.jsx(Yn,{"aria-hidden":"true"}),"Delete"]})]})]})}),s.jsx(Wr,{open:M,onOpenChange:R,children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsxs(eo,{children:["Delete ",e,"?"]}),s.jsx(to,{children:"All files inside will be lost."})]}),s.jsxs(Jr,{children:[s.jsx(so,{children:"Cancel"}),s.jsxs(no,{variant:"destructive",onClick:()=>F("delete"),disabled:A==="delete",children:[A==="delete"&&s.jsx(zt,{"aria-hidden":"true"}),"Delete"]})]})]})})]})}const $3=({className:e,containerRef:t,fromRef:r,toRef:a,curvature:l=0,reverse:c=!1,duration:u=5,delay:f=0,pathColor:m="gray",pathWidth:h=2,pathOpacity:g=.2,gradientStartColor:p="#ffaa40",gradientStopColor:b="#9c40ff",repeat:v=1/0,repeatDelay:j=0,startXOffset:S=0,startYOffset:C=0,endXOffset:N=0,endYOffset:E=0})=>{const T=x.useId(),[A,k]=x.useState(""),[M,R]=x.useState({width:0,height:0}),O=c?{x1:["90%","-10%"],x2:["100%","0%"],y1:["0%","0%"],y2:["0%","0%"]}:{x1:["10%","110%"],x2:["0%","100%"],y1:["0%","0%"],y2:["0%","0%"]};return x.useEffect(()=>{const D=()=>{if(t.current&&r.current&&a.current){const L=t.current.getBoundingClientRect(),q=r.current.getBoundingClientRect(),P=a.current.getBoundingClientRect(),$=L.width,H=L.height;R({width:$,height:H});const F=q.left-L.left+q.width/2+S,V=q.top-L.top+q.height/2+C,G=P.left-L.left+P.width/2+N,X=P.top-L.top+P.height/2+E,B=V-l,Z=`M ${F},${V} Q ${(F+G)/2},${B} ${G},${X}`;k(Z)}},_=new ResizeObserver(()=>{D()});return t.current&&_.observe(t.current),D(),()=>{_.disconnect()}},[t,r,a,l,S,C,N,E]),s.jsxs("svg",{fill:"none",width:M.width,height:M.height,xmlns:"http://www.w3.org/2000/svg",className:Le("pointer-events-none absolute top-0 left-0 transform-gpu stroke-2",e),viewBox:`0 0 ${M.width} ${M.height}`,children:[s.jsx("path",{d:A,stroke:m,strokeWidth:h,strokeOpacity:g,strokeLinecap:"round"}),s.jsx("path",{d:A,strokeWidth:h,stroke:`url(#${T})`,strokeOpacity:"1",strokeLinecap:"round"}),s.jsx("defs",{children:s.jsxs(Rn.linearGradient,{className:"transform-gpu",id:T,gradientUnits:"userSpaceOnUse",initial:{x1:"0%",x2:"0%",y1:"0%",y2:"0%"},animate:{x1:O.x1,x2:O.x2,y1:O.y1,y2:O.y2},transition:{delay:f,duration:u,ease:[.16,1,.3,1],repeat:v,repeatDelay:j},children:[s.jsx("stop",{stopColor:p,stopOpacity:"0"}),s.jsx("stop",{stopColor:p}),s.jsx("stop",{offset:"32.5%",stopColor:b}),s.jsx("stop",{offset:"100%",stopColor:b,stopOpacity:"0"})]})})]})},jW=["working","needs-docker","needs-install"],PE={working:{icon:zl,tone:"text-muted-foreground animate-spin motion-reduce:animate-none",title:e=>`Connecting to ${e.host}`},"needs-docker":{icon:rC,tone:"text-amber-500",title:e=>`Docker isn’t installed on ${e.host}`},"needs-install":{icon:rC,tone:"text-amber-500",title:e=>`${e.host} needs the runtime images`},failed:{icon:nI,tone:"text-destructive",title:e=>`Couldn’t connect to ${e.host}`}};function V3({onConnected:e,onBack:t,initialHost:r,connectedHost:a=null,onUseConnected:l}){var se,I;const[c,u]=x.useState(null),[f,m]=x.useState("download"),[h,g]=x.useState(""),[p,b]=x.useState(null),[v,j]=x.useState(null),[S,C]=x.useState(null),[N,E]=x.useState(!1),[T,A]=x.useState(null),[k,M]=x.useState(null),[R,O]=x.useState(0),D=x.useRef(0),_=x.useRef(null),L=x.useRef(!1),q=x.useId(),P=x.useCallback(U=>{L.current||(L.current=!0,e(U))},[e]);x.useEffect(()=>{const U=new AbortController,Q=++D.current,te=setTimeout(()=>U.abort(new Error("Reading hosts timed out. Try refreshing.")),1e4);return E(!0),A(null),M(null),is.connections(U.signal).then(le=>{var ce,oe,W;if(D.current!==Q)return;u(le);const J=(ce=le.job)!=null&&ce.host&&jW.includes(le.job.status)?le.job:null;J&&(b(J),m(J.runtimeInstallation||"download"));const ne=(J==null?void 0:J.host)??_.current??r??((oe=le.active)==null?void 0:oe.host);g(le.hosts.some(de=>de.name===ne)?ne:((W=le.hosts[0])==null?void 0:W.name)||"")}).catch(le=>{D.current===Q&&le.name!=="AbortError"&&A(le.message)}).finally(()=>{clearTimeout(te),D.current===Q&&E(!1)}),()=>{U.abort(),clearTimeout(te),D.current+=1}},[R,r]),x.useEffect(()=>{if((p==null?void 0:p.status)!=="working"||k||S)return;const U=new AbortController;let Q;async function te(){try{const le=await is.connectionJob(p.id,U.signal);if(U.signal.aborted)return;b(le),le.status==="ready"?P(le):le.status==="working"&&(Q=setTimeout(te,1e3))}catch(le){U.signal.aborted||M(le.message)}}return Q=setTimeout(te,500),()=>{U.abort(),clearTimeout(Q)}},[p==null?void 0:p.id,p==null?void 0:p.status,k,S,P]);async function $(U,Q){C(U),A(null),M(null);try{const te=await Q();b(te),te.status==="ready"&&P(te)}catch(te){A(te.message)}finally{C(null)}}const H=(c==null?void 0:c.hosts)??[],F=H.find(U=>U.name===h),V=!!S||(p==null?void 0:p.status)==="working",G=(p==null?void 0:p.status)==="needs-install"||(p==null?void 0:p.status)==="needs-docker",X=c&&!c.tools.ssh,B=p&&p.host===h&&PE[p.status]?PE[p.status]:null,Z=()=>O(U=>U+1),K=!!(a&&l&&h===a&&!p);return s.jsxs("div",{className:"grid gap-6 text-xs",children:[s.jsxs("div",{className:"grid gap-6 md:grid-cols-2 md:gap-8",children:[s.jsx("div",{className:"grid min-w-0 content-start gap-5",children:s.jsx(NW,{host:(F==null?void 0:F.label)??(h||"Your server"),live:(p==null?void 0:p.status)==="working"||K})}),s.jsxs("div",{className:"grid min-w-0 content-start gap-5",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(En,{htmlFor:`${q}-host`,className:"text-xs",children:"SSH host"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(hn,{id:`${q}-host`,className:"flex-1",value:F?h:"",disabled:V||!H.length,onChange:U=>{_.current=U.target.value,g(U.target.value),b(null),j(null),A(null),M(null)},children:[s.jsx("option",{value:"",disabled:!0,children:H.length?"Choose a host":"No hosts in ~/.ssh/config"}),H.map(U=>s.jsx("option",{value:U.name,children:U.label??U.name},U.name))]}),s.jsx(ue,{type:"button",variant:"outline",size:"icon","aria-label":"Refresh hosts",disabled:!!S||N,onClick:Z,children:s.jsx(Ia,{className:`size-3.5 ${N?"animate-spin motion-reduce:animate-none":""}`})})]}),K?s.jsx("p",{className:"text-muted-foreground",children:"Connected now. Choose another host to replace this connection."}):a&&F&&s.jsxs("p",{className:"text-muted-foreground",children:["Connecting ",h," replaces the connection to ",a,"."]}),F&&!F.managed&&!K&&s.jsxs("p",{className:"text-muted-foreground",children:["First time? Run ",s.jsxs("code",{className:"rounded bg-muted px-1 font-mono text-foreground",children:["ssh ",h]})," once to trust the machine."]}),X&&s.jsx(Rh,{children:"OpenSSH isn’t installed on this computer. Install it, then refresh."})]}),s.jsxs(SW,{children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx("p",{className:"font-medium text-foreground",children:"If the host is missing the runtime images"}),s.jsx("div",{role:"radiogroup","aria-label":"Runtime images",className:"inline-flex w-fit rounded-lg bg-muted p-0.5",children:[["download","Download on host"],["upload","I’ll upload a package"]].map(([U,Q])=>s.jsx("button",{type:"button",role:"radio","aria-checked":f===U,disabled:V||G,onClick:()=>m(U),className:`rounded-md px-2.5 py-1 transition-colors disabled:opacity-60 ${f===U?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:Q},U))})]}),s.jsxs("ul",{className:"grid list-disc gap-1.5 pl-4",children:[s.jsx("li",{children:"Needs Linux with Docker. On Ubuntu or Debian, OpenRod can install Docker (it asks first; needs passwordless sudo)."}),s.jsx("li",{children:"Docker access is admin access. Connect only to machines you trust."}),s.jsx("li",{children:"The host gets credentials for its own gateway, never your main one."}),s.jsx("li",{children:"The link runs inside OpenRod on this computer. Stopping OpenRod disconnects it; disconnect any time from the gateway menu in the sidebar."})]})]})]})]}),B&&s.jsxs("div",{role:"status","aria-live":"polite",className:"grid gap-3 rounded-xl border border-border bg-muted/20 p-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(B.icon,{className:`mt-0.5 size-4 shrink-0 ${B.tone}`}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium text-foreground",children:B.title(p)}),p.stage&&p.stage!=="Connection failed"&&s.jsx("p",{className:"mt-0.5 break-words whitespace-pre-wrap text-muted-foreground",children:p.stage})]})]}),p.probe&&s.jsx("div",{className:"flex flex-wrap gap-1.5",children:[`${p.probe.os||"Unknown OS"} · ${p.probe.arch||"?"}`,p.probe.dockerInstalled===!1?"No Docker":"Docker found",p.probe.runtimeReady?"Images ready":"Images missing"].map(U=>s.jsx("span",{className:"rounded-full border border-border bg-background px-2 py-0.5 text-[10px] text-muted-foreground",children:U},U))}),p.status==="needs-docker"&&((se=p.probe)!=null&&se.dockerInstallSupported?s.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[s.jsxs("p",{className:"text-muted-foreground",children:["OpenRod will install ",s.jsx("code",{className:"font-mono",children:"docker.io"}),", start it, and add your SSH user to the ",s.jsx("code",{className:"font-mono",children:"docker"})," group (root-equivalent). Nothing changes unless you approve."]}),s.jsx(ue,{type:"button",size:"sm",className:"justify-self-start",disabled:V,onClick:()=>$("docker",()=>is.installConnectionDocker(p.id)),children:S==="docker"?"Starting…":"Install Docker and continue"})]}):s.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[s.jsxs("p",{className:"text-muted-foreground",children:[((I=p.probe)==null?void 0:I.dockerInstallReason)||"Automatic install works on Ubuntu and Debian only."," Install Docker yourself, then check again."]}),s.jsx(ue,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:V,onClick:()=>$("connect",()=>is.connect({host:p.host,runtimeInstallation:f})),children:"Check again"})]})),p.status==="needs-install"&&s.jsxs("div",{className:"grid gap-2 border-t border-border pt-3",children:[s.jsx(ue,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:V,onClick:()=>$("download",()=>is.installConnectionRuntime(p.id)),children:S==="download"?"Starting download…":"Download on host"}),s.jsxs("p",{className:"text-muted-foreground",children:["Or upload a ",s.jsx("code",{className:"font-mono",children:"docker save"})," .tar with the sandbox, supervisor and gateway images for this host’s architecture."]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Rt,{"aria-label":"Docker-save package (.tar)",type:"file",accept:".tar,application/x-tar",className:"h-8 flex-1 text-xs",disabled:V,onChange:U=>{var Q;j(((Q=U.target.files)==null?void 0:Q[0])??null),A(null)}}),s.jsx(ue,{type:"button",variant:"outline",size:"sm",disabled:V||!(v!=null&&v.name.toLowerCase().endsWith(".tar")),onClick:()=>$("upload",()=>is.uploadConnectionPackage(p.id,v)),children:S==="upload"?"Uploading…":"Upload"})]}),v&&!v.name.toLowerCase().endsWith(".tar")&&s.jsx(Rh,{children:"Choose an uncompressed .tar archive."})]})]}),(T||B&&p.error)&&s.jsx(Rh,{children:T||p.error}),k&&s.jsxs(Rh,{children:["Lost track of progress: ",k," It may still be running. Refresh to check."]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-4",children:[s.jsx(ue,{type:"button",variant:"ghost",className:"mr-auto",disabled:!!S,onClick:t,children:"Back"}),K?s.jsxs(ue,{type:"button",onClick:l,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:["Continue with ",a]}):s.jsx(ue,{type:"button",disabled:V||!F||X||G,onClick:()=>$("connect",()=>is.connect({host:h,runtimeInstallation:f})),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:S==="connect"||(p==null?void 0:p.status)==="working"?s.jsxs(s.Fragment,{children:[s.jsx(zl,{className:"size-3.5 animate-spin"}),"Connecting…"]}):(p==null?void 0:p.status)==="failed"&&p.host===h?"Try again":"Connect"})]})]})}function Rh({children:e}){return s.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 break-words whitespace-pre-wrap text-destructive",children:e})}function SW({children:e}){const[t,r]=x.useState(!1);return s.jsxs("div",{children:[s.jsxs("button",{type:"button","aria-expanded":t,onClick:()=>r(a=>!a),className:"flex w-full items-center gap-2 rounded text-left text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx(uf,{className:"size-3.5"}),"Requirements & safety",s.jsx(Xo,{className:`ml-auto size-3.5 transition-transform ${t?"rotate-180":""}`})]}),t&&s.jsx("div",{className:"grid gap-4 pt-3 text-muted-foreground",children:e})]})}function NW({host:e,live:t}){const r=x.useRef(null),a=x.useRef(null),l=x.useRef(null),c=(u,f,m,h)=>s.jsxs("div",{className:"z-10 flex flex-col items-center gap-2 text-center",children:[s.jsx("span",{ref:u,className:"flex size-11 items-center justify-center rounded-2xl border border-border bg-background shadow-sm",children:s.jsx(f,{className:"size-5"})}),s.jsxs("span",{children:[s.jsx("span",{className:"block max-w-32 truncate font-medium text-foreground",children:m}),s.jsx("span",{className:"block text-[10px] text-muted-foreground",children:h})]})]});return s.jsxs("div",{ref:r,className:"relative flex items-start justify-between overflow-hidden rounded-xl border border-border bg-muted/20 px-8 py-4",children:[c(a,mp,"This computer","Gateway"),s.jsx("span",{className:"absolute top-[38px] left-1/2 z-10 -translate-x-1/2 -translate-y-1/2 rounded-full border border-border bg-background px-2 py-0.5 font-mono text-[10px] text-muted-foreground",children:"ssh"}),c(l,df,e,"Docker · sandboxes"),s.jsx($3,{containerRef:r,fromRef:a,toRef:l,duration:t?2.5:5,pathOpacity:.25,gradientStartColor:"#f59e0b",gradientStopColor:"#10b981"})]})}function CW({width:e=16,height:t=16,x:r=0,y:a=0,cx:l=1,cy:c=1,cr:u=1,className:f,glow:m=!1,...h}){const g=x.useId(),p=x.useRef(null),[b,v]=x.useState({width:0,height:0});x.useEffect(()=>{const S=()=>{if(p.current){const{width:C,height:N}=p.current.getBoundingClientRect();v({width:C,height:N})}};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const j=Array.from({length:Math.ceil(b.width/e)*Math.ceil(b.height/t)},(S,C)=>{const N=C%Math.ceil(b.width/e),E=Math.floor(C/Math.ceil(b.width/e));return{x:N*e+l+r,y:E*t+c+a,delay:Math.random()*5,duration:Math.random()*3+2}});return s.jsxs("svg",{ref:p,"aria-hidden":"true",className:Le("pointer-events-none absolute inset-0 h-full w-full text-neutral-400/80",f),...h,children:[s.jsx("defs",{children:s.jsxs("radialGradient",{id:`${g}-gradient`,children:[s.jsx("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"1"}),s.jsx("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0"})]})}),j.map(S=>s.jsx(Rn.circle,{cx:S.x,cy:S.y,r:u,fill:m?`url(#${g}-gradient)`:"currentColor",initial:m?{opacity:.4,scale:1}:{},animate:m?{opacity:[.4,1,.4],scale:[1,1.5,1]}:{},transition:m?{duration:S.duration,repeat:1/0,repeatType:"reverse",delay:S.delay,ease:"easeInOut"}:{}},`${S.x}-${S.y}`))]})}function Gw({step:e,subject:t="sandbox"}){return s.jsx("ol",{"aria-label":"Steps",className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:["Location",t==="template"?"Template":"Sandbox"].map((r,a)=>{const l=a+1===e,c=a+1<e;return s.jsxs(x.Fragment,{children:[a>0&&s.jsx("span",{"aria-hidden":"true",className:`h-px w-6 transition-colors ${c||l?"bg-foreground/40":"bg-border"}`}),s.jsxs("li",{"aria-current":l?"step":void 0,className:`flex items-center gap-1.5 transition-colors ${l?"text-foreground":""}`,children:[s.jsx("span",{className:`flex size-4 items-center justify-center rounded-full text-[9px] font-semibold transition-colors ${l?"bg-foreground text-background":c?"bg-foreground/15 text-foreground":"border border-border"}`,children:a+1}),r]})]},r)})})}function U3({location:e,onChange:t}){return s.jsxs("span",{className:"flex items-center gap-1.5 rounded-full border border-border bg-muted/30 py-0.5 pr-1 pl-2.5 text-[11px] text-muted-foreground",children:[e!=null&&e.remote?s.jsx(df,{"aria-hidden":"true",className:"size-3"}):s.jsx(mp,{"aria-hidden":"true",className:"size-3"}),s.jsx("span",{className:"max-w-40 truncate text-foreground",children:e!=null&&e.remote?Dd(e):"This computer"}),s.jsx(ue,{type:"button",variant:"ghost",size:"sm",className:"h-5 rounded-full px-2 text-[11px]",onClick:t,children:"Change"})]})}const Dd=e=>{var t;return((t=e==null?void 0:e.label)==null?void 0:t.replace(/^SSH · /,""))??(e==null?void 0:e.gateway)};function IE({live:e}){const t=Bs(),r=x.useId();return s.jsxs("svg",{viewBox:"0 0 72 48",className:"h-16 w-auto text-foreground","aria-hidden":"true",children:[s.jsx("defs",{children:s.jsxs("linearGradient",{id:`${r}-screen`,x1:"0",y1:"0",x2:"0",y2:"1",children:[s.jsx("stop",{offset:"0",stopColor:"currentColor",stopOpacity:"0.14"}),s.jsx("stop",{offset:"1",stopColor:"currentColor",stopOpacity:"0.03"})]})}),s.jsx("rect",{x:"10",y:"2",width:"52",height:"34",rx:"3.5",fill:"var(--popover)",stroke:"currentColor",strokeOpacity:"0.55"}),s.jsx("rect",{x:"13.5",y:"5.5",width:"45",height:"27",rx:"1.5",fill:`url(#${r}-screen)`}),s.jsx("rect",{x:"18",y:"11",width:"14",height:"1.6",rx:"0.8",fill:"currentColor",fillOpacity:"0.45"}),s.jsx("rect",{x:"18",y:"16",width:"22",height:"1.6",rx:"0.8",fill:"currentColor",fillOpacity:"0.3"}),s.jsx("rect",{x:"18",y:"21",width:"9",height:"1.6",rx:"0.8",fill:"#10b981",fillOpacity:"0.8"}),s.jsx(Rn.rect,{x:"29",y:"20.3",width:"3",height:"3",rx:"0.5",fill:"currentColor",fillOpacity:"0.7",animate:t||!e?void 0:{opacity:[1,0,1]},transition:{duration:1.1,repeat:1/0,times:[0,.5,1]}}),s.jsx("path",{d:"M2 38.5h68l-2.6 5.2a2.5 2.5 0 0 1-2.2 1.3H6.8a2.5 2.5 0 0 1-2.2-1.3Z",fill:"var(--popover)",stroke:"currentColor",strokeOpacity:"0.55",strokeLinejoin:"round"}),s.jsx("rect",{x:"30",y:"38.5",width:"12",height:"1.6",rx:"0.8",fill:"currentColor",fillOpacity:"0.35"})]})}function H3({live:e}){const t=Bs();return s.jsx("svg",{viewBox:"0 0 52 50",className:"h-[60px] w-auto text-foreground","aria-hidden":"true",children:[0,1,2].map(r=>s.jsxs("g",{children:[s.jsx("rect",{x:"2",y:2+r*16,width:"48",height:"13",rx:"3",fill:"var(--popover)",stroke:"currentColor",strokeOpacity:"0.55"}),s.jsxs(s.Fragment,{children:[s.jsx(Rn.circle,{cx:"9",cy:8.5+r*16,r:"1.6",fill:"#10b981",initial:{opacity:.9},animate:t||!e?void 0:{opacity:[.9,.25,.9]},transition:{duration:1.6,repeat:1/0,delay:r*.35}}),s.jsx("circle",{cx:"14.5",cy:8.5+r*16,r:"1.6",fill:"currentColor",fillOpacity:"0.25"}),[0,1,2,3].map(a=>s.jsx("rect",{x:30+a*4.2,y:5.5+r*16,width:"1.6",height:"6",rx:"0.8",fill:"currentColor",fillOpacity:"0.22"},a))]})]},r))})}function kW(){return s.jsx("svg",{viewBox:"0 0 76 48",className:"h-16 w-auto text-foreground","aria-hidden":"true",children:s.jsxs("g",{transform:"translate(0 3)",children:[s.jsx("path",{d:"M20 42a14 14 0 0 1-1.6-27.9A18 18 0 0 1 52.6 10 13 13 0 0 1 56 42Z",fill:"var(--popover)",stroke:"currentColor",strokeOpacity:"0.55",strokeLinejoin:"round"}),[0,1,2].map(e=>s.jsx("rect",{x:24+e*10,y:"26",width:"7",height:"7",rx:"1.5",fill:"currentColor",fillOpacity:.3-e*.07},e))]})})}function TW({kind:e,live:t}){const r=x.useRef(null),a=x.useRef(null),l=x.useRef(null);return s.jsxs("div",{ref:r,className:"relative flex h-36 items-center justify-center gap-14",children:[s.jsx(CW,{width:14,height:14,className:"text-foreground/15 transition-colors duration-500 [mask-image:radial-gradient(160px_circle_at_center,white,transparent)] group-hover:text-foreground/30"}),e==="cloud"&&s.jsx("span",{className:"relative z-10",children:s.jsx(kW,{})}),e==="local"&&s.jsx("span",{className:"relative z-10 transition-transform duration-500 group-hover:scale-105",children:s.jsx(IE,{live:t})}),e==="remote"&&s.jsxs(s.Fragment,{children:[s.jsx("span",{ref:a,className:"relative z-10 transition-transform duration-500 group-hover:-translate-x-1",children:s.jsx(IE,{live:t})}),s.jsx("span",{ref:l,className:"relative z-10 transition-transform duration-500 group-hover:translate-x-1",children:s.jsx(H3,{live:t})}),s.jsx($3,{containerRef:r,fromRef:a,toRef:l,duration:t?2.5:4,pathOpacity:.3,gradientStartColor:"#f59e0b",gradientStopColor:"#10b981"})]})]})}function by({index:e,scene:t,live:r,title:a,caption:l,tone:c="idle",disabled:u,onClick:f,trailing:m}){const h=Bs(),g=p=>{const b=p.currentTarget.getBoundingClientRect();p.currentTarget.style.setProperty("--x",`${p.clientX-b.left}px`),p.currentTarget.style.setProperty("--y",`${p.clientY-b.top}px`)};return s.jsxs(Rn.button,{type:"button",disabled:u,onClick:f,onPointerMove:g,initial:h?!1:{opacity:0,y:10},animate:{opacity:u?.5:1,y:0},transition:{duration:.35,delay:e*.07,ease:[.22,1,.36,1]},className:"group relative block w-full overflow-hidden rounded-2xl bg-muted/30 text-left outline-none transition-colors duration-300 hover:bg-muted/50 focus-visible:bg-muted/50 focus-visible:ring-1 focus-visible:ring-foreground/20 disabled:pointer-events-none",children:[s.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100",style:{background:"radial-gradient(260px circle at var(--x, 50%) var(--y, 50%), color-mix(in oklab, var(--foreground) 7%, transparent), transparent 70%)"}}),s.jsx(TW,{kind:t,live:r}),s.jsxs("span",{className:"relative flex items-center gap-3 px-4 pt-1 pb-4",children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-sm font-medium",children:a}),s.jsxs("span",{className:"flex items-center gap-1.5 truncate text-xs text-muted-foreground",children:[c!=="idle"&&s.jsx("span",{"aria-hidden":"true",className:`size-1.5 shrink-0 rounded-full ${c==="live"?"bg-emerald-500":"bg-amber-500"}`}),l]})]}),m||s.jsx(Ri,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground transition-all duration-300 group-hover:translate-x-0.5 group-hover:-translate-y-0.5 group-hover:text-foreground"})]})]})}function F3({locations:e,allowRemote:t,onPick:r,onConnected:a,onCancel:l,connecting:c,subject:u="sandbox"}){const f=Bs(),[m,h]=x.useState("choose"),[g,p]=x.useState(null),[b,v]=x.useState(!1),[j,S]=x.useState(null),C=e.find(k=>!k.remote),N=e.find(k=>k.remote);x.useEffect(()=>{if(C||!t)return;let k=!0;return is.connections().then(M=>{k&&p(M.locals)}).catch(()=>{k&&p([])}),()=>{k=!1}},[C,t]);async function E(){v(!0),S(null);try{await zM(is,g[0].name),window.location.reload()}catch(k){S(k.message),v(!1)}}const T=f?{}:{initial:{opacity:0,x:m==="remote"?24:-24},animate:{opacity:1,x:0},exit:{opacity:0,x:m==="remote"?-24:24},transition:{duration:.22,ease:[.22,1,.36,1]}},A=C?C.connected?"Local gateway":"Disconnected":g!=null&&g.length?`Use ${g[0].name}`:g?"No local gateway running":"Checking…";return s.jsxs("div",{className:"flex min-h-0 flex-col gap-6 rounded-xl bg-popover p-7 ring-1 ring-foreground/10",children:[s.jsxs(Nn,{className:"gap-3",children:[s.jsx(Gw,{step:1,subject:u}),s.jsxs("div",{className:"flex items-center gap-2",children:[m==="remote"&&s.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Back to locations",onClick:()=>h("choose"),children:s.jsx(Vv,{})}),s.jsx(wn,{children:m==="remote"?"Connect a machine":"Where should it run?"})]}),s.jsx(Hn,{className:m==="remote"?"sr-only":"text-xs",children:m==="remote"?`Connect an SSH host to ${u==="sandbox"?"run sandboxes on":"build templates on"}.`:`Pick a location for this ${u}.`})]}),s.jsx("div",{className:"-m-2 min-h-0 flex-1 overflow-x-hidden overflow-y-auto p-2",children:s.jsx(Vl,{mode:"wait",initial:!1,children:m==="choose"?s.jsxs(Rn.div,{...T,className:"grid gap-3",children:[s.jsxs("div",{className:`grid gap-4 ${t?"sm:grid-cols-3":""}`,children:[s.jsx(by,{index:0,scene:"local",live:C==null?void 0:C.connected,title:"This computer",caption:A,tone:C!=null&&C.connected?"live":"idle",disabled:C?!C.connected:!(g!=null&&g.length)||b,onClick:()=>C?r(C.id??C.context):E(),trailing:b&&s.jsx(zl,{className:"size-4 animate-spin text-muted-foreground"})}),t&&s.jsx(by,{index:1,scene:"remote",live:N==null?void 0:N.connected,title:"Remote machine",caption:N!=null&&N.connected?`Connected · ${Dd(N)}`:N?`${Dd(N)} · Disconnected`:"Your server, over SSH",tone:N!=null&&N.connected?"live":N?"warn":"idle",onClick:()=>h("remote")}),t&&s.jsx(by,{index:2,scene:"cloud",title:"Cloud",caption:"Coming soon",disabled:!0,trailing:s.jsx("span",{"aria-hidden":"true"})})]}),j&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:j}),s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(ue,{type:"button",variant:"ghost",onClick:l,children:"Cancel"})})]},"choose"):s.jsx(Rn.div,{...T,children:c?s.jsxs("div",{role:"status",className:"grid place-items-center gap-3 py-16 text-xs text-muted-foreground",children:[s.jsx(zl,{className:"size-5 animate-spin"}),"Connected. Opening the ",u," form…"]}):s.jsx(V3,{initialHost:N?Dd(N):void 0,connectedHost:N!=null&&N.connected?Dd(N):null,onUseConnected:()=>r(N.id??N.context),onConnected:a,onBack:()=>h("choose")})},"remote")})})]})}function kl({title:e,summary:t,children:r,...a}){return s.jsxs("details",{className:"group/setup min-w-0 border-t border-border",...a,children:[s.jsxs("summary",{className:"flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-sm py-2 outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden",children:[s.jsx(Ur,{className:"size-3.5 shrink-0 text-muted-foreground transition-transform group-open/setup:rotate-90","aria-hidden":"true"}),s.jsx("span",{className:"shrink-0 text-xs font-medium",children:e}),s.jsx("span",{className:"ml-auto truncate text-right text-[11px] text-muted-foreground",title:t,children:t})]}),s.jsx("div",{className:"grid min-w-0 gap-4 pb-4 pt-1",children:r})]})}const $o=(e,t="read-write")=>({host:e,ports:[443],protocol:"rest",access:t,enforcement:"enforce"}),Ah=["/usr/local/bin/node","/usr/bin/node"],yy=["generativelanguage.googleapis.com","cloudcode-pa.googleapis.com","oauth2.googleapis.com","accounts.google.com","www.googleapis.com","aiplatform.googleapis.com","*.aiplatform.googleapis.com"],EW=new Set(["cloudcode-pa.googleapis.com","daily-cloudcode-pa.googleapis.com","daily-cloudcode-pa.sandbox.googleapis.com"]),RW=e=>({...$o(e),...EW.has(e)?{deny:["fetchFromTrawlerCache","rewriteUri","generateContent"].map(t=>({method:"*",path:`/**:${t}*`}))}:{}}),Oh=["api.anthropic.com","api.openai.com","openrouter.ai","api.groq.com","api.deepseek.com","api.mistral.ai","api.x.ai","generativelanguage.googleapis.com"],vi=(e,t,r)=>({name:e,binaries:t,endpoints:[...new Set(r)].map(a=>$o(a))}),vy={claude:{name:"Claude Code",binaries:["/usr/bin/claude","/usr/local/bin/claude"],endpoints:["api.anthropic.com","platform.claude.com","claude.ai"].map(e=>$o(e)),authentication:"Attach a Claude credential or sign in with your subscription after connecting."},opencode:{name:"OpenCode",binaries:["/usr/local/lib/node_modules/opencode-ai/bin/opencode.exe","/usr/local/bin/opencode","/sandbox/.opencode/bin/opencode"],endpoints:[$o("models.opencode.ai","read-only"),$o("models.dev","read-only"),$o("opencode.ai"),...Oh.map(e=>$o(e))],authentication:"Includes connections for OpenCode’s hosted models. Use /connect for models that require an account. Other model providers need their own network rules and credentials."},codex:{name:"Codex",binaries:["/usr/bin/codex","/usr/local/bin/codex","/usr/local/lib/node_modules/@openai/**/codex","/usr/lib/node_modules/@openai/**/codex"],endpoints:["api.openai.com","auth.openai.com","chatgpt.com","ab.chatgpt.com"].map(e=>$o(e)),authentication:"Attach a Codex credential, or run codex after connecting and choose “Sign in with Device Code” (ChatGPT plan) or “Provide your own API key”. “Sign in with ChatGPT” can’t complete from a sandbox."},gemini:vi("Gemini CLI",[...Ah,"/usr/local/bin/gemini"],yy),pi:{...vi("Pi",[...Ah,"/usr/local/bin/pi"],[...Oh,...yy,"platform.claude.com","claude.ai","auth.openai.com","chatgpt.com","github.com","api.github.com","api.githubcopilot.com","*.githubcopilot.com","auth.x.ai","auth.kimi.com","api.kimi.com","auth.meta.com","api.meta.ai","radius.pi.dev"]),authentication:'Use /login inside Pi. If sign-in ends on a "site can’t be reached" page, copy the full URL from the address bar, paste it into Pi and press Enter.'},aider:vi("Aider",["/usr/local/bin/aider","/opt/aider/bin/python*","/usr/bin/python3*","/usr/local/bin/python3*"],Oh),copilot:vi("GitHub Copilot",[...Ah,"/usr/local/bin/copilot","/usr/local/lib/node_modules/@github/**/copilot","/usr/lib/node_modules/@github/**/copilot"],["github.com","api.github.com","api.githubcopilot.com","*.githubcopilot.com","copilot-proxy.githubusercontent.com"]),cursor:{...vi("Cursor",["/sandbox/.local/bin/cursor-agent","/sandbox/.local/share/cursor-agent/**","/usr/local/bin/cursor-agent"],[]),endpoints:[...["cursor.com","api2.cursor.sh","api3.cursor.sh","*.cursor.sh","*.cursorapi.com"].map(e=>$o(e)),{host:"agentn.global.api5.cursor.sh",ports:[443],protocol:"tcp",tlsSkip:!0}]},antigravity:{...vi("Antigravity",["/sandbox/.local/bin/agy","/sandbox/.antigravity/**","/sandbox/.local/share/antigravity/**","/usr/local/bin/agy",...Ah],[]),endpoints:[...[...yy,"antigravity.google","daily-cloudcode-pa.googleapis.com","daily-cloudcode-pa.sandbox.googleapis.com"].map(RW),$o("lh3.googleusercontent.com","read-only")]},kiro:vi("Kiro",["/sandbox/.local/bin/kiro-cli","/sandbox/.local/bin/kiro-cli-chat","/usr/local/bin/kiro-cli"],["app.kiro.dev","prod.us-east-1.auth.desktop.kiro.dev","runtime.us-east-1.kiro.dev","runtime.eu-central-1.kiro.dev","management.us-east-1.kiro.dev","management.eu-central-1.kiro.dev","q.us-east-1.amazonaws.com","q.eu-central-1.amazonaws.com","oidc.us-east-1.amazonaws.com","oidc.eu-central-1.amazonaws.com","cognito-identity.us-east-1.amazonaws.com","view.awsapps.com"]),droid:vi("Factory Droid",["/sandbox/.local/bin/droid","/sandbox/.factory/bin/**","/usr/local/bin/droid"],["factory.ai","*.factory.ai",...Oh])},AW=e=>({host:e,ports:[443],protocol:"rest",enforcement:"enforce",allow:[{method:"GET",path:"/**"}]}),_E={vscode:{name:"VS Code Server",rule:"tool-vscode-server",binaries:["/usr/bin/curl","/usr/bin/wget","/sandbox/.vscode-server/**"],endpoints:["update.code.visualstudio.com","vscode.download.prss.microsoft.com"].map(AW)}};function G3(e){if((e==null?void 0:e.source)!=="build")return{profiles:[],unsupported:[]};const t=[...new Set(e.agents??[])];return{profiles:[...t.filter(r=>vy[r]).map(r=>({id:r,rule:`agent-${r}`,...vy[r]})),...[...new Set(e.runtimes??[])].filter(r=>_E[r]).map(r=>({id:r,..._E[r]}))],unsupported:t.filter(r=>!vy[r])}}const Gl=Ls.filter(e=>!G3({source:"build",agents:[e.id]}).unsupported.length);function qw(e){const t=Array.isArray(e)?e:e==="terminal"?[]:[e];if(t.some(r=>!Gl.some(a=>a.id===r)))throw new Error("Choose a supported agent.");return Gl.filter(r=>t.includes(r.id)).map(r=>r.id)}function OW(e,t){const r=qw(e);if(r.length!==1||t==="shell")return"shell";const a=Gl.find(l=>l.id===t&&r.includes(l.id));if(!a)throw new Error("Choose Shell or a selected agent.");return a.command}function Yw(e,t="",r="agent",a=!1,l=[]){if(!["agent","shell"].includes(r))throw new Error("Choose Shell or the selected agent.");const c=a||l.length?["python","node"]:[],u=qw(e),f=Gl.find(m=>m.id===u[0]);return ba({name:t,agents:u,runtimes:c,setups:l.map(m=>m.id),setupRevisions:Object.fromEntries(l.map(m=>[m.id,m.revision])),command:Array.isArray(e)||r==="shell"?"":(f==null?void 0:f.command)||""})}function MW(e,t,r="agent",a=!1,l=[]){const c=Yw(t,"",r,a,l);return e.find(u=>u.managed&&u.status==="ready"&&u.image&&u.build===GG(c)&&JSON.stringify(ba({...u.recipe,name:""}))===JSON.stringify(c))}function LE(e,t){const r={claude:["claude-code"],codex:["codex"]}[t]||[];return e.filter(a=>r.includes(a.type))}const q3=(e,t)=>new Promise((r,a)=>{const l=()=>{clearTimeout(c),a(new DOMException("Preparation cancelled.","AbortError"))},c=setTimeout(()=>{t==null||t.removeEventListener("abort",l),r()},e);t==null||t.addEventListener("abort",l,{once:!0}),t!=null&&t.aborted&&l()});async function DW(e,t,{openIn:r="agent",withSetups:a=!1,setups:l=[],signal:c,onProgress:u=()=>{},onBuild:f=()=>{},onBuildUpdate:m=()=>{},wait:h=q3}={}){const g=()=>{if(c!=null&&c.aborted)throw new DOMException("Preparation cancelled.","AbortError")};g();const p=await e.imageTemplates();g();const b=MW(p,t,r,a,l);if(b)return m(b),b;const v=qw(t),S=`q-${(v.length>1?"agents":v[0]||"terminal").slice(0,9)}-${crypto.randomUUID().slice(0,6)}`;u("Preparing environment… First-time setup can take a few minutes.");const C=await e.buildImageTemplate(Yw(t,S,r,a,l));if(f(S),m({...C,name:S}),g(),C.status==="failed")throw new Error(C.error||"Environment build failed.");for(let N=0;N<900;N++){await h(2e3,c),g();const E=(await e.imageTemplates()).find(T=>T.name===S);if(g(),!E)throw new Error("The environment build disappeared. Check Templates and try again.");if(m(E),E.status==="failed")throw new Error(E.error||"Environment build failed.");if(E.status==="ready")return E}throw new Error("The build is still running. Check Templates before trying again.")}async function Y3(e,t,r,{signal:a,expectedRevisions:l={},onProgress:c=()=>{},wait:u=q3}={}){const f=()=>{if(a!=null&&a.aborted)throw new DOMException("Preparation cancelled.","AbortError")};if(f(),!t.length)return{setups:[],accessReview:null};const m=await e.setups(),h=[],g=r?{}:null;for(const p of t){f();const b=m.find(j=>j.id===p);if(!b||r&&r[p]!==b.revision||l[p]&&l[p]!==b.revision)throw new Error("A selected Setup changed. Reopen the dialog and review it again.");c(`Preparing MCP packages for ${b.name}…`);let v;try{v=await e.prepareLaunchSetup(p,b.revision);for(let j=0;v.status==="running"&&j<900;j++)f(),c(v.message||`Preparing ${b.name}…`),await u(2e3,a),f(),v=await e.setupPreparation(v.id);if(f(),v.status!=="complete"||!v.setup)throw new Error(v.message||"Package preparation did not finish. Retry creation.");h.push(v.setup),g&&(g[v.setup.id]=v.setup.revision)}catch(j){throw v!=null&&v.id&&v.status==="running"&&await e.cancelSetupPreparation(v.id).catch(()=>{}),j}}return{setups:h,accessReview:g}}const ar=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),K3=["claude","codex","cursor","pi","antigravity","opencode"].map(e=>Gl.find(t=>t.id===e)).filter(Boolean),BE=Gl.filter(e=>!K3.includes(e)),zW=[{id:"empty",label:"Empty"},{id:"folder",label:"Local folder"},{id:"repo",label:"Git repository"}];function PW(e){var t;try{const r=new URL(e.trim());if(r.protocol!=="https:")return null;const a=(t=r.pathname.split("/").filter(Boolean).pop())==null?void 0:t.replace(/\.git$/,"");return a?`${ya}/${/^[A-Za-z0-9]([A-Za-z0-9._-]{0,61}[A-Za-z0-9])?$/.test(a)?a:"repo"}`:null}catch{return null}}const IW={gitignore:".gitignore applied","gitignore-empty":".gitignore matched nothing, so everything is sent",none:"Not a git repository, so everything is sent"},_W={included:e=>`git history included (${rr(e.gitBytes)})`,worktree:()=>"Git worktree: history not included",subfolder:()=>"Inside a repository: history not included",none:()=>null};function LW({plan:e,sandbox:t}){return s.jsxs("div",{className:"grid min-w-0 gap-1 text-[11px]",children:[e.over?s.jsxs("p",{className:"text-red-700",children:["Over ",rr(e.limit),". Add a .gitignore, or upload it from a terminal."]}):s.jsxs("p",{children:[e.files.toLocaleString()," ",e.files===1?"file":"files"," · ",rr(e.bytes)," → ",s.jsx("span",{className:"font-mono",children:e.dest})]}),s.jsx("p",{className:"text-muted-foreground",children:[IW[e.filter],_W[e.git](e),e.links?`${e.links} ${e.links===1?"symlink":"symlinks"} kept as links`:null].filter(Boolean).join(" · ")}),e.secretCount>0&&s.jsxs("p",{className:"text-amber-700",children:["May hold secrets: ",s.jsx("span",{className:"font-mono",children:e.secrets.join(", ")}),e.secretCount>e.secrets.length?` and ${e.secretCount-e.secrets.length} more`:"",". Add ",e.secretCount===1?"it":"them"," to .gitignore to leave ",e.secretCount===1?"it":"them"," out."]}),s.jsxs("details",{className:"mt-1",children:[s.jsx("summary",{className:"cursor-pointer text-muted-foreground",children:"Upload from a terminal instead"}),e.git==="included"&&s.jsx("p",{className:"mt-1 text-muted-foreground",children:"Without git history."}),s.jsx(rf,{command:Lv(t||"NAME",e.display,ya)})]})]})}function BW({org:e,value:t,onChange:r,onCreated:a,onAddPolicy:l,invalid:c=!1}){const u=Bs(),f=L3(e.policies,t),m=Object.fromEntries(e.groups.map(g=>{var p,b;return[g.id,((b=(p=e.members)==null?void 0:p[g.id])==null?void 0:b.length)??0]})),h=e.groups.filter(g=>t.includes(g.id));return s.jsx("div",{id:"sandbox-groups",className:`-m-3 rounded-lg p-3 transition-colors ${c?"bg-destructive/5 ring-1 ring-destructive/60":""}`,children:s.jsxs("fieldset",{"aria-invalid":c||void 0,className:"grid min-w-0 gap-2.5",children:[s.jsxs("legend",{className:"mb-2.5 text-xs font-medium",children:["Groups ",s.jsx("span",{className:"text-muted-foreground",children:"· Optional"})]}),s.jsx(ef,{multiple:!0,groups:e.groups,counts:m,value:t,onChange:r,onCreated:a}),s.jsx(Rn.p,{initial:u?!1:{opacity:0,y:3},animate:{opacity:1,y:0},transition:{duration:.18},"aria-live":"polite",className:`text-[11px] leading-relaxed ${c?"text-destructive":"text-muted-foreground"}`,children:f.length?s.jsxs(s.Fragment,{children:["Gets ",f.length===1?"this network rule":`these ${f.length} network rules`,": ",s.jsx("span",{className:"text-foreground",children:f.map(g=>g.name).join(", ")}),"."]}):h.length?s.jsx(s.Fragment,{children:"No network rules yet: this sandbox starts locked down. Add a rule to allow more."}):e.groups.length?null:"Create a group to share network access between sandboxes. Network rules can then target the whole group."},t.join(",")||"empty"),h.length>0&&!f.length&&s.jsx(ue,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:l,children:"Add network rule"})]})})}function $E(e,t){const r=yo.getSnapshot().filter(a=>a.status!=="failed"&&a.status!=="cancelled"&&ar(a.location)===ar(t));return new Set([...e.map(a=>a.name),...r.map(a=>a.name)])}function VE(e,t="sandbox"){for(let r=1;r<1e3;r++){const a=`${t}-${r}`;if(!e.has(a))return a}return""}function X3({locations:e,location:t,onLocationChange:r,onRefreshLocations:a,allowRemote:l=!1,...c}){var k;const u=Cn(),f=$t(),[m,h]=x.useState(null),g=(k=c.initialImageTemplate)==null?void 0:k.location,p=e??[],b=g??t,v=b?p.find(M=>ar(M)===ar(b))??(ar(u)===ar(b)?u:b):p.find(M=>ar(M)===m)??u??p.find(M=>M.target===f.target&&M.connected)??null,j=!c.initialImageTemplate&&(l||p.length>1),[S,C]=x.useState("where"),[N,E]=x.useState(null);x.useEffect(()=>{c.open||h(null),C("where"),E(null)},[c.open]);const T=M=>{const R=p.find(O=>ar(O)===M&&O.connected);R&&(h(M),r==null||r(R))};x.useEffect(()=>{if(!N)return;const M=p.find(O=>O.gateway===N&&O.connected);if(M){E(null),T(ar(M)),C("form");return}const R=setInterval(()=>a==null?void 0:a(),1500);return()=>clearInterval(R)},[N,p]);const A=j&&S==="where"?s.jsx(F3,{locations:p,allowRemote:l,connecting:!!N,onPick:M=>{T(M),C("form")},onConnected:M=>{E(M.gateway),a==null||a()},onCancel:()=>c.onOpenChange(!1)}):null;return s.jsx(Oa,{location:v,children:s.jsx($W,{...c,locations:p,onLocationChange:T,chooser:A,onChangeLocation:j?()=>C("where"):void 0},ar(v)??"default")})}function $W({open:e,onOpenChange:t,onStarted:r,initialImageTemplate:a=null,locations:l,onLocationChange:c,chooser:u,onChangeLocation:f}){var Ge,Ye;const m=$t(),h=Cn(),g=Bs(),[p,b]=x.useState([]),[v,j]=x.useState([]),[S,C]=x.useState(""),[N,E]=x.useState([]),[T,A]=x.useState([]),[k,M]=x.useState(null),[R,O]=x.useState(""),[D,_]=x.useState([]),[L,q]=x.useState("quick"),[P,$]=x.useState([]),[H,F]=x.useState("shell"),[V,G]=x.useState({}),[X,B]=x.useState(null),[Z,K]=x.useState(null),[se,I]=x.useState("empty"),U=Tr(),Q=!!(h!=null&&h.cloud||((h==null?void 0:h.target)??(U==null?void 0:U.target))==="cloud"),[te,le]=x.useState(""),[J,ne]=x.useState(null),[ce,oe]=x.useState(""),[W,de]=x.useState(null),[Ee,Be]=x.useState([]),[Ne,Ae]=x.useState(null),[ee,re]=x.useState(!1),[xe,he]=x.useState(0),[$e,we]=x.useState(!1);x.useEffect(()=>{if(!e||(h==null?void 0:h.connected)===!1)return;let pe=!0;return b([]),j([]),m.overview().then(Ie=>{if(!pe)return;const ut=Ie.sandboxes??[],Qe=Ie.providers??[];b(ut),j(Qe),C(VE($E(ut,h))),_(Qe.map(kt=>kt.name))}).catch(Ie=>{pe&&B(Ie.message)}),C(""),q(a?"template":"quick"),$([]),F("shell"),G({}),A([]),O((a==null?void 0:a.name)||""),E(a?[a]:[]),m.imageTemplates().then(Ie=>{pe&&E(Ie.filter(ut=>ut.status==="ready"||ut.exists))}).catch(Ie=>{pe&&B(Ie.message)}),_([]),B(null),K(null),de(null),I("empty"),le(""),ne(null),oe(""),Be([]),we(!1),Ae(null),re(tp(h)),(tp(h)?m.syncLocalCatalog():Promise.resolve(null)).then(async Ie=>{if(!pe)return;const ut=await m.org();pe&&(Ie!=null&&Ie.available&&(ut.groups=ut.groups.filter(Qe=>!Ie.importedGroups.includes(Qe.id)||Ie.groups.includes(Qe.id))),de(ut),Ae(Ie))}).catch(Ie=>{pe&&(de(null),B(`Could not load sandbox settings: ${Ie.message}`))}).finally(()=>{pe&&re(!1)}),()=>{pe=!1}},[e,m,h==null?void 0:h.connected,h==null?void 0:h.remote,a,xe]);const _e=L==="template"?N.find(pe=>pe.name===R):null,Re=Gl.filter(pe=>P.includes(pe.id)),Te=G3(L==="quick"?Yw(P):_e!=null&&_e.managed?_e.recipe:null),be=L==="quick"?[...new Set(Re.flatMap(pe=>{const He=V[pe.id];return LE(v,pe.id).some(Ie=>Ie.name===He)?[He]:[]}))]:D,Ue=_e!=null&&_e.managed&&_e.recipe.source==="build"?Ls.filter(pe=>_e.recipe.agents.includes(pe.id)):null,Ze=L==="quick"?P:(Ue??[]).map(pe=>pe.id),ht=O6(Ze),at=L==="quick"?T.length>0:!!((Ye=(Ge=_e==null?void 0:_e.recipe)==null?void 0:Ge.setups)!=null&&Ye.length),Pe=at&&!ht.length;function ct(pe){const He=P.includes(pe)?P.filter(Ie=>Ie!==pe):[...P,pe];$(He),B(null),(He.length!==1||!He.includes(H))&&F("shell"),G(Ie=>Object.fromEntries(Object.entries(Ie).filter(([ut])=>He.includes(ut)))),/^(sandbox|terminal|claude|codex|cursor|opencode|pi|antigravity|copilot|kiro|droid|aider)-\d+$/.test(S)&&C(VE($E(p??[],h),He.length===1?He[0]:"sandbox"))}x.useEffect(()=>{if(se!=="folder"||!te.trim()){ne(null);return}let pe=!1;ne({loading:!0});const He=setTimeout(()=>{m.localFolder(te.trim()).then(Ie=>{pe||ne({data:Ie})}).catch(Ie=>{pe||ne({error:Ie.message})})},400);return()=>{pe=!0,clearTimeout(He)}},[se,te,m]);const We=Ee.every(pe=>W==null?void 0:W.groups.some(He=>He.id===pe)),me=se==="repo"?PW(ce):null,De=se==="empty"||(se==="folder"?!!(J!=null&&J.data&&!J.data.over):!!me),Oe=se==="folder"?te.trim():se==="repo"?ce.trim():"";function nt(pe){var Xe;if(pe.preventDefault(),(h==null?void 0:h.connected)===!1)return;const He=[!S&&"sandbox-name",L==="template"&&!_e&&"sandbox-image-template",!We&&"sandbox-groups"].find(Boolean);if(He||!De||Pe){we(!0),He&&((Xe=document.getElementById(He))==null||Xe.scrollIntoView({behavior:g?"auto":"smooth",block:"center"}));return}const Ie=se==="folder"?{folder:J.data.path}:se==="repo"?{repository:ce.trim()}:{},ut=S.trim(),Qe=L==="quick",kt=P,At=Qe?{session:OW(P,H)}:{},jt=T,Ht=k,St=be,dt=ht,yt=Ee,ae=_e;yo.start({name:ut,location:h,task:async({signal:rt,progress:Wt,build:Mn,creating:Pt})=>{let Mt=ae,Dn=[],oo=null,ms=null;const Er=()=>{ms&&m.cancelImageBuild(ms).catch(Ms=>qe.error(Ms.message))};rt.addEventListener("abort",Er);try{if(Qe){const Ms=await Y3(m,jt,Ht,{signal:rt,onProgress:Wt});Dn=Ms.setups.map($s=>$s.id),oo=Ms.accessReview,Mt=await DW(m,kt,{withSetups:jt.length>0,setups:Ms.setups,signal:rt,onProgress:Wt,onBuildUpdate:Mn,onBuild:$s=>{ms=$s,rt.aborted&&Er()}})}}finally{rt.removeEventListener("abort",Er)}if(rt.aborted)throw new DOMException("Cancelled","AbortError");Pt();const hs=await m.create({name:ut,imageTemplate:Mt.name,includeTemplateAccess:!Qe,...At,providers:St,setups:Dn,setupAccessReview:oo,setupTargets:dt,groups:yt,...Ie});hs.seed&&qe(`${hs.seed.kind==="folder"?"Uploading":"Cloning"} ${hs.seed.source}`,{description:`Into ${hs.seed.dest} once the sandbox starts. Progress is in its Files tab.`});for(const Ms of hs.opened??[])qe(`Opened ${Ms.name||"default"} on port ${Ms.port}`,{description:Ms.url??void 0});return{...hs,image:Mt.image,providers:St,createdAt:new Date().toISOString(),...h?{location:h}:{}}}}),t(!1),r==null||r()}return s.jsxs(s.Fragment,{children:[s.jsx(yn,{open:e,onOpenChange:t,children:s.jsx(vn,{className:"max-h-[90svh] gap-4 bg-transparent p-0 ring-0 sm:max-w-4xl",children:u??s.jsx(s.Fragment,{children:s.jsx("form",{onSubmit:nt,className:"@container flex min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-popover ring-1 ring-foreground/10 max-h-[90svh]",children:s.jsxs(Ef,{value:L,onValueChange:pe=>{q(pe),B(null)},className:"contents",children:[s.jsxs(Nn,{className:"shrink-0 gap-3 px-5 pt-5 pb-4 @3xl:px-7 @3xl:pt-6",children:[f&&s.jsx("div",{className:"pr-8",children:s.jsx(Gw,{step:2})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 pr-8",children:[s.jsx(wn,{children:"New sandbox"}),f?s.jsx(U3,{location:h,onChange:f}):!a&&l.length>0?null:s.jsx(So,{location:h}),s.jsxs(Rf,{className:"ml-auto w-fit","aria-label":"Sandbox creation method",children:[s.jsx(wr,{value:"quick",className:"px-3 text-xs",children:"Quick setup"}),s.jsx(wr,{value:"template",className:"px-3 text-xs",children:"From template"})]})]}),!f&&l.length>0&&!a&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"sandbox-location",className:"text-xs",children:"Location"}),s.jsxs(Hh,{value:ar(h)??"",onValueChange:c,items:l.map(pe=>({value:ar(pe),label:`${_s(pe)}${pe.connected?"":" · Disconnected"}`})),children:[s.jsx(Gh,{id:"sandbox-location",className:"w-full text-xs",children:s.jsx(Fh,{placeholder:"Choose a connected location"})}),s.jsx(qh,{align:"start",alignItemWithTrigger:!1,children:l.map(pe=>s.jsxs(Ad,{value:ar(pe),disabled:!pe.connected,children:[_s(pe),pe.connected?"":" · Disconnected"]},ar(pe)))})]})]}),(h==null?void 0:h.connected)===!1&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"This location is disconnected. Choose a connected location to create a sandbox."}),ee&&s.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading your local network policies, MCPs & Skills, and Groups…"}),(Ne==null?void 0:Ne.available)&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"Your local network policies, MCPs & Skills, and Groups are available here. Existing remote sandboxes keep their settings."}),tp(h)&&!ee&&!W&&s.jsx(ue,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>he(pe=>pe+1),children:"Retry loading settings"})]}),s.jsx("div",{className:"grid min-h-0 flex-1 overflow-y-auto overscroll-contain border-t border-border @3xl:grid-cols-[minmax(0,1fr)_19rem] @3xl:overflow-hidden",children:s.jsxs("fieldset",{disabled:(h==null?void 0:h.connected)===!1,className:"contents",children:[s.jsxs(Rn.div,{initial:g?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,ease:[.22,1,.36,1]},className:"grid min-w-0 content-start gap-6 p-5 @3xl:overflow-y-auto @3xl:p-7",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"sandbox-name",className:"text-xs",children:"Name"}),s.jsx(Rt,{id:"sandbox-name",value:S,onChange:pe=>C(pe.target.value.toLowerCase()),className:"h-10 font-mono text-sm",required:!0,"aria-invalid":$e&&!S||void 0,pattern:"[a-z0-9]([a-z0-9\\-]{0,17}[a-z0-9])?",maxLength:19,title:"Lowercase letters, digits and dashes, up to 19",autoFocus:!0})]}),s.jsxs(bo,{value:"quick",className:"grid gap-4",children:[s.jsxs("fieldset",{className:"min-w-0",children:[s.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-2 gap-2 @3xl:grid-cols-3",children:K3.map(pe=>s.jsxs("label",{className:"relative min-w-0",children:[s.jsx("input",{type:"checkbox",checked:P.includes(pe.id),onChange:()=>ct(pe.id),className:"peer sr-only"}),s.jsxs("span",{className:"flex min-h-11 cursor-pointer items-center gap-2.5 rounded-lg border border-border bg-background px-3 py-2 text-xs transition-all hover:-translate-y-px hover:bg-muted/50 hover:shadow-sm motion-reduce:hover:translate-y-0 @3xl:min-h-14 peer-checked:border-foreground/40 peer-checked:bg-accent peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-disabled:pointer-events-none peer-disabled:opacity-50",children:[s.jsx("img",{src:pe.logo,alt:"",className:"size-4 shrink-0 object-contain"}),s.jsx("span",{className:"min-w-0 flex-1",children:pe.name}),P.includes(pe.id)&&s.jsx(Fn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]})]},pe.id))}),s.jsxs(ju,{children:[s.jsxs(Su,{render:s.jsx(ue,{type:"button",variant:"outline",className:"mt-2 w-full justify-between text-xs"}),children:[s.jsx("span",{className:"truncate",children:BE.filter(pe=>P.includes(pe.id)).map(pe=>pe.name).join(", ")||"More agents"}),s.jsx(Xo,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}),s.jsx(Nu,{align:"start",children:BE.map(pe=>s.jsxs(Iw,{checked:P.includes(pe.id),onCheckedChange:()=>ct(pe.id),closeOnClick:!1,className:"text-xs",children:[s.jsx("img",{src:pe.logo,alt:"",className:"size-4 shrink-0 object-contain"}),pe.name]},pe.id))})]})]}),Re.length>0&&s.jsxs("fieldset",{className:"min-w-0",children:[s.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Open in"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{id:"shell",name:"Shell"},...Re.length===1?Re:[]].map(pe=>s.jsxs("label",{className:"relative min-w-0",children:[s.jsx("input",{type:"radio",name:"quick-open-in",value:pe.id,checked:H===pe.id,onChange:()=>F(pe.id),className:"peer sr-only"}),s.jsxs("span",{className:"flex min-h-16 cursor-pointer items-center gap-2.5 rounded-lg border border-border bg-background px-3 py-3 text-xs transition-colors hover:bg-muted/50 peer-checked:border-foreground/40 peer-checked:bg-accent peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-disabled:pointer-events-none peer-disabled:opacity-50",children:[pe.id==="shell"?s.jsx(Kv,{className:"size-5 shrink-0","aria-hidden":"true"}):s.jsx("img",{src:pe.logo,alt:"",className:"size-5 shrink-0 object-contain"}),s.jsx("span",{className:"min-w-0 flex-1 font-medium",children:pe.name}),s.jsx("span",{"aria-hidden":"true",className:`flex size-3.5 shrink-0 items-center justify-center rounded-full border ${H===pe.id?"border-foreground":"border-muted-foreground/40"}`,children:H===pe.id&&s.jsx("span",{className:"size-1.5 rounded-full bg-foreground"})})]})]},pe.id))})]}),Re.map(pe=>{const He=LE(v,pe.id);return He.length?s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs(En,{htmlFor:`quick-sign-in-${pe.id}`,className:"text-xs",children:[pe.name," API key"]}),s.jsxs(Hh,{value:V[pe.id]||"",onValueChange:Ie=>G(ut=>({...ut,[pe.id]:Ie??""})),children:[s.jsx(Gh,{id:`quick-sign-in-${pe.id}`,className:"w-full text-xs",children:s.jsx(Fh,{children:V[pe.id]||"None, I’ll use my subscription"})}),s.jsx(qh,{align:"start",alignItemWithTrigger:!1,children:s.jsxs(bk,{children:[s.jsx(Ad,{value:"",className:"text-xs",children:"None, I’ll use my subscription"}),He.map(Ie=>s.jsx(Ad,{value:Ie.name,className:"text-xs",children:Ie.name},Ie.name))]})})]})]},pe.id):null})]}),s.jsx(bo,{value:"template",className:"grid gap-4",children:s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"sandbox-image-template",className:"text-xs",children:"Environment"}),s.jsxs(Hh,{value:R,onValueChange:pe=>O(pe??""),children:[s.jsx(Gh,{id:"sandbox-image-template","aria-invalid":$e&&!_e||void 0,className:"w-full text-xs",children:s.jsx(Fh,{children:R||"Choose a template"})}),s.jsx(qh,{align:"start",alignItemWithTrigger:!1,children:s.jsx(bk,{children:N.map(pe=>s.jsx(Ad,{value:pe.name,className:"text-xs",children:pe.name},pe.name))})})]}),$e&&!_e&&N.length>0&&s.jsx("p",{className:"text-[11px] text-destructive",children:"Choose a template to create a sandbox."}),!N.length&&s.jsx("p",{className:`text-[11px] ${$e?"text-destructive":"text-muted-foreground"}`,children:"No ready templates. Use Quick setup or create one in Templates."}),_e&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:Ue?`Included tools: ${[...Ue.map(pe=>pe.name),...(_e.recipe.customAgents??[]).map(pe=>pe.name),"Terminal"].join(", ")}`:"Installed tools are not reported by this template."})]})}),L==="template"&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium",children:"Providers"}),v.length?s.jsx("div",{className:"flex flex-wrap gap-1.5",children:v.map(pe=>{const He=D.includes(pe.name);return s.jsxs("button",{type:"button","aria-pressed":He,onClick:()=>_(Ie=>He?Ie.filter(ut=>ut!==pe.name):[...Ie,pe.name]),className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${He?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[s.jsx("span",{className:`size-1.5 rounded-full ${He?"bg-emerald-500":"bg-stone-300"}`,"aria-hidden":"true"}),s.jsx("span",{className:"font-mono",children:pe.name}),s.jsx("span",{className:"text-muted-foreground",children:pe.type})]},pe.name)})}):s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No providers"})]}),X&&s.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:X})]}),s.jsxs(Rn.aside,{initial:g?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,delay:.06,ease:[.22,1,.36,1]},className:"grid min-w-0 content-start gap-6 border-t border-border bg-muted/25 p-5 @3xl:overflow-y-auto @3xl:border-t-0 @3xl:border-l @3xl:p-6",children:[W?s.jsx(BW,{org:W,value:Ee,onChange:Be,invalid:$e&&!We,onAddPolicy:()=>K(Vd({appliesTo:{everyone:!1,groups:Ee,sandboxes:[]}})),onCreated:pe=>de(He=>({...He,groups:[...He.groups,pe].sort((Ie,ut)=>Ie.name.localeCompare(ut.name)),members:{...He.members,[pe.id]:[]}}))}):s.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:X?"Groups unavailable. Reopen this dialog to retry.":"Loading groups…"}),(L==="quick"||at&&(Pe||Ze.includes("aider")))&&s.jsxs("div",{className:"space-y-3",children:[L==="quick"&&!ee&&s.jsx(T3,{localCatalog:Ne,autoPrepare:!0,automaticAccess:!0,preparationContext:"sandbox",accessReview:k,onAccessReview:M,value:T,onChange:A}),at&&Pe&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:Ze.includes("aider")?"Setup installation is unavailable for Aider. Choose another agent.":L==="quick"?"Choose an agent to use this Setup.":"Choose a template with a supported agent to use this Setup."}),at&&!Pe&&Ze.includes("aider")&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"Setup installation is unavailable for Aider."})]}),s.jsxs("div",{className:"grid min-w-0",children:[s.jsx(kl,{title:"Add project files",summary:Oe,children:s.jsxs("div",{className:"grid min-w-0 gap-1.5",children:[s.jsx("span",{className:"text-xs font-medium",children:"Start with"}),s.jsx("div",{className:"flex items-center gap-1 rounded-md border border-border p-0.5",children:zW.filter(pe=>!Q||pe.id!=="folder").map(pe=>s.jsx("button",{type:"button",onClick:()=>I(pe.id),"aria-pressed":se===pe.id,className:`flex-1 rounded px-2.5 py-1 text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${se===pe.id?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,children:pe.label},pe.id))}),se==="folder"&&s.jsxs(s.Fragment,{children:[s.jsx(Rt,{value:te,onChange:pe=>le(pe.target.value),className:"font-mono text-xs",placeholder:"~/code/my-project","aria-label":"Folder on this computer"}),(J==null?void 0:J.loading)&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Checking the folder…"}),(J==null?void 0:J.error)&&s.jsx("p",{className:"text-[11px] text-red-700",children:J.error}),(J==null?void 0:J.data)&&s.jsx(LW,{plan:J.data,sandbox:S})]}),se==="repo"&&s.jsxs(s.Fragment,{children:[s.jsx(Rt,{value:ce,onChange:pe=>oe(pe.target.value),className:"font-mono text-xs",placeholder:"https://github.com/org/repo","aria-label":"Git repository URL"}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[me?s.jsxs(s.Fragment,{children:["Cloned into ",s.jsx("span",{className:"font-mono",children:me})," once the sandbox starts. "]}):"An https:// URL. ","Public repositories only. Your access rules must allow Git connections to this host."]})]})]})}),Te.profiles.length>0&&s.jsx(kl,{title:Te.profiles.some(pe=>pe.rule.startsWith("tool-"))?"Agent and tool connections":"Agent connections",summary:`${new Set(Te.profiles.flatMap(pe=>pe.endpoints.map(He=>`${He.host}:${He.ports.join(",")}`))).size} destinations`,children:s.jsx("div",{className:"max-h-52 divide-y overflow-y-auto",children:Te.profiles.map(pe=>s.jsxs("details",{className:"px-3 py-2",children:[s.jsxs("summary",{className:"cursor-pointer text-xs",children:[pe.name,s.jsxs("span",{className:"ml-2 text-[11px] text-muted-foreground",children:[pe.endpoints.length," destinations · ",pe.rule]})]}),s.jsx("ul",{className:"mt-2 space-y-1",children:pe.endpoints.map(He=>{var Ie;return s.jsxs("li",{className:"flex flex-wrap items-baseline justify-between gap-x-3 text-[11px]",children:[s.jsxs("span",{className:"break-all font-mono",children:[He.host,":",He.ports.join(",")]}),s.jsx("span",{className:"text-muted-foreground",children:He.tlsSkip?"TLS passthrough":(Ie=He.allow)!=null&&Ie.length?`${He.allow.map(ut=>ut.method).join(", ")} only`:He.access==="read-only"?"Read only":"Read & write"})]},He.host)})}),pe.authentication&&s.jsx("p",{className:"mt-2 text-[11px]",children:pe.authentication}),s.jsx("p",{className:"mt-2 text-[11px] text-muted-foreground",children:"Allowed programs"}),s.jsx("ul",{className:"mt-1 space-y-1 break-all font-mono text-[10px] text-muted-foreground",children:pe.binaries.map(He=>s.jsx("li",{children:He},He))})]},pe.id))})})]})]})]})}),s.jsxs(No,{className:"mx-0 mb-0 shrink-0 items-center rounded-none border-t border-border bg-popover px-5 py-4 @3xl:px-7",children:[s.jsx(ue,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),s.jsx(ue,{type:"submit",disabled:(h==null?void 0:h.connected)===!1,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:"Create sandbox"})]})]})})})})}),s.jsx(JM,{open:!!Z,initial:Z,onOpenChange:pe=>{pe||K(null)},groups:(W==null?void 0:W.groups)??[],sandboxes:(p??[]).map(pe=>pe.name),assignments:(W==null?void 0:W.assignments)??{},onGroupCreated:pe=>de(He=>({...He,groups:[...He.groups,pe]})),onSaved:(pe,He)=>{var Ie;Be(ut=>[...new Set([...ut,...He.appliesTo.groups])]),de(ut=>({...ut,policies:[...ut.policies.filter(Qe=>Qe.id!==He.id),He]})),(Ie=pe.failed)!=null&&Ie.length?qe.error("Rule saved, but some sandboxes could not be updated."):qe.success(`Saved ${He.name}`)}})]})}function nx({count:e,rowHeight:t,overscan:r=8}){const[a,l]=x.useState(null),[c,u]=x.useState(0),[f,m]=x.useState(0);x.useLayoutEffect(()=>{if(!a)return;const b=()=>m(a.clientHeight);b();const v=new ResizeObserver(b);return v.observe(a),()=>v.disconnect()},[a]);const h=Math.max(0,Math.floor(c/t)-r),g=Math.ceil((f||600)/t)+r*2,p=Math.min(e,h+g);return{ref:l,onScroll:b=>u(b.currentTarget.scrollTop),start:h,end:p,paddingTop:h*t,totalHeight:e*t,scrollToTop:()=>{a==null||a.scrollTo({top:0}),u(0)}}}const UE=["api.anthropic.com","api.openai.com","github.com","pypi.org","registry.npmjs.org","files.pythonhosted.org","objects.githubusercontent.com","huggingface.co","sentry.io","api.stripe.com","pastebin.com","ngrok.io","s3.amazonaws.com"],HE=new Set(["pastebin.com","ngrok.io","api.stripe.com"]);function VW(e){let t=e>>>0;return()=>(t=t*1664525+1013904223>>>0)/2**32}const UW=(e,t)=>t[Math.floor(e()*t.length)];function W3(e,t=Math.random,r=new Date().toISOString()){const a=e[Math.floor(t()**2.2*e.length)],l=t()<.08?UW(t,[...HE]):UE[Math.floor(t()**1.8*(UE.length-3))],c=HE.has(l)?t()<.9:t()<.03;return{sandbox:a.name,at:r,kind:"audit",level:"OCSF",category:"NET",action:"OPEN",severity:c?"MED":"INFO",verdict:c?"denied":"allowed",destination:`${l}:443`,binary:"/usr/local/bin/claude",reason:c?"policy_dns_ineligible":null,policy:c?null:"_provider_my_claude",message:`NET:OPEN [${c?"MED":"INFO"}] ${c?"DENIED":"ALLOWED"} /usr/local/bin/claude(0) -> ${l}:443 #${Math.floor(t()*1e9)}`,detail:`/usr/local/bin/claude(0) -> ${l}:443`}}function HW(e,t=2e3){const r=VW(11),a=Date.now(),l=new Map(e.map(c=>[c.name,c.phase]));return Array.from({length:t},(c,u)=>W3(e,r,new Date(a-u*1500).toISOString())).filter(c=>["ready","error"].includes(l.get(c.sandbox)))}function Q3(e){const t=x.useMemo(()=>null,[]),[r,a]=x.useState(()=>t?HW(t):[]);return x.useEffect(()=>{if(!t)return;const l=t.filter(u=>u.phase==="ready"),c=setInterval(()=>{const u=Array.from({length:1+Math.floor(Math.random()*6)},()=>W3(l));a(f=>[...u,...f].slice(0,2e3))},450);return()=>clearInterval(c)},[t]),t?{...e,sandboxes:t,events:r,demo:!0}:e}const FE=[],FW={context:'["preview","default"]',gateway:"preview",workspace:"default",label:"Local",remote:!1,connected:!0},GE=40,GW=["all","running","sleeping","provisioning","error","unknown"],rs=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),nr=Vn,Mh=e=>JSON.stringify([rs(e.location),e.name]),ji=e=>e.toLocaleString("en-US"),wy=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),qE=[{id:"name",label:"Sandbox",width:"26%"},{id:"type",label:"Type",width:"11%",filter:"values"},{id:"phase",label:"Status",width:"11%",filter:"values"},{id:"owner",label:"Owner",width:"12%",filter:"values"},{id:"image",label:"Image",width:"22%",filter:"values"},{id:"startedAt",label:"Uptime",width:"8%"},{id:"createdAt",label:"Created",width:"10%",filter:"recent"}],qW=[{value:"1",label:"Last 24 hours"},{value:"7",label:"Last 7 days"},{value:"30",label:"Last 30 days"}],jy={type:[],phase:[],owner:[],image:[],createdAt:""},YW=Object.fromEntries(Object.entries(Fl).map(([e,t])=>[t.label,e])),Z3=()=>s.jsx(DR,{"aria-hidden":"true",strokeWidth:1.5,className:"size-3.5 shrink-0 text-muted-foreground"}),Sy={type:e=>s.jsx(I3,{type:YW[e.value]}),phase:e=>s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx("span",{"aria-hidden":"true",className:`size-1.5 shrink-0 rounded-full ${Sl[e.value].bar}`}),s.jsx("span",{className:"truncate",children:e.label})]}),image:e=>s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(Z3,{}),s.jsx("span",{className:"truncate font-mono text-[11px]",children:e.label})]})},YE={type:e=>e.type,phase:e=>tx(e.sandbox.phase),owner:e=>e.owner,image:e=>e.image},KE=Object.keys(Fl);function KW({onNavigate:e,allowRemote:t=!1,createRequest:r=0,onCreateRequestHandled:a}){const l=$t(),c=Tr(),u=Q3(Ua()),f=Cu(),{locations:m}=f,h=Cn(),[g,p]=x.useState(null),b=rs(h)??g,v=rs(h)??"",[j,S]=x.useState(null),[C,N]=x.useState(null),E=t;x.useEffect(()=>{let me=!0;return l.contextKey().then(De=>{me&&p(JSON.stringify([l.target,De]))}).catch(()=>{}),()=>{me=!1}},[l]);const T=m.find(me=>rs(me)===b),A=m.find(me=>rs(me)===v&&me.connected)??(T!=null&&T.connected?T:null)??m.find(me=>me.target===l.target&&!me.remote&&me.connected)??m.find(me=>me.target===l.target&&me.connected),k=m.find(me=>rs(me)===rs(j))??j??A,M=x.useSyncExternalStore(yo.subscribe,yo.getSnapshot),R=x.useMemo(()=>M.filter(me=>me.status==="created"&&!me.reported).map(me=>me.sandbox),[M]),O=x.useMemo(()=>u.demo?(u.sandboxes??FE).map((me,De)=>{const Oe=T??A??FW,nt=KE[De%KE.length];return{...me,location:nt===up(Oe)?Oe:{...Oe,placement:nt,host:`${nt}-demo`}}}):f.sandboxes,[u.demo,u.sandboxes,T,A,f.sandboxes]),D=x.useMemo(()=>{const me=new Set(O.map(Mh));return[...R.filter(De=>!me.has(Mh(De))).map(De=>({...De,location:m.find(Oe=>rs(Oe)===rs(De.location))??De.location})),...O]},[O,R,m]),[_,L]=x.useState(""),[q,P]=x.useState(jy),$=(me,De)=>P(Oe=>({...Oe,[me]:De})),[H,F]=x.useState({key:"name",direction:"asc"}),V=x.useDeferredValue(_),[G,X]=x.useState(null),[B,Z]=x.useState(()=>new Set),[K,se]=x.useState(null),[I,U]=x.useState(!1),Q=x.useRef(!1),[te,le]=x.useState([]),[J,ne]=x.useState(!!(c!=null&&c.createRequested));x.useEffect(()=>{c!=null&&c.createRequested&&(ne(!0),c.requestCreate(!1))},[c==null?void 0:c.createRequested]);const[ce,oe]=x.useState(Date.now),W=x.useRef(null);x.useEffect(()=>{const me=setInterval(()=>oe(Date.now()),3e4),De=Ge=>{var Ye;(Ge.metaKey||Ge.ctrlKey)&&Ge.key.toLowerCase()==="k"&&(Ge.preventDefault(),(Ye=W.current)==null||Ye.focus())};window.addEventListener("keydown",De);const Oe=()=>{try{const Ge=sessionStorage.getItem(Nl);if(sessionStorage.removeItem(Nl),Ge){let Ye;try{Ye=JSON.parse(Ge)}catch{}N(Ye&&typeof Ye.name=="string"?{name:Ye.name,context:rs(Ye.location)??(Ye.context&&Ye.target?JSON.stringify([Ye.target,Ye.context]):Ye.context)}:{name:Ge})}}catch{}},nt=Ge=>{var pe;const Ye=Ge.detail;typeof(Ye==null?void 0:Ye.name)=="string"&&(N({name:Ye.name,context:((pe=Ye.location)==null?void 0:pe.id)??(Ye.context?JSON.stringify([Ye.target??l.target,Ye.context]):void 0)}),f.refresh())};return Oe(),window.addEventListener("openrod-sandbox-handoff",nt),window.addEventListener(Nl,Oe),()=>{clearInterval(me),window.removeEventListener("keydown",De),window.removeEventListener(Nl,Oe),window.removeEventListener("openrod-sandbox-handoff",nt)}},[]),x.useEffect(()=>{const me=(C==null?void 0:C.context)??b;if(!C||!me||f.loading)return;const De=D.find(Oe=>Oe.name===C.name&&rs(Oe.location)===me);if(De!=null&&De.location.connected){X(De),N(null);try{sessionStorage.removeItem(Nl)}catch{}}},[C,b,f.loading,D]);const de=x.useRef(null);x.useEffect(()=>{const me=M.filter(Oe=>Oe.status==="created");if(!de.current){de.current=new Set(me.map(Oe=>Oe.id));return}const De=me.filter(Oe=>!de.current.has(Oe.id));De.length&&(De.forEach(Oe=>de.current.add(Oe.id)),X(null),L(""),P(jy),F({key:"createdAt",direction:"desc"}),f.refresh())},[M]);const Ee=x.useMemo(()=>gK(D),[D]),Be=x.useMemo(()=>D.map(me=>({sandbox:me,owner:Hd(me),type:Fl[up(me.location)].label,image:rp(me.image,me.imageTemplateName),search:[me.name,me.id,me.image,me.imageTemplateName,_s(me.location),Fl[up(me.location)].label,Hd(me),...me.providers??[]].join(" ").toLowerCase()})),[D]),Ne=x.useMemo(()=>Object.fromEntries(Object.entries(YE).map(([me,De])=>{const Oe=new Map;for(const Ge of Be)Oe.set(De(Ge),(Oe.get(De(Ge))??0)+1);const nt=[...Oe.keys()].sort(me==="phase"?(Ge,Ye)=>Pv.indexOf(Ge)-Pv.indexOf(Ye):wy.compare);return[me,nt.map(Ge=>({value:Ge,label:me==="phase"?Sl[Ge].label:Ge,count:Oe.get(Ge)}))]})),[Be]),Ae=x.useMemo(()=>{const me=V.trim().toLowerCase(),De=q.createdAt?ce-Number(q.createdAt)*864e5:null,Oe=Be.filter(Ge=>(!v||rs(Ge.sandbox.location)===v)&&Object.entries(YE).every(([Ye,pe])=>!q[Ye].length||q[Ye].includes(pe(Ge)))&&(De===null||Date.parse(Ge.sandbox.createdAt)>=De)&&(!me||Ge.search.includes(me))),nt=Ge=>H.key==="owner"||H.key==="image"||H.key==="type"?Ge[H.key]:H.key==="startedAt"?Ge.sandbox.phase==="ready"?Ge.sandbox.startedAt:null:Ge.sandbox[H.key];return Oe.sort((Ge,Ye)=>{const pe=nt(Ge),He=nt(Ye);if(!pe&&He)return 1;if(pe&&!He)return-1;const Ie=wy.compare(pe??"",He??"");return(H.direction==="asc"?Ie:-Ie)||wy.compare(Ge.sandbox.name,Ye.sandbox.name)})},[Be,q,v,V,H,ce]);x.useEffect(()=>{const me=new Set(D.filter(De=>{var Oe;return((Oe=De.location)==null?void 0:Oe.connected)&&!u.demo}).map(nr));Z(De=>{const Oe=new Set([...De].filter(nt=>me.has(nt)));return Oe.size===De.size?De:Oe})},[D,u.demo]);const ee=x.useMemo(()=>D.filter(me=>{var De;return((De=me.location)==null?void 0:De.connected)&&B.has(nr(me))}),[D,B]),re=Ae.filter(me=>{var De;return((De=me.sandbox.location)==null?void 0:De.connected)&&!u.demo}),xe=re.reduce((me,De)=>me+Number(B.has(nr(De.sandbox))),0),he=re.length>0&&xe===re.length,$e=x.useCallback(me=>{var De;(De=me.location)!=null&&De.connected&&Z(Oe=>{const nt=new Set(Oe),Ge=nr(me);return nt.has(Ge)?nt.delete(Ge):nt.add(Ge),nt})},[]),we=()=>Z(me=>{const De=new Set(me);for(const{sandbox:Oe}of re)he?De.delete(nr(Oe)):De.add(nr(Oe));return De});async function _e(){if(Q.current||u.demo||!(K!=null&&K.length))return;Q.current=!0,U(!0),le([]);const me=new Set,De=[];let Oe=0;const nt=async()=>{for(;Oe<K.length;){const Ge=K[Oe++];try{const Ye=m.find(pe=>rs(pe)===rs(Ge.location));if(!(Ye!=null&&Ye.connected))throw new Error("Location is disconnected. Reconnect before deleting.");await Gr(c!=null&&c.localViewer?Ye.target??"local":l.target,l.signal,Ye.context).lifecycle(Ge.name,"delete"),me.add(nr(Ge))}catch(Ye){De.push({key:nr(Ge),name:Ge.name,location:Ge.location,message:Ye.message})}}};try{await Promise.all(Array.from({length:Math.min(4,K.length)},nt)),Z(Ge=>new Set([...Ge].filter(Ye=>!me.has(Ye)))),le(De),me.size&&qe.success(`Deletion requested for ${ji(me.size)} ${me.size===1?"sandbox":"sandboxes"}`),De.length&&qe.error(`${ji(De.length)} ${De.length===1?"sandbox could":"sandboxes could"} not be deleted. Review the errors and retry.`),f.refresh()}finally{Q.current=!1,U(!1),se(null)}}const Re=nx({count:Ae.length,rowHeight:GE});x.useEffect(()=>{Re.scrollToTop()},[V,q,v,H]);const Te=x.useMemo(()=>eW(D,30,ce),[D,ce]),be=()=>{L(""),P(jy)},Ue=_||Object.values(q).some(me=>me.length),Ze=D.length===0&&f.loading&&!u.demo,ht=D.length===0&&f.error,at=G&&(D.find(me=>nr(me)===nr(G))??(G.id==null?D.find(me=>Mh(me)===Mh(G)):null)??G),Pe=at&&(m.find(me=>rs(me)===rs(at.location))??at.location),ct=at?{...u,sandboxes:[at],events:rs(Pe)===b?u.events:FE,overview:rs(Pe)===b?u.overview:{gateway:{name:Pe==null?void 0:Pe.gateway,workspace:Pe==null?void 0:Pe.workspace,remote:Pe==null?void 0:Pe.remote}},refresh:f.refresh}:null,We=()=>{S(A??null),ne(!0)};return x.useEffect(()=>{r&&(We(),a==null||a())},[r]),s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex h-[calc(100svh-3.5rem)] min-h-0 flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 pt-4 pb-3 sm:px-6",children:[s.jsx("div",{className:"flex flex-wrap gap-1",role:"group","aria-label":"Sandbox status",children:GW.filter(me=>["all","running","sleeping"].includes(me)||Ee.status[me]>0).map(me=>s.jsxs("button",{"aria-pressed":me==="all"?!q.phase.length:q.phase.length===1&&q.phase[0]===me,onClick:()=>$("phase",me==="all"?[]:[me]),className:`rounded-md px-3 py-1.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${(me==="all"?!q.phase.length:q.phase.length===1&&q.phase[0]===me)?"bg-accent/70":"hover:bg-muted/60"}`,children:[s.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[me!=="all"&&s.jsx("span",{"aria-hidden":"true",className:`size-1.5 rounded-full ${Sl[me].bar}`}),me==="all"?"Sandboxes":Sl[me].label]}),s.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:s.jsx(tf,{value:me==="all"?Ee.total:Ee.status[me]})})]},me))}),s.jsx("div",{className:"ml-auto hidden w-64 px-3 lg:block",children:s.jsx(nW,{points:Te,height:34,title:"Boxes · 30d"})})]}),s.jsx("div",{className:"flex h-[3px] shrink-0 overflow-hidden",role:"img","aria-label":Object.entries(Ee.status).map(([me,De])=>`${De} ${Sl[me].label}`).join(", "),children:Object.entries(Ee.status).map(([me,De])=>De>0&&s.jsx("span",{className:Sl[me].strip,style:{width:`${De/Ee.total*100}%`}},me))}),f.error&&D.length>0&&s.jsxs(Pi,{id:"sandboxes:inventory-error",tone:"warning",title:"Inventory refresh failed",actions:s.jsx(ue,{size:"xs",variant:"outline",onClick:f.refresh,children:"Retry"}),children:["Showing the last reading. ",f.error]}),m.filter(me=>!me.connected).map(me=>s.jsx(WW,{location:me,onReconnected:f.refresh},rs(me))),u.demo&&s.jsx("p",{className:"border-b border-border px-6 py-2 text-xs text-amber-700",children:"Preview · synthetic sandbox data"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-2 sm:px-6",children:[s.jsx(ea,{ref:W,value:_,onValueChange:L,placeholder:"Search name, owner, image…","aria-label":"Search sandboxes",className:"mr-auto w-full sm:w-64"}),Ue&&s.jsxs(ue,{variant:"ghost",size:"sm",onClick:be,children:[s.jsx(On,{className:"size-3"}),"Clear"]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Refresh sandboxes",onClick:f.refresh,children:s.jsx(Ia,{className:"size-3.5"})}),s.jsxs(ue,{size:"sm",disabled:!A&&!E,onClick:We,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[s.jsx(cs,{className:"size-3.5"}),"New sandbox"]})]}),ee.length>0&&s.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border bg-accent/30 px-6 py-2",children:[s.jsxs("span",{role:"status",className:"mr-auto text-xs",children:[s.jsx("strong",{children:ji(ee.length)})," selected",ee.length>xe&&s.jsxs("span",{className:"text-muted-foreground",children:[" · ",ji(ee.length-xe)," outside current filters"]})]}),s.jsx(ue,{variant:"ghost",size:"sm",disabled:I,onClick:()=>Z(new Set),children:"Clear selection"}),s.jsxs(ue,{variant:"destructive",size:"sm",disabled:I||u.demo,title:u.demo?"Deletion is unavailable for synthetic preview data":void 0,onClick:()=>se([...ee]),children:[s.jsx(Yn,{className:"size-3.5"}),I?"Deleting…":"Delete selected"]})]}),te.length>0&&s.jsxs(Pi,{id:"sandboxes:delete-errors",tone:"error",title:"Some sandboxes could not be deleted",onDismiss:()=>le([]),dismissLabel:"Dismiss deletion errors",children:[s.jsx("p",{children:"Failed boxes remain selected for retry."}),s.jsx("ul",{className:"mt-1 max-h-28 overflow-auto",children:te.map(me=>s.jsxs("li",{children:[s.jsx("strong",{className:"text-foreground",children:me.name})," ",s.jsx(So,{location:me.location}),": ",me.message]},me.key))})]}),s.jsx("div",{ref:Re.ref,onScroll:Re.onScroll,tabIndex:0,role:"region","aria-label":"Sandbox inventory",className:"min-h-0 flex-1 overflow-auto overscroll-contain outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:Ze?s.jsx("p",{role:"status",className:"py-20 text-center text-sm text-muted-foreground",children:"Loading sandboxes…"}):ht?s.jsxs("div",{role:"alert",className:"py-16 text-center",children:[s.jsx("p",{children:"Inventory unavailable"}),s.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:f.error}),s.jsx(ue,{variant:"outline",onClick:f.refresh,className:"mt-4",children:"Retry"})]}):Ae.length?s.jsxs("table",{"aria-label":"Sandboxes","aria-rowcount":Ae.length+1,className:"w-full min-w-[1040px] table-fixed border-separate border-spacing-0 text-xs",children:[s.jsxs("colgroup",{children:[s.jsx("col",{style:{width:48}}),qE.map(me=>s.jsx("col",{style:{width:me.width}},me.id))]}),s.jsx("thead",{className:"sticky top-0 z-10 bg-muted",children:s.jsxs("tr",{"aria-rowindex":1,children:[s.jsx("th",{scope:"col",className:"h-9 border-b border-border px-4 sm:pl-6",children:s.jsx(J3,{label:"Select all matching sandboxes",checked:he,mixed:xe>0&&!he,disabled:I||!re.length,onChange:we})}),qE.map(me=>s.jsx("th",{scope:"col","aria-sort":H.key===me.id?H.direction==="asc"?"ascending":"descending":"none",className:"group/column h-9 border-b border-border px-4 text-left font-medium text-muted-foreground first:pl-6",children:s.jsxs("div",{className:"flex h-9 items-center gap-1",children:[s.jsxs("button",{onClick:()=>F(De=>({key:me.id,direction:De.key===me.id&&De.direction==="asc"?"desc":"asc"})),className:"flex h-9 min-w-0 items-center gap-1.5 outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx("span",{className:"truncate",children:me.label}),H.key===me.id&&(H.direction==="asc"?s.jsx(lf,{className:"size-3 shrink-0"}):s.jsx(af,{className:"size-3 shrink-0"}))]}),s.jsx(QW,{column:me,sort:H,onSort:De=>F({key:me.id,direction:De}),values:Ne[me.id],value:q[me.id],onFilter:De=>$(me.id,De)})]})},me.id))]})}),s.jsxs("tbody",{children:[Re.paddingTop>0&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:8,style:{height:Re.paddingTop,padding:0,border:0}})}),Ae.slice(Re.start,Re.end).map((me,De)=>{var Oe;return s.jsx(XW,{row:me,now:ce,index:Re.start+De+2,onOpen:X,selected:B.has(nr(me.sandbox)),onSelect:$e,disabled:I||u.demo||!((Oe=me.sandbox.location)!=null&&Oe.connected)},nr(me.sandbox))}),Re.end<Ae.length&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:8,style:{height:(Ae.length-Re.end)*GE,padding:0,border:0}})})]})]}):s.jsxs("div",{className:"py-20 text-center",children:[s.jsx(ql,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),s.jsx("p",{className:"text-sm",children:D.length?"No matching sandboxes":"No sandboxes yet"}),s.jsx(ue,{variant:"outline",disabled:!D.length&&!A&&!E,className:"mt-4",onClick:()=>D.length?be():We(),children:D.length?"Clear filters":"Create sandbox"})]})}),s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border bg-card px-6 py-2 text-[11px] text-muted-foreground",children:[s.jsxs("span",{children:[s.jsx("strong",{className:"font-medium text-foreground",children:ji(Ae.length)}),Ue?` of ${ji(D.length)}`:""," sandboxes"]}),s.jsx("span",{className:"hidden sm:inline",children:"Click a row to inspect · ⌘K to search"})]})]}),at&&(Pe==null?void 0:Pe.connected)&&s.jsx(Oa,{location:Pe,children:s.jsx(wW,{name:at.name,sandbox:at,liveData:ct,onClose:()=>X(null),onNavigate:e,onChanged:f.refresh})},nr(at)),s.jsx(Wr,{open:K!==null,onOpenChange:me=>{!me&&!Q.current&&se(null)},children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsxs(eo,{children:["Delete ",ji((K==null?void 0:K.length)??0)," ",(K==null?void 0:K.length)===1?"sandbox":"sandboxes","?"]}),s.jsx(to,{children:"This permanently deletes the selected sandboxes and their data. This cannot be undone."})]}),s.jsx("ul",{"aria-label":"Sandboxes to delete",className:"max-h-48 overflow-auto rounded-md border border-border p-3 text-xs",children:K==null?void 0:K.map(me=>s.jsxs("li",{className:"flex items-center gap-2 break-all py-1",children:[me.name,s.jsx(So,{location:me.location})]},nr(me)))}),s.jsxs(Jr,{children:[s.jsx(so,{disabled:I,children:"Cancel"}),s.jsx(no,{variant:"destructive",disabled:I||!(K!=null&&K.length),onClick:_e,children:I?"Deleting…":"Delete sandboxes"})]})]})}),s.jsx(Oa,{location:k,children:s.jsx(X3,{open:J,onOpenChange:ne,locations:m,location:k,onLocationChange:S,onRefreshLocations:f.refresh,allowRemote:E})})]})}const XW=x.memo(function({row:t,now:r,index:a,onOpen:l,selected:c,onSelect:u,disabled:f}){var j;const{sandbox:m,owner:h,image:g}=t,p="h-10 border-b border-border/60 px-4 py-0 align-middle text-muted-foreground",b=!((j=m.location)!=null&&j.connected),v=`${m.name} at ${_s(m.location)}`;return s.jsxs("tr",{"aria-rowindex":a,"aria-disabled":b||void 0,onClick:()=>{b||l(m)},className:`group transition-colors ${b?"opacity-60":"cursor-pointer hover:bg-muted/60 focus-within:bg-muted/60"} ${c?"bg-accent/40":"bg-card"}`,children:[s.jsx("td",{className:`${p} sm:pl-6`,onClick:S=>S.stopPropagation(),children:s.jsx(J3,{label:`Select ${v}`,checked:c,disabled:f,onChange:()=>u(m)})}),s.jsx("td",{className:`${p} pl-6`,children:s.jsxs("button",{disabled:b,"aria-haspopup":"dialog","aria-label":`Open ${v}`,onClick:S=>{S.stopPropagation(),b||l(m)},className:"flex h-9 w-full min-w-0 items-center gap-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed",children:[s.jsx(ql,{"aria-hidden":"true",strokeWidth:1.4,className:"size-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate font-medium text-foreground",title:m.name,children:m.name}),s.jsx(Ri,{className:"ml-auto size-3 shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"})]})}),s.jsx("td",{className:p,children:s.jsx(_3,{location:m.location})}),s.jsx("td",{className:p,children:s.jsxs("span",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[s.jsx("span",{className:`size-1.5 shrink-0 rounded-full ${Pa(m.phase).bar}`}),Kp[m.phase]??"Unknown"]})}),s.jsx("td",{className:p,children:s.jsx("span",{className:"block truncate",title:h,children:h})}),s.jsx("td",{className:p,children:s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",title:m.image||g,children:[s.jsx(Z3,{}),s.jsx("span",{className:"truncate font-mono text-[11px]",children:g})]})}),s.jsx("td",{className:p,children:s.jsx("span",{className:"block truncate font-mono text-[11px]",title:"Uptime requires a reported start time",children:xK(m,r)})}),s.jsx("td",{className:p,children:s.jsxs("span",{className:"block truncate tabular-nums",title:m.createdAt||"Not reported",children:[d3(m.createdAt,r),m.createdAt?" ago":""]})})]})});function WW({location:e,onReconnected:t}){const r=$t(),[a,l]=x.useState({busy:!1,error:null}),c=x.useRef(!0);x.useEffect(()=>(c.current=!0,()=>{c.current=!1}),[]);async function u(){l({busy:!0,error:null});try{let f=await r.connect({host:e.host});for(;f.status==="working";)await new Promise(m=>setTimeout(m,1e3)),f=await r.connectionJob(f.id);if(f.status!=="ready")throw new Error(f.error||`${e.host} needs setup. Use New sandbox → Remote to finish connecting.`);t(),c.current&&l({busy:!1,error:null})}catch(f){c.current&&l({busy:!1,error:f.message})}}return s.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-b border-amber-200 bg-amber-50 px-6 py-2 text-xs text-amber-800",children:[s.jsxs("span",{children:[_s(e)," disconnected. Its last inventory is retained; reconnect to use these resources.",e.error?` ${e.error}`:"",a.error?` ${a.error}`:""]}),e.host&&s.jsxs(ue,{size:"xs",variant:"outline",disabled:a.busy,onClick:u,children:[s.jsx(Ia,{className:`size-3 ${a.busy?"animate-spin motion-reduce:animate-none":""}`}),a.busy?"Reconnecting…":"Reconnect"]})]})}function J3({label:e,checked:t,mixed:r=!1,disabled:a,onChange:l}){const c=x.useRef(null);return x.useEffect(()=>{c.current&&(c.current.indeterminate=r)},[r]),s.jsx("input",{ref:c,type:"checkbox","aria-label":e,checked:t,disabled:a,onChange:l,className:"block size-4 cursor-pointer rounded border-border accent-[var(--action)] focus-visible:outline-2 focus-visible:outline-ring disabled:cursor-not-allowed"})}function QW({column:e,sort:t,onSort:r,values:a,value:l,onFilter:c}){const u=e.filter==="values"?l.length>0:e.filter==="recent"?!!l:!1,f=t.key===e.id?t.direction:null,m=h=>c(l.includes(h)?l.filter(g=>g!==h):[...l,h]);return s.jsxs(ju,{children:[s.jsx(Su,{render:s.jsx("button",{type:"button","aria-label":`Sort and filter ${e.label}${u?" (filtered)":""}`,className:`flex h-6 shrink-0 items-center justify-center overflow-hidden rounded outline-none hover:bg-background/70 hover:text-foreground focus-visible:w-6 focus-visible:ring-2 focus-visible:ring-ring data-[popup-open]:w-6 ${u?"w-6 text-foreground":"w-0 group-hover/column:w-6"}`}),children:s.jsx(DI,{className:"size-3.5 shrink-0"})}),s.jsxs(Nu,{align:"start",className:"w-56",children:[s.jsxs(np,{children:[s.jsxs(Ys,{className:"text-xs",onClick:()=>r("asc"),children:[s.jsx(lf,{className:"size-3.5"}),"Sort ascending",f==="asc"&&s.jsx(Fn,{className:"ml-auto size-3.5"})]}),s.jsxs(Ys,{className:"text-xs",onClick:()=>r("desc"),children:[s.jsx(af,{className:"size-3.5"}),"Sort descending",f==="desc"&&s.jsx(Fn,{className:"ml-auto size-3.5"})]})]}),e.filter==="values"&&s.jsxs(s.Fragment,{children:[s.jsx($d,{}),s.jsxs(np,{children:[s.jsx(zv,{className:"text-[11px]",children:"Show only"}),s.jsx("div",{className:"max-h-64 overflow-y-auto",children:a.map(h=>{var g;return s.jsxs(Iw,{checked:l.includes(h.value),onCheckedChange:()=>m(h.value),closeOnClick:!1,className:"text-xs",children:[s.jsx("span",{className:"min-w-0 flex-1 truncate",children:((g=Sy[e.id])==null?void 0:g.call(Sy,h))??h.label}),s.jsx("span",{className:"ml-2 font-mono text-[10px] tabular-nums text-muted-foreground",children:ji(h.count)})]},h.value)})})]})]}),e.filter==="recent"&&s.jsxs(s.Fragment,{children:[s.jsx($d,{}),s.jsxs(np,{children:[s.jsx(zv,{className:"text-[11px]",children:"Created"}),s.jsxs(EY,{value:l,onValueChange:c,children:[s.jsx(ZT,{value:"",className:"text-xs",children:"Any time"}),qW.map(h=>s.jsx(ZT,{value:h.value,className:"text-xs",children:h.label},h.value))]})]})]}),u&&s.jsxs(s.Fragment,{children:[s.jsx($d,{}),s.jsxs(Ys,{className:"text-xs",onClick:()=>c(e.filter==="values"?[]:""),children:[s.jsx(On,{className:"size-3.5"}),"Clear filter"]})]})]})]})}const Ny=()=>({name:"",url:"",format:"ocsf",auth:"none",token:"",sandboxes:"",category:"",verdict:""}),Dh="h-9 w-full rounded-md border border-border bg-card px-2 text-xs",Cy=e=>e?new Date(e).toLocaleString():"Never";function ZW(){const e=$t(),[t,r]=x.useState([]),[a,l]=x.useState(Ny),[c,u]=x.useState(!1),[f,m]=x.useState(null),[h,g]=x.useState(null),[p,b]=x.useState(null),[v,j]=x.useState(!1),S=x.useCallback(async()=>{try{r(await e.activityDestinations()),b(null),j(!0)}catch(T){b(T.message)}},[e]);x.useEffect(()=>{S();const T=setInterval(S,5e3);return()=>clearInterval(T)},[S]);const C=T=>({value:a[T],onChange:A=>l(k=>({...k,[T]:A.target.value}))});async function N(T,A){g(T);try{const k=await e.activityDestinationAction(T,A);A==="test"&&qe.success(`Test accepted · HTTP ${k.status}`),await S(),m(null)}catch(k){qe.error(k.message),await S()}finally{g(null)}}async function E(T){T.preventDefault(),g("new");try{await e.createActivityDestination({name:a.name,url:a.url,format:a.format,auth:a.auth,token:a.token,filters:{sandboxes:a.sandboxes.split(",").map(A=>A.trim()).filter(Boolean),categories:a.category?[a.category]:[],verdicts:a.verdict?[a.verdict]:[]}}),l(Ny()),u(!1),await S(),qe.success("Webhook saved. Test it, then enable forwarding.")}catch(A){qe.error(A.message)}finally{g(null)}}return s.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-y-auto p-5",children:[s.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"Webhooks start paused. Test the connection, then enable forwarding."}),p&&s.jsxs("div",{role:"alert",className:"rounded-md border border-destructive/30 p-3 text-xs",children:[p,s.jsx("button",{className:"ml-2 underline",onClick:S,children:"Retry"})]}),!v&&!p&&s.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading webhooks…"}),t.map(T=>s.jsxs("section",{className:"space-y-3 rounded-lg border border-border p-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx("h3",{className:"truncate text-sm font-medium",children:T.name}),s.jsx("span",{className:`text-xs ${T.error?"text-amber-700":"text-muted-foreground"}`,children:T.enabled?T.error?"Retrying":"Enabled":T.error?"Needs attention":"Paused"})]}),s.jsx("p",{className:"break-all font-mono text-[11px] text-muted-foreground",children:T.url}),s.jsxs("p",{className:"text-xs text-muted-foreground tabular-nums",children:[T.delivered.toLocaleString()," delivered · ",T.backlog.toLocaleString()," pending"]}),s.jsxs("details",{className:"text-xs",children:[s.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"Delivery details"}),s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsxs("p",{className:"text-xs text-muted-foreground",children:[T.format==="ocsf"?"OCSF JSON":"Console JSON"," · ",T.auth==="none"?"No authentication":T.auth==="bearer"?"Bearer token":"API key"]}),s.jsxs("p",{className:"text-xs",children:[T.filters.sandboxes.join(", ")||"All sandboxes"," · ",T.filters.categories.join(", ")||"All event types"," · ",T.filters.verdicts.join(", ")||"All decisions"]}),s.jsxs("dl",{className:"grid grid-cols-3 gap-3 text-xs",children:[s.jsxs("div",{children:[s.jsx("dt",{className:"text-muted-foreground",children:"Delivered"}),s.jsx("dd",{className:"mt-1",children:T.delivered.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-muted-foreground",children:"Pending"}),s.jsx("dd",{className:"mt-1",children:T.backlog.toLocaleString()})]}),s.jsxs("div",{children:[s.jsx("dt",{className:"text-muted-foreground",children:"Filtered out"}),s.jsx("dd",{className:"mt-1",children:T.skipped.toLocaleString()})]})]}),s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Last delivery: ",Cy(T.lastDeliveredAt),T.lastStatus?` · HTTP ${T.lastStatus}`:""]}),T.lastTest&&s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Test: ",T.lastTest.ok?`Accepted · HTTP ${T.lastTest.status}`:T.lastTest.error," · ",Cy(T.lastTest.at)]})]})]}),T.error&&s.jsxs("p",{role:"status",className:"text-xs text-amber-700",children:[T.error," · Attempt ",T.attempts,"/8",T.enabled?` · Next retry ${Cy(T.nextAttempt)}`:" · Forwarding paused; queued events retained"]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(ue,{size:"xs",variant:"outline",disabled:!!h,onClick:()=>N(T.id,"test"),children:"Send test"}),s.jsx(ue,{size:"xs",variant:"outline",disabled:!!h,onClick:()=>N(T.id,T.enabled?"pause":"resume"),children:T.enabled?"Pause":"Enable forwarding"}),T.error&&s.jsx(ue,{size:"xs",variant:"outline",disabled:!!h,onClick:()=>N(T.id,"retry"),children:"Retry now"}),s.jsx(ue,{size:"xs",variant:"ghost",disabled:!!h,onClick:()=>m(T.id),children:"Remove"})]}),f===T.id&&s.jsxs("div",{className:"space-y-2 border-t border-border pt-3 text-xs",children:[s.jsx("p",{children:"Remove this webhook and its delivery position? Activity history will remain."}),s.jsx(ue,{size:"xs",variant:"destructive",disabled:!!h,onClick:()=>N(T.id,"remove"),children:"Remove webhook"}),s.jsx(ue,{size:"xs",variant:"ghost",onClick:()=>m(null),children:"Cancel"})]})]},T.id)),v&&!t.length&&!c&&s.jsxs("div",{className:"rounded-lg border border-dashed border-border p-6 text-center",children:[s.jsx("p",{className:"text-sm",children:"No webhooks connected"}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Send activity to your monitoring tools."})]}),c?s.jsxs("form",{onSubmit:E,className:"space-y-4 rounded-lg border border-border p-4",children:[s.jsx("h3",{className:"text-sm font-medium",children:"New webhook"}),s.jsxs("label",{className:"block space-y-1 text-xs",children:[s.jsx("span",{children:"Name"}),s.jsx(Rt,{required:!0,maxLength:80,placeholder:"Security monitoring",...C("name")})]}),s.jsxs("label",{className:"block space-y-1 text-xs",children:[s.jsx("span",{children:"HTTPS endpoint"}),s.jsx(Rt,{required:!0,type:"url",placeholder:"https://logs.example.com/events",...C("url")})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Use a public HTTPS endpoint that accepts JSON."}),s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsxs("label",{className:"space-y-1 text-xs",children:[s.jsx("span",{children:"Event format"}),s.jsxs(hn,{className:Dh,...C("format"),children:[s.jsx("option",{value:"ocsf",children:"OCSF JSON"}),s.jsx("option",{value:"json",children:"Console JSON"})]})]}),s.jsxs("label",{className:"space-y-1 text-xs",children:[s.jsx("span",{children:"Authentication"}),s.jsxs(hn,{className:Dh,...C("auth"),children:[s.jsx("option",{value:"none",children:"None"}),s.jsx("option",{value:"bearer",children:"Bearer token"}),s.jsx("option",{value:"api-key",children:"X-API-Key"})]})]})]}),a.auth!=="none"&&s.jsxs("label",{className:"block space-y-1 text-xs",children:[s.jsx("span",{children:a.auth==="bearer"?"Bearer token":"API key"}),s.jsx(Rt,{required:!0,type:"password",autoComplete:"new-password",...C("token")})]}),s.jsxs("details",{className:"rounded-md border border-border p-3",children:[s.jsxs("summary",{className:"cursor-pointer text-xs font-medium",children:["Event filters ",s.jsxs("span",{className:"font-normal text-muted-foreground",children:["· ",a.sandboxes||a.category||a.verdict?"Custom":"All events"]})]}),s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsxs("label",{className:"block space-y-1 text-xs",children:[s.jsx("span",{children:"Sandboxes"}),s.jsx(Rt,{placeholder:"All sandboxes, or comma-separated names",...C("sandboxes")})]}),s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsxs("label",{className:"space-y-1 text-xs",children:[s.jsx("span",{children:"Event type"}),s.jsxs(hn,{className:Dh,...C("category"),children:[s.jsx("option",{value:"",children:"All event types"}),Object.entries({NET:"Network",HTTP:"HTTP",SSH:"Session",AUTH:"Authentication",PROC:"Process",FILE:"File",CONFIG:"Configuration",FINDING:"Finding",EVENT:"Event"}).map(([T,A])=>s.jsx("option",{value:T,children:A},T))]})]}),s.jsxs("label",{className:"space-y-1 text-xs",children:[s.jsx("span",{children:"Decision"}),s.jsxs(hn,{className:Dh,...C("verdict"),children:[s.jsx("option",{value:"",children:"All decisions"}),s.jsx("option",{value:"allowed",children:"Allowed"}),s.jsx("option",{value:"denied",children:"Denied"})]})]})]})]})]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Forwarding includes original log data. You can enable it after saving."}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(ue,{type:"submit",size:"sm",disabled:!!h,children:"Save paused"}),s.jsx(ue,{type:"button",size:"sm",variant:"ghost",onClick:()=>{u(!1),l(Ny())},children:"Cancel"})]})]}):s.jsx(ue,{size:"sm",variant:"outline",onClick:()=>u(!0),children:"Add webhook"}),s.jsxs("details",{className:"border-t border-border pt-4 text-[11px] text-muted-foreground",children:[s.jsx("summary",{className:"cursor-pointer text-xs hover:text-foreground",children:"Integration details"}),s.jsxs("div",{className:"mt-3 space-y-3 leading-relaxed",children:[s.jsx("p",{children:"Events are collected from the time the webhook is created and sent while the console server runs, even with this drawer closed. Existing history is not backfilled."}),s.jsx("p",{children:"The endpoint receives one JSON event per HTTPS POST and must return HTTP 2xx. Vendor-specific formats such as Splunk HEC need an adapter. Acceptance confirms receipt, not indexing."}),s.jsx("p",{children:"Delivery is at least once. Deduplicate using the Idempotency-Key header or event ID. Failures retry with backoff and pause after 8 attempts. History and delivery positions survive restarts; collection gaps still apply."}),s.jsx("p",{children:"OCSF uses version 1.4.0, Base Event, with source fields in unmapped.openshell. Credentials are stored locally in a file restricted to your OS account and are never returned to the browser."})]})]})]})}const e4="1.4.0";function XE(e){const t=Date.parse(e.at),r=Date.parse(e.receivedAt);if(!Number.isFinite(t)&&!Number.isFinite(r))throw new Error("OCSF export requires an event or collection timestamp");const a={INFO:1,INFORMATIONAL:1,LOW:2,MED:3,MEDIUM:3,HIGH:4,CRITICAL:5,FATAL:6}[String(e.severity).toUpperCase()]??0,l=e.action||e.method;return{category_uid:0,class_uid:0,activity_id:l?99:0,type_uid:l?99:0,...l?{activity_name:l}:{},severity_id:a,time:Number.isFinite(t)?t:r,metadata:{version:e4,product:{name:"OpenRod",vendor_name:"OpenRod"},...e.id?{uid:e.id}:{},...Number.isFinite(r)?{logged_time:r}:{},...e.correlationId?{correlation_uid:e.correlationId}:{}},...e.message?{message:e.message}:{},status_id:e.outcome==="success"?1:e.outcome==="failure"?2:0,raw_data:JSON.stringify(e.original??e),unmapped:{openshell:e,time_basis:Number.isFinite(t)?"source_event":"collection_time; source timestamp unavailable"}}}function JW(e,t="json",r){if(!Array.isArray(r))return t==="ocsf"?XE(e):e;const a=c3(e).values,l=Object.fromEntries(r.filter(u=>Object.hasOwn(a,u)).map(u=>[u,a[u]]));if(t!=="ocsf")return l;const c=XE(e);return{category_uid:0,class_uid:0,activity_id:r.includes("action")?c.activity_id:0,type_uid:r.includes("action")?c.type_uid:0,...r.includes("action")&&c.activity_name?{activity_name:c.activity_name}:{},severity_id:r.includes("severity")?c.severity_id:0,time:c.time,metadata:{version:e4,product:c.metadata.product},unmapped:{openshell:l,time_basis:c.unmapped.time_basis}}}function eQ(e,t,r="json"){const a=e.map(l=>JW(l,r,t==null?void 0:t.columns));return r==="ocsf"?a:{exportedAt:new Date().toISOString(),context:t,events:a}}function tQ(e,{paused:t,demo:r,activityRevision:a}){const l=$t(),c=x.useRef(t);c.current=t;const u=JSON.stringify(e),[f,m]=x.useState({events:[],total:0,nextOffset:null}),[h,g]=x.useState(0),[p,b]=x.useState(null),[v,j]=x.useState(!1),[S,C]=x.useReducer(A=>A+1,0),N=x.useRef(0),E=x.useRef(0);return x.useEffect(()=>{const A=++N.current;if(r)return;let k=!0;const M=async(O=!1)=>{const D=++E.current;j(!0);try{const _=await l.activity(JSON.parse(u));k&&N.current===A&&D===E.current&&(!O||!c.current)&&(m(_),b(null))}catch(_){k&&D===E.current&&b(_.message)}finally{k&&D===E.current&&j(!1)}};g(0),m({events:[],total:0,nextOffset:null}),M();const R=setInterval(()=>{c.current||M(!0)},5e3);return()=>{k=!1,clearInterval(R)}},[u,r,S,a,l]),{...f,loading:v,error:p,page:h,goToPage:async A=>{if(v||A<0||A>=Math.ceil(f.total/e.limit))return;const k=N.current,M=++E.current;j(!0);try{const R=await l.activity({...JSON.parse(u),snapshot:f.snapshot,offset:A*e.limit,now:f.now});k===N.current&&M===E.current&&(m(R),g(A),b(null))}catch(R){k===N.current&&M===E.current&&b(R.message)}finally{k===N.current&&M===E.current&&j(!1)}},refresh:C}}const vl=50,zh=[{id:"time",label:"Time",width:150},{id:"severity",label:"Security severity",width:150},{id:"logLevel",label:"Log level",width:110},{id:"sandbox",label:"Sandbox",width:125},{id:"agent",label:"Observed agent",width:145},{id:"action",label:"Activity",width:200},{id:"verdict",label:"Decision",width:125},{id:"destination",label:"Target",width:260}],nQ=Object.fromEntries(Wg.map(e=>[e.name,{name:e.name,logo:`/logos/agents/${e.logo}.svg`}])),Ph={all:"Available history",15:"Last 15 minutes",60:"Last hour",1440:"Last 24 hours",custom:"Custom range"},sr="h-8 rounded-md border border-border bg-card px-2 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",sQ=e=>Number.isFinite(Date.parse(e))?new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-";function ky({options:e,selected:t,onChange:r,label:a}){const[l,c]=x.useState(""),u=x.useDeferredValue(l),f=x.useMemo(()=>e.filter(g=>g.toLowerCase().includes(u.toLowerCase())),[e,u]),m=nx({count:f.length,rowHeight:32});x.useEffect(()=>{m.scrollToTop()},[u]);const h=new Set(t);return s.jsxs(s.Fragment,{children:[s.jsx(ea,{"aria-label":`Search ${a}`,placeholder:`Search ${a.toLowerCase()}…`,value:l,onValueChange:c}),s.jsxs("div",{className:"flex items-center justify-between text-[11px] text-muted-foreground",children:[s.jsxs("span",{children:[t.length.toLocaleString()," selected · ",f.length.toLocaleString()," matches"]}),s.jsx("button",{onClick:()=>r([]),className:"underline",children:"Clear"})]}),s.jsxs("div",{ref:m.ref,onScroll:m.onScroll,className:"h-56 overflow-auto",role:"group","aria-label":a,children:[s.jsx("div",{style:{height:m.totalHeight,position:"relative"},children:s.jsx("div",{style:{transform:`translateY(${m.paddingTop}px)`},children:f.slice(m.start,m.end).map(g=>s.jsxs("label",{className:"flex h-8 cursor-pointer items-center gap-2 rounded px-2 text-xs hover:bg-muted",children:[s.jsx("input",{type:"checkbox",checked:h.has(g),onChange:()=>r(h.has(g)?t.filter(p=>p!==g):[...t,g])}),s.jsx("span",{className:"truncate",title:g,children:g})]},g))})}),!f.length&&s.jsx("p",{className:"py-5 text-center text-xs text-muted-foreground",children:"No matches"})]})]})}function Ih(e){if(!e||!Number.isFinite(Date.parse(e)))return e||"";const t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,19)}function rQ(){try{const e=JSON.parse(new URLSearchParams(window.location.search).get("investigation")||"{}");if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const r of["query","direction","range","from","to"])typeof e[r]=="string"&&(t[r]=e[r]);for(const r of["sandboxes","verdicts","agents"])Array.isArray(e[r])&&e[r].every(a=>typeof a=="string")&&(t[r]=e[r]);return e.filters&&typeof e.filters=="object"&&Object.values(e.filters).every(r=>r&&typeof r.value=="string"&&["equals","contains","excludes"].includes(r.mode))&&(t.filters=e.filters),e.sort&&typeof e.sort.key=="string"&&["asc","desc"].includes(e.sort.direction)&&(t.sort=e.sort),t4(t)}catch{return{}}}function t4(e){var a,l;if(((l=(a=e.filters)==null?void 0:a.agent)==null?void 0:l.mode)!=="equals")return e;const{agent:t,...r}=e.filters;return{...e,agents:e.agents??(t.value?[t.value]:[]),filters:r}}function oQ(){try{const e=JSON.parse(localStorage.getItem("openshell.activity.views")||"[]");return Array.isArray(e)?e.filter(t=>t&&typeof t.name=="string"&&t.query&&typeof t.query=="object"):[]}catch{return[]}}function aQ(e,t,r){const a=new Blob([JSON.stringify(eQ(e,t,r),null,2)],{type:"application/json"}),l=URL.createObjectURL(a),c=document.createElement("a");c.href=l,c.download=r==="ocsf"?"openshell-activity-ocsf.json":"openshell-activity.json",c.click(),setTimeout(()=>URL.revokeObjectURL(l),1e3)}function iQ(){const e=Cn();return s.jsx(lQ,{},(e==null?void 0:e.id)??(e==null?void 0:e.context)??"default")}function lQ(){var St,dt,yt;const e=$t(),t=Cn(),r=Q3(Ua()),[a]=x.useState(rQ),[l,c]=x.useState(["time","sandbox","agent","action","verdict","destination"]),u=zh.filter(ae=>l.includes(ae.id)),[f,m]=x.useState(oQ),[h,g]=x.useState(""),[p,b]=x.useState(!1),[v,j]=x.useState("columns"),[S,C]=x.useState(null),[N,E]=x.useState(!1),[T,A]=x.useState(null),[k,M]=x.useState(Date.now),[R,O]=x.useState(a.query??""),[D,_]=x.useState(a.direction??"all"),[L,q]=x.useState(a.sandboxes??[]),[P,$]=x.useState(a.agents??[]),[H,F]=x.useState(a.verdicts??[]),[V,G]=x.useState(a.filters??{}),[X,B]=x.useState(a.range??"all"),[Z,K]=x.useState(Ih(a.from)),[se,I]=x.useState(Ih(a.to)),[U,Q]=x.useState(a.sort??{key:"time",direction:"desc"}),[te,le]=x.useState(null),[J,ne]=x.useState(()=>new Set),[ce,oe]=x.useState(null),[W,de]=x.useState(!1),[Ee,Be]=x.useState(null),Ne=x.useDeferredValue(R),Ae={query:Ne,direction:D,sandboxes:L,verdicts:H,agents:P,filters:V,range:X,from:Z&&Number.isFinite(Date.parse(Z))?new Date(Z).toISOString():Z,to:se&&Number.isFinite(Date.parse(se))?new Date(se).toISOString():se,sort:U},ee=JSON.stringify(Ae),[re,xe]=x.useState({query:ee,page:0}),he=tQ({...Ae,limit:vl},{paused:!!T,demo:r.demo,activityRevision:r.activityRevision});x.useEffect(()=>{ne(new Set),le(null)},[r.activityRevision]),x.useEffect(()=>{ne(new Set)},[Ne,D,L,H,P,V,X,Z,se]);async function $e(ae,Xe){at(),de(!0),Be(null);try{const rt=await e.previewActivityDeletion({mode:ae,ids:Xe||[...J],query:Ae});oe(rt)}catch(rt){qe.error(rt.message)}finally{de(!1)}}async function we(){de(!0),Be(null);try{const ae=await e.deleteActivity(ce.token);oe(null),le(null),ne(new Set),A([]),he.refresh(),r.refresh(),qe.success(`Deleted ${ae.deleted.toLocaleString()} log${ae.deleted===1?"":"s"}`)}catch(ae){Be(ae.message)}finally{de(!1)}}function _e(ae){at(),ne(Xe=>{const rt=new Set(Xe);return rt.has(ae)?rt.delete(ae):rt.size<5e3&&rt.add(ae),rt})}const Re=r.demo?T??r.events:he.events;function Te(ae){ae=t4(ae),at(),O(ae.query||""),_(ae.direction||"all"),q(ae.sandboxes||[]),F(ae.verdicts||[]),$(ae.agents||[]),G(ae.filters||{}),B(ae.range||"all"),K(Ih(ae.from)),I(Ih(ae.to)),Q(ae.sort||{key:"time",direction:"desc"})}function be(ae,Xe){Te({filters:{[ae]:{mode:"equals",value:Xe}}}),le(null)}function Ue(ae){C({format:ae,columns:[...l],range:X,from:Z,to:se})}const Ze=S&&(!S.columns.length||S.range==="custom"&&(!S.from&&!S.to||S.from&&!Number.isFinite(Date.parse(S.from))||S.to&&!Number.isFinite(Date.parse(S.to))||S.from&&S.to&&Date.parse(S.from)>Date.parse(S.to)));async function ht(){if(!S||Ze)return;const{format:ae,columns:Xe,range:rt,from:Wt,to:Mn}=S,Pt={...Ae,columns:Xe,range:rt,from:Wt?new Date(Wt).toISOString():"",to:Mn?new Date(Mn).toISOString():""};E(!0);try{if(r.demo){aQ(sE(ct,{...Pt,now:k}).map(Dn=>Dn.event),{...Pt,demo:!0},ae),C(null);return}const Mt=document.createElement("a");Mt.href=e.url("/activity/export",{format:ae,query:JSON.stringify(Pt),context:await e.contextKey(),...t?{location:"1"}:{}}),Mt.download=ae==="ocsf"?"openshell-activity-ocsf.json":"openshell-activity.json",document.body.appendChild(Mt),Mt.click(),Mt.remove(),C(null)}catch(Mt){qe.error(`Export failed: ${Mt.message}`)}finally{E(!1)}}const at=()=>{T||(A(Re),M(Date.now()))},Pe=ae=>Xe=>{at(),ae(Xe)},ct=x.useMemo(()=>Re.map(c3),[Re]),We=x.useMemo(()=>[...new Set([...(r.sandboxes??[]).map(ae=>ae.name),...he.sandboxes??[],...Re.map(ae=>ae.sandbox),...L].filter(Boolean))].sort(),[r.sandboxes,he.sandboxes,Re,L]),me=x.useMemo(()=>[...new Set(r.demo?ct.map(ae=>ae.values.agent):he.agents??ct.map(ae=>ae.values.agent))].filter(Boolean).sort((ae,Xe)=>ae.localeCompare(Xe)),[r.demo,ct,he.agents]),De=X==="custom"&&(!Z&&!se||Z&&se&&Date.parse(Z)>Date.parse(se)),Oe=x.useMemo(()=>De?[]:r.demo?sE(ct,{query:Ne,direction:D,sandboxes:L,verdicts:H,agents:P,filters:V,range:X,from:Z,to:se,now:k,sort:U}):ct,[ct,Ne,D,L,H,P,V,X,Z,se,k,U,De,r.demo]),nt=De?0:r.demo?Oe.length:he.total||0,Ge=Math.max(1,Math.ceil(nt/vl)),Ye=r.demo?Math.min(re.query===ee?re.page:0,Ge-1):he.page,pe=r.demo?Oe.slice(Ye*vl,(Ye+1)*vl):Oe;function He(ae){at(),ne(new Set),le(null),r.demo?xe({query:ee,page:ae}):he.goToPage(ae)}const Ie=nx({count:pe.length,rowHeight:48});x.useEffect(()=>{Ie.scrollToTop()},[Ne,D,L,H,P,V,X,Z,se,U,Ye]);const ut=x.useMemo(()=>{if(!T)return 0;const ae=new Set(T.map(nf));return r.events.filter(Xe=>!ae.has(nf(Xe))).length},[T,r.events]),Qe=pe.filter(ae=>ae.values.verdict==="denied").length,kt=pe.filter(ae=>ae.values.verdict==="allowed").length,At=R||L.length||H.length||P.length||D!=="all"||X!=="all"||Object.values(V).some(ae=>ae.value);function jt(){at(),O(""),_("all"),q([]),F([]),$([]),G({}),B("all"),K(""),I("")}const Ht=[...D!=="all"?[{label:`Direction: ${D}`,clear:()=>_("all")}]:[],...R?[{label:`Search: ${R}`,clear:()=>O("")}]:[],...L.length?[{label:`${L.length} sandbox${L.length===1?`: ${L[0]}`:"es"}`,clear:()=>q([])}]:[],...P.length?[{label:`Observed agents: ${P.join(", ")}`,clear:()=>$([])}]:[],...H.length?[{label:`Decision: ${H.join(", ")}`,clear:()=>F([])}]:[],...X!=="all"?[{label:Ph[X],clear:()=>B("all")}]:[],...Object.entries(V).filter(([,ae])=>ae.value).map(([ae,Xe])=>{var rt;return{label:`${((rt=zh.find(Wt=>Wt.id===ae))==null?void 0:rt.label)??ae}${ae==="agent"?"":` ${Xe.mode}`}: ${Xe.value}`,clear:()=>G(Wt=>({...Wt,[ae]:{...Xe,value:""}}))}})];return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex h-[calc(100svh-3.5rem)] min-h-0 flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-3 sm:px-6",children:[s.jsx(ea,{"aria-label":"Search activity",placeholder:"Search activity…",value:R,onValueChange:Pe(O),className:"min-w-44 flex-1 basis-full sm:basis-44"}),s.jsxs(ip,{children:[s.jsxs(lp,{className:`${sr} flex items-center gap-2 hover:bg-muted`,children:[s.jsx(aC,{className:"size-3.5"}),"Filters",(X!=="all"||D!=="all"||L.length>0||H.length>0||Object.values(V).some(ae=>ae.value))&&s.jsx("span",{className:"rounded bg-foreground px-1.5 text-[10px] text-background",children:+(X!=="all")+ +(D!=="all")+ +(L.length>0)+ +(H.length>0)+Object.values(V).filter(ae=>ae.value).length})]}),s.jsxs(cp,{align:"end",className:"max-h-[min(38rem,80svh)] w-80 max-w-[calc(100vw-2rem)] overflow-y-auto p-4",children:[s.jsx("p",{className:"text-xs font-medium",children:"Filter activity"}),s.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Time frame",s.jsx(hn,{"aria-label":"Time range",className:sr,value:X,onChange:ae=>Pe(B)(ae.target.value),children:Object.entries(Ph).map(([ae,Xe])=>s.jsx("option",{value:ae,children:Xe},ae))})]}),s.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Direction",s.jsxs(hn,{"aria-label":"Direction",className:sr,value:D,onChange:ae=>Pe(_)(ae.target.value),children:[s.jsx("option",{value:"all",children:"All directions"}),s.jsx("option",{value:"unknown",children:"Direction not applicable / unknown"}),s.jsx("option",{value:"out",children:"Outbound"}),s.jsx("option",{value:"in",children:"Inbound"})]})]}),s.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Event type",s.jsxs(hn,{"aria-label":"Event category",className:sr,value:((St=V.category)==null?void 0:St.value)||"",onChange:ae=>Pe(G)({...V,category:{mode:"equals",value:ae.target.value}}),children:[s.jsx("option",{value:"",children:"All event types"}),["Network","HTTP","Session","Configuration","Process","File","Authentication","Finding","Event","Log","Unclassified"].map(ae=>s.jsx("option",{children:ae},ae))]})]}),s.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Security severity",s.jsxs(hn,{"aria-label":"Security severity",className:sr,value:((dt=V.severity)==null?void 0:dt.value)||"",onChange:ae=>Pe(G)({...V,severity:{mode:"equals",value:ae.target.value}}),children:[s.jsx("option",{value:"",children:"All severities"}),["FATAL","CRITICAL","HIGH","MED","LOW","INFO","Not reported"].map(ae=>s.jsx("option",{children:ae},ae))]})]}),s.jsxs("label",{className:"grid gap-1.5 text-[11px] text-muted-foreground",children:["Log level",s.jsxs(hn,{"aria-label":"Log level",className:sr,value:((yt=V.logLevel)==null?void 0:yt.value)||"",onChange:ae=>Pe(G)({...V,logLevel:{mode:"equals",value:ae.target.value}}),children:[s.jsx("option",{value:"",children:"All log levels"}),["ERROR","WARN","INFO","DEBUG","TRACE","Not reported"].map(ae=>s.jsx("option",{children:ae},ae))]})]}),s.jsxs("div",{className:"mt-1 border-t pt-3",children:[s.jsx("p",{className:"mb-2 text-[11px] font-medium",children:"Decision"}),s.jsx("div",{className:"grid grid-cols-2 gap-2",children:["allowed","denied","not reported","not applicable"].map(ae=>s.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[s.jsx("input",{type:"checkbox",checked:H.includes(ae),onChange:()=>Pe(F)(H.includes(ae)?H.filter(Xe=>Xe!==ae):[...H,ae])}),ae]},ae))})]}),s.jsxs("div",{className:"mt-1 flex flex-col gap-2 border-t pt-3",children:[s.jsx("p",{className:"text-[11px] font-medium",children:"Sandboxes"}),s.jsx(ky,{label:"Sandboxes",options:We,selected:L,onChange:Pe(q)})]})]})]}),s.jsxs(ip,{children:[s.jsxs(lp,{className:`${sr} flex items-center gap-2 hover:bg-muted`,children:[s.jsx(l6,{className:"size-3.5"}),"View",s.jsx(Xo,{className:"size-3"})]}),s.jsxs(cp,{align:"end",className:"w-72 p-3",children:[s.jsx("div",{className:"mb-1 flex gap-1 rounded-md bg-muted p-1",role:"group","aria-label":"View options",children:[["columns","Columns"],["saved","Saved views"]].map(([ae,Xe])=>s.jsx("button",{"aria-pressed":v===ae,onClick:()=>j(ae),className:`flex-1 rounded px-2 py-1.5 text-xs transition-colors ${v===ae?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:Xe},ae))}),v==="columns"?s.jsx("div",{children:zh.map(ae=>s.jsxs("label",{className:"flex items-center gap-2 py-1 text-xs",children:[s.jsx("input",{type:"checkbox",disabled:ae.id==="time",checked:l.includes(ae.id),onChange:Xe=>c(Xe.target.checked?[...l,ae.id]:l.filter(rt=>rt!==ae.id))}),ae.label]},ae.id))}):s.jsxs("div",{className:"flex max-h-80 flex-col gap-3 overflow-auto",children:[s.jsx(Rt,{"aria-label":"View name",value:h,onChange:ae=>g(ae.target.value),placeholder:"Name this investigation…"}),s.jsx(ue,{size:"sm",disabled:!h.trim(),onClick:()=>{try{const ae=[...f.filter(Xe=>Xe.name!==h.trim()),{name:h.trim(),query:Ae}];localStorage.setItem("openshell.activity.views",JSON.stringify(ae)),m(ae),g(""),qe.success("View saved in this browser")}catch{qe.error("Could not save view")}},children:"Save view"}),f.map(ae=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{className:"min-w-0 flex-1 truncate text-left text-xs",onClick:()=>Te(ae.query),children:ae.name}),s.jsx("button",{"aria-label":`Delete view ${ae.name}`,onClick:()=>{try{const Xe=f.filter(rt=>rt.name!==ae.name);localStorage.setItem("openshell.activity.views",JSON.stringify(Xe)),m(Xe)}catch{qe.error("Could not delete view")}},children:s.jsx(On,{className:"size-3"})})]},ae.name)),!f.length&&s.jsx("p",{className:"py-2 text-center text-xs text-muted-foreground",children:"No saved views yet."})]})]})]}),s.jsxs(ju,{children:[s.jsxs(Su,{"aria-label":"Activity actions",className:`${sr} flex items-center gap-2 hover:bg-muted`,children:["Actions",s.jsx(Xo,{className:"size-3"})]}),s.jsxs(Nu,{align:"end",className:"w-60",children:[s.jsxs(Ys,{disabled:N||!!De,onClick:()=>Ue("json"),children:[s.jsx(Kc,{}),"Export Console JSON"]}),s.jsxs(Ys,{disabled:N||!!De,onClick:()=>Ue("ocsf"),children:[s.jsx(Kc,{}),"Export OCSF JSON"]}),s.jsxs(Ys,{onClick:()=>b(!0),children:[s.jsx(uC,{}),"Webhooks"]}),!r.demo&&s.jsxs(s.Fragment,{children:[s.jsx($d,{}),s.jsxs(Ys,{disabled:W||!J.size,variant:"destructive",onClick:()=>$e("selected"),children:[s.jsx(Yn,{}),"Delete selected logs",J.size?` (${J.size})`:""]}),s.jsxs(Ys,{disabled:W||!!De||he.loading||!he.total,variant:"destructive",onClick:()=>$e("matching"),children:[s.jsx(Yn,{}),"Delete matching logs"]}),s.jsxs(Ys,{disabled:W,variant:"destructive",onClick:()=>$e("all"),children:[s.jsx(Yn,{}),"Delete all logs"]})]})]})]})]}),(he.error||r.historyError)&&!r.demo&&s.jsx(Pi,{id:"activity:history-error",tone:"error",title:"History unavailable",actions:s.jsx(ue,{size:"xs",variant:"outline",onClick:he.refresh,children:"Retry"}),children:he.error||r.historyError}),X==="custom"&&s.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-border px-6 py-2 text-xs",children:[s.jsxs("label",{className:"flex items-center gap-2",children:["From",s.jsx("input",{type:"datetime-local","aria-label":"From time",className:sr,value:Z,onInput:ae=>Pe(K)(ae.currentTarget.value)})]}),s.jsxs("label",{className:"flex items-center gap-2",children:["To",s.jsx("input",{type:"datetime-local","aria-label":"To time",className:sr,value:se,onInput:ae=>Pe(I)(ae.currentTarget.value)})]}),s.jsx("span",{className:"text-muted-foreground",children:Intl.DateTimeFormat().resolvedOptions().timeZone}),De&&s.jsx("span",{role:"alert",className:"text-red-600",children:"Choose a start or end time; the end must follow the start."})]}),!!At&&s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-b border-border px-6 py-2",children:[Ht.map(ae=>s.jsxs("button",{onClick:ae.clear,title:`Remove ${ae.label}`,className:"flex max-w-72 items-center gap-2 rounded border border-border bg-muted/40 px-2 py-1 text-[11px]",children:[s.jsx("span",{className:"truncate",children:ae.label}),s.jsx(On,{className:"size-3 shrink-0"})]},ae.label)),s.jsx(ue,{size:"xs",variant:"ghost",onClick:jt,children:"Clear all"})]}),s.jsxs("div",{className:"flex min-h-10 flex-wrap items-center gap-x-4 gap-y-1 border-b border-border px-6 py-2 text-[11px] text-muted-foreground",children:[s.jsxs("span",{children:[s.jsx("strong",{className:"font-mono text-foreground",children:nt.toLocaleString()})," ",r.demo?"demo events":"matching events"]}),s.jsxs("span",{children:[kt.toLocaleString()," allowed · ",s.jsxs("span",{className:Qe?"text-red-600":"",children:[Qe.toLocaleString()," denied"]})," ",s.jsx("span",{className:"text-muted-foreground/70",children:"on this page"})]}),s.jsxs("button",{className:"flex min-h-10 items-center gap-1.5 rounded px-2 text-xs hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>{T?(A(null),xe({query:ee,page:0}),M(Date.now()),he.refresh(),Ie.scrollToTop()):at()},children:[T?s.jsx(IR,{className:"size-3"}):s.jsx(qI,{className:"size-3"}),T?"Resume":"Pause"]}),T&&s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{children:"View paused"}),s.jsx("button",{className:"rounded text-foreground underline underline-offset-4 disabled:opacity-40",disabled:r.demo&&!ut,onClick:()=>{A(r.demo?r.events:Re),M(Date.now()),he.refresh(),Ie.scrollToTop()},children:r.demo?`${ut.toLocaleString()} new events`:"Refresh"})]}),J.size>0&&s.jsxs("span",{className:"flex items-center gap-2",children:[J.size.toLocaleString()," selected",s.jsx("button",{className:"underline",onClick:()=>ne(new Set),children:"Clear selection"})]}),s.jsx("span",{className:"ml-auto",children:Intl.DateTimeFormat().resolvedOptions().timeZone})]}),s.jsxs("div",{ref:Ie.ref,onScroll:ae=>{Ie.onScroll(ae),ae.currentTarget.scrollTop>0&&at()},tabIndex:0,role:"region","aria-label":"Activity events",className:"min-h-0 flex-1 overflow-auto outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:[s.jsxs("table",{style:{minWidth:u.reduce((ae,Xe)=>ae+Xe.width,r.demo?0:40)},className:"w-full table-fixed border-separate border-spacing-0 text-xs","aria-label":"Activity","aria-rowcount":pe.length+1,children:[s.jsxs("colgroup",{children:[!r.demo&&s.jsx("col",{style:{width:52}}),u.map(ae=>s.jsx("col",{style:{width:ae.width}},ae.id))]}),s.jsx("thead",{className:"sticky top-0 z-10 bg-muted",children:s.jsxs("tr",{children:[!r.demo&&s.jsx("th",{scope:"col",className:"h-10 border-b border-border pr-3 pl-4 text-left sm:pl-6",children:s.jsx("input",{type:"checkbox","aria-label":"Select logs on this page",disabled:!pe.length||pe.length>5e3,checked:pe.length>0&&pe.every(ae=>J.has(ae.key)),ref:ae=>{ae&&(ae.indeterminate=pe.some(Xe=>J.has(Xe.key))&&!pe.every(Xe=>J.has(Xe.key)))},onChange:ae=>{at(),ne(ae.target.checked?new Set(pe.map(Xe=>Xe.key)):new Set)}})}),u.map(ae=>{var Xe,rt,Wt,Mn;return s.jsx("th",{scope:"col","aria-sort":U.key===ae.id?U.direction==="asc"?"ascending":"descending":"none",className:"h-10 border-b border-border px-3 text-left font-medium text-muted-foreground",children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxs("button",{className:"flex h-9 flex-1 items-center gap-1 outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>Pe(Q)({key:ae.id,direction:U.key===ae.id&&U.direction==="asc"?"desc":"asc"}),children:[ae.label,U.key===ae.id&&(U.direction==="asc"?s.jsx(lf,{className:"size-3"}):s.jsx(af,{className:"size-3"}))]}),s.jsxs(ip,{children:[s.jsx(lp,{"aria-label":`Filter ${ae.label}`,className:`rounded p-1 hover:bg-accent ${(ae.id==="time"?X!=="all":ae.id==="sandbox"?L.length:ae.id==="verdict"?H.length:ae.id==="agent"?P.length||(Xe=V.agent)!=null&&Xe.value:(rt=V[ae.id])!=null&&rt.value)?"bg-accent text-foreground":""}`,children:s.jsx(aC,{className:"size-3"})}),s.jsxs(cp,{align:"start",children:[s.jsxs("p",{className:"text-xs font-medium",children:["Filter ",ae.label.toLowerCase()]}),ae.id==="agent"?s.jsxs("div",{role:"group","aria-label":"Observed agents",className:"max-h-64 overflow-y-auto",children:[s.jsxs("div",{className:"mb-1 flex items-center justify-between px-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{children:P.length?`${P.length} selected`:"All agents"}),s.jsx("button",{className:"underline",onClick:()=>{at(),$([]),G(({agent:Pt,...Mt})=>Mt)},children:"Clear"})]}),me.map(Pt=>s.jsxs("label",{className:"flex min-h-8 cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-xs hover:bg-muted",children:[s.jsx("input",{type:"checkbox",checked:P.includes(Pt),onChange:()=>{at(),G(({agent:Mt,...Dn})=>Dn),$(Mt=>Mt.includes(Pt)?Mt.filter(Dn=>Dn!==Pt):[...Mt,Pt])},className:"accent-foreground"}),s.jsx(fp,{agent:nQ[Pt]??{name:Pt}})]},Pt)),!me.length&&s.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No agents in the logs"})]}):ae.id==="sandbox"?s.jsx(ky,{label:"Sandboxes",options:We,selected:L,onChange:Pe(q)}):ae.id==="verdict"?s.jsx(ky,{label:"Decisions",options:["allowed","denied","not reported","not applicable"],selected:H,onChange:Pe(F)}):ae.id==="time"?s.jsxs(s.Fragment,{children:[s.jsx(hn,{"aria-label":"Filter time",className:sr,value:X,onChange:Pt=>Pe(B)(Pt.target.value),children:Object.entries(Ph).map(([Pt,Mt])=>s.jsx("option",{value:Pt,children:Mt},Pt))}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Custom dates appear above the table."})]}):s.jsxs(s.Fragment,{children:[s.jsxs(hn,{"aria-label":`${ae.label} match mode`,className:sr,value:((Wt=V[ae.id])==null?void 0:Wt.mode)??"contains",onChange:Pt=>{var Mt;return Pe(G)({...V,[ae.id]:{value:((Mt=V[ae.id])==null?void 0:Mt.value)??"",mode:Pt.target.value}})},children:[s.jsx("option",{value:"equals",children:"Equals"}),s.jsx("option",{value:"contains",children:"Contains"}),s.jsx("option",{value:"excludes",children:"Excludes"})]}),s.jsx(Rt,{"aria-label":`${ae.label} filter value`,placeholder:`Filter ${ae.label.toLowerCase()}…`,value:((Mn=V[ae.id])==null?void 0:Mn.value)??"",onChange:Pt=>{var Mt;return Pe(G)({...V,[ae.id]:{mode:((Mt=V[ae.id])==null?void 0:Mt.mode)??"contains",value:Pt.target.value}})},className:"h-8 text-xs"})]})]})]})]})},ae.id)})]})}),s.jsxs("tbody",{children:[Ie.paddingTop>0&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:u.length+(r.demo?0:1),style:{height:Ie.paddingTop,padding:0}})}),pe.slice(Ie.start,Ie.end).map((ae,Xe)=>s.jsxs("tr",{"aria-rowindex":Ie.start+Xe+2,onClick:()=>{at(),le(ae)},className:`group cursor-pointer hover:bg-muted/70 ${(te==null?void 0:te.key)===ae.key?"bg-accent":"bg-card"}`,children:[!r.demo&&s.jsx("td",{className:"h-12 border-b border-border/60 pr-3 pl-4 sm:pl-6",onClick:rt=>rt.stopPropagation(),children:s.jsx("input",{type:"checkbox","aria-label":`Select log ${ae.values.sandbox} ${ae.values.time}`,checked:J.has(ae.key),disabled:!J.has(ae.key)&&J.size>=5e3,onChange:()=>_e(ae.key)})}),u.map(rt=>s.jsx("td",{className:`h-12 border-b border-border/60 px-3 py-0 font-mono text-[11px] ${rt.id==="verdict"?ae.values.verdict==="denied"?"text-red-600":ae.values.verdict==="allowed"?"text-emerald-700":"text-muted-foreground":rt.id==="destination"?"text-foreground":"text-muted-foreground"}`,children:rt.id==="time"?s.jsx("button",{"aria-label":`Inspect event ${ae.values.sandbox} ${ae.values.time}`,"aria-haspopup":"dialog",className:"h-8 w-full truncate text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:Wt=>{Wt.stopPropagation(),at(),le(ae)},children:sQ(ae.values.time)}):rt.id==="action"?s.jsxs("span",{className:"block truncate",title:`${ae.values.category} · ${ae.values.action} · ${ae.values.process}`,children:[s.jsxs("span",{className:"block truncate text-foreground",children:[ae.values.category," · ",ae.event.method||ae.event.action||"Not reported"]}),s.jsx("span",{className:"block truncate text-[10px]",children:ae.values.process||ae.event.detail||ae.event.message||"Process not reported"})]}):rt.id==="agent"&&ae.agent?s.jsx("span",{className:"font-sans text-foreground",children:s.jsx(fp,{agent:ae.agent})}):s.jsx("span",{className:"block truncate",title:ae.values[rt.id],children:ae.values[rt.id]||"-"})},rt.id))]},ae.key)),Ie.end<pe.length&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:u.length+(r.demo?0:1),style:{height:(pe.length-Ie.end)*48,padding:0}})})]})]}),!pe.length&&s.jsxs("div",{className:"py-20 text-center text-sm text-muted-foreground",children:[s.jsx("p",{children:he.error&&!r.demo?"Could not load retained events":he.loading&&!r.demo?"Searching retained events…":De?"Set a valid time range":At?"No matching events in available history":"No activity available"}),!!At&&s.jsx(ue,{variant:"outline",size:"sm",className:"mt-3",onClick:jt,children:"Clear filters"})]})]}),nt>vl&&s.jsxs("nav",{"aria-label":"Activity pagination",className:"flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-border bg-card px-6 py-3",children:[s.jsxs("span",{"aria-live":"polite",className:"text-xs tabular-nums text-muted-foreground",children:[(Ye*vl+1).toLocaleString(),"-",Math.min((Ye+1)*vl,nt).toLocaleString()," of ",nt.toLocaleString()," logs"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ue,{variant:"outline",size:"sm","aria-label":"First page",disabled:Ye===0||!r.demo&&he.loading,onClick:()=>He(0),children:"First"}),s.jsx(ue,{variant:"outline",size:"sm","aria-label":"Previous page",disabled:Ye===0||!r.demo&&he.loading,onClick:()=>He(Ye-1),children:"Previous"}),s.jsx("span",{"aria-live":"polite",className:"px-2 text-xs tabular-nums text-muted-foreground",children:!r.demo&&he.loading?"Loading…":`Page ${Ye+1} of ${Ge.toLocaleString()}`}),s.jsx(ue,{variant:"outline",size:"sm","aria-label":"Next page",disabled:Ye>=Ge-1||!r.demo&&he.loading,onClick:()=>He(Ye+1),children:"Next"}),s.jsx(ue,{variant:"outline",size:"sm","aria-label":"Last page",disabled:Ye>=Ge-1||!r.demo&&he.loading,onClick:()=>He(Ge-1),children:"Last"})]})]})]}),s.jsx(yn,{open:!!S,onOpenChange:ae=>{ae||C(null)},children:s.jsxs(vn,{className:"sm:max-w-md max-h-[85vh] overflow-y-auto",children:[s.jsxs(Nn,{children:[s.jsxs(wn,{children:["Export ",(S==null?void 0:S.format)==="ocsf"?"OCSF JSON":"Console JSON"]}),s.jsx(Hn,{children:"Your current columns and time frame are ready to export. Other table filters still apply."})]}),S&&s.jsxs(s.Fragment,{children:[s.jsxs("label",{className:"grid gap-2 text-xs font-medium",children:["Time frame",s.jsx(hn,{className:sr,value:S.range,onChange:ae=>C({...S,range:ae.target.value}),children:Object.entries(Ph).map(([ae,Xe])=>s.jsx("option",{value:ae,children:Xe},ae))})]}),S.range==="custom"&&s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[["from","to"].map(ae=>s.jsxs("label",{className:"grid gap-1 text-xs",children:[s.jsx("span",{children:ae==="from"?"From":"To"}),s.jsx("input",{type:"datetime-local",className:sr+" w-full min-w-0",value:S[ae],onChange:Xe=>C({...S,[ae]:Xe.target.value})})]},ae)),s.jsxs("p",{className:"text-[11px] text-muted-foreground sm:col-span-2",children:[Intl.DateTimeFormat().resolvedOptions().timeZone," · Leave one end empty for an open range."]})]}),s.jsxs("fieldset",{className:"space-y-3",children:[s.jsx("legend",{className:"text-xs font-medium",children:"Columns"}),s.jsx("div",{className:"grid grid-cols-2 gap-3",children:zh.map(ae=>s.jsxs("label",{className:"flex items-center gap-2 text-xs",children:[s.jsx("input",{type:"checkbox",checked:S.columns.includes(ae.id),disabled:ae.id==="time"&&S.format==="ocsf",onChange:Xe=>C({...S,columns:Xe.target.checked?[...S.columns,ae.id]:S.columns.filter(rt=>rt!==ae.id)})}),ae.label]},ae.id))})]}),S.format==="ocsf"&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"OCSF includes the required event time and schema fields alongside your selected columns."}),Ze&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Choose at least one column and a valid time frame."}),s.jsxs(No,{children:[s.jsx(ue,{variant:"outline",onClick:()=>C(null),children:"Cancel"}),s.jsxs(ue,{disabled:N||Ze,onClick:ht,children:[s.jsx(Kc,{}),N?"Exporting…":"Export"]})]})]})]})}),s.jsx(Wr,{open:!!ce,onOpenChange:ae=>{!ae&&!W&&oe(null)},children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsx(eo,{children:(ce==null?void 0:ce.mode)==="all"?"Delete all retained logs?":(ce==null?void 0:ce.mode)==="matching"?"Delete matching logs?":"Delete selected logs?"}),s.jsxs(to,{children:[ce==null?void 0:ce.count.toLocaleString()," log",(ce==null?void 0:ce.count)===1?"":"s"," will be permanently removed from Activity and pending webhook delivery. This cannot be undone."]})]}),s.jsxs("p",{className:"text-xs leading-relaxed text-muted-foreground",children:[(ce==null?void 0:ce.mode)==="all"?"This includes every sandbox and ignores the current filters. ":"","New logs arriving after this review will be kept. Copies in sandbox files, exports, or external systems are not deleted; a webhook request already in flight may still arrive."]}),Ee&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:Ee}),s.jsxs(Jr,{children:[s.jsx(so,{disabled:W,children:"Cancel"}),s.jsx(no,{variant:"destructive",disabled:W||!(ce!=null&&ce.count)||!!Ee,onClick:we,children:W?"Deleting…":`Delete ${ce==null?void 0:ce.count.toLocaleString()} log${(ce==null?void 0:ce.count)===1?"":"s"}`})]})]})}),s.jsx(Ul,{open:p,onOpenChange:b,children:s.jsxs(cu,{className:"gap-0 data-[side=right]:w-full sm:data-[side=right]:max-w-2xl",children:[s.jsxs(uu,{className:"border-b border-border pr-12",children:[s.jsxs(du,{className:"flex items-center gap-2",children:[s.jsx(uC,{"aria-hidden":"true",className:"size-4 text-muted-foreground",strokeWidth:1.5}),"Webhooks"]}),s.jsx(fu,{children:"Send activity to an HTTPS endpoint."})]}),p&&s.jsx(ZW,{})]})}),s.jsx(Ul,{open:!!te,onOpenChange:ae=>{ae||le(null)},children:s.jsxs(cu,{className:"w-full gap-0 sm:max-w-lg",children:[s.jsxs(uu,{className:"border-b border-border pr-12",children:[s.jsx(du,{children:"Event details"}),s.jsx(fu,{children:"Full values from this event. The activity view stays paused."})]}),te&&s.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-auto p-5",children:[s.jsx("div",{className:"flex flex-wrap gap-2",children:[[te.event.scope?"scope":"sandbox",te.event.scope||te.values.sandbox,"Sandbox timeline"],["destination",te.values.destination,"Same target"],["process",te.values.process,"Same executable"],["policy",te.values.policy,"Same policy"],["session",te.values.session,"Same session"],["correlation",te.values.correlation,"Same correlation"]].filter(([,ae])=>ae).map(([ae,Xe,rt])=>s.jsx(ue,{size:"xs",variant:"outline",onClick:()=>be(ae,Xe),children:rt},ae))}),!r.demo&&s.jsxs(ue,{size:"sm",variant:"destructive",disabled:W,onClick:()=>$e("selected",[te.key]),children:[s.jsx(Yn,{}),"Delete log"]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Pivots match recorded fields. An executable match does not prove the same process instance."}),s.jsx("dl",{className:"space-y-4",children:[["Timestamp",te.values.time],["Sandbox",te.values.sandbox],["Sandbox ID",te.values.sandboxId],["Collection scope",te.event.scope],["Direction",te.values.direction],["Category",te.values.category],["Security severity",te.values.severity],["Log level",te.values.logLevel],["Decision",te.values.verdict],["Agent",te.values.agent],["Attribution",te.agent?"Executable name match only; initiating agent and parent process are not reported.":"Initiating agent not reported by this event."],["Initiator","Not reported"],["Session ID",te.values.session],["Correlation ID",te.values.correlation],["Action",te.values.action],["Executable",te.event.binary],["Destination",te.values.destination],["Policy",te.event.policy],["Policy revision at event time",te.event.policyVersion??"Not reported"],["Enforcement mode at event time",te.event.enforcement??"Not reported"],["Event ID",te.key],["Source cursor",te.event.sourceCursor],["Identity evidence",te.event.idSource||"No source event ID reported"],["Received at",te.event.receivedAt],["Source",te.event.source],["Parser target",te.event.target],["Reason",te.event.reason],["Why",te.values.why]].map(([ae,Xe])=>s.jsxs("div",{children:[s.jsx("dt",{className:"mb-1 text-[11px] text-muted-foreground",children:ae}),s.jsxs("dd",{className:"flex items-start gap-2",children:[s.jsx("span",{className:"min-w-0 flex-1 break-all font-mono text-xs",children:ae==="Agent"&&te.agent?s.jsx(fp,{agent:te.agent}):Xe||"-"}),Xe&&s.jsx(WE,{label:ae,value:Xe})]})]},ae))}),s.jsxs("div",{children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("h3",{className:"text-xs font-medium",children:"Raw event"}),s.jsx(WE,{label:"raw event",value:JSON.stringify(te.event,null,2)})]}),s.jsx("pre",{className:"overflow-auto whitespace-pre-wrap break-all rounded-md border border-border bg-muted/40 p-3 text-[11px]",children:JSON.stringify(te.event,null,2)})]})]})]})})]})}function WE({label:e,value:t}){const[r,a]=x.useState(!1);return x.useEffect(()=>{if(r){const l=setTimeout(()=>a(!1),1500);return()=>clearTimeout(l)}},[r]),s.jsx("button",{className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-muted","aria-label":`Copy ${e}`,onClick:async()=>{try{await navigator.clipboard.writeText(t),a(!0)}catch{qe.error("Could not copy to clipboard")}},children:r?s.jsx(Fn,{className:"size-3.5"}):s.jsx(cf,{className:"size-3.5"})})}const Ei=(e,t,r=`${t}s`)=>`${e} ${e===1?t:r}`,QE="groups-show-sandboxes";function cQ(e){try{sessionStorage.setItem(Hl,JSON.stringify(e))}catch{}}function Zp(e,t){var r,a;(r=e.failed)!=null&&r.length?qe.warning(`${t}. ${Ei(e.failed.length,"sandbox","sandboxes")} could not be updated`,{description:e.failed.map(l=>`${l.sandbox}: ${l.error}`).join(`
520
- `)}):qe.success(t,{description:(a=e.applied)!=null&&a.length?`Network access updated in ${Ei(e.applied.length,"sandbox","sandboxes")}.`:void 0})}function uQ({policy:e,onClick:t}){const r=e.action==="block"?Yv:pu;return s.jsxs("button",{type:"button",onClick:t,title:`${e.action==="block"?"Blocks":"Allows"} ${e.destinations.join(", ")}`,className:Le("flex max-w-full items-center gap-1 rounded-full border px-2 py-px text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring",e.action==="block"?"border-red-200 bg-red-50 text-red-700 hover:bg-red-100/70":"border-emerald-600/20 bg-emerald-50 text-emerald-800 hover:bg-emerald-100/70"),children:[s.jsx(r,{className:"size-3 shrink-0","aria-hidden":"true"}),s.jsx("span",{className:"truncate",children:e.name})]})}function dQ({names:e,limit:t=4}){return e.length?s.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[e.slice(0,t).map(r=>s.jsx("span",{className:"rounded border border-border bg-background px-1.5 py-px font-mono text-[10.5px] text-muted-foreground",children:r},r)),e.length>t&&s.jsxs("span",{className:"text-[11px] text-faint",children:["+",e.length-t]})]}):s.jsx("span",{className:"text-[11px] text-faint",children:"No sandboxes yet"})}const fQ=[{title:"Create a group",body:"Name it for a kind of work, like Frontend or Data."},{title:"Add network rules",body:"Choose the destinations this group can reach or must block."},{title:"Add sandboxes",body:"Choose one or more groups for each sandbox. Their network rules combine."}];function mQ({onCreate:e,onPolicy:t}){return s.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[s.jsx(qo,{children:s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("span",{className:"flex size-9 items-center justify-center rounded-xl border border-stone-300 bg-card shadow-[0_3px_8px_#1c191708]",children:s.jsx(Ta,{className:"size-4.5 text-stone-600",strokeWidth:1.4})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-[15px] font-medium tracking-tight",children:"Give sandboxes the same network access, together"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Instead of one rule per sandbox, make a group and aim rules at the group."})]})]})}),s.jsxs("ol",{className:"relative mt-8 grid gap-3 sm:grid-cols-3",children:[s.jsx("span",{"aria-hidden":"true",className:"absolute top-[22px] right-[16%] left-[16%] hidden h-px bg-gradient-to-r from-border via-stone-300 to-border sm:block"}),fQ.map((r,a)=>s.jsx(qo,{delay:.08+a*.08,className:"relative",children:s.jsxs("li",{className:"flex h-full flex-col rounded-lg border border-border bg-card p-4",children:[s.jsx("span",{className:"relative z-10 flex size-[26px] items-center justify-center rounded-full border border-stone-300 bg-card font-mono text-[11px] text-stone-600",children:a+1}),s.jsx("p",{className:"mt-3 text-xs font-medium",children:r.title}),s.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",children:r.body})]})},r.title))]}),s.jsx(qo,{delay:.34,children:s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-2",children:[s.jsxs(ue,{onClick:e,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[s.jsx(cs,{}),"Create your first group"]}),s.jsxs(ue,{variant:"ghost",onClick:t,className:"text-muted-foreground",children:["Network rules",s.jsx(Ay,{})]})]})})]})}function hQ({open:e,onOpenChange:t,groups:r,sandboxes:a,assignments:l,onCreated:c}){const u=$t(),[f,m]=x.useState(""),[h,g]=x.useState(""),[p,b]=x.useState([]),[v,j]=x.useState(!1),[S,C]=x.useState(null);x.useEffect(()=>{e&&(m(""),g(""),b([]),C(null))},[e]);const N=MM(f),E=r.some(k=>k.id===N),T=k=>jo({assignments:l},k).map(M=>{var R;return(R=r.find(O=>O.id===M))==null?void 0:R.name}).filter(Boolean).join(", ");async function A(k){k.preventDefault(),j(!0),C(null);try{const{group:M}=await u.saveGroup({id:N,name:f.trim(),description:h.trim(),isNew:!0});let R=null;if(p.length)try{R=await u.setGroupMembers(p,[M.id],"add")}catch(O){qe.warning(`Created ${M.name}, but could not add sandboxes`,{description:O.message})}t(!1),c(M,R,p.length)}catch(M){C(M.message)}finally{j(!1)}}return s.jsx(yn,{open:e,onOpenChange:t,children:s.jsx(vn,{className:"max-h-[90svh] overflow-y-auto sm:max-w-md",children:s.jsxs("form",{onSubmit:A,className:"grid gap-4",children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:"New group"}),s.jsx(Hn,{className:"text-xs",children:"Network rules aimed at this group reach every sandbox in it."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"group-name",className:"text-xs",children:"Name"}),s.jsx(Rt,{id:"group-name",value:f,onChange:k=>m(k.target.value),placeholder:"Frontend",className:"text-xs",required:!0,autoFocus:!0}),E&&s.jsx("p",{className:"text-[11px] text-red-700",children:"A group with this name already exists."})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs(En,{htmlFor:"group-description",className:"text-xs",children:["Description ",s.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),s.jsx(Pf,{id:"group-description",rows:2,value:h,onChange:k=>g(k.target.value),placeholder:"Web apps: npm and GitHub",className:"text-xs"})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs("span",{className:"text-xs font-medium",children:["Add sandboxes ",s.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),a.length?s.jsx("ul",{className:"max-h-48 divide-y divide-border/60 overflow-y-auto rounded-md border border-border",children:a.map(k=>{const M=p.includes(k.name),R=T(k.name);return s.jsx("li",{children:s.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5 px-3 py-1.5 text-xs hover:bg-muted/50",children:[s.jsx("input",{type:"checkbox",checked:M,onChange:()=>b(O=>M?O.filter(D=>D!==k.name):[...O,k.name]),className:"size-3.5"}),s.jsx("span",{className:Le("size-1.5 shrink-0 rounded-full",Pa(k.phase).cell),"aria-hidden":"true"}),s.jsx("span",{className:"truncate font-mono",children:k.name}),R&&s.jsx("span",{className:"ml-auto shrink-0 text-[11px] text-muted-foreground",children:`also in ${R}`})]})},k.name)})}):s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No sandboxes yet. Pick this group when you create one."})]}),S&&s.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:S}),s.jsxs(No,{children:[s.jsx(ue,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),s.jsxs(ue,{type:"submit",disabled:v||!N||E,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[v&&s.jsx(zt,{"aria-hidden":"true"}),"Create group",p.length?` with ${Ei(p.length,"sandbox","sandboxes")}`:""]})]})]})})})}function pQ({group:e,org:t,sandboxes:r,onClose:a,onChanged:l,onPolicy:c}){const u=$t(),[f,m]=x.useState(""),[h,g]=x.useState(""),[p,b]=x.useState(!1),[v,j]=x.useState(!1);if(x.useEffect(()=>{e&&(m(e.name),g(e.description))},[e]),!e)return s.jsx(Ul,{open:!1,onOpenChange:()=>{}});const S=t.members[e.id]??[],C=DM(t.policies,e.id),N=t.policies.filter(O=>O.appliesTo.everyone),E=r.filter(O=>!S.includes(O.name)),T=O=>jo(t,O).map(D=>{var _;return(_=t.groups.find(L=>L.id===D))==null?void 0:_.name}).filter(Boolean).join(", "),A=f.trim()!==e.name||h.trim()!==e.description;async function k(){b(!0);try{await u.saveGroup({...e,name:f.trim()||e.name,description:h.trim()}),qe.success(`Saved ${f.trim()||e.name}`),l()}catch(O){qe.error(O.message)}finally{b(!1)}}async function M(O,D){b(!0);try{Zp(await u.setGroupMembers(O,[e.id],D?"add":"remove"),D?`Added ${O.join(", ")} to ${e.name}`:`Removed ${O.join(", ")} from ${e.name}`),l()}catch(_){qe.error(_.message)}finally{b(!1)}}async function R(){b(!0);try{Zp(await u.deleteGroup(e.id),`Deleted ${e.name}`),a(),l()}catch(O){qe.error(O.message)}finally{b(!1),j(!1)}}return s.jsx(Ul,{open:!0,onOpenChange:O=>{O||a()},children:s.jsxs(cu,{className:"w-full! overflow-y-auto sm:max-w-[460px]!",children:[s.jsxs(uu,{className:"border-b p-6",children:[s.jsxs(du,{className:"flex items-center gap-2 text-base",children:[s.jsx(Ta,{className:"size-4 text-muted-foreground",strokeWidth:1.5}),e.name]}),s.jsxs(fu,{children:[Ei(S.length,"sandbox","sandboxes")," · ",Ei(C.length,"rule")," aimed at this group"]})]}),s.jsxs("div",{className:"space-y-6 px-6 pb-6",children:[s.jsxs("section",{className:"grid gap-3",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"edit-group-name",className:"text-xs",children:"Name"}),s.jsx(Rt,{id:"edit-group-name",value:f,onChange:O=>m(O.target.value),className:"text-xs"})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"edit-group-description",className:"text-xs",children:"Description"}),s.jsx(Pf,{id:"edit-group-description",rows:2,value:h,onChange:O=>g(O.target.value),className:"text-xs"})]}),A&&s.jsxs(ue,{size:"sm",className:"w-fit bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",disabled:p,onClick:k,children:[p&&s.jsx(zt,{}),"Save"]})]}),s.jsxs("section",{className:"grid gap-2",children:[s.jsx("h3",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Sandboxes"}),S.length?s.jsx("ul",{className:"divide-y divide-border/60 rounded-md border border-border",children:S.map(O=>{const D=r.find(_=>_.name===O);return s.jsxs("li",{className:"flex items-center gap-2.5 px-3 py-1.5",children:[s.jsx("span",{className:Le("size-1.5 shrink-0 rounded-full",Pa(D==null?void 0:D.phase).cell),"aria-hidden":"true"}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:O}),s.jsx(ue,{size:"icon-xs",variant:"ghost","aria-label":`Remove ${O} from ${e.name}`,disabled:p,onClick:()=>M([O],null),children:s.jsx(On,{})})]},O)})}):s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["No sandboxes yet. Add one below, or pick ",e.name," when you create a sandbox."]}),E.length>0&&s.jsxs(hn,{value:"","aria-label":`Add a sandbox to ${e.name}`,disabled:p,onChange:O=>O.target.value&&M([O.target.value],e.id),className:"h-8 w-fit rounded-md border border-dashed border-border bg-transparent px-2 text-[11px] text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx("option",{value:"",children:"+ Add sandbox"}),E.map(O=>s.jsxs("option",{value:O.name,children:[O.name,T(O.name)?` (also in ${T(O.name)})`:""]},O.name))]})]}),s.jsxs("section",{className:"grid gap-2",children:[s.jsx("h3",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Network access"}),C.length?s.jsx("div",{className:"flex flex-wrap gap-1.5",children:C.map(O=>s.jsx(uQ,{policy:O,onClick:()=>c({edit:O.id})},O.id))}):s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"No network rules yet."}),N.length>0&&s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Also, like every sandbox: ",N.map(O=>O.name).join(", "),"."]}),s.jsxs(ue,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>c({new:{appliesTo:{groups:[e.id]}}}),children:[s.jsx(cs,{}),"Add rule for ",e.name]})]}),s.jsxs("section",{className:"border-t border-border pt-4",children:[(S.length>0||C.length>0)&&s.jsx("p",{className:"mb-2 text-[11px] text-muted-foreground",children:"Move the sandboxes and move or delete the network rules before deleting this group."}),s.jsxs(ue,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-destructive",disabled:p||S.length>0||C.length>0,onClick:()=>j(!0),children:[s.jsx(Yn,{}),"Delete group"]})]})]}),s.jsx(Wr,{open:v,onOpenChange:j,children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsxs(eo,{children:["Delete ",e.name,"?"]}),s.jsx(to,{children:"This empty group will be deleted."})]}),s.jsxs(Jr,{children:[s.jsx(so,{children:"Cancel"}),s.jsx(no,{variant:"destructive",onClick:R,children:"Delete group"})]})]})})]})})}function gQ({group:e,members:t,policies:r,onOpen:a,delay:l}){return s.jsx(qo,{delay:l,className:"h-full",children:s.jsxs("button",{onClick:a,className:"group/card flex h-full w-full flex-col gap-3 rounded-lg border border-border bg-card p-4 text-left outline-none transition-[border-color,box-shadow] hover:border-stone-300 hover:shadow-[0_3px_10px_#1c19170a] focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsxs("span",{className:"flex items-start gap-2",children:[s.jsx(Ta,{className:"mt-0.5 size-3.5 shrink-0 text-muted-foreground",strokeWidth:1.5,"aria-hidden":"true"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate text-xs font-medium",children:e.name}),e.description&&s.jsx("span",{className:"mt-0.5 line-clamp-2 block text-[11px] text-muted-foreground",children:e.description})]}),s.jsx(Ur,{className:"size-3.5 shrink-0 text-faint transition-transform group-hover/card:translate-x-0.5","aria-hidden":"true"})]}),s.jsx(dQ,{names:t}),s.jsxs("span",{className:"mt-auto flex min-w-0 flex-wrap items-center gap-1 border-t border-border/60 pt-3",children:[r.length?r.slice(0,3).map(c=>s.jsx("span",{className:Le("truncate rounded-full border px-2 py-px text-[10.5px]",c.action==="block"?"border-red-200 bg-red-50 text-red-700":"border-emerald-600/20 bg-emerald-50 text-emerald-800"),children:c.name},c.id)):s.jsx("span",{className:"text-[11px] text-faint",children:"No rules yet"}),r.length>3&&s.jsxs("span",{className:"text-[11px] text-faint",children:["+",r.length-3]})]})]})})}function xQ({onNavigate:e}){const t=$t(),r=Ua(),[a,l]=x.useState(null),[c,u]=x.useState(!1),[f,m]=x.useState(null),[h,g]=x.useState(""),[p,b]=x.useState([]),[v,j]=x.useState([]),[S,C]=x.useState(!1),[N,E]=x.useState(()=>{try{return localStorage.getItem(QE)==="1"}catch{return!1}}),T=()=>E(H=>{try{localStorage.setItem(QE,H?"0":"1")}catch{}return!H}),A=x.useCallback(async()=>{try{l(await t.org())}catch(H){l({error:H.message})}},[]);x.useEffect(()=>{A()},[A]);const k=x.useMemo(()=>[...r.sandboxes??[]].filter(H=>H.phase!=="deleting").sort((H,F)=>H.name.localeCompare(F.name)),[r.sandboxes]),M=H=>{cQ(H),e("egress")};if(!a)return s.jsx("p",{role:"status",className:"py-24 text-center text-sm text-muted-foreground",children:"Loading…"});if(a.error)return s.jsx("p",{role:"alert",className:"py-24 text-center text-sm text-muted-foreground",children:a.error});const R=a.groups,O=a.assignments??{},D=k.filter(H=>jo(a,H.name).length).length,_=h.trim().toLowerCase(),L=k.filter(H=>!_||H.name.includes(_)||R.some(F=>jo(a,H.name).includes(F.id)&&F.name.toLowerCase().includes(_))),q=L.length>0&&L.every(H=>p.includes(H.name));async function P(H,F,V="replace"){C(!0);try{Zp(await t.setGroupMembers(H,F,V),`Updated groups for ${Ei(H.length,"sandbox","sandboxes")}`),b([]),await A()}catch(G){qe.error(G.message)}finally{C(!1)}}const $=s.jsx(hQ,{open:c,onOpenChange:u,groups:R,sandboxes:k,assignments:O,onCreated:async(H,F,V)=>{F?Zp(F,`Created ${H.name} with ${Ei(V,"sandbox","sandboxes")}`):qe.success(`Created ${H.name}`,{description:"Add sandboxes and network rules to it in any order."}),await A(),m(H.id)}});return R.length?s.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 pt-4 pb-3 sm:px-6",children:[s.jsx("div",{className:"flex flex-wrap gap-1",children:[{label:"Groups",value:R.length},{label:"In a group",value:D},{label:"No group",value:k.length-D}].map(H=>s.jsxs("div",{className:"rounded-md px-3 py-1.5",children:[s.jsx("span",{className:"block text-[11px] text-muted-foreground",children:H.label}),s.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:s.jsx(tf,{value:H.value})})]},H.label))}),s.jsxs(ue,{size:"sm",className:"ml-auto bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",onClick:()=>u(!0),children:[s.jsx(cs,{className:"size-3.5"}),"New group"]})]}),s.jsxs("section",{"aria-label":"Groups",className:"grid gap-3 px-4 py-5 sm:grid-cols-2 sm:px-6 xl:grid-cols-3",children:[R.map((H,F)=>s.jsx(gQ,{group:H,members:a.members[H.id]??[],policies:DM(a.policies,H.id),onOpen:()=>m(H.id),delay:F*.04},H.id)),s.jsx(qo,{delay:R.length*.04,className:"h-full",children:s.jsxs("button",{onClick:()=>u(!0),className:"flex h-full min-h-32 w-full flex-col items-center justify-center gap-1.5 rounded-lg border border-dashed border-border text-[11px] text-muted-foreground outline-none transition-colors hover:border-foreground/30 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx(cs,{className:"size-4",strokeWidth:1.5,"aria-hidden":"true"}),"New group"]})})]}),s.jsxs("section",{"aria-label":"Sandboxes and their groups",className:"border-t border-border",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 sm:px-6",children:[s.jsxs("button",{type:"button",onClick:T,"aria-expanded":N,className:"flex items-center gap-1.5 rounded text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[s.jsx(Ur,{className:Le("size-3.5 text-muted-foreground transition-transform",N&&"rotate-90"),"aria-hidden":"true"}),s.jsx("span",{className:"font-medium",children:"Sandboxes"}),s.jsx("span",{className:"font-mono text-[11px] tabular-nums text-muted-foreground",children:k.length}),k.length-D>0&&s.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["· ",k.length-D," not in a group"]})]}),N&&s.jsx(ea,{value:h,onValueChange:g,placeholder:"Search sandbox or group…","aria-label":"Search sandboxes",className:"ml-auto w-full sm:w-56"})]}),N&&s.jsxs(s.Fragment,{children:[p.length>0&&s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-y border-border bg-accent/50 px-4 py-2 text-xs sm:px-6",children:[s.jsx(Fn,{className:"size-3.5","aria-hidden":"true"}),Ei(p.length,"sandbox","sandboxes")," selected",s.jsx("fieldset",{disabled:S,className:"min-w-0",children:s.jsx(ef,{multiple:!0,allowCreate:!1,groups:R,value:v,onChange:j})}),s.jsx(ue,{variant:"outline",size:"sm",disabled:S||!v.length,onClick:()=>P(p,v,"add"),children:"Add to groups"}),s.jsx(ue,{variant:"outline",size:"sm",disabled:S||!v.length,onClick:()=>P(p,v,"remove"),children:"Remove from groups"}),s.jsx(ue,{variant:"ghost",size:"sm",onClick:()=>b([]),children:"Clear"}),S&&s.jsx(zt,{"aria-hidden":"true"})]}),k.length?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("div",{className:"min-w-[640px]",children:[s.jsxs("div",{className:"grid h-9 grid-cols-[28px_minmax(0,1.4fr)_minmax(180px,1fr)_minmax(0,1.2fr)] items-center gap-4 border-y border-border bg-muted px-4 text-xs font-medium text-muted-foreground sm:px-6",children:[s.jsx("input",{type:"checkbox","aria-label":"Select every sandbox shown",checked:q,onChange:()=>b(q?[]:L.map(H=>H.name)),className:"size-3.5"}),s.jsx("span",{children:"Sandbox"}),s.jsx("span",{children:"Groups"}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(tg,{className:"size-3","aria-hidden":"true"}),"Network rules"]})]}),s.jsxs("ul",{className:"divide-y divide-border/60 bg-card",children:[L.map(H=>{var X;const F=jo(a,H.name),V=tq(a.policies,{name:H.name,groups:F,setups:((X=a.setupMembers)==null?void 0:X[H.name])??[]}),G=p.includes(H.name);return s.jsxs("li",{className:Le("grid min-h-11 grid-cols-[28px_minmax(0,1.4fr)_minmax(180px,1fr)_minmax(0,1.2fr)] items-center gap-4 px-4 py-1.5 sm:px-6",G&&"bg-accent/40"),children:[s.jsx("input",{type:"checkbox","aria-label":`Select ${H.name}`,checked:G,onChange:()=>b(B=>G?B.filter(Z=>Z!==H.name):[...B,H.name]),className:"size-3.5"}),s.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx("span",{className:Le("size-2 shrink-0 rounded-[3px]",Pa(H.phase).cell),"aria-hidden":"true"}),s.jsx("span",{className:"truncate font-mono text-xs",children:H.name})]}),s.jsx("fieldset",{disabled:S,"aria-label":`Groups for ${H.name}`,className:"min-w-0",children:s.jsx(ef,{multiple:!0,allowCreate:!1,groups:R,value:F,onChange:B=>{const Z=B.filter(se=>!F.includes(se)),K=F.filter(se=>!B.includes(se));P([H.name],Z.length?Z:K,Z.length?"add":"remove")}})}),s.jsx("span",{className:"truncate text-[11px] text-muted-foreground",title:V.map(B=>B.name).join(`
521
- `),children:V.length?V.map(B=>B.name).join(", "):s.jsx("span",{className:"text-faint",title:"Its policy and agent rules still apply",children:"No network rules"})})]},H.name)}),!L.length&&s.jsxs("li",{className:"px-6 py-8 text-center text-xs text-muted-foreground",children:["No sandbox matches “",h,"”."]})]})]})}):s.jsx("p",{className:"px-6 py-10 text-center text-xs text-muted-foreground",children:"No sandboxes yet. When you create one, pick a group for it in the New sandbox dialog."})]})]}),$,s.jsx(pQ,{group:R.find(H=>H.id===f)??null,org:a,sandboxes:k,onClose:()=>m(null),onChanged:A,onPolicy:M})]}):s.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[s.jsx(mQ,{onCreate:()=>u(!0),onPolicy:()=>e("egress")}),$]})}const bQ=({className:e,size:t=50,delay:r=0,duration:a=6,colorFrom:l="#ffaa40",colorTo:c="#9c40ff",transition:u,style:f,reverse:m=!1,initialOffset:h=0,borderWidth:g=1})=>s.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-[inherit] border-(length:--border-beam-width) border-transparent mask-[linear-gradient(transparent,transparent),linear-gradient(#000,#000)] mask-intersect [mask-clip:padding-box,border-box]",style:{"--border-beam-width":`${g}px`},children:s.jsx(Rn.div,{className:Le("absolute aspect-square","bg-linear-to-l from-(--color-from) via-(--color-to) to-transparent",e),style:{width:t,offsetPath:`rect(0 auto auto 0 round ${t}px)`,"--color-from":l,"--color-to":c,...f},initial:{offsetDistance:`${h}%`},animate:{offsetDistance:m?[`${100-h}%`,`${-h}%`]:[`${h}%`,`${100+h}%`]},transition:{repeat:1/0,ease:"linear",duration:a,delay:-r,...u}})}),yQ=[{minutes:60,label:"1 hour"},{minutes:480,label:"8 hours"},{minutes:1440,label:"1 day"},{minutes:null,label:"Until I close it"}],vQ=[{label:"Dev server",port:3e3,name:"dev"},{label:"Vite",port:5173,name:"vite"},{label:"Jupyter",port:8888,name:"jupyter"},{label:"Web app",port:8080,name:"web"}];function wQ(e,t){const r=Date.parse(e)-t;if(r<=0)return"closing…";const a=Math.round(r/6e4);return a<60?`${a}m`:a<2880?`${Math.floor(a/60)}h ${a%60?`${a%60}m`:""}`.trim():`${Math.round(a/1440)}d`}function jQ(e=3e4){const[t,r]=x.useState(Date.now());return x.useEffect(()=>{const a=setInterval(()=>r(Date.now()),e);return()=>clearInterval(a)},[e]),t}function n4({value:e,onChange:t,label:r="Close automatically"}){return s.jsx("div",{role:"radiogroup","aria-label":r,className:"flex items-center gap-1 rounded-md border border-border p-0.5",children:yQ.map(a=>s.jsx("button",{type:"button",role:"radio","aria-checked":e===a.minutes,onClick:()=>t(a.minutes),className:`flex-1 rounded px-2 py-1 text-[11px] whitespace-nowrap outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${e===a.minutes?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground"}`,children:a.label},String(a.minutes)))})}function SQ({text:e}){const[t,r]=x.useState(!1);return s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Copy URL",onClick:async()=>{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)},children:t?s.jsx(Fn,{className:"size-3.5 text-emerald-600"}):s.jsx(cf,{className:"size-3.5"})})}function NQ({service:e,visits:t,now:r,onChanged:a,remote:l}){var v;const c=$t(),[u,f]=x.useState(null),[m,h]=x.useState(!1),g=e.name||"default",p=t.filter(j=>j.verdict==="denied").length;async function b(j,S,C){f(j);try{await S(),qe.success(C),a()}catch(N){qe.error(N.message)}finally{f(null),h(!1)}}return s.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-border bg-card",children:[e.expiresAt&&Date.parse(e.expiresAt)-r<15*6e4&&s.jsx(bQ,{size:60,duration:8,colorFrom:"#f59e0b",colorTo:"#fde68a"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-4 py-3",children:[s.jsx(Uv,{strokeWidth:1.4,className:"size-4 text-emerald-600","aria-hidden":"true"}),s.jsx("span",{className:"font-mono text-[13px] font-medium",children:g}),s.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["→ port ",e.port]}),s.jsxs("span",{className:"ml-auto flex items-center gap-1.5 text-[11px]",children:[s.jsx(cC,{className:`size-3.5 ${e.expiresAt?"text-amber-600":"text-muted-foreground"}`,"aria-hidden":"true"}),e.expiresAt?s.jsxs("span",{className:"text-amber-800",children:["closes in ",wQ(e.expiresAt,r)]}):s.jsx("span",{className:"text-muted-foreground",children:"no timer"})]})]}),l&&s.jsx("p",{className:"border-t border-border/70 px-4 py-2 text-[11px] text-muted-foreground",children:"Reachable by anyone with gateway access."}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-border/70 px-4 py-2",children:[e.url?s.jsxs(s.Fragment,{children:[s.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"min-w-0 truncate font-mono text-[11px] underline-offset-2 hover:underline",children:e.url}),s.jsx(SQ,{text:e.url}),s.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer","aria-label":"Open in a new tab",className:"rounded p-1 text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(mI,{className:"size-3.5"})})]}):s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"No URL"}),s.jsxs("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground",title:"Visits recorded in the last hour",children:[t.length," visit",t.length===1?"":"s",p?s.jsxs("span",{className:"text-red-600",children:[" · ",p," failed"]}):null]})]}),p>0&&((v=t[0])==null?void 0:v.verdict)==="denied"&&s.jsxs("p",{className:"border-t border-border/70 bg-amber-50/50 px-4 py-1.5 text-[11px] text-amber-800",children:["Last visit failed: nothing listening on port ",e.port,"."]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-t border-border/70 px-4 py-2",children:[m?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"w-full sm:w-96",children:s.jsx(n4,{value:void 0,onChange:j=>b("extend",()=>c.extendService(e,j),j?"Timer reset":"Timer removed"),label:"New auto-close"})}),s.jsx(ue,{size:"icon-xs",variant:"ghost",onClick:()=>h(!1),"aria-label":"Cancel",children:s.jsx(On,{})})]}):s.jsxs(ue,{size:"xs",variant:"ghost",onClick:()=>h(!0),disabled:!!u,children:[s.jsx(cC,{}),"Change timer"]}),s.jsxs(ue,{size:"xs",variant:"outline",className:"ml-auto border-destructive/30 text-destructive hover:bg-destructive/5 hover:text-destructive",disabled:!!u,onClick:()=>b("close",()=>c.closeService(e),`Closed ${g}`),children:[u==="close"?s.jsx(zt,{}):s.jsx(AR,{}),"Close now"]})]})]})}function CQ({sandbox:e,onOpened:t}){const r=$t(),[a,l]=x.useState(""),[c,u]=x.useState(""),[f,m]=x.useState(60),[h,g]=x.useState(!1),[p,b]=x.useState(null);async function v(j){j.preventDefault(),g(!0),b(null);try{const S=await r.exposeService({sandbox:e,name:c.trim(),port:Number(a),closeAfterMinutes:f});qe.success(`Opened ${c||"default"} on port ${a}`,{description:S.url??void 0}),l(""),u(""),t()}catch(S){b(S.message)}finally{g(!1)}}return s.jsxs("form",{onSubmit:v,className:"space-y-3 rounded-lg border border-dashed border-border p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:"text-[11px] font-medium",children:"Open a port"}),vQ.map(j=>s.jsxs("button",{type:"button",onClick:()=>{l(String(j.port)),u(j.name)},className:`rounded border px-2 py-0.5 text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${a===String(j.port)?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[j.label," ",s.jsx("span",{className:"font-mono opacity-60",children:j.port})]},j.port))]}),s.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[s.jsxs("div",{className:"grid w-24 gap-1",children:[s.jsx(En,{htmlFor:"door-port",className:"text-[11px] text-muted-foreground",children:"Port"}),s.jsx(Rt,{id:"door-port",value:a,onChange:j=>l(j.target.value.replace(/\D/g,"")),className:"h-8 font-mono text-xs",placeholder:"3000",required:!0,inputMode:"numeric",title:"App must listen on 127.0.0.1"})]}),s.jsxs("div",{className:"grid w-36 gap-1",children:[s.jsx(En,{htmlFor:"door-name",className:"text-[11px] text-muted-foreground",children:"Name"}),s.jsx(Rt,{id:"door-name",value:c,onChange:j=>u(j.target.value.toLowerCase()),className:"h-8 font-mono text-xs",placeholder:"default"})]}),s.jsxs("div",{className:"min-w-72 flex-1",children:[s.jsx("span",{className:"mb-1 block text-[11px] text-muted-foreground",children:"Auto-close"}),s.jsx(n4,{value:f,onChange:m})]}),s.jsxs(ue,{type:"submit",size:"sm",disabled:h||!a,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[h?s.jsx(zt,{}):s.jsx(Uv,{}),"Open"]})]}),p&&s.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:p})]})}const _h={visit:e=>e.verdict==="denied"?`Visit to port ${e.port??"?"} failed`:`Visit to port ${e.port??"?"}`,session:()=>"Terminal session opened",command:()=>"Command run","service-opened":e=>`Opened ${e.service||"default"} → port ${e.port??"?"}`,"service-closed":e=>`Closed ${e.service||"default"}`};function kQ(e){const t=[];for(const r of e){const a=t[t.length-1];if(a&&r.type==="visit"&&a.type==="visit"&&a.port===r.port&&Math.abs(Date.parse(a.at)-Date.parse(r.at))<2e3){r.verdict==="denied"&&(t[t.length-1]=r);continue}t.push(r)}return t}function TQ(){const e=Cn();return s.jsx(EQ,{},(e==null?void 0:e.id)??(e==null?void 0:e.context)??"default")}function EQ(){var E,T,A;const e=$t(),t=Cn(),r=t?`ingress-scope:${t.context}`:"ingress-scope",a=Ua(),l=jQ(),c=(a.sandboxes??[]).filter(k=>k.phase!=="deleting"),[u,f]=x.useState(()=>{try{return sessionStorage.getItem(r)}catch{return null}}),m=((E=c.find(k=>k.name===u))==null?void 0:E.name)??((T=c[0])==null?void 0:T.name)??null;x.useEffect(()=>{try{m&&sessionStorage.setItem(r,m)}catch{}},[m,r]);const[h,g]=x.useState(null),p=x.useCallback(()=>e.ingress().then(g).catch(k=>g({error:k.message})),[e]);x.useEffect(()=>{p();const k=setInterval(p,15e3);return()=>clearInterval(k)},[p]);const b=((h==null?void 0:h.services)??[]).filter(k=>k.sandbox===m),v=x.useMemo(()=>{const k={};for(const M of(h==null?void 0:h.services)??[])k[M.sandbox]=(k[M.sandbox]??0)+1;return k},[h]),j=x.useMemo(()=>kQ(a.events.filter(k=>k.kind==="inbound"&&k.sandbox===m)),[a.events,m]),S=k=>j.filter(M=>M.type==="visit"&&M.port===k&&Date.parse(M.at)>l-36e5),C=j.filter(k=>k.type==="session"||k.type==="command"),N=(A=h==null?void 0:h.sessions)==null?void 0:A.ttlSeconds;return s.jsxs("div",{className:"flex h-full min-h-0",children:[s.jsxs("nav",{"aria-label":"Sandbox",className:"hidden w-56 shrink-0 overflow-y-auto border-r border-border bg-background p-3 md:block",children:[s.jsx("p",{className:"px-2 pb-2 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Sandboxes"}),c.map(k=>s.jsxs("button",{onClick:()=>f(k.name),"aria-current":m===k.name,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${m===k.name?"bg-accent":"hover:bg-muted/60"}`,children:[s.jsx("span",{className:`size-2 shrink-0 rounded-[2px] ${Pa(k.phase).cell}`,"aria-hidden":"true"}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px]",children:k.name}),v[k.name]?s.jsxs("span",{className:"rounded bg-emerald-50 px-1 font-mono text-[10px] text-emerald-800",title:"Open services",children:[v[k.name]," open"]}):s.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:"closed"})]},k.id))]}),s.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:m?h?h.error?s.jsx("p",{role:"alert",className:"py-16 text-center text-sm text-muted-foreground",children:h.error}):s.jsxs("div",{className:"mx-auto grid max-w-6xl gap-6 px-4 py-5 sm:px-6 xl:grid-cols-[minmax(0,1fr)_17rem]",children:[s.jsxs("div",{className:"min-w-0 space-y-6",children:[s.jsx(hn,{value:m,onChange:k=>f(k.target.value),className:"h-8 rounded-md border border-input bg-transparent px-2 font-mono text-xs md:hidden","aria-label":"Sandbox",children:c.map(k=>s.jsx("option",{children:k.name},k.id))}),s.jsx(qo,{duration:.22,offset:3,blur:"1px",children:s.jsx("div",{className:`rounded-lg border p-5 ${b.length?"border-emerald-600/20 bg-emerald-50/40":"border-border bg-card"}`,children:s.jsxs("p",{className:"flex items-center gap-2 text-sm font-medium",children:[b.length?s.jsx(Uv,{className:"size-4 text-emerald-600"}):s.jsx(AR,{className:"size-4 text-muted-foreground"}),b.length?`${b.length} service${b.length===1?"":"s"} open`:`${m} is closed`]})})}),s.jsxs("section",{className:"space-y-3",children:[s.jsxs("h2",{className:"flex items-center gap-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:[s.jsx(Fv,{className:"size-3"}),"Web services"]}),b.map(k=>s.jsx(NQ,{remote:h.auth.remote,service:k,visits:S(k.port),now:l,onChanged:()=>{p(),a.refresh()}},`${k.sandbox}/${k.name}`)),s.jsx(CQ,{sandbox:m,onOpened:()=>{p(),a.refresh()}})]}),s.jsxs("section",{className:"space-y-2",children:[s.jsxs("h2",{className:"flex items-center gap-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:[s.jsx(_R,{className:"size-3"}),"Terminal access"]}),s.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[s.jsx("p",{className:"px-4 py-3 text-[11px] text-muted-foreground",children:N===null?"Default session lifetime":N===0?"Sessions never expire":`Sessions expire after ${Math.round(N/60)} min`}),s.jsx("div",{className:"border-t border-border/70",children:C.length?C.slice(0,8).map(k=>s.jsxs("div",{className:"flex h-[28px] items-center gap-3 border-b border-border/50 px-4 font-mono text-[11px] last:border-0",children:[s.jsx("span",{className:"w-16 shrink-0 text-muted-foreground",children:new Date(k.at).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}),s.jsx("span",{children:_h[k.type](k)})]},`${k.at}|${k.message}`)):s.jsx("p",{className:"px-4 py-2.5 text-[11px] text-muted-foreground",children:"No recent sessions"})})]})]})]}),s.jsxs("aside",{className:"space-y-4",children:[s.jsxs("section",{className:"rounded-lg border border-border bg-card p-4",children:[s.jsxs("h3",{className:"flex items-center gap-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:[s.jsx(hu,{className:"size-3"}),"Access"]}),s.jsx("p",{className:"mt-2 text-[11px] leading-relaxed",children:h.auth.mode==="mtls"?"Client certificate (this Mac)":`Sign-in: ${h.auth.mode}`})]}),s.jsxs("section",{children:[s.jsx("h3",{className:"mb-2 text-[10px] font-bold tracking-widest text-faint uppercase",children:"Recent inbound"}),s.jsx("ol",{className:"rounded-lg border border-border bg-card",children:j.length?j.slice(0,14).map(k=>{var M;return s.jsxs("li",{className:"flex items-start gap-2 border-b border-border/50 px-3 py-1.5 text-[11px] last:border-0",children:[s.jsx("span",{className:`mt-1.5 size-1.5 shrink-0 rounded-full ${k.verdict==="denied"?"bg-red-500":k.type.startsWith("service")?"bg-emerald-500":"bg-stone-400"}`,"aria-hidden":"true"}),s.jsx("span",{className:"min-w-0 flex-1",children:((M=_h[k.type])==null?void 0:M.call(_h,k))??k.type}),s.jsx("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:xu(k.at)})]},`${k.at}|${k.message}`)}):s.jsx("li",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:"Nothing yet."})})]})]})]}):s.jsx("p",{role:"status",className:"py-16 text-center text-sm text-muted-foreground",children:"Loading…"}):s.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:"No sandboxes yet."})})]})}function RQ({tab:e,onNavigate:t}){const r=Cn();return s.jsxs(Ef,{value:e,onValueChange:a=>t(a,r),className:"h-[calc(100svh-3.5rem)] min-h-0 gap-0",children:[s.jsx("div",{className:"shrink-0 border-b bg-card px-4 sm:px-8",children:s.jsxs(Rf,{variant:"line",className:"h-11! gap-5 p-0",children:[s.jsx(wr,{value:"egress",className:"h-full px-0 text-xs after:bottom-0!",children:"Egress"}),s.jsx(wr,{value:"ingress",className:"h-full px-0 text-xs after:bottom-0!",children:"Ingress"})]})}),s.jsx(bo,{value:"egress",className:"min-h-0",children:s.jsx(OK,{onNavigate:t})}),s.jsx(bo,{value:"ingress",className:"min-h-0",children:s.jsx(TQ,{})})]})}const Ty=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function AQ(e,t,r=Date.now()){const a=new Map(t.map(l=>[l.id,l]));return e.map(l=>{const c=a.get(l.type),u=Object.values(l.expires??{}).map(Date.parse).filter(Number.isFinite).sort((h,g)=>h-g)[0]??null,f=u===null?"none":u<=r?"expired":u<=r+7*864e5?"expiring":"scheduled",m=((c==null?void 0:c.endpoints)??[]).map(h=>h.host);return{secret:l,profile:c,expiry:u,status:f,service:(c==null?void 0:c.name)??l.type,hosts:m,search:[l.name,l.type,c==null?void 0:c.name,...l.credentialKeys,...l.attachedTo,...m].join(" ").toLowerCase()}})}function OQ(e,{query:t,scope:r,service:a,expiry:l,sort:c}){const u=t.trim().toLowerCase();return e.filter(f=>(!u||f.search.includes(u))&&(r==="all"||(r==="attached"?f.secret.attachedTo.length>0:f.secret.attachedTo.length===0))&&(!a||f.secret.type===a)&&(!l||f.status===l)).sort((f,m)=>{const h=v=>({name:v.secret.name,service:v.service,credentials:v.secret.credentialKeys.length,attached:v.secret.attachedTo.length,expiry:v.expiry})[c.key],g=h(f),p=h(m);if(g===null)return p===null?Ty.compare(f.secret.name,m.secret.name):1;if(p===null)return-1;const b=typeof g=="number"?g-p:Ty.compare(g,p);return(c.direction==="asc"?b:-b)||Ty.compare(f.secret.name,m.secret.name)})}const MQ=[{id:"agent",label:"Agents"},{id:"inference",label:"Models"},{id:"code",label:"Code & packages"},{id:"cloud",label:"Cloud"}],s4=[{id:"claude-code",name:"Claude Code",group:"agent",blurb:"Anthropic's coding agent",keyUrl:"https://console.anthropic.com/settings/keys",keyHint:"sk-ant-…"},{id:"codex",name:"Codex",group:"agent",blurb:"Existing Codex OAuth session",helpUrl:"https://developers.openai.com/codex/auth/"},{id:"copilot",name:"Copilot",group:"agent",blurb:"GitHub Copilot CLI"},{id:"cursor",name:"Cursor",group:"agent",blurb:"Cursor bootstrap network access"},{id:"anthropic",name:"Anthropic",group:"inference",blurb:"Claude API",keyUrl:"https://console.anthropic.com/settings/keys",keyHint:"sk-ant-…"},{id:"openai",name:"OpenAI",group:"inference",blurb:"GPT models API",keyUrl:"https://platform.openai.com/api-keys",keyHint:"sk-…"},{id:"nvidia",name:"NVIDIA",group:"inference",blurb:"NIM model endpoints",keyUrl:"https://build.nvidia.com",keyHint:"nvapi-…"},{id:"openrouter",name:"OpenRouter",group:"inference",blurb:"One key, many models",keyUrl:"https://openrouter.ai/keys",keyHint:"sk-or-…"},{id:"deepinfra",name:"DeepInfra",group:"inference",blurb:"Open models, hosted"},{id:"google-vertex-ai",name:"Vertex AI",group:"inference",blurb:"Google Cloud models"},{id:"aws-bedrock",name:"Bedrock",group:"inference",blurb:"Models on AWS"},{id:"github",name:"GitHub",group:"code",blurb:"Repos and API",keyUrl:"https://github.com/settings/personal-access-tokens",keyHint:"github_pat_…"},{id:"pypi",name:"PyPI",group:"code",blurb:"Install Python packages"},{id:"aws",name:"AWS",group:"cloud",blurb:"AWS APIs"},{id:"aws-s3",name:"S3",group:"cloud",blurb:"Buckets and objects"},{id:"google-cloud",name:"Google Cloud",group:"cloud",blurb:"GCP APIs"}],r4=e=>s4.find(t=>t.id===e)??null,DQ=e=>r4(e)?`/logos/${e}.svg`:null;function sx({type:e,size:t="md",className:r}){const a=DQ(e),l=t==="lg"?"size-10 rounded-lg":t==="sm"?"size-6 rounded-md":"size-8 rounded-md",c=t==="lg"?"size-5":t==="sm"?"size-3.5":"size-[18px]";return s.jsx("span",{className:Le("flex shrink-0 items-center justify-center border border-border/80 bg-linear-to-b from-background to-muted/50 shadow-[0_1px_2px_#00000008]",l,r),children:a?s.jsx("img",{src:a,alt:"","aria-hidden":"true",className:Le("object-contain",c),draggable:!1}):s.jsx(hu,{strokeWidth:1.4,className:Le("text-muted-foreground",c),"aria-hidden":"true"})})}function o4(e){return e.id==="aws-bedrock"?"This profile requires an upstream Bedrock bridge. Direct AWS credential authentication is not implemented by this profile; this form cannot configure the bridge.":(e.credentials??[]).some(t=>{var r;return t.refresh===!0||((r=t.refresh)==null?void 0:r.strategy)})?"This profile requires managed credential refresh setup. Configure it with the OpenShell CLI; this form does not yet support its refresh material.":(e.credentials??[]).some(t=>{var r;return!((r=t.envVars)!=null&&r.length)})?"This profile has credentials without environment mappings and cannot be configured in this form.":null}function zQ(e){return(e.credentials??[]).map(t=>{var r;return{...t,key:(r=t.envVars)==null?void 0:r[0],label:t.description||t.name,placeholder:t.name==="account_id"?"Enter account ID":/token/.test(t.name)?"Paste token":"Paste API key",inputType:t.name==="account_id"?"text":"password"}})}function PQ(e,t){const r=o4(e);if(r)throw new Error(r);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Credentials must be an object.");const a=e.credentials??[],l=new Set(a.flatMap(u=>u.envVars??[])),c={};for(const[u,f]of Object.entries(t)){if(!l.has(u))throw new Error(`${u} is not a credential of this profile.`);if(typeof f!="string")throw new Error(`${u} must be text.`);if(f){if(!f.trim()||f!==f.trim()||/[\r\n\x00]/.test(f))throw new Error(`${u} contains whitespace or line breaks. Paste only the credential value.`);if(f.length>8192)throw new Error(`${u} is too long.`);c[u]=f}}for(const u of a){const f=u.envVars.filter(m=>c[m]);if(u.required&&!f.length)throw new Error(`${u.description||u.name} is required.`);if(new Set(f.map(m=>c[m])).size>1)throw new Error(`Aliases for ${u.name} must contain the same value.`)}if(a.length&&!Object.keys(c).length)throw new Error("Enter at least one credential.");return c}function IQ({query:e,setQuery:t,have:r,onPick:a,picking:l}){const c=e.trim().toLowerCase(),u=m=>!c||`${m.name} ${m.blurb} ${m.id}`.toLowerCase().includes(c),f=MQ.map(m=>({...m,items:s4.filter(h=>h.group===m.id&&u(h))})).filter(m=>m.items.length);return s.jsxs("div",{className:"space-y-3",children:[s.jsx(ea,{value:e,onValueChange:t,placeholder:"Search services","aria-label":"Search services",autoFocus:!0}),s.jsxs("div",{className:"-mx-1 max-h-[60svh] space-y-3 overflow-y-auto px-1 pt-1",children:[f.map(m=>s.jsxs("section",{children:[s.jsx("h3",{className:"mb-1.5 text-[10px] font-bold tracking-widest text-faint uppercase",children:m.label}),s.jsx("div",{className:"grid grid-cols-3 gap-1.5 sm:grid-cols-4",children:m.items.map(h=>s.jsxs("button",{type:"button",onClick:()=>a(h),disabled:!!l,title:h.blurb,className:"group relative flex items-center gap-2 rounded-lg border border-border/70 bg-card py-1.5 pr-2 pl-1.5 text-left outline-none transition-[border-color,background-color,transform] hover:border-foreground/20 hover:bg-muted/30 focus-visible:ring-2 focus-visible:ring-ring motion-safe:hover:-translate-y-px disabled:opacity-60",children:[l===h.id?s.jsx("span",{className:"flex size-6 items-center justify-center",children:s.jsx(zt,{className:"size-3.5"})}):s.jsx(sx,{type:h.id,size:"sm"}),s.jsx("span",{className:"min-w-0 truncate text-[12px] font-medium",children:h.name}),r.has(h.id)&&s.jsx("span",{className:"absolute -top-1 -right-1 flex size-3.5 items-center justify-center rounded-full bg-emerald-500 text-white",title:"You already have a secret for this",children:s.jsx(Fn,{className:"size-2.5",strokeWidth:3})})]},h.id))})]},m.id)),!f.length&&s.jsxs("p",{className:"py-6 text-center text-[11px] text-muted-foreground",children:["No service matches “",e,"”."]})]})]})}function _Q({service:e,profile:t,taken:r,sandboxes:a,onBack:l,onDone:c}){const u=$t(),[f,m]=x.useState(()=>{const R=`my-${e.id}`;if(!r.has(R))return R;for(let O=2;;O++)if(!r.has(`${R}-${O}`))return`${R}-${O}`}),[h,g]=x.useState({}),[p,b]=x.useState([]),[v,j]=x.useState(!1),[S,C]=x.useState(null),N=t.endpoints.map(R=>R.host),E=zQ(t),T=o4(t),A=t.id==="codex"&&E.some(R=>R.key==="CODEX_AUTH_ACCESS_TOKEN"),k=E.length===0;async function M(R){R.preventDefault(),j(!0),C(null);try{await u.createSecret({name:f,type:t.id,credentials:PQ(t,h)}),g({});const O=[];for(const D of p)try{await u.attachSecret(f,D,!0)}catch{O.push(D)}qe.success(`Stored ${f}`,{description:p.length?`Attached to ${p.filter(D=>!O.includes(D)).join(", ")||"none"}${O.length?` · failed: ${O.join(", ")}`:""}`:"Credential saved. Vendor connection not tested."}),c()}catch(O){C(O.message)}finally{j(!1)}}return s.jsxs("form",{onSubmit:M,autoComplete:"off",className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ue,{type:"button",variant:"ghost",size:"icon-sm",onClick:l,"aria-label":"Choose another service",children:s.jsx(Vv,{})}),s.jsx(sx,{type:e.id,size:"lg"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-[14px] font-medium",children:e.name}),s.jsx("p",{className:"truncate text-[11px] text-muted-foreground",children:e.blurb})]}),e.keyUrl&&!k&&!T&&s.jsxs("a",{href:e.keyUrl,target:"_blank",rel:"noreferrer",className:"flex shrink-0 items-center gap-0.5 rounded-md px-2 py-1 text-[11px] text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:["Get a key",s.jsx(Ri,{className:"size-3"})]})]}),A&&s.jsxs("p",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2.5 text-xs leading-relaxed",children:["This profile stores an existing ChatGPT OAuth session: access token, refresh token, and account ID, with an optional ID token. An OpenAI API key does not belong in these fields. Browser sign-in and API-key setup for Codex are not available in this form. ",s.jsx("a",{className:"underline",href:e.helpUrl,target:"_blank",rel:"noreferrer",children:"Authentication guide"})]}),T&&s.jsx("p",{role:"status",className:"rounded-lg border border-border bg-muted/30 px-3 py-2.5 text-xs leading-relaxed",children:T}),k&&s.jsxs("p",{className:"rounded-lg border border-border px-3 py-2.5 text-[11px] leading-relaxed",children:[s.jsx("span",{className:"font-medium",children:"No key needed."})," ",s.jsxs("span",{className:"text-muted-foreground",children:["This lets a sandbox reach ",e.name,"'s hosts, but only from the programs below."]})]}),s.jsx("div",{className:"space-y-2.5",children:!T&&E.map((R,O)=>{const D=R.key;return s.jsxs("label",{className:"block",children:[s.jsxs("span",{className:"mb-1 flex items-baseline gap-2 text-[11px]",children:[s.jsxs("span",{className:"font-medium",children:[R.label,R.required?s.jsx("span",{className:"text-muted-foreground",children:" · required"}):s.jsx("span",{className:"font-normal text-muted-foreground",children:" · optional"})]}),s.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:D})]}),s.jsxs("span",{className:"relative block",children:[s.jsx(iC,{className:"absolute top-2.5 left-3 size-3.5 text-muted-foreground","aria-hidden":"true"}),s.jsx(Rt,{"aria-label":R.label,type:R.inputType,value:h[D]??"",onChange:_=>g(L=>({...L,[D]:_.target.value})),className:"h-9 pl-9 font-mono text-xs",placeholder:E.length===1&&e.keyHint?e.keyHint:R.placeholder,required:R.required,maxLength:8192,autoFocus:O===0,spellCheck:!1,autoComplete:"off"})]})]},D)})}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-3 py-2.5",children:[s.jsx("p",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Profile destinations"}),s.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:N.map(R=>s.jsx("span",{className:"rounded border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:R},R))}),s.jsxs("p",{className:"mt-1.5 text-[10px] text-muted-foreground",children:["Allowed program paths: ",t.binaries.join(", ")||"None declared",". These must match the programs installed in your sandbox."]})]}),!T&&s.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[s.jsxs("label",{className:"grid w-44 gap-1",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Name"}),s.jsx(Rt,{value:f,onChange:R=>m(R.target.value.toLowerCase()),className:"h-8 font-mono text-xs",required:!0,pattern:"[a-z0-9]([a-z0-9\\-]{0,61}[a-z0-9])?"})]}),a.length>0&&s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"mb-1 block text-[11px] text-muted-foreground",children:"Attach to"}),s.jsx("div",{className:"flex flex-wrap gap-1",children:a.map(R=>{const O=p.includes(R.name);return s.jsxs("button",{type:"button","aria-pressed":O,onClick:()=>b(D=>O?D.filter(_=>_!==R.name):[...D,R.name]),className:`flex h-8 items-center gap-1.5 rounded-md border px-2 font-mono text-[11px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring ${O?"border-foreground/25 bg-accent":"border-border text-muted-foreground hover:text-foreground"}`,children:[s.jsx("span",{className:`size-1.5 rounded-full ${O?"bg-emerald-500":"bg-stone-300"}`,"aria-hidden":"true"}),R.name]},R.id)})})]})]}),S&&s.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:S}),s.jsxs(ue,{type:"submit",disabled:v||!!T,className:"h-9 w-full bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[v?s.jsx(zt,{}):s.jsx(iC,{}),k?`Add ${e.name} access`:`Store ${e.name} secret`]})]})}function LQ({open:e,onOpenChange:t,profiles:r,providers:a,sandboxes:l,reload:c}){const u=$t(),f=Bs(),[m,h]=x.useState(""),[g,p]=x.useState(null),[b,v]=x.useState(null),[j,S]=x.useState(r);x.useEffect(()=>S(r),[r]),x.useEffect(()=>{e||(p(null),h(""),v(null))},[e]);const C=new Set(a.map(M=>M.type)),N=new Set(a.map(M=>M.name)),E=g&&j.find(M=>M.id===g.id);async function T(M){if(j.some(R=>R.id===M.id)){p(M);return}v(M.id);try{await u.importProfile(M.id);const R=await c();S((R==null?void 0:R.profiles)??j),p(M)}catch(R){qe.error(`Couldn't set up ${M.name}: ${R.message}`)}finally{v(null)}}const A=g&&E?"key":"pick",k=f?{}:{initial:{opacity:0,x:A==="key"?12:-12},animate:{opacity:1,x:0},exit:{opacity:0,x:A==="key"?-12:12},transition:{duration:.16,ease:"easeOut"}};return s.jsx(yn,{open:e,onOpenChange:t,children:s.jsxs(vn,{className:"gap-0 overflow-hidden p-0 sm:max-w-[580px]","aria-describedby":void 0,children:[s.jsxs("div",{className:"border-b border-border px-5 pt-4 pb-3",children:[s.jsx(wn,{className:"text-[14px]",children:A==="pick"?"Add secret":(E==null?void 0:E.credentials.length)===0?`Add ${g.name}`:"Add credentials"}),s.jsx("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:A==="pick"?"Pick the service it's for.":(E==null?void 0:E.credentials.length)===0?"Access only. Nothing secret is stored.":"Stored by the gateway. Saving does not verify the vendor connection."})]}),s.jsx("div",{className:"max-h-[75svh] overflow-y-auto p-5",children:s.jsx(Vl,{mode:"wait",initial:!1,children:s.jsx(Rn.div,{...k,children:A==="pick"?s.jsx(IQ,{query:m,setQuery:h,have:C,onPick:T,picking:b}):s.jsx(_Q,{service:g,profile:E,taken:N,sandboxes:l,onBack:()=>p(null),onDone:()=>{t(!1),c()}})},A)})})]})})}const BQ={header:e=>`sent as the ${e.headerName??"custom"} header`,bearer:()=>"sent as Authorization: Bearer",basic:()=>"sent as HTTP basic auth",query:e=>`sent as the ?${e.queryParam??"…"} parameter`,path:()=>"placed in the request path"},$Q=e=>(BQ[e.authStyle]??(()=>"resolved by the proxy"))(e),VQ=e=>e&&Date.parse(e)-Date.now()<7*864e5;function UQ({id:e,label:t,hint:r,value:a,onChange:l,required:c}){return s.jsxs("div",{className:"grid gap-1",children:[s.jsxs(En,{htmlFor:e,className:"font-mono text-[11px]",children:[t,c&&s.jsx("span",{className:"text-red-600",children:" *"})]}),s.jsx(Rt,{id:e,type:"password",value:a,onChange:u=>l(u.target.value),autoComplete:"off",spellCheck:!1,className:"font-mono text-xs",placeholder:"Paste the value",required:c,title:r})]})}function HQ({secret:e,onClose:t,onDone:r}){const a=$t(),[l,c]=x.useState({}),[u,f]=x.useState(!1),[m,h]=x.useState(null);return x.useEffect(()=>{c({}),h(null)},[e]),s.jsx(yn,{open:!!e,onOpenChange:g=>{g||t()},children:s.jsx(vn,{className:"sm:max-w-md","aria-describedby":void 0,children:s.jsxs("form",{autoComplete:"off",className:"grid gap-4",onSubmit:async g=>{g.preventDefault(),f(!0),h(null);try{const p=await a.rotateSecret(e.name,l);c({}),qe.success(`Rotated ${e.name}`,{description:p.sandboxesNotified?`${p.sandboxesNotified} sandbox${p.sandboxesNotified===1?"":"es"} updated`:void 0}),t(),r()}catch(p){h(p.message)}finally{f(!1)}},children:[s.jsx(Nn,{children:s.jsxs(wn,{children:["Rotate ",e==null?void 0:e.name]})}),e==null?void 0:e.credentialKeys.map(g=>s.jsx(UQ,{id:`rot-${g}`,label:g,value:l[g]??"",onChange:p=>c(b=>({...b,[g]:p}))},g)),m&&s.jsx("p",{role:"alert",className:"rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:m}),s.jsxs(No,{children:[s.jsx(ue,{type:"button",variant:"ghost",onClick:t,children:"Cancel"}),s.jsxs(ue,{type:"submit",disabled:u||!Object.values(l).some(Boolean),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[u&&s.jsx(zt,{"aria-hidden":"true"}),"Rotate"]})]})]})})})}function FQ({secret:e,keyName:t,onDone:r}){var h;const a=$t(),l=(h=e.expires)==null?void 0:h[t],[c,u]=x.useState(!1),[f,m]=x.useState("");return c?s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Rt,{type:"date",value:f,onChange:g=>m(g.target.value),className:"h-7 w-36 text-[11px]","aria-label":`Expiry for ${t}`}),s.jsx(ue,{size:"xs",variant:"outline",onClick:async()=>{try{await a.secretExpiry(e.name,t,f?new Date(`${f}T23:59:00`).toISOString():null),qe.success(f?"Expiry set":"Expiry cleared"),u(!1),r()}catch(g){qe.error(g.message)}},children:"Save"}),l&&s.jsx(ue,{size:"xs",variant:"ghost",onClick:async()=>{try{await a.secretExpiry(e.name,t,null),u(!1),r()}catch(g){qe.error(g.message)}},children:"Clear"}),s.jsx(ue,{size:"icon-xs",variant:"ghost",onClick:()=>u(!1),"aria-label":"Cancel",children:s.jsx(On,{})})]}):s.jsxs("button",{onClick:()=>{m(l?l.slice(0,10):""),u(!0)},className:`flex items-center gap-1 text-[11px] outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring ${VQ(l)?"text-amber-700":"text-muted-foreground"}`,children:[s.jsx(YP,{className:"size-3"}),l?`expires ${Yd(l)}`:"no expiry"]})}function GQ({secret:e,profile:t,sandboxes:r,onRotate:a,onDelete:l,onDone:c}){var p;const u=$t(),[f,m]=x.useState(!1),h=r.filter(b=>!e.attachedTo.includes(b.name));async function g(b,v){m(!0);try{await u.attachSecret(e.name,b,v),qe.success(v?`Attached to ${b}`:`Detached from ${b}`),c()}catch(j){qe.error(j.message)}finally{m(!1)}}return s.jsxs("div",{className:"bg-card",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border/70 px-4 py-3",children:[s.jsx(sx,{type:e.type}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"truncate font-mono text-[13px] font-medium",children:e.name}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:((p=r4(e.type))==null?void 0:p.name)??(t==null?void 0:t.name)??e.type})]}),s.jsxs("div",{className:"ml-auto flex items-center gap-1.5",children:[e.credentialKeys.length>0&&s.jsxs(ue,{size:"sm",variant:"outline",onClick:a,children:[s.jsx(Ia,{}),"Rotate"]}),s.jsx(ue,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground hover:text-destructive",onClick:l,"aria-label":`Delete ${e.name}`,children:s.jsx(Yn,{className:"size-3.5"})})]})]}),s.jsxs("div",{className:"grid gap-4 px-4 py-3 ",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("h4",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Credentials"}),e.credentialKeys.length===0&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"None. Access only."}),e.credentialKeys.map(b=>{const v=t==null?void 0:t.credentials.find(j=>j.envVars.includes(b));return s.jsxs("div",{className:"space-y-0.5",children:[s.jsxs("p",{className:"flex items-center gap-1.5 font-mono text-[11px]",title:v?$Q(v):void 0,children:[s.jsx("span",{className:"size-1.5 rounded-full bg-emerald-500","aria-hidden":"true"}),b]}),s.jsx("div",{className:"pl-3",children:s.jsx(FQ,{secret:e,keyName:b,onDone:c})})]},b)})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("h4",{className:"text-[10px] font-bold tracking-widest text-faint uppercase",children:"Allowed hosts"}),t?s.jsxs(s.Fragment,{children:[s.jsx("ul",{className:"space-y-0.5 font-mono text-[11px]",children:t.endpoints.map(b=>s.jsxs("li",{children:[b.host,b.port?`:${b.port}`:"",s.jsxs("span",{className:"font-sans text-[10px] text-muted-foreground",children:[" ",b.access??""]})]},`${b.host}:${b.port}`))}),s.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["by ",t.binaries.map(b=>b.split("/").pop()).filter((b,v,j)=>j.indexOf(b)===v).join(", ")||"any program"]})]}):s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Profile not found."})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-t border-border/70 px-4 py-2.5 text-[11px]",children:[s.jsx(zR,{className:"size-3 text-muted-foreground","aria-hidden":"true"}),s.jsx("span",{className:"text-muted-foreground",children:"Attached to"}),e.attachedTo.map(b=>s.jsxs("span",{className:"flex items-center gap-0.5 rounded bg-muted py-0.5 pr-0.5 pl-1.5 font-mono text-[10px]",children:[b,s.jsx("button",{onClick:()=>g(b,!1),disabled:f,"aria-label":`Detach from ${b}`,className:"rounded p-0.5 text-muted-foreground outline-none hover:text-destructive focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(On,{className:"size-2.5"})})]},b)),!e.attachedTo.length&&s.jsx("span",{className:"text-muted-foreground/70",children:"no sandbox"}),h.length>0&&s.jsxs(hn,{value:"",disabled:f,onChange:b=>b.target.value&&g(b.target.value,!0),"aria-label":"Attach to a sandbox",className:"ml-auto h-7 rounded-md border border-input bg-transparent px-1.5 text-[11px] text-muted-foreground",children:[s.jsx("option",{value:"",children:"Attach to…"}),h.map(b=>s.jsx("option",{value:b.name,children:b.name},b.id))]}),f&&s.jsx(zt,{className:"size-3"})]})]})}const ZE=[],JE=[{id:"name",label:"Secret",width:"28%"},{id:"service",label:"Service",width:"16%"},{id:"credentials",label:"Credentials",width:"13%"},{id:"attached",label:"Sandboxes",width:"16%"},{id:"expiry",label:"Next expiry",width:"15%"},{id:"hosts",label:"Allowed hosts",width:"12%"}],qQ={none:"No expiry",expired:"Expired",expiring:"Within 7 days",scheduled:"Scheduled"};function YQ(){const e=Cn();return s.jsx(KQ,{},(e==null?void 0:e.id)??(e==null?void 0:e.context)??"default")}function KQ(){const e=$t(),t=Ua(),[r,a]=x.useState(null),[l,c]=x.useState(null),[u,f]=x.useState(!1),[m,h]=x.useState(!1),[g,p]=x.useState(null),[b,v]=x.useState(null),[j,S]=x.useState(null),[C,N]=x.useState(""),[E,T]=x.useState("all"),[A,k]=x.useState(""),[M,R]=x.useState(""),[O,D]=x.useState({key:"name",direction:"asc"}),[_,L]=x.useState(Date.now),q=x.useRef(null),P=x.useDeferredValue(C),$=x.useCallback(async()=>{f(!0);try{const ne=await e.secrets();return a(ne),c(null),ne}catch(ne){return c(ne.message),null}finally{f(!1)}},[e]);x.useEffect(()=>{$()},[$]),x.useEffect(()=>{const ne=setInterval(()=>L(Date.now()),6e4),ce=oe=>{var W;(oe.metaKey||oe.ctrlKey)&&oe.key.toLowerCase()==="k"&&!j&&!m&&!g&&!b&&(oe.preventDefault(),(W=q.current)==null||W.focus())};return window.addEventListener("keydown",ce),()=>{clearInterval(ne),window.removeEventListener("keydown",ce)}},[j,m,g,b]);const H=(r==null?void 0:r.providers)??ZE,F=(r==null?void 0:r.profiles)??ZE,V=x.useMemo(()=>AQ(H,F,_),[H,F,_]),G=x.useMemo(()=>OQ(V,{query:P,scope:E,service:A,expiry:M,sort:O}),[V,P,E,A,M,O]),X=x.useMemo(()=>[...new Map(V.map(ne=>[ne.secret.type,ne.service])).entries()].sort((ne,ce)=>ne[1].localeCompare(ce[1])),[V]),B=nx({count:G.length,rowHeight:40});x.useEffect(()=>{B.scrollToTop()},[P,E,A,M,O]);const Z=V.find(ne=>ne.secret.name===j),K=(t.sandboxes??[]).filter(ne=>ne.phase!=="deleting"),se=V.filter(ne=>ne.secret.attachedTo.length>0).length,I=V.filter(ne=>ne.status==="expiring").length,U=V.filter(ne=>ne.status==="expired").length,Q=C||E!=="all"||A||M,te=()=>{N(""),T("all"),k(""),R("")},le=()=>{$(),t.refresh()},J="h-10 border-b border-border/60 px-4 py-0 align-middle text-muted-foreground";return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex h-[calc(100svh-3.5rem)] min-h-0 flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border px-4 pt-4 pb-3 sm:px-6",role:"group","aria-label":"Secret inventory summary",children:[[["all","Secrets",V.length],["attached","Attached",se],["unattached","Unattached",V.length-se]].map(([ne,ce,oe])=>s.jsxs("button",{"aria-pressed":E===ne,onClick:()=>T(ne),className:`rounded-md px-3 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring ${E===ne?"bg-accent/70":"hover:bg-muted/60"}`,children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:ce}),s.jsx("span",{className:"mt-1 block font-mono text-lg leading-none tabular-nums",children:s.jsx(tf,{value:oe})})]},ne)),s.jsx("div",{className:"ml-auto flex gap-1",children:[["expiring","Expiring in 7 days",I],["expired","Expired",U]].map(([ne,ce,oe])=>s.jsxs("button",{"aria-pressed":M===ne,onClick:()=>R(M===ne?"":ne),className:`rounded-md px-3 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring ${M===ne?"bg-accent/70":"hover:bg-muted/60"}`,children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:ce}),s.jsx("span",{className:`mt-1 block font-mono text-lg leading-none tabular-nums ${oe?ne==="expired"?"text-red-600":"text-amber-700":"text-muted-foreground"}`,children:s.jsx(tf,{value:oe})})]},ne))})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border px-4 py-2 sm:px-6",children:[s.jsx(ea,{ref:q,value:C,onValueChange:N,placeholder:"Search name, sandbox, host…","aria-label":"Search secrets",className:"mr-auto w-full sm:w-72"}),s.jsxs(hn,{"aria-label":"Filter by service",value:A,onChange:ne=>k(ne.target.value),className:"h-8 max-w-44 rounded-md border border-border bg-card px-2 text-xs",children:[s.jsx("option",{value:"",children:"All services"}),X.map(([ne,ce])=>s.jsx("option",{value:ne,children:ce},ne))]}),s.jsxs(hn,{"aria-label":"Filter by expiry",value:M,onChange:ne=>R(ne.target.value),className:"h-8 rounded-md border border-border bg-card px-2 text-xs",children:[s.jsx("option",{value:"",children:"Any expiry"}),Object.entries(qQ).map(([ne,ce])=>s.jsx("option",{value:ne,children:ce},ne))]}),Q&&s.jsxs(ue,{variant:"ghost",size:"sm",onClick:te,children:[s.jsx(On,{}),"Clear"]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Refresh secrets",disabled:u,onClick:le,children:s.jsx(Ia,{className:u?"animate-spin":""})}),s.jsxs(ue,{size:"sm",disabled:!r,onClick:()=>h(!0),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[s.jsx(cs,{}),"Add secret"]})]}),l&&s.jsxs("div",{role:"alert",className:"flex items-center gap-3 border-b border-border px-6 py-2 text-xs text-red-600",children:[s.jsxs("span",{children:[r?"Could not refresh. Showing the last reading. ":"",l]}),s.jsx(ue,{variant:"outline",size:"sm",onClick:$,children:"Retry"})]}),s.jsx("div",{ref:B.ref,onScroll:B.onScroll,tabIndex:0,role:"region","aria-label":"Secret inventory",className:"min-h-0 flex-1 overflow-auto overscroll-contain outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",children:!r&&!l?s.jsx("p",{role:"status",className:"py-20 text-center text-sm text-muted-foreground",children:"Loading secrets…"}):G.length?s.jsxs("table",{"aria-label":"Secrets","aria-rowcount":G.length+1,className:"w-full min-w-[900px] table-fixed border-separate border-spacing-0 text-xs",children:[s.jsx("colgroup",{children:JE.map(ne=>s.jsx("col",{style:{width:ne.width}},ne.id))}),s.jsx("thead",{className:"sticky top-0 z-10 bg-muted",children:s.jsx("tr",{"aria-rowindex":1,children:JE.map(ne=>s.jsx("th",{scope:"col","aria-sort":O.key===ne.id?O.direction==="asc"?"ascending":"descending":"none",className:"h-9 border-b border-border px-4 text-left font-medium text-muted-foreground first:pl-6",children:ne.id==="hosts"?ne.label:s.jsxs("button",{className:"flex h-9 w-full items-center gap-1.5 outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>D({key:ne.id,direction:O.key===ne.id&&O.direction==="asc"?"desc":"asc"}),children:[ne.label,O.key===ne.id&&(O.direction==="asc"?s.jsx(lf,{className:"size-3"}):s.jsx(af,{className:"size-3"}))]})},ne.id))})}),s.jsxs("tbody",{children:[B.paddingTop>0&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:6,style:{height:B.paddingTop,padding:0}})}),G.slice(B.start,B.end).map((ne,ce)=>s.jsxs("tr",{"aria-rowindex":B.start+ce+2,onClick:()=>S(ne.secret.name),className:"group cursor-pointer bg-card hover:bg-muted/60 focus-within:bg-muted/60",children:[s.jsx("td",{className:`${J} pl-6`,children:s.jsxs("button",{"aria-haspopup":"dialog","aria-label":`Open ${ne.secret.name}`,className:"flex h-9 w-full items-center gap-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:oe=>{oe.stopPropagation(),S(ne.secret.name)},children:[s.jsx(sx,{type:ne.secret.type,size:"sm"}),s.jsx("span",{title:ne.secret.name,className:"truncate font-medium text-foreground",children:ne.secret.name}),s.jsx(Ri,{className:"ml-auto size-3 shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"})]})}),s.jsx("td",{className:J,children:s.jsx("span",{className:"block truncate",title:ne.service,children:ne.service})}),s.jsx("td",{className:J,children:s.jsx("span",{className:"font-mono text-[11px]",children:ne.secret.credentialKeys.length||"Access only"})}),s.jsx("td",{className:J,children:s.jsx("span",{className:"block truncate",title:ne.secret.attachedTo.slice(0,10).join(", "),children:ne.secret.attachedTo.length===1?ne.secret.attachedTo[0]:ne.secret.attachedTo.length?`${ne.secret.attachedTo.length.toLocaleString()} sandboxes`:"Unattached"})}),s.jsx("td",{className:J,children:s.jsxs("span",{className:ne.status==="expired"?"text-red-600":ne.status==="expiring"?"text-amber-700":"",title:ne.expiry?new Date(ne.expiry).toLocaleString():void 0,children:[ne.status==="expired"?"Expired · ":"",ne.expiry?new Date(ne.expiry).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):"No expiry"]})}),s.jsx("td",{className:J,children:s.jsx("span",{className:"block truncate font-mono text-[11px]",title:ne.hosts.join(", "),children:ne.hosts.length===1?ne.hosts[0]:ne.hosts.length?`${ne.hosts.length} hosts`:"-"})})]},ne.secret.name)),B.end<G.length&&s.jsx("tr",{"aria-hidden":"true",children:s.jsx("td",{colSpan:6,style:{height:(G.length-B.end)*40,padding:0}})})]})]}):s.jsxs("div",{className:"py-20 text-center",children:[s.jsx(hu,{className:"mx-auto mb-3 size-6 text-muted-foreground"}),s.jsx("p",{className:"text-sm",children:l&&!r?"Secrets unavailable":V.length?"No matching secrets":"No secrets yet"}),r&&s.jsx(ue,{variant:"outline",className:"mt-4",onClick:V.length?te:()=>h(!0),children:V.length?"Clear filters":"Add secret"})]})}),s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border bg-card px-6 py-2 text-[11px] text-muted-foreground",children:[s.jsxs("span",{children:[s.jsx("strong",{className:"font-medium text-foreground",children:G.length.toLocaleString()}),Q?` of ${V.length.toLocaleString()}`:""," secrets"]}),s.jsx("span",{className:"hidden sm:inline",children:"Click a row to inspect · ⌘K to search"})]})]}),s.jsx(Ul,{open:!!Z,onOpenChange:ne=>{ne||S(null)},children:s.jsxs(cu,{className:"w-full gap-0 sm:max-w-lg","aria-describedby":"secret-description",children:[s.jsxs(uu,{className:"border-b border-border px-4 py-4 pr-12",children:[s.jsx(du,{children:"Secret details"}),s.jsx(fu,{id:"secret-description",className:"text-xs",children:"Manage credentials, expiry, and sandbox access."})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:Z&&s.jsx(GQ,{secret:Z.secret,profile:Z.profile,sandboxes:K,onRotate:()=>p(Z.secret),onDelete:()=>v(Z.secret),onDone:le},Z.secret.name)})]})}),s.jsx(LQ,{open:m,onOpenChange:h,profiles:F,providers:H,sandboxes:K,reload:async()=>{const ne=await $();return t.refresh(),ne}}),s.jsx(HQ,{secret:g,onClose:()=>p(null),onDone:le}),s.jsx(Wr,{open:!!b,onOpenChange:ne=>{ne||v(null)},children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsxs(eo,{children:["Delete ",b==null?void 0:b.name,"?"]}),s.jsx(to,{children:b!=null&&b.attachedTo.length?`Detach from ${b.attachedTo.join(", ")} first.`:"This cannot be undone."})]}),s.jsxs(Jr,{children:[s.jsx(so,{children:"Cancel"}),s.jsx(no,{variant:"destructive",disabled:!!(b!=null&&b.attachedTo.length),onClick:async()=>{try{await e.deleteSecret(b.name),qe.success(`Deleted ${b.name}`),le()}catch(ne){qe.error(ne.message)}finally{v(null)}},children:"Delete"})]})]})})]})}async function XQ(e,t,r,a={}){var u,f,m;const l=await Y3(e,t.setups||[],null,{...a,expectedRevisions:t.setupRevisions});if((u=a.signal)!=null&&u.aborted)throw new DOMException("Preparation cancelled.","AbortError");const c=ba({...t,setups:l.setups.map(h=>h.id),setupRevisions:Object.fromEntries(l.setups.map(h=>[h.id,h.revision]))});return(f=a.onPrepared)==null||f.call(a),(m=a.onProgress)==null||m.call(a,"Starting image build…"),e.buildImageTemplate(c,r)}const WQ="bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",a4=["claude","codex","cursor","pi","antigravity","opencode"].map(e=>Ls.find(t=>t.id===e)).filter(Boolean),eR=Ls.filter(e=>!a4.includes(e)),tR={runtimes:"runtimes",repository:"repository",customAgents:"custom",base:"system",packages:"system",setup:"system",environment:"environment"};function zd({label:e,hint:t,htmlFor:r,children:a}){return s.jsxs("div",{className:"grid content-start gap-1.5",children:[s.jsx(En,{htmlFor:r,className:"text-xs",children:e}),a,t&&s.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:t})]})}function nR({type:e="checkbox",name:t,checked:r,onChange:a,disabled:l,children:c}){return s.jsxs("label",{className:"relative min-w-0",children:[s.jsx("input",{type:e,name:t,checked:r,onChange:a,disabled:l,className:"peer sr-only"}),s.jsx("span",{className:"flex min-h-11 cursor-pointer items-center gap-2.5 rounded-lg border border-border bg-background px-3 py-2 text-xs transition-all hover:-translate-y-px hover:bg-muted/50 hover:shadow-sm motion-reduce:hover:translate-y-0 @3xl:min-h-14 peer-checked:border-foreground/40 peer-checked:bg-accent peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-disabled:pointer-events-none peer-disabled:opacity-50",children:c})]})}function QQ(e){const t=Cn();return s.jsx(ZQ,{...e},(t==null?void 0:t.id)??(t==null?void 0:t.context)??"default")}function ZQ({initial:e,draftKey:t,onClose:r,onStarted:a,onChangeLocation:l}){var Ne,Ae,ee;const c=$t(),u=Cn(),f=Bs(),[m,h]=x.useState(()=>ba(e==null?void 0:e.recipe)),g=!!(e!=null&&e.replace),[p]=x.useState(()=>(e==null?void 0:e.baseline)??JSON.stringify(ba(e==null?void 0:e.recipe))),[b,v]=x.useState(()=>new Set(Array.isArray(e==null?void 0:e.advanced)?e.advanced:e!=null&&e.advanced?["system","environment"]:ba(e==null?void 0:e.recipe).customAgents.length?["custom"]:[])),j=re=>({open:b.has(re),onToggle:xe=>{const he=xe.currentTarget.open;v($e=>he===$e.has(re)?$e:new Set(he?[...$e,re]:[...$e].filter(we=>we!==re)))}}),[S,C]=x.useState(()=>!Vp.some(re=>re.id===ba(e==null?void 0:e.recipe).command)),[N,E]=x.useState(""),[T,A]=x.useState(!1),[k,M]=x.useState(!1),[R,O]=x.useState(""),D=x.useRef(null);x.useEffect(()=>()=>{var re;return(re=D.current)==null?void 0:re.abort()},[]);const[_,L]=x.useState(null),[q,P]=x.useState(!1),[$,H]=x.useState(!1),F=m.source==="build",V=re=>{Qg({...m,...re})&&C(!1),h(xe=>ba({...xe,...re,...re.setups?{setupRevisions:Object.fromEntries(Object.entries(xe.setupRevisions||{}).filter(([he])=>re.setups.includes(he)))}:{}}))},G=JSON.stringify(m)!==p,X=YG(m);x.useEffect(()=>{try{sessionStorage.setItem(t,JSON.stringify({recipe:m,replace:g,baseline:p,advanced:[...b]}))}catch{}},[t,m,g,p,b]);const B=tp(u),[Z,K]=x.useState({loading:B,value:null,error:""}),[se,I]=x.useState(0),[U]=x.useState(()=>ba(e==null?void 0:e.recipe).setups);x.useEffect(()=>{if(!B)return;let re=!0;return K({loading:!0,value:null,error:""}),c.syncLocalCatalog().then(xe=>{re&&K({loading:!1,value:xe,error:""})}).catch(xe=>{re&&K({loading:!1,value:null,error:xe.message})}),()=>{re=!1}},[c,B,se]),x.useEffect(()=>{let re=!0;return c.localImages().then(xe=>{re&&L(xe)}).catch(xe=>{re&&L({images:[],error:xe.message})}),()=>{re=!1}},[c]),x.useEffect(()=>{const re=xe=>{G&&(xe.preventDefault(),xe.returnValue="")};return window.addEventListener("beforeunload",re),()=>window.removeEventListener("beforeunload",re)},[G]);function Q(re){var $e;const xe=m.agents.includes(re)?m.agents.filter(we=>we!==re):Ls.filter(we=>we.id===re||m.agents.includes(we.id)).map(we=>we.id),he=!S&&(m.command===""?m.agents.length===0:Ls.some(we=>we.command===m.command));xe.length>1&&C(!1),V({agents:xe,...he?{command:(($e=Ls.find(we=>we.id===xe[0]))==null?void 0:$e.command)??""}:{}})}const te=re=>V({runtimes:m.runtimes.includes(re)?m.runtimes.filter(xe=>xe!==re):[...m.runtimes,re]}),le=[Ov(m).some(re=>re.npm)&&!m.runtimes.includes("node")&&"Node.js 22",Ov(m).some(re=>re.python)&&!m.runtimes.includes("python")&&"Python 3"].filter(Boolean),J=Vp.filter(re=>{var xe;return!F||re.id===""||m.agents.includes((xe=Ls.find(he=>he.command===re.id))==null?void 0:xe.id)}),ne=[...Mv.filter(re=>m.runtimes.includes(re.id)).map(re=>re.name),...le].join(", "),ce=[(Ne=$p.find(re=>re.id===m.base))==null?void 0:Ne.name,`${m.packages.length} ${m.packages.length===1?"package":"packages"}`,m.setup.trim()&&"setup commands"].filter(Boolean).join(" · "),oe=m.environment.length?`${m.environment.length} ${m.environment.length===1?"variable":"variables"}`:"";async function W(re){re.preventDefault();const xe=Object.entries(X)[0]??(S&&!m.command.trim()?["command","Enter a start command, or pick one of the options."]:null);if(xe){tR[xe[0]]&&v($e=>new Set([...$e,tR[xe[0]]])),E(xe[1]);return}if(T||(u==null?void 0:u.connected)===!1)return;A(!0),M(!0),E(""),O("");const he=new AbortController;D.current=he;try{a(await XQ(c,m,g,{signal:he.signal,onProgress:O,onPrepared:()=>M(!1)}))}catch($e){$e.name!=="AbortError"&&E($e.message)}finally{A(!1),M(!1),O(""),D.current=null}}function de(){const re=URL.createObjectURL(new Blob([Dv(m)],{type:"text/plain"})),xe=document.createElement("a");xe.href=re,xe.download="Dockerfile",xe.click(),URL.revokeObjectURL(re)}function Ee(){T||(G?H(!0):r())}const Be=(re=0)=>({initial:f?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,delay:re,ease:[.22,1,.36,1]}});return s.jsx(yn,{open:!0,onOpenChange:re=>{re||Ee()},children:s.jsx(vn,{className:"max-h-[90svh] gap-4 bg-transparent p-0 ring-0 sm:max-w-4xl",children:s.jsxs("form",{onSubmit:W,className:"@container flex max-h-[90svh] min-h-0 min-w-0 flex-col overflow-hidden rounded-xl bg-popover ring-1 ring-foreground/10",children:[s.jsxs(Ef,{value:m.source,onValueChange:re=>{V({source:re}),re==="build"&&m.agents.length>1&&C(!1),E("")},className:"contents",children:[s.jsxs(Nn,{className:"shrink-0 gap-3 px-5 pt-5 pb-4 @3xl:px-7 @3xl:pt-6",children:[l&&s.jsx("div",{className:"pr-8",children:s.jsx(Gw,{step:2,subject:"template"})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 pr-8",children:[s.jsx(wn,{className:"truncate",children:g?`Edit ${m.name}`:"New template"}),l?s.jsx(U3,{location:u,onChange:l}):s.jsx(So,{location:u}),s.jsxs(Rf,{className:"ml-auto w-fit","aria-label":"Template image source",children:[s.jsx(wr,{value:"build",className:"px-3 text-xs",children:"Build an image"}),s.jsx(wr,{value:"image",className:"px-3 text-xs",children:"Existing image"})]})]}),s.jsx(Hn,{className:"text-xs",children:F?"Built on the console’s Docker engine. For an SSH host, the image is built for its architecture and transferred before the template is saved.":"Boots an image you already have, as is."}),(u==null?void 0:u.connected)===!1&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"This location is disconnected. Choose a connected location to save a template."})]}),s.jsx("div",{className:"grid min-h-0 flex-1 overflow-y-auto overscroll-contain border-t border-border @3xl:grid-cols-[minmax(0,1fr)_19rem] @3xl:overflow-hidden",children:s.jsxs("fieldset",{disabled:T||(u==null?void 0:u.connected)===!1,className:"contents",children:[s.jsxs(Rn.div,{...Be(),className:"grid min-w-0 content-start gap-6 p-5 @3xl:overflow-y-auto @3xl:p-7",children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:"template-name",className:"text-xs",children:"Name"}),s.jsx(Rt,{id:"template-name",value:m.name,disabled:g,maxLength:19,onChange:re=>V({name:re.target.value.toLowerCase()}),placeholder:"frontend-app",className:"h-10 font-mono text-sm",autoFocus:!g,"aria-invalid":N&&X.name&&m.name?!0:void 0}),m.name&&X.name&&s.jsx("p",{className:"text-[11px] text-destructive",children:X.name})]}),F?s.jsxs("fieldset",{className:"min-w-0",children:[s.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-2 gap-2 @3xl:grid-cols-3",children:a4.map(re=>s.jsxs(nR,{checked:m.agents.includes(re.id),onChange:()=>Q(re.id),children:[s.jsx("img",{src:re.logo,alt:"",className:"size-4 shrink-0 object-contain"}),s.jsx("span",{className:"min-w-0 flex-1",children:re.name}),m.agents.includes(re.id)&&s.jsx(Fn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]},re.id))}),s.jsxs(ju,{children:[s.jsxs(Su,{render:s.jsx(ue,{type:"button",variant:"outline",className:"mt-2 w-full justify-between text-xs"}),children:[s.jsx("span",{className:"truncate",children:eR.filter(re=>m.agents.includes(re.id)).map(re=>re.name).join(", ")||"More agents"}),s.jsx(Xo,{className:"size-3.5 shrink-0","aria-hidden":"true"})]}),s.jsx(Nu,{align:"start",children:eR.map(re=>s.jsxs(Iw,{checked:m.agents.includes(re.id),onCheckedChange:()=>Q(re.id),closeOnClick:!1,className:"text-xs",children:[s.jsx("img",{src:re.logo,alt:"",className:"size-4 shrink-0 object-contain"}),re.name]},re.id))})]})]}):s.jsxs(zd,{label:"Image",htmlFor:"template-image",hint:_!=null&&_.error?_.error:"An image on the selected Docker engine, or a registry reference Docker is signed in to.",children:[s.jsx(Rt,{id:"template-image",value:m.image,onChange:re=>V({image:re.target.value.trim()}),placeholder:"ghcr.io/your-team/workspace:latest",className:"font-mono text-xs"}),((Ae=_==null?void 0:_.images)==null?void 0:Ae.length)>0&&s.jsxs(hn,{"aria-label":"Choose an available image",value:_.images.some(re=>re.reference===m.image)?m.image:"",onChange:re=>V({image:re.target.value}),className:"w-full text-xs",children:[s.jsx("option",{value:"",disabled:!0,children:"Choose an available image"}),_.images.map(re=>s.jsx("option",{value:re.reference,children:re.reference},re.reference))]})]}),s.jsx(JQ,{starts:J,recipe:m,custom:S,setCustom:C,patch:V}),N&&s.jsx("p",{role:"alert",className:"whitespace-pre-wrap rounded-md border border-red-200 bg-red-50/60 px-3 py-2 text-[11px] text-red-700",children:N})]}),s.jsxs(Rn.aside,{...Be(.06),className:"grid min-w-0 content-start gap-6 border-t border-border bg-muted/25 p-5 @3xl:overflow-y-auto @3xl:border-t-0 @3xl:border-l @3xl:p-6",children:[Z.loading&&s.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading your local MCPs & Skills…"}),((ee=Z.value)==null?void 0:ee.available)&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"Your local MCPs & Skills are available here. Existing remote templates keep their settings."}),Z.error&&s.jsxs("div",{className:"grid gap-2",children:[s.jsxs("p",{role:"alert",className:"text-xs text-destructive",children:["Could not load your local MCPs & Skills: ",Z.error]}),s.jsx(ue,{type:"button",variant:"outline",size:"sm",className:"w-fit",onClick:()=>I(re=>re+1),children:"Retry"})]}),!Z.loading&&s.jsx(T3,{localCatalog:Z.value,retained:U,autoPrepare:!0,preparationContext:"template",value:m.setups,onChange:re=>V({setups:re})}),s.jsxs("div",{className:"grid min-w-0",children:[F&&s.jsxs(kl,{title:"Runtimes and tools",summary:ne,...j("runtimes"),children:[s.jsx("div",{className:"grid gap-2",children:Mv.filter(re=>!re.retired||m.runtimes.includes(re.id)).map(re=>s.jsxs(nR,{checked:m.runtimes.includes(re.id),onChange:()=>te(re.id),children:[s.jsx("img",{src:re.logo,alt:"",className:`size-4 shrink-0 object-contain ${re.id==="vscode"?"dark:invert":""}`}),s.jsx("span",{className:"min-w-0 flex-1",children:re.name}),m.runtimes.includes(re.id)&&s.jsx(Fn,{className:"size-3.5 shrink-0","aria-hidden":"true"})]},re.id))}),le.length>0&&s.jsxs("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:[le.join(" and ")," ",le.length>1?"are":"is"," included for the selected agents."]})]}),F&&s.jsx(kl,{title:"Repository",summary:m.repository,...j("repository"),children:s.jsx(zd,{htmlFor:"template-repository",label:"Clone at build time",hint:"A public HTTPS repository, cloned into /sandbox/project. Private repositories can be cloned after launch.",children:s.jsx(Rt,{id:"template-repository",value:m.repository,onChange:re=>V({repository:re.target.value.trim()}),placeholder:"https://github.com/your-team/project.git",className:"font-mono text-xs"})})}),F&&s.jsx(kl,{title:"Custom agent",summary:m.customAgents.length?"Install command set":"",...j("custom"),children:s.jsx(tZ,{agents:m.customAgents,onChange:re=>{re.length>m.customAgents.length&&C(!1),V({customAgents:re,...re.length>m.customAgents.length?{command:""}:{}})},error:N?X.customAgents:void 0})}),F&&s.jsxs(kl,{title:"System",summary:ce,...j("system"),children:[s.jsx(zd,{label:"Operating system",htmlFor:"template-base",children:s.jsx(hn,{id:"template-base",value:m.base,onChange:re=>V({base:re.target.value}),className:"w-full text-xs",children:$p.map(re=>s.jsx("option",{value:re.id,children:re.name},re.id))})}),s.jsx(eZ,{packages:m.packages,onChange:re=>V({packages:re})}),s.jsx(zd,{label:"Setup commands",htmlFor:"template-setup",hint:`Run with bash in ${m.repository?"/sandbox/project":"/sandbox"} as the sandbox user, at build time. A failing command stops the build.`,children:s.jsx(Pf,{id:"template-setup",value:m.setup,onChange:re=>V({setup:re.target.value}),rows:4,placeholder:m.runtimes.includes("python")?"pip install -r requirements.txt":"npm ci",className:"font-mono text-xs",spellCheck:!1})})]}),s.jsxs(kl,{title:"Environment variables",summary:oe,...j("environment"),children:[s.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:"Non-secret values, stored with the template. Attach credentials through Secrets when you launch."}),m.environment.map((re,xe)=>s.jsxs("div",{className:"flex gap-1.5",children:[s.jsx(Rt,{"aria-label":`Variable ${xe+1} name`,className:"min-w-0 flex-1 font-mono text-xs",value:re.name,onChange:he=>V({environment:m.environment.map(($e,we)=>xe===we?{...$e,name:he.target.value}:$e)}),placeholder:"NODE_ENV"}),s.jsx(Rt,{"aria-label":`Variable ${xe+1} value`,className:"min-w-0 flex-1 font-mono text-xs",value:re.value,onChange:he=>V({environment:m.environment.map(($e,we)=>xe===we?{...$e,value:he.target.value}:$e)}),placeholder:"development"}),s.jsx(ue,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove variable ${xe+1}`,onClick:()=>V({environment:m.environment.filter((he,$e)=>$e!==xe)}),children:s.jsx(Yn,{})})]},xe)),s.jsxs(ue,{type:"button",variant:"outline",size:"sm",className:"justify-self-start",disabled:m.environment.length>=40,onClick:()=>V({environment:[...m.environment,{name:"",value:""}]}),children:[s.jsx(cs,{}),"Add variable"]})]})]}),s.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:"Software only. Network, file and credential access come from the groups and policies you pick at launch, plus the selected agents’ own sign-in and model destinations."})]})]})}),(R||g)&&s.jsx("p",{role:R?"status":void 0,className:"flex shrink-0 items-center gap-1.5 border-t border-border px-5 py-3 text-[11px] text-muted-foreground @3xl:px-7",children:R||s.jsxs(s.Fragment,{children:[s.jsx(uf,{className:"size-3.5 shrink-0","aria-hidden":"true"}),F?"Rebuilding replaces this template.":"Saving replaces this template."," Sandboxes already running from it keep their current image."]})}),s.jsxs(No,{className:"mx-0 mb-0 shrink-0 items-center rounded-none border-t border-border bg-popover px-5 py-4 @3xl:px-7",children:[F&&s.jsxs(ue,{type:"button",variant:"ghost",className:"sm:mr-auto",onClick:()=>P(!0),children:[s.jsx(MR,{}),"View Dockerfile"]}),s.jsx(ue,{type:"button",variant:"ghost",disabled:T&&!k,onClick:()=>{var re;return k?(re=D.current)==null?void 0:re.abort():Ee()},children:k?"Cancel preparation":"Cancel"}),s.jsxs(ue,{type:"submit",className:WQ,disabled:T||(u==null?void 0:u.connected)===!1,children:[T?s.jsx(zt,{}):s.jsx(Gv,{}),k?"Preparing MCPs…":F?g?"Rebuild template":"Build template":"Save template"]})]})]}),s.jsx(yn,{open:q,onOpenChange:P,children:s.jsxs(vn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-2xl",children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:"Generated Dockerfile"}),s.jsx(Hn,{children:"Setup commands are added as a separate build-context file."})]}),s.jsx("pre",{className:"overflow-x-auto rounded-md border bg-muted/30 p-4 font-mono text-[11px] leading-relaxed",children:F?Dv(m):""}),s.jsxs(ue,{type:"button",variant:"outline",onClick:de,children:[s.jsx(Kc,{}),"Download Dockerfile"]})]})}),s.jsx(yn,{open:$,onOpenChange:H,children:s.jsxs(vn,{children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:"Discard this template?"}),s.jsx(Hn,{children:"Your changes haven’t been built yet."})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ue,{type:"button",variant:"ghost",onClick:()=>H(!1),children:"Keep editing"}),s.jsx(ue,{type:"button",variant:"destructive",onClick:r,children:"Discard"})]})]})})]})})})}function JQ({starts:e,recipe:t,custom:r,setCustom:a,patch:l}){const c=Qg(t),u=[...c?Vp.filter(m=>m.id===""):e].sort((m,h)=>(m.id===""?-1:0)-(h.id===""?-1:0)),f=(m,h,g,p,b)=>s.jsxs("label",{className:"relative min-w-0",children:[s.jsx("input",{type:"radio",name:"template-open-in",checked:m,disabled:c,onChange:p,className:"peer sr-only"}),s.jsxs("span",{className:"flex min-h-16 cursor-pointer items-center gap-2.5 rounded-lg border border-border bg-background px-3 py-3 text-xs transition-colors hover:bg-muted/50 peer-checked:border-foreground/40 peer-checked:bg-accent peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-disabled:pointer-events-none peer-disabled:opacity-80",children:[h,s.jsx("span",{className:"min-w-0 flex-1 font-medium",children:g}),s.jsx("span",{"aria-hidden":"true",className:`flex size-3.5 shrink-0 items-center justify-center rounded-full border ${m?"border-foreground":"border-muted-foreground/40"}`,children:m&&s.jsx("span",{className:"size-1.5 rounded-full bg-foreground"})})]})]},b);return s.jsxs("fieldset",{className:"min-w-0",children:[s.jsx("legend",{className:"mb-1.5 text-xs font-medium",children:"Open in"}),s.jsxs("div",{className:"grid grid-cols-2 gap-2 @3xl:grid-cols-3",children:[u.map(m=>{const h=Ls.find(g=>g.command===m.id);return f(c||!r&&t.command===m.id,h?s.jsx("img",{src:h.logo,alt:"",className:"size-5 shrink-0 object-contain"}):s.jsx(Kv,{"aria-hidden":"true",className:"size-5 shrink-0"}),m.name,()=>{a(!1),l({command:m.id})},m.id||"shell")}),!c&&f(r,s.jsx(MR,{"aria-hidden":"true",className:"size-5 shrink-0"}),"Custom command",()=>{r||(a(!0),l({command:""}))},"custom")]}),!c&&r&&s.jsx(Rt,{"aria-label":"Start command",value:t.command,onChange:m=>l({command:m.target.value}),placeholder:"npm run dev",className:"mt-2 font-mono text-xs"}),s.jsx("p",{className:"mt-1.5 text-[11px] leading-relaxed text-muted-foreground",children:c?"Multiple agents are installed. Start in Shell to run any of them.":r?"Runs through /bin/bash as the sandbox’s main process.":"Opens as a session you connect to. Exiting it keeps the sandbox running."})]})}function eZ({packages:e,onChange:t}){const[r,a]=x.useState(""),l=x.useRef(null);function c(){const u=FT(r);u.length&&t([...new Set([...e,...u])]),a("")}return s.jsx(zd,{label:"System packages",htmlFor:"template-packages",hint:"Press Enter to add. Paste several separated by spaces, commas or new lines.",children:s.jsxs("div",{className:"rounded-lg border bg-background p-2",children:[e.length>0&&s.jsx("ul",{"aria-label":"System packages",className:"mb-3 flex flex-wrap gap-1.5",children:e.map(u=>s.jsxs("li",{className:"inline-flex max-w-full items-center gap-1 rounded-md border bg-muted/40 py-1 pl-2 pr-1",children:[s.jsx("span",{className:"min-w-0 break-all font-mono text-[11px]",children:u}),s.jsx("button",{type:"button","aria-label":`Remove package ${u}`,onClick:()=>t(e.filter(f=>f!==u)),className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",children:s.jsx(On,{className:"size-3"})})]},u))}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Rt,{ref:l,id:"template-packages",value:r,onChange:u=>a(u.target.value),onBlur:c,onKeyDown:u=>{u.key==="Enter"&&!u.nativeEvent.isComposing&&(u.preventDefault(),c())},onPaste:u=>{const f=u.clipboardData.getData("text");if(/[\s,]/.test(f)){u.preventDefault();const m=u.currentTarget,h=r.slice(0,m.selectionStart)+f+r.slice(m.selectionEnd);t([...new Set([...e,...FT(h)])]),a("")}},placeholder:"jq, unzip…",className:"min-w-0 flex-1 font-mono text-xs",autoComplete:"off",spellCheck:!1}),s.jsxs(ue,{type:"button",variant:"outline",size:"sm",onClick:()=>{var u;c(),(u=l.current)==null||u.focus()},children:[s.jsx(cs,{}),"Add"]})]})]})})}function tZ({agents:e,onChange:t,error:r}){return s.jsxs("div",{className:"space-y-2",children:[s.jsx(En,{htmlFor:"custom-agent-install",className:"text-xs",children:"Install command"}),s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-background px-3 py-1 focus-within:border-ring focus-within:ring-2 focus-within:ring-ring/30",children:[s.jsx(Kv,{"aria-hidden":"true",className:"mt-2 size-3.5 shrink-0 text-muted-foreground"}),s.jsx(Pf,{id:"custom-agent-install",value:e.map(a=>a.install).join(`
522
- `),onChange:a=>t(a.target.value.trim()?[{name:"Custom agent",install:a.target.value}]:[]),rows:1,maxLength:6e3,spellCheck:!1,autoComplete:"off",placeholder:"Paste an agent install command…",className:"min-h-8 resize-none rounded-none border-0 bg-transparent px-0 py-1.5 font-mono text-xs leading-5 focus-visible:ring-0 md:text-xs","aria-invalid":!!r})]}),r&&s.jsx("p",{role:"alert",className:"text-[11px] text-destructive",children:r})]})}const Ps=e=>(e==null?void 0:e.id)??(e==null?void 0:e.context),sR="bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",$r=e=>e.status==="building",Lh=e=>e.status==="ready"||e.exists,nZ=e=>$r(e)?e.exists?"Rebuilding":"Building":e.status==="failed"?e.exists?"Rebuild failed":"Build failed":"Ready";function rR({record:e}){return s.jsxs("span",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-[11px]",children:[$r(e)?s.jsx(zt,{className:"size-3 text-amber-600"}):s.jsx("span",{className:`size-1.5 rounded-full ${e.status==="failed"?"bg-amber-500":"bg-emerald-500"}`}),nZ(e)]})}const oR=e=>{var t;return((t=Vp.find(r=>r.id===e))==null?void 0:t.name)??e};function sZ(){var Ae;const e=$t(),t=Tr(),{templates:r,locations:a,error:l,refresh:c,loading:u}=Cu(),[f,m]=x.useState(""),[h,g]=x.useState(""),[p,b]=x.useState(null),[v,j]=x.useState(null),S=v?uy(Ps(v.location)):null,[C,N]=x.useState(null),[E,T]=x.useState(!1),[A,k]=x.useState(null),M=x.useRef(!1),[R,O]=x.useState(null),[D,_]=x.useState(null),[L,q]=x.useState(!1),P=x.useRef(!1),[$,H]=x.useState(()=>new Set),[F,V]=x.useState([]);x.useEffect(()=>{let ee=!0;return e.contextKey().then(re=>{ee&&b(JSON.stringify([e.target,re]))}).catch(re=>qe.error(re.message)),()=>{ee=!1}},[e]),x.useEffect(()=>{if(M.current||!p)return;const ee=a.find(xe=>Ps(xe)===p);if(!(ee!=null&&ee.connected))return;M.current=!0;const re=GT(uy(Ps(ee)));re&&j(xe=>xe??{...re,location:ee})},[p,a]);const G=r.find(ee=>Vn(ee)===C),X=ee=>a.find(re=>Ps(re)===Ps(ee.location))??ee.location,B=a.length>1,Z=ee=>X(ee).connected!==!1,K=ee=>{if(!Z(ee))throw new Error(`${_s(X(ee))} is disconnected. Reconnect before continuing.`);return Gr(t!=null&&t.localViewer?X(ee).target??"local":e.target,e.signal,ee.location.context)},se=r.filter(ee=>(!B||!h||Ps(ee.location)===h)&&`${ee.name} ${ee.image||""} ${ee.recipe.repository||""}`.toLowerCase().includes(f.toLowerCase())),I=se.filter(ee=>!$r(ee)&&Z(ee)),U=r.filter(ee=>$.has(Vn(ee))&&!$r(ee)&&Z(ee)),Q=I.filter(ee=>$.has(Vn(ee))).length,te=I.length>0&&Q===I.length;x.useEffect(()=>{const ee=new Set(r.filter(re=>!$r(re)&&(a.find(xe=>Ps(xe)===Ps(re.location))??re.location).connected!==!1).map(Vn));H(re=>new Set([...re].filter(xe=>ee.has(xe))))},[r,a]);function le(ee){H(re=>{const xe=new Set(re);return xe.has(ee)?xe.delete(ee):xe.add(ee),xe})}function J(){H(ee=>{const re=new Set(ee);for(const xe of I)te?re.delete(Vn(xe)):re.add(Vn(xe));return re})}async function ne(ee){const re=[];for(const xe of ee)try{const he=await K(xe).imageTemplateUsage(xe.name);he.sandboxes.length&&re.push({target:xe,message:"This template cannot be deleted while sandboxes use it.",sandboxes:he.sandboxes})}catch(he){re.push({target:xe,message:he.message})}V(re)}async function ce(ee){if(!P.current){P.current=!0,q(!0),V([]),N(null),O(ee);try{await ne(ee)}finally{P.current=!1,q(!1)}}}async function oe(ee,re){if(!P.current){P.current=!0,q(!0);try{await K(ee).lifecycle(re,"delete"),qe.success(`Deleted sandbox ${re}`),await ne(R),await c()}catch(xe){qe.error(xe.message)}finally{P.current=!1,q(!1)}}}async function W(){if(P.current||!(R!=null&&R.length))return;P.current=!0,q(!0),V([]);const ee=new Set,re=[],xe=new Map;try{for(const he of R)try{const $e=await K(he).deleteImageTemplate(he.name);ee.add(Vn(he));const we=$e==null?void 0:$e.imageCleanup,_e=JSON.stringify([Ps(he.location),we==null?void 0:we.image]);(we==null?void 0:we.status)==="retained"?xe.set(_e,{image:we.image,reason:we.reason,location:X(he)}):we!=null&&we.image&&xe.delete(_e)}catch($e){re.push({target:he,message:$e.message,sandboxes:$e.sandboxes})}for(const{image:he,reason:$e,location:we}of xe.values())qe.warning($e,{description:`${_s(we)} · ${he}`,duration:1e4});H(he=>new Set([...he].filter($e=>!ee.has($e)))),N(he=>ee.has(he)?null:he),V(re),ee.size&&qe.success(`Deleted ${ee.size} ${ee.size===1?"template":"templates"}`),O(re.length?R.filter(he=>!ee.has(Vn(he))):null),await c()}finally{P.current=!1,q(!1)}}function de(ee,re,xe){Z(ee)&&(N(null),j({recipe:re,replace:xe,location:X(ee)}))}function Ee(ee){if(!(ee!=null&&ee.connected))return;const re=GT(uy(Ps(ee)));j({...re??{},location:ee}),T(!1)}x.useEffect(()=>{if(!A)return;const ee=a.find(xe=>xe.gateway===A&&xe.connected);if(ee){k(null),Ee(ee);return}const re=setInterval(c,1500);return()=>clearInterval(re)},[A,a]);function Be(){try{sessionStorage.removeItem(S)}catch{}j(null)}async function Ne(ee){try{await ee(),await c()}catch(re){qe.error(re.message)}}return s.jsxs("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:[v&&s.jsx(Oa,{location:X(v),children:s.jsx(QQ,{initial:v,draftKey:S,onClose:Be,onChangeLocation:v.replace?void 0:()=>{j(null),T(!0)},onStarted:ee=>{N(Vn({...ee,location:v.location})),Be(),c()}},JSON.stringify([Ps(v.location),((Ae=v.recipe)==null?void 0:Ae.name)||"new"]))}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-4 py-3 sm:px-6",children:[s.jsx(ea,{"aria-label":"Search image templates",value:f,onValueChange:m,placeholder:"Search…",className:"mr-auto min-w-32 flex-1 sm:max-w-60"}),B&&s.jsxs(hn,{"aria-label":"Filter template location",value:h,onChange:ee=>g(ee.target.value),className:"h-8 rounded-md border bg-card px-2 text-xs",children:[s.jsx("option",{value:"",children:"All locations"}),a.map(ee=>s.jsxs("option",{value:Ps(ee),children:[_s(ee),Ps(ee)===p?" (default)":"",ee.connected===!1?" · disconnected":""]},Ps(ee)))]}),s.jsxs(ue,{size:"sm",className:sR,onClick:()=>T(!0),children:[s.jsx(cs,{}),"New template"]})]}),U.length>0&&s.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b bg-accent/30 px-4 py-2 sm:px-6",children:[s.jsxs("span",{role:"status",className:"mr-auto text-xs",children:[U.length," selected",U.length>Q&&s.jsxs("span",{className:"text-muted-foreground",children:[" · ",U.length-Q," outside current filters"]})]}),s.jsx(ue,{variant:"ghost",size:"sm",disabled:L,onClick:()=>H(new Set),children:"Clear selection"}),s.jsxs(ue,{variant:"destructive",size:"sm",disabled:L,onClick:()=>ce(U),children:[s.jsx(Yn,{}),"Delete selected"]})]}),l&&s.jsxs("div",{role:"alert",className:"px-4 py-4 text-xs sm:px-6",children:[s.jsx("p",{children:l}),s.jsx(ue,{variant:"outline",size:"sm",className:"mt-3",onClick:c,children:"Try again"})]}),a.filter(ee=>ee.connected===!1).map(ee=>s.jsxs("div",{role:"status",className:"border-b bg-muted/30 px-4 py-3 text-xs text-muted-foreground sm:px-6",children:[_s(ee)," is disconnected. Saved templates are shown; reconnect to use or change them.",ee.error&&s.jsx("span",{className:"ml-1",children:ee.error})]},Ps(ee))),u&&!r.length?s.jsxs("div",{role:"status",className:"flex items-center justify-center gap-2 py-10 text-xs text-muted-foreground",children:[s.jsx(zt,{}),"Loading…"]}):se.length?s.jsx(qo,{duration:.15,offset:0,blur:"0px",children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{"aria-label":"Image templates",className:"w-full min-w-[580px] text-left",children:[s.jsx("thead",{className:"border-b text-[11px] text-muted-foreground",children:s.jsxs("tr",{children:[s.jsx("th",{className:"w-10 px-4 py-2 sm:pl-6",children:s.jsx(Il,{"aria-label":"Select all matching templates",checked:te,indeterminate:Q>0&&!te,disabled:L||!I.length,onCheckedChange:J})}),s.jsx("th",{className:"px-4 py-2 font-normal",children:"Name"}),B&&s.jsx("th",{className:"px-4 py-2 font-normal",children:"Location"}),s.jsx("th",{className:"px-4 py-2 font-normal",children:"Starts in"}),s.jsx("th",{className:"px-4 py-2 font-normal",children:"Image"}),s.jsx("th",{className:"px-4 py-2 font-normal",children:"Status"}),s.jsx("th",{className:"px-4 py-2",children:s.jsx("span",{className:"sr-only",children:"Actions"})})]})}),s.jsx("tbody",{className:"divide-y",children:se.map(ee=>s.jsxs("tr",{className:$.has(Vn(ee))?"bg-accent/40 hover:bg-muted/40":"hover:bg-muted/40",children:[s.jsx("td",{className:"px-4 py-2 sm:pl-6",children:s.jsx(Il,{"aria-label":`Select ${ee.name} in ${_s(X(ee))}`,checked:$.has(Vn(ee)),disabled:L||$r(ee)||!Z(ee),onCheckedChange:()=>le(Vn(ee))})}),s.jsx("td",{className:"max-w-72 px-4 py-2",children:s.jsxs("button",{className:"group flex max-w-full items-center gap-2 rounded text-left font-mono text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>N(Vn(ee)),children:[s.jsx("span",{"aria-hidden":"true",className:"flex size-7 shrink-0 items-center justify-center rounded-lg border bg-muted/40 text-muted-foreground",children:s.jsx(DR,{className:"size-4",strokeWidth:1.5})}),s.jsx("span",{className:"truncate group-hover:underline",children:ee.name})]})}),B&&s.jsx("td",{className:"px-4 py-2",children:s.jsx(_3,{location:X(ee)})}),s.jsx("td",{className:"px-4 py-2 text-[11px] text-muted-foreground",children:ee.managed===!1?"-":oR(ee.recipe.command)}),s.jsx("td",{className:"px-4 py-2",children:s.jsx("span",{className:"block max-w-64 truncate font-mono text-[11px] text-muted-foreground",title:ee.image||"",children:ee.image||(ee.recipe.source==="image"?ee.recipe.image:"Not built yet")})}),s.jsx("td",{className:"px-4 py-2",children:s.jsx(rR,{record:ee})}),s.jsx("td",{className:"px-4 py-2 text-right sm:pr-6",children:s.jsxs("div",{className:"flex items-center justify-end gap-1",children:[!$r(ee)&&(ee.status==="failed"||ee.status==="ready"&&ee.managed)&&s.jsxs(ue,{variant:"ghost",size:"xs",disabled:!Z(ee),"aria-label":`Edit ${ee.name} in ${_s(X(ee))}`,onClick:()=>de(ee,ee.recipe,ee.status==="ready"||!!ee.exists),children:[s.jsx(lC,{}),"Edit"]}),s.jsxs(ue,{variant:"ghost",size:"xs",disabled:Lh(ee)&&!Z(ee),onClick:()=>Lh(ee)?_(ee):N(Vn(ee)),children:[Lh(ee)?"Use template":$r(ee)?"View progress":"Details",s.jsx(Ay,{})]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":`Delete ${ee.name} in ${_s(X(ee))}`,title:$r(ee)?"Cancel the build before deleting this template":`Delete ${ee.name}`,disabled:L||$r(ee)||!Z(ee),onClick:()=>ce([ee]),children:s.jsx(Yn,{})})]})})]},Vn(ee)))})]})})}):s.jsxs("div",{className:"py-12 text-center text-xs text-muted-foreground",children:[s.jsx("p",{children:r.length?"No matching templates.":"No image templates yet."}),f&&s.jsx(ue,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>m(""),children:"Clear search"})]}),s.jsx(yn,{open:!!G,onOpenChange:ee=>{ee||N(null)},children:s.jsx(vn,{className:"max-h-[85svh] overflow-y-auto sm:max-w-2xl",children:G&&s.jsxs(s.Fragment,{children:[s.jsxs(Nn,{children:[s.jsx(wn,{className:"font-mono",children:G.name}),s.jsx(Hn,{children:G.managed===!1?"Created outside the console. Edit it with the openshell CLI.":"OpenShell sandbox template"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(So,{location:X(G)}),s.jsx(rR,{record:G})]}),!Z(G)&&s.jsx("p",{role:"status",className:"text-xs text-muted-foreground",children:"This location is disconnected. Reconnect to use or change this template."}),s.jsx("dl",{className:"divide-y rounded-lg border px-4 text-xs",children:[["Image",s.jsx("span",{className:"break-all font-mono",children:G.image||(G.recipe.source==="image"?G.recipe.image:"Not built yet")},"i")],...G.managed===!1?[]:[["Starts in",oR(G.recipe.command)]],...G.recipe.source==="build"&&G.managed!==!1?[["Agents",[...G.recipe.agents.map(ee=>{var re;return(re=Ls.find(xe=>xe.id===ee))==null?void 0:re.name}),...(G.recipe.customAgents??[]).map(ee=>ee.name)].join(", ")||"None"],["Repository",G.recipe.repository?s.jsx("span",{className:"break-all font-mono",children:G.recipe.repository},"r"):"None"]]:[],["Environment",G.recipe.environment.length?s.jsx("span",{className:"font-mono",children:G.recipe.environment.map(ee=>ee.name).join(", ")},"e"):"None"],["CLI",s.jsxs("code",{className:"font-mono",children:["openshell sandbox create --template ",G.name]},"c")]].map(([ee,re])=>s.jsxs("div",{className:"flex gap-4 py-2",children:[s.jsx("dt",{className:"w-24 shrink-0 text-muted-foreground",children:ee}),s.jsx("dd",{className:"min-w-0",children:re})]},ee))}),G.error&&s.jsx("p",{role:"alert",className:"whitespace-pre-wrap rounded-md border border-amber-200 bg-amber-50/50 p-3 text-xs text-amber-800",children:G.error}),G.logs&&s.jsxs("details",{open:$r(G)||G.status==="failed",className:"overflow-hidden rounded-lg border",children:[s.jsx("summary",{className:"cursor-pointer bg-muted/35 px-3 py-2 text-xs",children:"Build log"}),s.jsx("pre",{"aria-label":"Build log",className:"max-h-64 overflow-auto whitespace-pre-wrap break-all bg-card p-4 font-mono text-[10px] leading-relaxed",children:G.logs})]}),s.jsx("div",{className:"flex flex-wrap items-center gap-2 border-t pt-4",children:$r(G)?s.jsxs(ue,{variant:"outline",disabled:!Z(G),onClick:()=>Ne(()=>K(G).cancelImageBuild(G.name)),children:[s.jsx(On,{}),"Cancel build"]}):s.jsxs(s.Fragment,{children:[G.status==="failed"&&s.jsxs(ue,{variant:"outline",size:"sm",disabled:!Z(G),onClick:()=>de(G,G.recipe,!!G.exists),children:[s.jsx(t6,{}),"Edit and retry"]}),G.status==="failed"&&G.exists&&s.jsx(ue,{variant:"ghost",size:"sm",disabled:!Z(G),onClick:()=>Ne(()=>K(G).dismissImageBuild(G.name)),children:"Dismiss"}),G.status==="ready"&&G.managed&&s.jsxs(ue,{variant:"ghost",size:"sm",disabled:!Z(G),onClick:()=>de(G,G.recipe,!0),children:[s.jsx(lC,{}),"Edit"]}),G.managed!==!1&&s.jsxs(ue,{variant:"ghost",size:"sm",disabled:!Z(G),onClick:()=>de(G,{...G.recipe,name:`${G.name.slice(0,14)}-copy`},!1),children:[s.jsx(cf,{}),"Duplicate"]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Delete image template",disabled:L||!Z(G),onClick:()=>ce([G]),children:s.jsx(Yn,{})}),Lh(G)&&s.jsxs(ue,{className:`ml-auto ${sR}`,disabled:!Z(G),onClick:()=>{_(G),N(null)},children:["Use template",s.jsx(Ay,{})]})]})})]})})}),s.jsx(yn,{open:!!R,onOpenChange:ee=>{!ee&&!P.current&&O(null)},children:s.jsxs(vn,{className:"max-h-[85svh] overflow-y-auto",children:[s.jsxs(Nn,{children:[s.jsxs(wn,{children:["Delete ",(R==null?void 0:R.length)===1?"this template":`${(R==null?void 0:R.length)??0} templates`,"?"]}),s.jsx(Hn,{children:"The selected templates and their unused Docker images will be deleted in their owning locations. Templates used by existing sandboxes cannot be deleted. Images shared with other templates are kept."})]}),s.jsx("ul",{className:"max-h-40 overflow-y-auto text-xs",children:R==null?void 0:R.map(ee=>s.jsxs("li",{className:"flex items-center gap-2 break-all py-1",children:[s.jsx("span",{className:"font-mono",children:ee.name}),s.jsx(So,{location:X(ee)})]},Vn(ee)))}),F.length>0&&s.jsxs("div",{role:"alert",className:"rounded-md border border-destructive/30 bg-destructive/5 p-3 text-xs",children:[s.jsxs("p",{children:["Cannot delete ",(R==null?void 0:R.length)===1?"this template":"these templates","."]}),s.jsx("ul",{className:"mt-2 space-y-3",children:F.map(ee=>{var re;return s.jsxs("li",{children:[s.jsxs("p",{children:[s.jsx("span",{className:"font-mono",children:ee.target.name})," ",s.jsx(So,{location:X(ee.target)}),": ",ee.message]}),((re=ee.sandboxes)==null?void 0:re.length)>0&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"mt-1 text-muted-foreground",children:"Delete the sandboxes below, then retry. Deleting a sandbox permanently removes its files."}),s.jsx("ul",{className:"mt-2 space-y-2",children:ee.sandboxes.map(xe=>s.jsxs("li",{className:"flex items-center justify-between gap-3",children:[s.jsx("span",{className:"break-all font-mono",children:xe.name}),s.jsxs(ue,{variant:"destructive",size:"sm",disabled:L||!Z(ee.target),"aria-label":`Delete sandbox ${xe.name} in ${_s(X(ee.target))}`,onClick:()=>oe(ee.target,xe.name),children:[s.jsx(Yn,{}),"Delete sandbox"]})]},Vn({...xe,location:ee.target.location})))})]})]},Vn(ee.target))})})]}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(ue,{variant:"ghost",disabled:L,onClick:()=>O(null),children:"Cancel"}),s.jsxs(ue,{variant:"destructive",disabled:L||!(R!=null&&R.some(Z)),onClick:W,children:[L&&s.jsx(zt,{}),L?"Deleting…":F.length?"Retry deletion":(R==null?void 0:R.length)===1?"Delete template":"Delete templates"]})]})]})}),s.jsx(yn,{open:E,onOpenChange:ee=>{T(ee),ee||k(null)},children:s.jsx(vn,{className:"gap-4 bg-transparent p-0 ring-0 sm:max-w-3xl",children:s.jsx(F3,{locations:a,allowRemote:!0,subject:"template",connecting:!!A,onPick:ee=>Ee(a.find(re=>Ps(re)===ee)),onConnected:ee=>{k(ee.gateway),c()},onCancel:()=>T(!1)})})}),D&&s.jsx(Oa,{location:X(D),children:s.jsx(X3,{open:!0,initialImageTemplate:D,onOpenChange:ee=>{ee||_(null)},onStarted:()=>_(null)})})]})}const i4=x.createContext(void 0);function rZ(){const e=x.useContext(i4);if(e===void 0)throw new Error(Jt(63));return e}const oZ="data-checked",aZ="data-unchecked",l4={...ig,checked(e){return e?{[oZ]:""}:{[aZ]:""}}},iZ=x.forwardRef(function(t,r){const{checked:a,className:l,defaultChecked:c,"aria-labelledby":u,form:f,id:m,inputRef:h,name:g,nativeButton:p=!1,onCheckedChange:b,readOnly:v=!1,required:j=!1,disabled:S=!1,render:C,uncheckedValue:N,value:E,style:T,...A}=t,{clearErrors:k}=lg(),{state:M,setTouched:R,setDirty:O,validityData:D,setFilled:_,setFocused:L,validationMode:q,disabled:P,name:$,validation:H}=gu(),{labelId:F}=mf(),V=P||S,G=$??g,X=x.useRef(null),B=qr(X,h,H.inputRef),Z=x.useRef(null),K=ds(),se=hf({id:m}),I=p?void 0:se,[U,Q]=Xr({controlled:a,default:!!c,name:"Switch",state:"checked"});xg(Z,K,U,void 0,!V,g),Ke(()=>{_(U)},[U,_]),bf(U,()=>{k(G),O(U!==D.initialValue),H.change(U)});const{getButtonProps:te,buttonRef:le}=ro({disabled:V,native:p}),J=dA(u,F,X,!p,I),ne={id:p?se:K,role:"switch","aria-checked":U,"aria-readonly":v||void 0,"aria-required":j||void 0,"aria-labelledby":J,onFocus(){V||L(!0)},onBlur(){const de=X.current;!de||V||(R(!0),L(!1),q==="onBlur"&&H.commit(de.checked))},onClick(de){if(v||V)return;de.preventDefault();const Ee=X.current;Ee&&Xc(Ee,de)}},ce={...H.getValidationProps(V),checked:U,disabled:V,form:f,id:I,name:G,required:j,style:G?g1:wg,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:B,onChange(de){if(de.nativeEvent.defaultPrevented)return;if(v){de.preventDefault();return}const Ee=de.currentTarget.checked,Be=bt(kr,de.nativeEvent);b==null||b(Ee,Be),!Be.isCanceled&&Q(Ee)},onClick(de){de.stopPropagation()},onFocus(){var de;(de=Z.current)==null||de.focus()},...E!==void 0?{value:E}:gn},oe=x.useMemo(()=>({...M,checked:U,disabled:V,readOnly:v,required:j}),[M,U,V,v,j]),W=wt("span",t,{state:oe,ref:[r,Z,le],props:[ne,A,te,de=>H.getValidationProps(V,de)],stateAttributesMapping:l4});return s.jsxs(i4.Provider,{value:oe,children:[W,!U&&G&&N!==void 0&&s.jsx("input",{type:"hidden",form:f,name:G,value:N,disabled:V}),s.jsx("input",{...ce,suppressHydrationWarning:!0})]})}),lZ=x.forwardRef(function(t,r){const{render:a,className:l,style:c,...u}=t,f=rZ();return wt("span",t,{state:f,ref:r,stateAttributesMapping:l4,props:u})});function cZ({className:e,...t}){return s.jsx(iZ,{"data-slot":"switch",className:Le("peer relative inline-flex h-[18px] w-8 shrink-0 cursor-pointer items-center rounded-full border border-transparent outline-none transition-colors duration-200 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-checked:bg-[var(--connection)] data-unchecked:bg-foreground/15",e),...t,children:s.jsx(lZ,{"data-slot":"switch-thumb",className:"pointer-events-none block size-3.5 rounded-full bg-white shadow-sm ring-0 transition-transform duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] data-checked:translate-x-[15px] data-unchecked:translate-x-[1px]"})})}const uZ=({children:e,className:t,shimmerWidth:r=100,...a})=>s.jsx("span",{style:{"--shiny-width":`${r}px`},className:Le("mx-auto max-w-md text-neutral-600/70 dark:text-neutral-400/70","animate-shiny-text bg-size-[var(--shiny-width)_100%] bg-clip-text bg-position-[0_0] bg-no-repeat [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]","bg-linear-to-r from-transparent via-black/80 via-50% to-transparent dark:via-white/80",t),...a,children:e}),dZ=`Create a Linux VM I can connect to OpenRod (a sandbox console) over SSH.
523
- Use the cloud provider or server I already use: check which CLIs I'm logged into (aws, gcloud, az, doctl, hcloud, …). If it's unclear, ask me before creating anything.
524
-
525
- Requirements:
526
- - Ubuntu 22.04/24.04 LTS (or Debian 12), amd64 or arm64. A full VM, not a container.
527
- - At least 2 vCPU, 4 GB RAM, 30 GB disk.
528
- - SSH with key-based login only (ed25519). Use my existing key, or generate a new key pair on my machine without a passphrase (or add it to ssh-agent with ssh-add). Password login is not supported.
529
- - A non-root user with that key in ~/.ssh/authorized_keys.
530
- - Docker Engine (rootful, the docker.io or docker-ce package), running and enabled. Not Docker Desktop, not rootless.
531
- - Add that user to the docker group, so \`docker ps\` works without sudo.
532
- - Python 3 installed.
533
- - In sshd_config: AllowTcpForwarding yes and AllowStreamLocalForwarding yes, then restart sshd.
534
- - Open the SSH port (22 or a custom one) to my IP in the firewall/security group.
535
-
536
- Verify, from my machine: \`ssh <user>@<host> 'docker ps && python3 --version'\` succeeds with no password prompt.
537
-
538
- When you're done, reply with ONLY this, nothing else:
539
-
540
- - Display name: <short name for the VM>
541
- - Hostname: <user>@<public IP or DNS>
542
- - SSH port: <port, or 22>
543
- - Authentication: "SSH agent / default keys" if the key is ~/.ssh/id_ed25519 or ~/.ssh/id_rsa, or is loaded in ssh-agent. Otherwise "Key file: <full path to the PRIVATE key on my machine, e.g. ~/.ssh/openrod-vm — not the .pub>"
544
- - Host key fingerprint (ED25519): <output of \`ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub\` on the VM>
545
- `;async function fZ(e,t){try{return await navigator.clipboard.writeText(e),!0}catch{}const r=Object.assign(document.createElement("textarea"),{value:e,readOnly:!0});r.style.cssText="position:fixed;opacity:0;pointer-events:none",t.parentElement.append(r),r.select();try{return document.execCommand("copy")}catch{return!1}finally{r.remove(),t.focus()}}const mZ={initial:{opacity:0,scale:.6,filter:"blur(2px)"},animate:{opacity:1,scale:1,filter:"blur(0px)"},exit:{opacity:0,scale:.6,filter:"blur(2px)"}};function hZ({className:e}){const[t,r]=x.useState(!1),a=Bs();x.useEffect(()=>{if(!t)return;const u=setTimeout(()=>r(!1),2e3);return()=>clearTimeout(u)},[t]);const l=async u=>{await fZ(dZ,u.currentTarget)?r(!0):qe.error("Couldn’t copy the prompt",{description:"Your browser blocked clipboard access."})},c=a?{}:{...mZ,transition:{duration:.18,ease:"easeOut"}};return s.jsx(_f,{delay:300,children:s.jsxs(Ma,{children:[s.jsxs(Da,{render:s.jsx(ue,{type:"button",variant:"outline",size:"sm",onClick:l,"aria-label":t?"Prompt copied":"Copy a VM setup prompt for your AI agent",className:Le("h-8 gap-1.5 px-3 text-xs",e)}),children:[s.jsx("span",{className:"relative grid size-3.5 place-items-center","aria-hidden":"true",children:s.jsx(Vl,{initial:!1,mode:"popLayout",children:s.jsx(Rn.span,{className:"grid place-items-center",...c,children:t?s.jsx(Fn,{className:"size-3.5 text-emerald-600 dark:text-emerald-400"}):s.jsx(cf,{className:"size-3.5"})},t?"check":"copy")})}),s.jsx(Vl,{initial:!1,mode:"wait",children:s.jsx(Rn.span,{...a?{}:{initial:{opacity:0,y:3},animate:{opacity:1,y:0},exit:{opacity:0,y:-3},transition:{duration:.15}},children:t?s.jsx("span",{className:"text-foreground",children:"Copied — paste into your agent"}):s.jsx(uZ,{className:"mx-0 text-inherit motion-reduce:animate-none dark:text-inherit",children:"Need a VM? Copy agent prompt"})},t?"copied":"idle")}),s.jsx("span",{role:"status",className:"sr-only",children:t?"VM setup prompt copied to clipboard":""})]}),s.jsx(za,{side:"top",className:"max-w-64",children:"Copies a prompt your AI agent can use to create a VM on any cloud provider or server, then tells you what to enter here."})]})})}const aR={name:"",hostname:"",port:"",auth:"default",identityFile:""},pZ=[["default","SSH agent / default keys"],["identity","Key file"]];function gZ({open:e,onOpenChange:t,onAdded:r}){const[a,l]=x.useState(aR),[c,u]=x.useState(null),[f,m]=x.useState(!1),[h,g]=x.useState(null),p=x.useId();x.useEffect(()=>{e&&(l(aR),u(null),g(null),m(!1))},[e]);const b=N=>E=>{l(T=>({...T,[N]:E.target.value})),g(null)},v=a.name.trim()&&a.hostname.trim()&&(a.auth==="default"||a.identityFile.trim());async function j(N){m(!0),g(null);try{await N()}catch(E){g(E.message)}finally{m(!1)}}const S=N=>{N.preventDefault(),v&&!f&&j(async()=>u(await is.scanSshHost(a)))},C=()=>j(async()=>{const N=await is.addSshHost(c.token);r(N)});return s.jsx(yn,{open:e,onOpenChange:N=>{f||t(N)},children:s.jsxs(vn,{className:"sm:max-w-md","aria-describedby":void 0,children:[s.jsx(Nn,{children:s.jsx(wn,{children:c?"Trust this machine?":"Add SSH connection"})}),c?s.jsxs("div",{className:"grid gap-4 text-xs",children:[s.jsxs("p",{className:"text-muted-foreground",children:["OpenRod reached ",s.jsxs("span",{className:"font-mono text-foreground",children:[c.user?`${c.user}@`:"",c.host,c.port?`:${c.port}`:""]})," and it presented these host keys. Confirm they match the server before you trust it; a mismatch could mean someone is intercepting the connection."]}),s.jsx("ul",{className:"grid gap-2",children:c.fingerprints.map(N=>s.jsxs("li",{className:"rounded-lg border border-border bg-muted/20 px-3 py-2",children:[s.jsx("span",{className:"block text-[10px] text-muted-foreground",children:N.type}),s.jsx("span",{className:"block font-mono break-all text-foreground",children:N.fingerprint})]},N.type))}),s.jsxs("p",{className:"text-muted-foreground",children:["On the server, ",s.jsx("code",{className:"rounded bg-muted px-1 font-mono text-foreground",children:"ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub"})," prints the matching fingerprint."]}),h&&s.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 break-words whitespace-pre-wrap text-destructive",children:h}),s.jsxs(No,{children:[s.jsx(ue,{type:"button",variant:"ghost",disabled:f,onClick:()=>{u(null),g(null)},children:"Back"}),s.jsxs(ue,{type:"button",disabled:f,onClick:C,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f?s.jsx(zt,{"aria-hidden":"true"}):s.jsx(pu,{"aria-hidden":"true",className:"size-4"}),"Trust and save"]})]})]}):s.jsxs("form",{autoComplete:"off",className:"grid gap-4 text-xs",onSubmit:S,children:[s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:`${p}-name`,className:"text-xs",children:"Display name"}),s.jsx(Rt,{id:`${p}-name`,value:a.name,onChange:b("name"),maxLength:60,placeholder:"Build server",autoFocus:!0})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx(En,{htmlFor:`${p}-host`,className:"text-xs",children:"Hostname"}),s.jsx(Rt,{id:`${p}-host`,value:a.hostname,onChange:b("hostname"),spellCheck:!1,autoCapitalize:"none",placeholder:"host.com or user@host.com",className:"font-mono"})]}),s.jsxs("div",{className:"grid gap-1.5",children:[s.jsxs(En,{htmlFor:`${p}-port`,className:"text-xs",children:["SSH port ",s.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),s.jsx(Rt,{id:`${p}-port`,value:a.port,onChange:b("port"),inputMode:"numeric",placeholder:"22",className:"font-mono"})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx("div",{role:"radiogroup","aria-label":"Authentication",className:"inline-flex w-fit rounded-lg bg-muted p-0.5",children:pZ.map(([N,E])=>s.jsx("button",{type:"button",role:"radio","aria-checked":a.auth===N,onClick:()=>{l(T=>({...T,auth:N})),g(null)},className:`rounded-md px-3 py-1 transition-colors ${a.auth===N?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:E},N))}),a.auth==="identity"?s.jsx(Rt,{"aria-label":"Private key file",value:a.identityFile,onChange:b("identityFile"),spellCheck:!1,autoCapitalize:"none",placeholder:"~/.ssh/id_ed25519",className:"font-mono"}):s.jsx("p",{className:"text-muted-foreground",children:"Uses your SSH agent and the keys SSH tries by default. Password logins aren’t supported."})]}),h&&s.jsx("p",{role:"alert",className:"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 break-words whitespace-pre-wrap text-destructive",children:h}),s.jsxs(No,{children:[s.jsx(hZ,{className:"sm:mr-auto"}),s.jsx(ue,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),s.jsxs(ue,{type:"submit",disabled:!v||f,className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[f&&s.jsx(zt,{"aria-hidden":"true"}),f?"Checking…":"Continue"]})]})]})]})})}const c4={connected:{label:"Connected",dot:"bg-emerald-500"},connecting:{label:"Connecting…",dot:"bg-amber-400"},failed:{label:"Connection failed",dot:"bg-red-500"},off:{label:"Not connected",dot:"bg-stone-400 dark:bg-stone-500"}},iR=e=>c4[e]?e:"off",xZ=(e,t,r)=>`${e} ${e===1?t:r}`;function bZ({row:e,count:t}){const r=c4[e.state];return s.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx("span",{"aria-hidden":"true",className:Le("size-1.5 shrink-0 rounded-full",r.dot,e.state==="connecting"&&"motion-safe:animate-pulse")}),s.jsx("span",{children:r.label}),e.state==="connected"&&s.jsxs("span",{className:"hidden sm:inline",children:["· ",xZ(t,"sandbox","sandboxes")]})]})}function yZ({row:e,count:t,working:r,onToggle:a,onCreate:l,menu:c}){const u=e.state==="connected",f=e.label??e.name,m=e.address;return s.jsxs("li",{className:"px-4 py-2 sm:px-5",children:[s.jsxs("div",{className:"flex items-center gap-3.5",children:[s.jsx("span",{className:"flex h-[18px] w-8 shrink-0 items-center justify-center",children:r||e.state==="connecting"?s.jsx(zt,{"aria-label":"Working",className:"size-3.5"}):s.jsx(cZ,{checked:u,"aria-label":`${u?"Disconnect from":"Connect to"} ${f}`,onCheckedChange:h=>a(e,h)})}),s.jsx("span",{"aria-hidden":"true",className:Le("flex w-6 shrink-0 justify-center transition-opacity duration-300 [&_svg]:block [&_svg]:h-[22px]",!u&&"opacity-50"),children:s.jsx(H3,{live:u})}),s.jsxs("span",{className:"flex min-w-0 flex-1 items-baseline gap-2.5",children:[s.jsx("span",{className:"truncate text-[13px] font-medium",children:f}),m&&s.jsx("span",{className:"hidden min-w-0 truncate font-mono text-[11px] text-muted-foreground md:block",children:m})]}),s.jsx(bZ,{row:e,count:t}),s.jsxs("span",{className:"flex w-[60px] shrink-0 items-center justify-end gap-0.5",children:[u&&l&&s.jsxs(Ma,{children:[s.jsx(Da,{render:s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":`New sandbox on ${f}`,onClick:l,className:"size-7 text-muted-foreground hover:text-foreground"}),children:s.jsx(f6,{className:"size-4"})}),s.jsx(za,{children:"New sandbox"})]}),c]})]}),e.state==="failed"&&e.error&&s.jsx("p",{className:"mt-1 truncate pl-[46px] font-mono text-[11px] text-destructive",title:e.error,children:e.error})]})}function vZ({onCreateSandbox:e}){const t=Cu(),[r,a]=x.useState(null),[l,c]=x.useState(null),[u,f]=x.useState(null),[m,h]=x.useState(null),[g,p]=x.useState(!1),[b,v]=x.useState(null),j=x.useCallback(async P=>{try{a(await is.connections(P)),c(null)}catch($){$.name!=="AbortError"&&c($.message)}},[]);x.useEffect(()=>{const P=new AbortController;return j(P.signal),()=>P.abort()},[j]);const S=(r==null?void 0:r.active)??null,C=iR(S==null?void 0:S.status),N=C==="connected",E=x.useMemo(()=>{if(!r)return[];const P=r.hosts.map($=>({...$,state:(S==null?void 0:S.host)===$.name?iR(S.status):"off",error:(S==null?void 0:S.host)===$.name?S.error:null}));return S&&!P.some($=>$.name===S.host)&&P.push({name:S.host,state:C,error:S.error}),P},[r,S,C]),T=E.filter(P=>P.managed||P.name===(S==null?void 0:S.host)).sort((P,$)=>($.state==="connected")-(P.state==="connected")||(P.label??P.name).localeCompare($.label??$.name)),A=E.filter(P=>!T.includes(P)),k=P=>t.sandboxes.filter($=>{var H;return((H=$.location)==null?void 0:H.remote)&&$.location.host===P.name}).length;async function M(P,$,H){f(P);try{await $(),await j(),t.refresh()}catch(F){qe.error(H,{description:F.message})}finally{f(null)}}const R=(P,$)=>{$?h({host:P.name,replacing:N?S.host:void 0}):M(P.name,async()=>{await is.disconnectRemote(),qe.success(`Disconnected from ${P.label??P.name}`)},"Couldn’t disconnect")};function O(){const{kind:P,row:$}=b;v(null);const H=$.label??$.name;P==="forget"?M($.name,async()=>{await is.forgetRemote(),qe.success(`Forgot ${H}`)},"Couldn’t forget it"):M($.name,async()=>{(S==null?void 0:S.host)===$.name&&await is.forgetRemote(),await is.removeSshHost($.name),qe.success(`Deleted ${H}`)},"Couldn’t delete it")}function D(P){const $=P.name===(S==null?void 0:S.host);return!P.managed&&!$?null:s.jsxs(ju,{children:[s.jsx(Su,{render:s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":`More actions for ${P.label??P.name}`,className:"size-7 text-muted-foreground hover:text-foreground"}),children:s.jsx(dI,{className:"size-4"})}),s.jsxs(Nu,{align:"end",className:"min-w-44",children:[P.state==="connected"&&s.jsx(Ys,{onClick:()=>R(P,!1),children:"Disconnect"}),P.state!=="connected"&&P.state!=="connecting"&&s.jsx(Ys,{onClick:()=>R(P,!0),children:P.state==="failed"?"Try again":"Connect"}),$&&!P.managed&&s.jsx(Ys,{onClick:()=>v({kind:"forget",row:P}),children:"Forget"}),P.managed&&s.jsxs(s.Fragment,{children:[s.jsx($d,{}),s.jsxs(Ys,{variant:"destructive",disabled:P.state==="connected"||P.state==="connecting",onClick:()=>v({kind:"delete",row:P}),children:["Delete",P.state==="connected"?" (disconnect first)":""]})]})]})]})}const _=(P,$)=>s.jsx(qo,{delay:.04*$,offset:4,blur:"3px",className:"contents",children:s.jsx(yZ,{row:P,count:k(P),working:u===P.name,onToggle:R,onCreate:e,menu:D(P)})},P.name),L=(b==null?void 0:b.row.label)??(b==null?void 0:b.row.name),q="divide-y divide-border/60 overflow-hidden rounded-xl border border-border/80 bg-card";return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-[calc(100svh-3.5rem)] overflow-y-auto",children:s.jsxs("div",{className:"grid gap-8 px-4 py-5 sm:px-6",children:[l&&s.jsxs("div",{role:"alert",className:"flex items-center gap-3 text-xs text-red-600",children:[s.jsx("span",{children:l}),s.jsx(ue,{variant:"outline",size:"sm",onClick:()=>j(),children:"Retry"})]}),!r&&!l&&s.jsx("p",{role:"status",className:"py-20 text-center text-sm text-muted-foreground",children:"Reading connections…"}),r&&s.jsxs(s.Fragment,{children:[s.jsxs("section",{"aria-label":"SSH connections",className:"grid gap-4",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"text-sm font-medium",children:"SSH connections"}),s.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Added in OpenRod. One machine is connected at a time."})]}),s.jsx(ue,{variant:"ghost",size:"icon-sm","aria-label":"Refresh connections",onClick:()=>j(),className:"text-muted-foreground",children:s.jsx(Ia,{})}),s.jsxs(ue,{size:"sm",onClick:()=>p(!0),className:"bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90",children:[s.jsx(cs,{className:"size-3.5"}),"Add"]})]}),T.length>0?s.jsx("ul",{className:q,children:T.map(_)}):s.jsxs("div",{className:"rounded-xl border border-border bg-card py-14 text-center",children:[s.jsx(df,{className:"mx-auto mb-3 size-6 text-muted-foreground",strokeWidth:1.5}),s.jsx("p",{className:"text-sm",children:"No saved connections"}),s.jsx("p",{className:"mx-auto mt-1 max-w-xs text-xs text-muted-foreground",children:"Add a server to run sandboxes on your own machine over SSH. You confirm its host key before anything is saved."}),s.jsx(ue,{variant:"outline",className:"mt-4",onClick:()=>p(!0),children:"Add connection"})]})]}),A.length>0&&s.jsxs("section",{"aria-label":"Hosts in your SSH config",className:"grid gap-4",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-medium",children:"From your SSH config"}),s.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Found in ",s.jsx("span",{className:"font-mono",children:"~/.ssh/config"}),". OpenRod reads these and never edits them."]})]}),s.jsx("ul",{className:q,children:A.map(_)})]})]})]})}),s.jsx(Wr,{open:!!b,onOpenChange:P=>{P||v(null)},children:s.jsxs(Qr,{children:[s.jsxs(Zr,{children:[s.jsxs(eo,{children:[(b==null?void 0:b.kind)==="forget"?"Forget":"Delete"," ",L,"?"]}),s.jsx(to,{children:(b==null?void 0:b.kind)==="forget"?`${(b==null?void 0:b.row.state)==="connected"?"This disconnects from the machine and removes it from this page. ":"This removes it from this page. "}Sandboxes on the machine keep running, and the host stays in your SSH configuration, so you can connect again later.`:"This removes the saved connection and its trusted host keys from OpenRod. Sandboxes on the machine keep running. You can add it again later."})]}),s.jsxs(Jr,{children:[s.jsx(so,{children:"Cancel"}),s.jsx(no,{variant:"destructive",onClick:O,children:(b==null?void 0:b.kind)==="forget"?"Forget":"Delete"})]})]})}),s.jsx(gZ,{open:g,onOpenChange:p,onAdded:P=>{p(!1),qe.success(`Added ${P.name}`),j(),h({host:P.alias})}}),s.jsx(yn,{open:!!m,onOpenChange:P=>{P||h(null)},children:s.jsxs(vn,{className:"sm:max-w-3xl","aria-describedby":void 0,children:[s.jsx(Nn,{children:s.jsx(wn,{children:m!=null&&m.replacing?"Switch host":"Connect a remote machine"})}),m&&s.jsx(V3,{initialHost:m.host,connectedHost:m.replacing??null,onUseConnected:()=>h(null),onConnected:P=>{h(null),qe.success(`Connected to ${P.host}`),j(),t.refresh()},onBack:()=>h(null)})]})})]})}const lR=({...e})=>{const{resolvedTheme:t}=xR();return s.jsx(Oq,{theme:t??"system",className:"toaster group",icons:{success:s.jsx(eI,{className:"size-4"}),info:s.jsx(uf,{className:"size-4"}),warning:s.jsx(_a,{className:"size-4"}),error:s.jsx(PR,{className:"size-4"}),loading:s.jsx(zl,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e})};function wZ({children:e,user:t,logout:r}){const[a]=x.useState(()=>window.location.hash.startsWith("#local-connect=")?hP(window.location.hash)??!1:null),[l,c]=x.useState(""),u=x.useRef(null),f=a&&window.opener&&!window.opener.closed;return x.useEffect(()=>{if(!f)return;let m=!0;return u.current??(u.current=bP(a)),u.current.then(({code:h})=>{m&&window.opener.postMessage({type:"openrod-local-connected",nonce:a.nonce,code:h},a.origin)}).catch(h=>{m&&c(h.message)}),()=>{m=!1}},[a,f]),a===null?e:s.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:s.jsxs("section",{className:"max-w-sm text-center",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Finishing sign-in…"}),s.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:f?`Returning to local OpenRod as ${t.email}. This window will close automatically.`:"This sign-in request is invalid or its local OpenRod tab closed. Start again from local OpenRod."}),l&&s.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:l}),(l||!f)&&s.jsx("button",{className:"mt-5 block w-full text-xs underline",onClick:r,children:"Sign out"})]})})}function jZ({children:e}){var j;const{chooseGroups:t,dialog:r,cancel:a}=Fw(),l=x.useRef(new AbortController),c=x.useMemo(()=>Gr("local",l.current.signal),[]),u=x.useRef(0);x.useEffect(()=>{const S=++u.current;return()=>queueMicrotask(()=>{u.current===S&&l.current.abort()})},[]);const f=x.useRef((j=/^#cloud-return=([a-f0-9-]{36})$/.exec(window.location.hash))==null?void 0:j[1]),[m,h]=x.useState(Ho&&f.current&&window.opener?"waiting":"normal"),[g,p]=x.useState(""),b=x.useRef(!1),v=x.useRef(!1);return x.useEffect(()=>{if(m!=="waiting")return;const S=async C=>{var N;if(!(b.current||C.origin!==va||C.source!==window.opener||((N=C.data)==null?void 0:N.type)!=="openrod-local-bundle"||C.data.nonce!==f.current)){b.current=!0,h("importing");try{if(typeof C.data.error=="string")throw Error(C.data.error);const T=(await c.inventory()).locations.find(R=>!R.remote&&R.connected);if(!T)throw Error("Connect a local gateway before importing this workspace.");const A=c.forContext(T.context),k=await t(A,"local OpenRod",l.current.signal);if(v.current)return;const M=await A.importCloud({...C.data.bundle,...k?{destinationGroups:k}:{}});if(window.opener.postMessage({type:"openrod-local-result",nonce:f.current,name:M.name},va),v.current)return;p(C.data.warning??"Workspace copied locally. Reconnect agent credentials to continue."),window.location.href=Up(M.name,"shell",{...T,target:"local"}),h("done")}catch(E){if(v.current||l.current.signal.aborted)return;p(E.message),h("error"),window.opener.postMessage({type:"openrod-local-result",nonce:f.current,error:E.message},va)}}};return window.addEventListener("message",S),window.opener.postMessage({type:"openrod-local-ready",nonce:f.current},va),()=>window.removeEventListener("message",S)},[m]),x.useEffect(()=>{if(!["waiting","importing"].includes(m))return;const S=Date.now()+35*6e4,C=setInterval(()=>{var N;((N=window.opener)!=null&&N.closed||Date.now()>S)&&(l.current.abort(),a(),p("The cloud tab closed or the copy timed out. Open the workspace to check whether a copy was created."),h("error"))},1e3);return()=>clearInterval(C)},[m]),m==="normal"||m==="done"?s.jsxs(s.Fragment,{children:[g&&s.jsx(Pi,{id:"local-return",tone:m==="done"?"success":"warning",title:m==="done"?"Workspace continued locally":"Workspace copy didn’t finish",onDismiss:()=>p(""),children:g}),e]}):s.jsxs(s.Fragment,{children:[r,s.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:s.jsxs("section",{className:"max-w-md text-center",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Continuing your workspace locally…"}),s.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Keep the cloud tab open while your files are copied and your template is rebuilt for this computer."}),g&&s.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:g}),s.jsx("button",{className:"mt-6 text-sm underline",onClick:()=>{l.current.abort(),a(),v.current=!0,b.current=!0,window.location.hash="",h("normal")},children:"Open local workspace"})]})})]})}function SZ(e){try{if(!e.startsWith("#handoff="))return null;const t=JSON.parse(atob(e.slice(9).replaceAll("-","+").replaceAll("_","/"))),r=new URL(t.origin);return r.origin!==t.origin||r.protocol!=="http:"||!["localhost","127.0.0.1","[::1]"].includes(r.hostname)||!/^\d{1,5}$/.test(r.port)||!/^[a-f0-9-]{36}$/.test(t.nonce)?null:{origin:r.origin,nonce:t.nonce}}catch{return null}}async function cR(e,t="GET"){const r=await fetch(`/api/cloud/${e}`,{method:t,headers:t==="POST"?{"x-openshell-console":"1"}:void 0}),a=await r.json();if(!r.ok)throw Error(a.error??"Cloud machine unavailable");return a}function NZ({children:e,logout:t}){const[r,a]=x.useState(null),[l,c]=x.useState(""),[u,f]=x.useState(null),m=x.useRef(SZ(window.location.hash)),h=x.useRef(!1);return x.useEffect(()=>{let g=!0,p;async function b(){try{const v=await cR("machine");g&&(a(v),c(v.error??""),v.status!=="ready"&&(p=setTimeout(b,5e3)))}catch(v){g&&(c(v.message),p=setTimeout(b,1e4))}}return b(),()=>{g=!1,clearTimeout(p)}},[]),x.useEffect(()=>{const g=m.current;if((r==null?void 0:r.status)!=="ready"||!g||!window.opener||h.current)return;h.current=!0,f({status:"waiting"});const p=j=>{var S;if(m.current&&!(j.source!==window.opener||j.origin!==g.origin||((S=j.data)==null?void 0:S.type)!=="openrod-cloud-result"||j.data.nonce!==g.nonce)){if(j.data.error){f({status:"error",message:j.data.error});return}f({status:"done",message:j.data.warning??"Workspace copied. Reconnect your agent credentials to continue."}),/^[a-z0-9-]{1,63}$/.test(j.data.name??"")&&(window.location.hash=`terminal/${j.data.name}?session=shell`)}};window.addEventListener("message",p),cR("handoff","POST").then(({ticket:j})=>window.opener.postMessage({type:"openrod-cloud-ready",nonce:g.nonce,ticket:j},g.origin)).catch(j=>f({status:"error",message:j.message}));const b=Date.now()+35*6e4,v=setInterval(()=>{var j;m.current&&((j=window.opener)!=null&&j.closed||Date.now()>b)&&(f({status:"error",message:"The source tab closed or the copy timed out. Open your workspace to check whether a copy was created."}),clearInterval(v))},1e3);return()=>{window.removeEventListener("message",p),clearInterval(v)}},[r==null?void 0:r.status]),(r==null?void 0:r.status)==="ready"&&(!u||u.status==="done")?s.jsxs(s.Fragment,{children:[(u==null?void 0:u.message)&&s.jsx(Pi,{id:"cloud-transfer",tone:"success",title:"Workspace continued in the cloud",onDismiss:()=>f(null),children:u.message}),e]}):s.jsx("main",{className:"grid min-h-screen place-items-center px-6",children:s.jsxs("section",{className:"max-w-md text-center",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:u?"Continuing your workspace…":"Preparing your private machine…"}),s.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:u?"Keep the local OpenRod tab open while your files are copied and your template is rebuilt.":"Your account has one dedicated machine. Its first start can take several minutes."}),(l||(u==null?void 0:u.message))&&s.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:(u==null?void 0:u.message)??l}),u&&s.jsx("button",{onClick:()=>{m.current=null,f(null),window.location.hash=""},className:"mt-4 text-sm underline",children:"Open cloud workspace"}),s.jsx("button",{onClick:t,className:"mt-6 block w-full text-xs underline",children:"Sign out"})]})})}function CZ({open:e,onOpenChange:t}){const r=Tr(),{chooseGroups:a,dialog:l}=Fw(),c=Cu(),u=c.sandboxes.filter(T=>{var A,k,M;return T.phase==="ready"&&((A=T.location)==null?void 0:A.target)!=="cloud"&&!((k=T.location)!=null&&k.remote)&&((M=T.location)==null?void 0:M.connected)}),[f,m]=x.useState("new"),[h,g]=x.useState(""),[p,b]=x.useState(!1),[v,j]=x.useState(""),[S,C]=x.useState(""),N=x.useRef(null);x.useEffect(()=>()=>{var T;return(T=N.current)==null?void 0:T.abort()},[]),x.useEffect(()=>{e&&(j(""),g(""))},[e]);async function E(){if(p||!Ho)return;const T=u.find(k=>Vn(k)===h);if(f==="copy"&&!T){j("Choose a connected local sandbox.");return}const A=new AbortController;N.current=A,b(!0),j(""),C("signin");try{if(await r.connect(),A.signal.throwIfAborted(),f==="copy"){C("prepare"),await NR(()=>ru("machine"),{signal:A.signal}),C("transfer");const k=Gr("cloud",A.signal);C("groups");const M=await a(k,"cloud",A.signal);C("transfer");const R=await CR(Gr("local",A.signal,T.location.context),k,T.name,M),O=await k.contextKey();A.signal.throwIfAborted();try{sessionStorage.setItem("gateway-box",JSON.stringify({name:R.name,context:O,target:"cloud"}))}catch{}c.refresh(),qe.success("Workspace ready in cloud",{description:R.warning||"Reconnect your agent credentials to continue."})}r.requestCreate(f==="new"),t(!1),r.selectTarget("cloud")}catch(k){j(k.name==="AbortError"?"Cloud preparation cancelled.":k.message)}finally{b(!1),C(""),N.current=null}}return s.jsx(yn,{open:e,onOpenChange:T=>{p||t(T)},children:s.jsxs(vn,{className:"sm:max-w-md",children:[s.jsxs(Nn,{children:[s.jsx(wn,{children:"Build in cloud"}),s.jsx(Hn,{children:"Keep using local OpenRod, your terminal and editor with your private cloud machine."})]}),s.jsx("div",{className:"space-y-2",children:[["new","New cloud sandbox"],["existing","Open an existing cloud sandbox"],["copy","Continue an existing local sandbox"]].map(([T,A])=>s.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 text-sm",children:[s.jsx("input",{type:"radio",name:"cloud-start",disabled:p,checked:f===T,onChange:()=>m(T)}),A]},T))}),f==="copy"&&s.jsxs(s.Fragment,{children:[s.jsxs(hn,{"aria-label":"Local sandbox to copy",value:h,disabled:p,onChange:T=>g(T.target.value),className:"rounded-md border bg-background p-2 text-sm",children:[s.jsx("option",{value:"",children:"Choose a local sandbox"}),u.map(T=>s.jsxs("option",{value:Vn(T),children:[T.name," · ",_s(T.location)]},Vn(T)))]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Copies workspace files and rebuilds saved templates. Your local source stays available. Credential files are excluded; reconnect agents in cloud."})]}),v&&s.jsx("p",{role:"alert",className:"text-sm text-destructive",children:v}),!Ho&&s.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:Rl}),s.jsxs(ue,{disabled:p||!Ho||f==="copy"&&!h,onClick:E,children:[p&&s.jsx(zt,{}),p?S==="signin"?"Sign in with Google…":S==="groups"?"Choose destination group…":S==="transfer"?"Copying and rebuilding…":"Preparing cloud machine…":"Keep using local OpenRod"]}),p&&S==="prepare"&&s.jsx(ue,{variant:"ghost",onClick:()=>{var T;return(T=N.current)==null?void 0:T.abort()},children:"Cancel preparation"}),p&&r.connecting&&s.jsx(ue,{variant:"ghost",onClick:r.cancelConnect,children:"Cancel sign-in"}),va,l]})})}async function uR(e,t){const r=await fetch(`/api/auth/${e}`,{method:t===void 0?"GET":"POST",headers:t===void 0?void 0:{"content-type":"application/json","x-openshell-console":"1"},body:t===void 0?void 0:JSON.stringify(t)}),a=await r.json();if(a.code===Si&&window.dispatchEvent(new Event(Si)),!r.ok)throw Object.assign(new Error(a.error??"Sign-in unavailable"),{code:a.code});return a}const kZ=()=>{var e;return((e=Tr())==null?void 0:e.target)==="cloud"};function TZ(){var a,l;const e=Tr(),[t,r]=x.useState(!1);return e!=null&&e.localViewer?Ho?s.jsxs("div",{className:"ml-auto flex items-center gap-3 text-xs",children:[s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-foreground",children:"Compute"}),s.jsxs("select",{"aria-label":"Compute target",className:"rounded-md border bg-background px-2 py-1.5 text-foreground",value:e.target,onChange:c=>c.target.value==="cloud"&&!e.connected?r(!0):e.selectTarget(c.target.value),children:[s.jsx("option",{value:"local",children:"Local"}),s.jsx("option",{value:"cloud",children:"Cloud"})]})]}),e.connected&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"hidden max-w-40 truncate text-muted-foreground sm:block",children:(l=e.user)==null?void 0:l.email}),s.jsx("button",{className:"underline underline-offset-4",onClick:e.disconnect,children:"Sign out"})]}),!e.connected&&s.jsx("button",{disabled:e.connecting,onClick:()=>e.connect().catch(c=>qe.error("Couldn’t sign in",{description:c.message})),className:Py({size:"sm",variant:"outline"}),children:e.connecting?"Signing in…":"Sign in"}),s.jsxs("button",{onClick:()=>r(!0),className:Py({size:"sm",className:"gap-2"}),children:[s.jsx(rI,{"aria-hidden":"true"}),"Build in cloud"]}),s.jsx(CZ,{open:t,onOpenChange:r})]}):null:s.jsxs("div",{className:"ml-auto flex items-center gap-3 text-xs",children:[s.jsx("span",{className:"max-w-40 truncate text-muted-foreground",children:(a=e==null?void 0:e.user)==null?void 0:a.email}),s.jsx("button",{className:"underline underline-offset-4",onClick:e==null?void 0:e.logout,children:"Sign out"})]})}function EZ({children:e}){const[t,r]=x.useState(null),[a,l]=x.useState(null),[c,u]=x.useState(!0),[f,m]=x.useState(""),[h,g]=x.useState(!1);x.useEffect(()=>{let v=!0;async function j(){try{const N=await uR("config");if(!["local","cloud"].includes(N.mode))throw Error("Invalid console configuration");if(!v)return;if(r(N),N.mode==="cloud"){const E=await fetch("/api/auth/me");if(E.ok){const T=await E.json();v&&l(T.user)}else if(E.status!==401){const T=await E.json();throw Error(T.error??"Authentication unavailable")}}}catch(N){v&&m(N.message)}finally{v&&u(!1)}}j();const S=()=>{l(null),m("Your session expired. Sign in again.")},C=()=>g(!0);return window.addEventListener("openrod-session-expired",S),window.addEventListener(Si,C),()=>{v=!1,window.removeEventListener("openrod-session-expired",S),window.removeEventListener(Si,C)}},[]);const p=()=>m(Rl);async function b(){try{await uR("logout",{})}catch(v){m(v.message)}finally{l(null)}}return h?s.jsx("main",{className:"grid min-h-screen place-items-center bg-background px-6",children:s.jsxs("section",{className:"w-full max-w-md rounded-xl border border-border bg-card p-8 text-center shadow-sm",children:[s.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Open the console link"}),s.jsxs("p",{className:"mt-3 text-sm text-muted-foreground",children:["Open the link printed by ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-foreground",children:"openrod"})," in your terminal. It carries a secret that changes every time the console starts, so open the new link after a restart."]})]})}):c?s.jsx("div",{className:"grid min-h-screen place-items-center text-sm text-muted-foreground",children:"Loading OpenRod…"}):(t==null?void 0:t.mode)==="local"?s.jsx(SP,{children:s.jsx(jZ,{children:e})}):a?s.jsx(wZ,{user:a,logout:b,children:s.jsx(wP,{user:a,logout:b,children:s.jsx(NZ,{logout:b,children:e},a.uid)})}):s.jsx("main",{className:"grid min-h-screen place-items-center bg-background px-6",children:s.jsxs("section",{className:"w-full max-w-sm rounded-xl border border-border bg-card p-8 text-center shadow-sm",children:[s.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:window.location.hash.startsWith("#local-connect=")?"Sign in to OpenRod":"Your workspace, in the cloud."}),s.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:window.location.hash.startsWith("#local-connect=")?"Sign in with Google. You’ll return to local OpenRod automatically.":"Sign in or create your account with Google. Your workspace runs on your own private machine."}),f&&s.jsx("p",{role:"alert",className:"mt-4 text-sm text-destructive",children:f}),s.jsx("button",{disabled:!t,onClick:p,className:"mt-6 w-full rounded-lg bg-primary px-4 py-3 text-sm font-medium text-primary-foreground disabled:opacity-50",children:"Continue with Google"}),s.jsx("p",{className:"mt-5 text-xs text-muted-foreground",children:"Running OpenRod locally? No account required."})]})})}const RZ=x.lazy(()=>cP(()=>import("./terminal-view-Bqw3jQjI.js"),__vite__mapDeps([0,1])).then(e=>({default:e.TerminalView}))),Bv={sandboxes:"Sandboxes",activity:"Activity",groups:"Groups",egress:"Network",ingress:"Network",secrets:"Secrets",templates:"Templates",setups:"MCPs & Skills",connections:"Connections"};class AZ extends x.Component{constructor(){super(...arguments);tn(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}componentDidUpdate(r){r.view!==this.props.view&&this.state.error&&this.setState({error:null})}render(){return this.state.error?s.jsxs("div",{role:"alert",className:"mx-auto mt-10 max-w-md rounded-lg border border-border p-5 text-center text-sm",children:[s.jsx("p",{children:"This page hit an error."}),s.jsx("p",{className:"mt-1 font-mono text-[11px] text-muted-foreground",children:this.state.error.message}),s.jsx("button",{className:"mt-3 text-xs underline underline-offset-2",onClick:()=>this.setState({error:null}),children:"Try again"})]}):this.props.children}}function dR(){const e=new URLSearchParams(window.location.hash.split("?")[1]??""),t=e.get("gateway"),r=e.get("workspace");if(!t||!r)return null;const a=e.get("remote")==="1",l=e.get("target")??new URLSearchParams(window.location.search).get("target")??void 0;return{id:JSON.stringify([l??"local",JSON.stringify([t,r])]),context:JSON.stringify([t,r]),gateway:t,workspace:r,connected:!0,remote:a,target:l,cloud:l==="cloud",label:e.get("label")||(a?`SSH · ${t}`:"Local")}}function OZ({location:e,children:t}){return e?s.jsx(Oa,{location:e,children:s.jsx(Bw,{children:t})}):t}function fR(){const e=/^#terminal\/([a-z0-9-]{1,63})(?:\?(.*))?$/.exec(window.location.hash);if(!e)return null;const t=new URLSearchParams(e[2]??""),r=t.get("gateway"),a=t.get("workspace"),l=r&&a?{context:JSON.stringify([r,a]),gateway:r,workspace:a,connected:!0,remote:t.get("remote")==="1",target:new URLSearchParams(window.location.search).get("target")??void 0}:null;return{name:e[1],session:t.get("session")||void 0,setupLogin:t.get("setupLogin")||void 0,mcp:t.get("mcp")||void 0,location:l}}function mR(){const e=window.location.hash.slice(1).split("?")[0];return e==="policies"?(window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}#egress`),"egress"):e==="guardrails"?(window.history.replaceState(null,"",`${window.location.pathname}${window.location.search}#activity`),"activity"):Bv[e]?e:"sandboxes"}function MZ({onSetup:e,onConnections:t,children:r}){const a=eg(),{connection:l,overview:c}=Ua(),u=!!e&&l==="setup-required",[f,m]=x.useState(null),[h,g]=x.useState({busy:!1,error:null});if(x.useEffect(()=>{if(!u)return;let v=!0;return a.connections().then(j=>{v&&m(j.locals)}).catch(()=>{v&&m([])}),()=>{v=!1}},[u,a]),!e)return r;if(l==="connecting"&&!c)return s.jsx("section",{className:"p-8",children:s.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Reading connection settings…"})});if(!u)return r;async function p(){g({busy:!0,error:null});try{await zM(a,f[0].name),window.location.reload()}catch(v){g({busy:!1,error:v.message})}}const b="bg-[var(--action)] text-[var(--action-foreground)] hover:bg-[var(--action)]/90";return s.jsxs("section",{"aria-labelledby":"setup-heading",className:"mx-auto my-16 grid w-full max-w-md justify-items-center gap-4 px-6 text-center",children:[s.jsx("h2",{id:"setup-heading",className:"text-xl font-semibold tracking-tight",children:"Choose where sandboxes run"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Groups, network rules and secrets need a location. You don’t need a sandbox first."}),s.jsxs("div",{className:"flex flex-wrap justify-center gap-2",children:[(f==null?void 0:f.length)>0&&s.jsxs(ue,{onClick:p,disabled:h.busy,title:`Use the ${f[0].name} gateway`,className:b,children:[h.busy&&s.jsx(zl,{"aria-hidden":"true",className:"size-4 animate-spin"}),"Use this computer"]}),s.jsx(ue,{variant:"outline",onClick:t,children:"Connect a remote machine"}),s.jsxs(ue,{variant:f!=null&&f.length?"ghost":void 0,onClick:e,className:f!=null&&f.length?"":b,children:[s.jsx(cs,{"aria-hidden":"true",className:"size-4"}),"New sandbox"]})]}),h.error&&s.jsx("p",{role:"alert",className:"text-xs text-destructive",children:h.error})]})}function DZ(){var v;const e=kZ(),t=eg(),r=Tr(),[a,l]=x.useState(mR),[c,u]=x.useState(fR),[f,m]=x.useState(0),[h,g]=x.useState(dR),p=e?void 0:()=>{b("sandboxes"),m(j=>j+1)};x.useEffect(()=>{const j=()=>{l(mR()),u(fR()),g(dR())};window.addEventListener("popstate",j),window.addEventListener("hashchange",j);const S=C=>b(C.detail.view,C.detail.location);return window.addEventListener("openrod-navigate",S),()=>{window.removeEventListener("popstate",j),window.removeEventListener("hashchange",j),window.removeEventListener("openrod-navigate",S)}},[]);function b(j,S=null){var N;if((N=t.signal)!=null&&N.aborted||!Bv[j])return;l(j),g(S);const C=S?`?${new URLSearchParams({gateway:S.gateway,workspace:S.workspace,label:S.label,remote:S.remote?"1":"0",...S.target?{target:S.target}:{}})}`:"";window.history.pushState(null,"",j==="sandboxes"&&!S?window.location.pathname:`#${j}${C}`)}return c?s.jsxs(s.Fragment,{children:[s.jsx(x.Suspense,{fallback:null,children:s.jsx(Oa,{location:c.location,children:s.jsx(RZ,{name:c.name,session:c.session,setupLogin:c.setupLogin,mcp:c.mcp},`${r==null?void 0:r.target} ${((v=c.location)==null?void 0:v.context)??""} ${c.name} ${c.session??""}`)})}),s.jsx(lR,{position:"bottom-right"})]}):s.jsx(Bw,{children:s.jsxs(LX,{children:[s.jsx(KX,{view:a,onNavigate:b}),s.jsxs(VX,{className:"min-w-0 bg-background",children:[s.jsxs("header",{className:"flex h-14 shrink-0 items-center border-b border-border bg-card px-4 sm:px-6",children:[s.jsx($X,{className:"mr-2 md:hidden"}),s.jsx("h1",{className:"text-[18px] font-semibold tracking-tight",children:Bv[a]}),h&&s.jsx("span",{className:"ml-3",children:s.jsx(So,{location:h})}),s.jsx(TZ,{})]}),s.jsx(XK,{}),s.jsx(oX,{}),s.jsx(AZ,{view:a,children:s.jsx(OZ,{location:h,children:s.jsxs(MZ,{onSetup:a==="sandboxes"||a==="templates"||a==="connections"?void 0:p,onConnections:()=>b("connections"),children:[a==="sandboxes"&&s.jsx(KW,{onNavigate:b,allowRemote:!e,createRequest:f,onCreateRequestHandled:()=>m(0)}),a==="activity"&&s.jsx(iQ,{}),a==="groups"&&s.jsx(xQ,{onNavigate:b}),(a==="egress"||a==="ingress")&&s.jsx(RQ,{tab:a,onNavigate:b}),a==="secrets"&&s.jsx(YQ,{}),a==="templates"&&s.jsx(sZ,{}),a==="setups"&&s.jsx(N3,{}),a==="connections"&&!e&&s.jsx(vZ,{onCreateSandbox:p})]})})},`${a}:${(h==null?void 0:h.target)??""}:${(h==null?void 0:h.context)??""}`)]}),s.jsx(lR,{position:"bottom-right"})]})})}aP.createRoot(document.getElementById("root")).render(s.jsx(Je.StrictMode,{children:s.jsx(Xz,{attribute:"class",defaultTheme:"system",enableSystem:!0,storageKey:"openshell-theme",children:s.jsx(EZ,{children:s.jsx(DZ,{})})})}));export{ue as B,Xo as C,ju as D,So as L,JI as R,Kv as T,Cn as a,IZ as b,Su as c,ZG as d,Nu as e,Ys as f,s as j,tp as p,x as r,AM as s,Up as t,$t as u};